index.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <link rel="stylesheet" href="{__PLUG_PATH}swiper/swiper-3.4.1.min.css">
  4. <script type="text/javascript" src="{__PLUG_PATH}swiper/swiper-3.4.1.jquery.min.js"></script>
  5. <script type="text/javascript" src="{__PLUG_PATH}jquery-slide-up.js"></script>
  6. <script type="text/javascript" src="{__WAP_PATH}crmeb/js/jquery.downCount.js"></script>
  7. <script type="text/javascript" src="{__WAP_PATH}crmeb/js/car-model.js"></script>
  8. <script type="text/javascript" src="{__WAP_PATH}crmeb/js/base.js"></script>
  9. <script type="text/javascript" src="{__WAP_PATH}crmeb/js/lottie.min.js"></script>
  10. {/block}
  11. {block name="title"}
  12. <?= \service\SystemConfigService::get('site_name') ?>
  13. {/block}
  14. {block name="content"}
  15. <div class="page-index" id="app-index">
  16. <section ref="bsDom">
  17. <div>
  18. <!--<div class="search-wrapper">
  19. <form method="post" @submit.prevent="goSearch">
  20. <div class="search-box flex"><input type="text" v-model="keyword" placeholder="商品搜索: 请输入商品关键词"> <a
  21. class="index-icon home-btn" href="{:url('my/notice')}">
  22. {gt name="notice" value="0"} <b class="count-num">{$notice}</b> {/gt} </a></div>
  23. </form>
  24. </div>-->
  25. <!-- 滑动导航 -->
  26. <!-- <div class="common-slider-nav" ref="xScroll">
  27. <ul class="swiper-wrapper">
  28. <li class="swiper-slide on"><a href="javascript:void(0);">商城优选</a></li>
  29. <li class="swiper-slide"><a href="{:url('store/combination')}"><img src="{__WAP_PATH}sx/images/pt-bg.png" alt=""></a></li>
  30. {volist name="category" id="vo"}
  31. <li class="swiper-slide"><a href="{:Url('store/index',['cid'=>$vo['id']])}">{$vo.cate_name}</a></li>
  32. {/volist}
  33. </ul>
  34. </div>-->
  35. {notempty name="banner"}
  36. <div class="banner" ref="banners">
  37. <ul class="swiper-wrapper">
  38. {volist name="banner" id="vo"}
  39. <li class="swiper-slide"><a href="<?= empty($vo['url']) ? 'javascript:void(0);' : $vo['url']; ?>">
  40. <img src="{$vo.pic|unThumb}"/> </a></li>
  41. {/volist}
  42. </ul>
  43. <div class="swiper-pagination"></div>
  44. </div>
  45. {/notempty}
  46. {notempty name="menus"}
  47. <div class="nav">
  48. <ul class="flex"> {volist name="menus" id="vo"}
  49. <li><a href="<?= empty($vo['url']) ? 'javascript:void(0);' : $vo['url']; ?>"> <img src="{$vo.icon|unThumb}">
  50. <p>{$vo.name}</p></a></li>
  51. {/volist}
  52. </ul>
  53. </div>
  54. {/notempty}
  55. {notempty name="roll_news"}
  56. <div class="hot-txt-roll border-1px flex">
  57. <div class="hot-icon"><img src="{__WAP_PATH}crmeb/images/hot-icon.png"></div>
  58. <div class="txt-list">
  59. <ul class="line"> {volist name="roll_news" id="vo"}
  60. <li style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;"><a
  61. style="display: block;"
  62. href="<?= empty($vo['url']) ? 'javascript:void(0);' : $vo['url']; ?>">{$vo.info}</a>
  63. </li>
  64. {/volist}
  65. </ul>
  66. </div>
  67. </div>
  68. {/notempty}
  69. <div class="coupon-wrapper" v-cloak="" v-show="couponList.length > 0" style="overflow:hidden;">
  70. <!--<div ref="xCoupon">-->
  71. <!-- 已使用 typethree -->
  72. <div class="coupon-list">
  73. <div class="swiper-wrapper">
  74. <div class="swiper-slide coupon-item flex" v-for="item in couponList"
  75. :class="[(isValidCoupon(item) && !item.is_use) ? 'typeone' : 'typethree']">
  76. <div class="count-num flex"><em><i class="small-symbol">¥</i>{{item.coupon_price}}</em>
  77. <p>满{{item.use_min_price}}元可用</p></div>
  78. <div class="count-btn flex" v-text="isValidCoupon(item) ? (item.is_use !== true ? '点击领取' : '您已领取') : '已经领完' "
  79. @click="isValidCoupon(item) && item.is_use !== true && userGetCoupon(item)"></div>
  80. </div>
  81. </div>
  82. </div>
  83. <!--</div>-->
  84. <a class="more-wrapper" href="{:Url('store/issue_coupon')}" v-show="couponList.length >= 2">查看更多 ></a>
  85. </div>
  86. <!-- 秒杀列表 -->
  87. {notempty name="storeSeckill"}
  88. <div class="hotspike-list">
  89. <div class="index-common-title border-1px">限时秒杀 <a href="{:Url('store/seckill_index')}"><i class="icon"></i></a></div>
  90. <ul>
  91. {volist name="storeSeckill" id="vo"}
  92. <li class="flex">
  93. <div class="picture"><img src="{$vo.image}" alt="">
  94. <div class="count-down flex countdown" data-time="{$vo.stop_time|date='Y/m/d H:i:s',###}">
  95. <span class="days">00</span>
  96. <em>:</em>
  97. <span class="hours">00</span>
  98. <em>:</em>
  99. <span class="minutes">00</span>
  100. <em>:</em>
  101. <span class="seconds">00</span>
  102. </div>
  103. </div>
  104. <div class="text-info flex">
  105. <div class="title">{$vo.title}</div>
  106. <div class="price-wrapper"><span class="price"><i>¥</i>{$vo.price}</span> <span class="old-price">¥{$vo.ot_price}</span>
  107. </div>
  108. <div class="schedule flex">
  109. <span>已抢{$vo.round}%</span>
  110. <span class="schedule-bar" ><i class="schedule-weight" data-width="{$vo.round}%"></i></span></div>
  111. <a class="link" href="{:url('store/seckill_detail',['id'=>$vo.id])}">马上抢</a></div>
  112. </li>
  113. {/volist}
  114. </ul>
  115. </div>
  116. {/notempty}
  117. <div class="buyspell-list" v-cloak="" v-show="combinationList.length > 0">
  118. <div class="index-common-title border-1px">
  119. <span class="color-red">拼团 . </span>花少钱买好货 <i class="icon" @click="window.location.href='{:url('store/combination')}'"></i>
  120. </div>
  121. <div class="product-banner"><img src="{$pinkImage}"></div>
  122. <div class="bslist-box">
  123. <div class="bs-item flex" v-for="item in combinationList">
  124. <div class="picture">
  125. <img :src="item.image">
  126. </div>
  127. <div class="bs-item-info flex">
  128. <div class="info-title">{{item.title}}</div>
  129. <div class="count-wrapper">
  130. <span class="price">¥{{item.price}}</span>
  131. <span class="old-price">¥{{item.product_price}}</span>
  132. <span class="count">已拼{{item.sales}}单</span>
  133. </div>
  134. <a class="people-num flex">
  135. <span class="numbers">{{item.people}}人团</span>
  136. <span class="peo-txt" @click="window.location.href='{:url('store/combination_detail',[],false)}/id/'+item.id">去开团</span>
  137. <i class="index-icon people-icon"></i>
  138. </a>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <!-- 商品分类模板 -->
  144. <div class="template-prolist" v-cloak="" v-for="item in cateGroupList" v-show="cateGroupList.length > 0">
  145. <div class="index-common-title border-1px">
  146. <a :href="'/wap/store/index/cid/'+item.id">
  147. {{item.cate_name}} <i class="icon"></i> </a></div>
  148. <div class="product-banner"><img :src="unThumb(item.pic)" v-show="item.pic != ''"></div>
  149. <ul class="flex">
  150. <li v-for="pro in item.product"><a :href="'/wap/store/detail/id/'+pro.id">
  151. <div class="picture"><img :src="pro.image"></div>
  152. <div class="product-info"><p class="title" v-text="pro.store_name"></p>
  153. <p class="count-wrapper flex"><span class="price"
  154. v-html="getPriceStr(pro.price)"></span> <span
  155. class="count">已售{{pro.sales}}{{pro.unit_name || '件'}}</span></p></div>
  156. </a></li>
  157. </ul>
  158. </div> <!-- 商品分类模板 -->
  159. <div class="template-prolist">
  160. <div class="title-like flex" v-show="page.list.length > 0" v-cloak=""><span class="title-line left"></span> <span class="icon"></span>
  161. <span>新品推荐</span> <span class="title-line right"></span></div>
  162. <ul class="flex">
  163. <li v-for="item in page.list" v-cloak=""><a :href="'/wap/store/detail/id/'+item.id">
  164. <div class="picture"><img :src="item.image"></div>
  165. <div class="product-info"><p class="title" v-text="item.store_name"></p>
  166. <p class="count-wrapper flex"><span class="price"
  167. v-html="getPriceStr(item.price)"></span> <span
  168. class="count">已售{{item.sales}}{{item.unit_name || '件'}}</span></p></div>
  169. </a></li>
  170. </ul>
  171. </div>
  172. <p class="loading-line" v-show="loading == true"><i></i><span>正在加载中</span><i></i></p>
  173. <p class="loading-line" v-show="loading == false && page.loaded == false" v-cloak="" @click="getList">
  174. <i></i><span>点击加载</span><i></i></p>
  175. <p class="loading-line" v-show="loading == false && page.loaded == true" v-cloak="">
  176. <i></i><span>没有更多了</span><i></i></p></div>
  177. </section>
  178. {include file="public/store_menu"}
  179. </div>
  180. <div class="flex" id="bubble-txt" style="display: none;">
  181. <div class="avatar">
  182. <img src="" alt="" class="avater-pink">
  183. </div>
  184. <span class="nickname"></span>
  185. </div>
  186. <div class="lottie-bg">
  187. <div id="lottie"></div>
  188. </div>
  189. <script type="text/javascript">
  190. function loadCRMEB() {
  191. var anim;
  192. var elem = document.getElementById('lottie');
  193. var animData = {
  194. container: elem,
  195. renderer: 'svg',
  196. loop: true,
  197. autoplay: true,
  198. rendererSettings: {
  199. progressiveLoad: false,
  200. imagePreserveAspectRatio: 'xMidYMid meet'
  201. },
  202. path: '{__WAP_PATH}crmeb/js/animation.json'
  203. };
  204. anim = lottie.loadAnimation(animData);
  205. anim.setSubframe(false);
  206. setTimeout(
  207. function () {
  208. $('.lottie-bg').hide();
  209. }, 2000)
  210. }
  211. if(!window.name) {
  212. loadCRMEB();
  213. window.name = "CRMEB";
  214. }else{
  215. $('.lottie-bg').hide();
  216. }
  217. var base = new Base64();
  218. (function () {
  219. var $pinkListUser = <?php echo json_encode($storePink);?>;
  220. if($pinkListUser.length > 0){
  221. var $i = 0,dom = $('#bubble-txt'),src = $('.avater-pink'),name = $('.nickname'),pinkShow = function (item) {
  222. src.attr('src',item['src']);
  223. name.html(item['nickname']);
  224. dom.show().addClass('bubble-txt');
  225. setTimeout(function () {
  226. dom.hide().removeClass('bubble-txt');
  227. },5100);
  228. },si = setInterval(function () {
  229. if(document.readyState=="complete"){
  230. window.clearInterval(si);
  231. pinkShow($pinkListUser[$i++]);
  232. setInterval(function () {
  233. if($pinkListUser.length <= $i) $i = 0;
  234. pinkShow($pinkListUser[$i++]);
  235. },6500);
  236. }
  237. },500);
  238. }
  239. requirejs(['vue', 'store', 'helper', 'better-scroll'], function (Vue, storeApi, $h, BScroll) {
  240. new Vue({
  241. el: '#app-index',
  242. data: {
  243. couponList: [],
  244. cateGroupList: [],
  245. page: {first: 0, limit: 20, list: [], loaded: false},
  246. loading: false,
  247. scroll: null,
  248. keyword: '',
  249. gettingCoupon: false,
  250. combinationList:[],
  251. pinkData:{
  252. src:'',
  253. nickname:''
  254. },
  255. isPinkOne:false
  256. },
  257. methods: {
  258. unThumb:function(src){
  259. return src.replace('/s_','/');
  260. },
  261. formatPrice: function (price) {
  262. var format = price.toString().split('.');
  263. if (format[1] == undefined) format[1] = '00';
  264. if (format[1].length == 1) format[1] += '0';
  265. return format;
  266. },
  267. getPriceStr: function (price) {
  268. var format = this.formatPrice(price);
  269. return "<i>¥</i>" + format[0] + "<i>." + format[1] + "</i>";
  270. },
  271. userGetCoupon: function (coupon) {
  272. if (this.gettingCoupon) return;
  273. this.gettingCoupon = true;
  274. var that = this;
  275. storeApi.goLogin() && storeApi.userGetCoupon(coupon.id, function () {
  276. coupon.is_use = true;
  277. $h.pushMsgOnce('领取成功!');
  278. setTimeout(function () {
  279. that.gettingCoupon = false;
  280. }, 300);
  281. }, function () {
  282. setTimeout(function () {
  283. that.gettingCoupon = false;
  284. }, 300);
  285. return true;
  286. });
  287. },
  288. isValidCoupon: function (coupon) {
  289. return !(coupon.total_count > 0 && coupon.remain_count == 0);
  290. },
  291. goSearch: function () {
  292. if (!this.keyword) return;
  293. location.href = $h.U({c: 'store', a: 'index', p: {keyword: base.encode(this.keyword)}});
  294. },
  295. getIssueCouponList: function () {
  296. var that = this;
  297. storeApi.getIssueCouponList(4, function (res) {
  298. that.couponList = res.data.data;
  299. that.$nextTick(function () {
  300. var sliderProduct = new Swiper('.coupon-list', { freeMode: true, freeModeMomentumRatio: 0, slidesPerView: 'auto', });
  301. })
  302. });
  303. },
  304. getCateData: function () {
  305. var that = this;
  306. storeApi.getCategoryProductList(4, function (res) {
  307. that.cateGroupList = res.data.data;
  308. // that.$nextTick(function () {
  309. // that.scroll.refresh();
  310. // })
  311. })
  312. },
  313. getCombinationList:function () {
  314. var that = this;
  315. storeApi.baseGet($h.U({
  316. c:"public_api",
  317. a:"get_pink_host",
  318. p:{limit:2}
  319. }),function (res) {
  320. that.combinationList = res.data.data;
  321. // that.$nextTick(function () {
  322. // that.scroll.refresh();
  323. // })
  324. })
  325. },
  326. elInit: function () {
  327. that = this;
  328. if(this.$refs.banners){
  329. var liDom = $(this.$refs.banners).find('li');
  330. if(liDom.length > 0 ){
  331. liDom.width(document.body.offsetWidth);
  332. $(this.$refs.banners).find('ul').width((document.body.offsetWidth * liDom.length)+'px');
  333. var myBanner = new Swiper('.banner', {
  334. pagination: '.swiper-pagination',
  335. paginationClickable: false,
  336. autoplay: 4500,
  337. loop: true,
  338. speed: 2500,
  339. autoplayDisableOnInteraction: false
  340. });
  341. }
  342. }
  343. $('.schedule-weight').each(function() {
  344. var _this = $(this);
  345. var width = _this.attr('data-width');
  346. _this.css("width",width);
  347. });
  348. $('.countdown').each(function () {
  349. var _this = $(this);
  350. var count = _this.attr('data-time');
  351. _this.downCount({date: count, offset: +8});
  352. });
  353. $(".line").slideUp({"li_h": $('.txt-list').height()});
  354. },
  355. getList: function () {
  356. if (this.loading) return;
  357. var that = this, group = that.page;
  358. if (group.loaded) return;
  359. this.loading = true;
  360. storeApi.getBestProductList({first: group.first, limit: group.limit}, function (res) {
  361. var list = res.data.data;
  362. group.loaded = list.length < group.limit;
  363. group.first += list.length;
  364. group.list = group.list.concat(list);
  365. that.$set(that, 'page', group);
  366. that.loading = false;
  367. // that.$nextTick(function () {
  368. // if (list.length) that.scroll.refresh();
  369. // that.scroll.finishPullUp();
  370. // });
  371. }, function () {
  372. that.loading = false
  373. });
  374. },
  375. },
  376. mounted: function () {
  377. var that = this;
  378. this.elInit();
  379. this.getIssueCouponList();
  380. this.getCateData();
  381. this.getCombinationList();
  382. setTimeout(function() {
  383. that.getList();
  384. },0);
  385. }
  386. })
  387. });
  388. }());</script>
  389. {/block}