index.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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. <div class="template-prolist" v-show="is_bestList.length > 0" >
  88. <div class="title-like flex" v-cloak=""><span class="title-line left"></span> <span class="icon"></span>
  89. <span>精品推荐</span> <span class="title-line right"></span></div>
  90. <ul class="flex">
  91. <li v-for="item in is_bestList" v-cloak=""><a :href="'/wap/store/detail/id/'+item.id">
  92. <div class="picture"><img :src="item.image"></div>
  93. <div class="product-info"><p class="title" v-text="item.store_name"></p>
  94. <p class="count-wrapper flex"><span class="price" v-html="getPriceStr(item.price)"></span> <span
  95. class="count">已售{{item.sales}}{{item.unit_name || '件'}}</span></p></div>
  96. </a></li>
  97. </ul>
  98. </div>
  99. <!-- 商品新品推荐模板 -->
  100. <div class="template-prolist" v-show="is_newList.length > 0">
  101. <div class="title-like flex" v-cloak=""><span class="title-line left"></span> <span class="icon"></span>
  102. <span>首发新品</span> <span class="title-line right"></span></div>
  103. <ul class="flex">
  104. <li v-for="item in is_newList" v-cloak=""><a :href="'/wap/store/detail/id/'+item.id">
  105. <div class="picture"><img :src="item.image"></div>
  106. <div class="product-info"><p class="title" v-text="item.store_name"></p>
  107. <p class="count-wrapper flex"><span class="price" v-html="getPriceStr(item.price)"></span> <span
  108. class="count">已售{{item.sales}}{{item.unit_name || '件'}}</span></p></div>
  109. </a></li>
  110. </ul>
  111. </div>
  112. <!-- 商品热卖推荐模板 -->
  113. <div class="template-prolist" v-show="is_hotList.length > 0">
  114. <div class="title-like flex" v-cloak=""><span class="title-line left"></span> <span class="icon"></span>
  115. <span>热卖单品</span> <span class="title-line right"></span></div>
  116. <ul class="flex">
  117. <li v-for="item in is_hotList" v-cloak=""><a :href="'/wap/store/detail/id/'+item.id">
  118. <div class="picture"><img :src="item.image"></div>
  119. <div class="product-info"><p class="title" v-text="item.store_name"></p>
  120. <p class="count-wrapper flex"><span class="price" v-html="getPriceStr(item.price)"></span> <span
  121. class="count">已售{{item.sales}}{{item.unit_name || '件'}}</span></p></div>
  122. </a></li>
  123. </ul>
  124. </div>
  125. <!-- 商品促销推荐模板 -->
  126. <div class="template-prolist" v-show="is_benefitList.length > 0">
  127. <div class="title-like flex" v-cloak=""><span class="title-line left"></span> <span class="icon"></span>
  128. <span>特价专区</span> <span class="title-line right"></span></div>
  129. <ul class="flex">
  130. <li v-for="item in is_benefitList" v-cloak=""><a :href="'/wap/store/detail/id/'+item.id">
  131. <div class="picture"><img :src="item.image"></div>
  132. <div class="product-info"><p class="title" v-text="item.store_name"></p>
  133. <p class="count-wrapper flex"><span class="price" v-html="getPriceStr(item.price)"></span> <span
  134. class="count">已售{{item.sales}}{{item.unit_name || '件'}}</span></p></div>
  135. </a></li>
  136. </ul>
  137. </div>
  138. <!-- 秒杀列表 -->
  139. {notempty name="storeSeckill"}
  140. <div class="hotspike-list">
  141. <div class="index-common-title border-1px">限时秒杀 <a href="{:Url('store/seckill_index')}"><i class="icon"></i></a></div>
  142. <ul>
  143. {volist name="storeSeckill" id="vo"}
  144. <li class="flex">
  145. <div class="picture"><img src="{$vo.image}" alt="">
  146. <div class="count-down flex countdown" data-time="{$vo.stop_time|date='Y/m/d H:i:s',###}">
  147. <span class="days">00</span>
  148. <em>:</em>
  149. <span class="hours">00</span>
  150. <em>:</em>
  151. <span class="minutes">00</span>
  152. <em>:</em>
  153. <span class="seconds">00</span>
  154. </div>
  155. </div>
  156. <div class="text-info flex">
  157. <div class="title">{$vo.title}</div>
  158. <div class="price-wrapper"><span class="price"><i>¥</i>{$vo.price}</span> <span class="old-price">¥{$vo.ot_price}</span>
  159. </div>
  160. <div class="schedule flex">
  161. <span>已抢{$vo.round}%</span>
  162. <span class="schedule-bar" ><i class="schedule-weight" data-width="{$vo.round}%"></i></span></div>
  163. <a class="link" href="{:url('store/seckill_detail',['id'=>$vo.id])}">马上抢</a></div>
  164. </li>
  165. {/volist}
  166. </ul>
  167. </div>
  168. {/notempty}
  169. <div class="buyspell-list" v-cloak="" v-show="combinationList.length > 0">
  170. <div class="index-common-title border-1px">
  171. <span class="color-red">拼团 . </span>花少钱买好货 <i class="icon" @click="window.location.href='{:url('store/combination')}'"></i>
  172. </div>
  173. <div class="product-banner"><img src="{$pinkImage}"></div>
  174. <div class="bslist-box">
  175. <div class="bs-item flex" v-for="item in combinationList">
  176. <div class="picture">
  177. <img :src="item.image">
  178. </div>
  179. <div class="bs-item-info flex">
  180. <div class="info-title">{{item.title}}</div>
  181. <div class="count-wrapper">
  182. <span class="price">¥{{item.price}}</span>
  183. <span class="old-price">¥{{item.product_price}}</span>
  184. <span class="count">已拼{{item.sales}}单</span>
  185. </div>
  186. <a class="people-num flex">
  187. <span class="numbers">{{item.people}}人团</span>
  188. <span class="peo-txt" @click="window.location.href='{:url('store/combination_detail',[],false)}/id/'+item.id">去开团</span>
  189. <i class="index-icon people-icon"></i>
  190. </a>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. <!-- 商品分类模板 -->
  196. <div class="template-prolist" v-cloak="" v-for="item in cateGroupList" v-show="cateGroupList.length > 0">
  197. <div class="index-common-title border-1px">
  198. <a :href="'/wap/store/index/cid/'+item.id">
  199. {{item.cate_name}} <i class="icon"></i> </a></div>
  200. <div class="product-banner"><img :src="unThumb(item.pic)" v-show="item.pic != ''"></div>
  201. <ul class="flex">
  202. <li v-for="pro in item.product"><a :href="'/wap/store/detail/id/'+pro.id">
  203. <div class="picture"><img :src="pro.image"></div>
  204. <div class="product-info"><p class="title" v-text="pro.store_name"></p>
  205. <p class="count-wrapper flex"><span class="price"
  206. v-html="getPriceStr(pro.price)"></span> <span
  207. class="count">已售{{pro.sales}}{{pro.unit_name || '件'}}</span></p></div>
  208. </a></li>
  209. </ul>
  210. </div>
  211. <!-- 商品分类模板 -->
  212. <div class="template-prolist">
  213. <div class="title-like flex" v-show="page.list.length > 0" v-cloak=""><span class="title-line left"></span> <span class="icon"></span>
  214. <span>新品推荐</span> <span class="title-line right"></span></div>
  215. <ul class="flex">
  216. <li v-for="item in page.list" v-cloak=""><a :href="'/wap/store/detail/id/'+item.id">
  217. <div class="picture"><img :src="item.image"></div>
  218. <div class="product-info"><p class="title" v-text="item.store_name"></p>
  219. <p class="count-wrapper flex"><span class="price"
  220. v-html="getPriceStr(item.price)"></span> <span
  221. class="count">已售{{item.sales}}{{item.unit_name || '件'}}</span></p></div>
  222. </a></li>
  223. </ul>
  224. </div>
  225. <p class="loading-line" v-show="loading == true"><i></i><span>正在加载中</span><i></i></p>
  226. <p class="loading-line" v-show="loading == false && page.loaded == false" v-cloak="" @click="getList">
  227. <i></i><span>点击加载</span><i></i></p>
  228. <p class="loading-line" v-show="loading == false && page.loaded == true" v-cloak="">
  229. <i></i><span>没有更多了</span><i></i></p></div>
  230. </section>
  231. {include file="public/store_menu"}
  232. </div>
  233. <div class="flex" id="bubble-txt" style="display: none;">
  234. <div class="avatar">
  235. <img src="" alt="" class="avater-pink">
  236. </div>
  237. <span class="nickname"></span>
  238. </div>
  239. <div class="lottie-bg">
  240. <div id="lottie"></div>
  241. </div>
  242. <script type="text/javascript">
  243. function loadCRMEB() {
  244. var anim;
  245. var elem = document.getElementById('lottie');
  246. var animData = {
  247. container: elem,
  248. renderer: 'svg',
  249. loop: true,
  250. autoplay: true,
  251. rendererSettings: {
  252. progressiveLoad: false,
  253. imagePreserveAspectRatio: 'xMidYMid meet'
  254. },
  255. path: '{__WAP_PATH}crmeb/js/animation.json'
  256. };
  257. anim = lottie.loadAnimation(animData);
  258. anim.setSubframe(false);
  259. setTimeout(
  260. function () {
  261. $('.lottie-bg').hide();
  262. }, 2000)
  263. }
  264. if(!window.name) {
  265. loadCRMEB();
  266. window.name = "CRMEB";
  267. }else{
  268. $('.lottie-bg').hide();
  269. }
  270. var base = new Base64();
  271. (function () {
  272. var $pinkListUser = <?php echo json_encode($storePink);?>;
  273. if($pinkListUser.length > 0){
  274. var $i = 0,dom = $('#bubble-txt'),src = $('.avater-pink'),name = $('.nickname'),pinkShow = function (item) {
  275. src.attr('src',item['src']);
  276. name.html(item['nickname']);
  277. dom.show().addClass('bubble-txt');
  278. setTimeout(function () {
  279. dom.hide().removeClass('bubble-txt');
  280. },5100);
  281. },si = setInterval(function () {
  282. if(document.readyState=="complete"){
  283. window.clearInterval(si);
  284. pinkShow($pinkListUser[$i++]);
  285. setInterval(function () {
  286. if($pinkListUser.length <= $i) $i = 0;
  287. pinkShow($pinkListUser[$i++]);
  288. },6500);
  289. }
  290. },500);
  291. }
  292. requirejs(['vue', 'store', 'helper', 'better-scroll'], function (Vue, storeApi, $h, BScroll) {
  293. new Vue({
  294. el: '#app-index',
  295. data: {
  296. couponList: [],
  297. cateGroupList: [],
  298. is_bestList: [],//精品推荐
  299. is_newList:[],//首发新品
  300. is_hotList: [],//热卖单品
  301. is_benefitList:[],//促销
  302. page: {first: 0, limit: 20, list: [], loaded: false},
  303. loading: false,
  304. scroll: null,
  305. keyword: '',
  306. gettingCoupon: false,
  307. combinationList:[],
  308. pinkData:{
  309. src:'',
  310. nickname:''
  311. },
  312. isPinkOne:false
  313. },
  314. methods: {
  315. unThumb:function(src){
  316. return src.replace('/s_','/');
  317. },
  318. formatPrice: function (price) {
  319. var format = price.toString().split('.');
  320. if (format[1] == undefined) format[1] = '00';
  321. if (format[1].length == 1) format[1] += '0';
  322. return format;
  323. },
  324. getPriceStr: function (price) {
  325. var format = this.formatPrice(price);
  326. return "<i>¥</i>" + format[0] + "<i>." + format[1] + "</i>";
  327. },
  328. userGetCoupon: function (coupon) {
  329. if (this.gettingCoupon) return;
  330. this.gettingCoupon = true;
  331. var that = this;
  332. storeApi.goLogin() && storeApi.userGetCoupon(coupon.id, function () {
  333. coupon.is_use = true;
  334. $h.pushMsgOnce('领取成功!');
  335. setTimeout(function () {
  336. that.gettingCoupon = false;
  337. }, 300);
  338. }, function () {
  339. setTimeout(function () {
  340. that.gettingCoupon = false;
  341. }, 300);
  342. return true;
  343. });
  344. },
  345. isValidCoupon: function (coupon) {
  346. return !(coupon.total_count > 0 && coupon.remain_count == 0);
  347. },
  348. goSearch: function () {
  349. if (!this.keyword) return;
  350. location.href = $h.U({c: 'store', a: 'index', p: {keyword: base.encode(this.keyword)}});
  351. },
  352. getIssueCouponList: function () {
  353. var that = this;
  354. storeApi.getIssueCouponList(4, function (res) {
  355. that.couponList = res.data.data;
  356. that.$nextTick(function () {
  357. var sliderProduct = new Swiper('.coupon-list', { freeMode: true, freeModeMomentumRatio: 0, slidesPerView: 'auto', });
  358. })
  359. });
  360. },
  361. getCateData: function () {
  362. var that = this;
  363. storeApi.getCategoryProductList(4, function (res) {
  364. that.cateGroupList = res.data.data;
  365. // that.$nextTick(function () {
  366. // that.scroll.refresh();
  367. // })
  368. })
  369. },
  370. getCombinationList:function () {
  371. var that = this;
  372. storeApi.baseGet($h.U({
  373. c:"public_api",
  374. a:"get_pink_host",
  375. p:{limit:2}
  376. }),function (res) {
  377. that.combinationList = res.data.data;
  378. // that.$nextTick(function () {
  379. // that.scroll.refresh();
  380. // })
  381. })
  382. },
  383. elInit: function () {
  384. that = this;
  385. if(this.$refs.banners){
  386. var liDom = $(this.$refs.banners).find('li');
  387. if(liDom.length > 0 ){
  388. liDom.width(document.body.offsetWidth);
  389. $(this.$refs.banners).find('ul').width((document.body.offsetWidth * liDom.length)+'px');
  390. var myBanner = new Swiper('.banner', {
  391. pagination: '.swiper-pagination',
  392. paginationClickable: false,
  393. autoplay: 4500,
  394. loop: true,
  395. speed: 2500,
  396. autoplayDisableOnInteraction: false
  397. });
  398. }
  399. }
  400. $('.schedule-weight').each(function() {
  401. var _this = $(this);
  402. var width = _this.attr('data-width');
  403. _this.css("width",width);
  404. });
  405. $('.countdown').each(function () {
  406. var _this = $(this);
  407. var count = _this.attr('data-time');
  408. _this.downCount({date: count, offset: +8});
  409. });
  410. $(".line").slideUp({"li_h": $('.txt-list').height()});
  411. },
  412. getList: function () {
  413. if (this.loading) return;
  414. var that = this, group = that.page;
  415. if (group.loaded) return;
  416. this.loading = true;
  417. storeApi.getBestProductList({first: group.first, limit: group.limit}, function (res) {
  418. var list = res.data.data;
  419. group.loaded = list.length < group.limit;
  420. group.first += list.length;
  421. group.list = group.list.concat(list);
  422. that.$set(that, 'page', group);
  423. that.loading = false;
  424. // that.$nextTick(function () {
  425. // if (list.length) that.scroll.refresh();
  426. // that.scroll.finishPullUp();
  427. // });
  428. }, function () {
  429. that.loading = false
  430. });
  431. },
  432. getproductList: function (type) {
  433. var that = this;
  434. storeApi.getPublicProductList({first:0, limit: 4,type:type}, function (res) {
  435. if(type=='is_best')
  436. that.is_bestList = res.data.data;
  437. if(type=='is_hot')
  438. that.is_hotList = res.data.data;
  439. if(type=='is_new')
  440. that.is_newList = res.data.data;
  441. if(type=='is_benefit')
  442. that.is_benefitList = res.data.data;
  443. }, function () {
  444. });
  445. },
  446. },
  447. mounted: function () {
  448. var that = this;
  449. this.elInit();
  450. this.getIssueCouponList();
  451. this.getproductList('is_best');//精品
  452. this.getproductList('is_hot');//热卖
  453. this.getproductList('is_benefit');//促销
  454. this.getproductList('is_new');//首发新品
  455. this.getIssueCouponList();
  456. this.getCateData();
  457. this.getCombinationList();//猜猜喜欢
  458. setTimeout(function() {
  459. that.getList();
  460. },0);
  461. }
  462. })
  463. });
  464. }());</script>
  465. {/block}