index.html 20 KB

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