Commit a049ff968899a776d87583904cc5580596e88b8b

Authored by WXD-SEASON\season
2 parents 823ecff8 72ba7fd5

Merge branch 'test' of http://git.vipzhuang.cn/wxd/MShopWeApp into qa

... ... @@ -75,7 +75,8 @@ App({
75 75 sp_scene: null,
76 76  
77 77 navBarHeight:44, //默认高度44
78   - is_pc:0, //是不是在pc端打开小程序
  78 + is_pc:0, //是不是在pc端打开小程序
  79 + is_get_login:0
79 80 },
80 81 auth: o,
81 82 request: a,
... ... @@ -108,9 +109,14 @@ App({
108 109 if (!app.globalData.userInfo) {
109 110 var user = wx.getStorageSync("userinfo");
110 111 if (user && user.user_id) {
  112 +
111 113 //--生成会员 --
112 114 app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id, {}).then(res => {
  115 +
  116 + app.globalData.is_get_login=1;
  117 +
113 118 if (res.data.code == 0) {
  119 +
114 120 user = res.data.data;
115 121 //-- 小程序会员被解绑了,就要清空会员 --
116 122 if (user['is_weappuser'] == 0) {
... ... @@ -139,8 +145,10 @@ App({
139 145 }
140 146 })
141 147 }
142   - else if(app.globalData.user_id){ //-- 启用默认的user_id --
  148 + else if(app.globalData.user_id){ //-- 启用默认的user_id --
  149 +
143 150 app.promiseGet("/api/weshop/users/get/" + app.globalData.setting.stoid + "/" + app.globalData.user_id,{}).then(res=>{
  151 + app.globalData.is_get_login=1;
144 152 if(res.data.code==0){
145 153 app.globalData.userInfo = res.data.data;
146 154 wx.setStorageSync("userinfo",app.globalData.userInfo);
... ... @@ -165,6 +173,9 @@ App({
165 173 app.request.get("/api/weshop/users/openidandkey", {
166 174 data: dd,
167 175 success: function (e) {
  176 + //说明会员是有wx.login运行拿了一下是不是会员
  177 + app.globalData.is_get_login=1;
  178 +
168 179 if (e.data.code == 0) {
169 180 //如果有会员的话,没有sessionKey
170 181 if (!e.data.data.sessionKey) {
... ... @@ -796,6 +807,35 @@ App({
796 807 });
797 808 },
798 809  
  810 +
  811 + //--- 最多十秒 ---
  812 + waitfor_login(func){
  813 +
  814 + if(getApp().globalData.user_id){
  815 + func();
  816 + }else {
  817 + var n = 0;
  818 + var that=this;
  819 + if (!this.globalData.is_get_login) {
  820 + var inter = setInterval(function () {
  821 + n++;
  822 + if (that.globalData.is_get_login) {
  823 + clearInterval(inter);
  824 + func();
  825 + }
  826 + if (n > 80) {
  827 + clearInterval(inter);
  828 + func();
  829 + }
  830 + }, 100);
  831 + }else{
  832 + func();
  833 + }
  834 + }
  835 +
  836 +
  837 + },
  838 +
799 839 //------定时等待某个值,有值才进行运算--------
800 840 waitfor: function (page, key, pop_value, func) {
801 841 var n = 0;
... ...
components/diy_floatingBox/diy_floatingBox.js 0 → 100644
  1 +// components/div_floatingBox/div_floatingBox.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 + farr:{
  8 + type: Object,
  9 + value:null
  10 + },
  11 + loaction_index: {
  12 + type: Number,
  13 + value: 0,
  14 + },
  15 + is_show_top: {
  16 + type: Number,
  17 + value: 0,
  18 + },
  19 + },
  20 +
  21 + /**
  22 + * 组件的初始数据
  23 + */
  24 + data: {
  25 +
  26 + },
  27 +
  28 + /**
  29 + * 组件的方法列表
  30 + */
  31 + methods: {
  32 + scrollfn(){
  33 + wx.pageScrollTo({
  34 + scrollTop: 0,
  35 + duration: 300
  36 + })
  37 + }
  38 + }
  39 +})
... ...
components/diy_floatingBox/diy_floatingBox.json 0 → 100644
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "floatingWindow": "/components/diy_floatingWindow/diy_floatingWindow",
  5 + "scan": "/components/diy_scan/diy_scan",
  6 + "service": "/components/diy_service/diy_service"
  7 + }
  8 +}
0 9 \ No newline at end of file
... ...
components/diy_floatingBox/diy_floatingBox.wxml 0 → 100644
  1 +<!--components/div_floatingBox/div_floatingBox.wxml-->
  2 +<view class="floatingBox" style="{{loaction_index==1 ? 'right: 0;padding-right:2rpx' :'left: 0;padding-left:2rpx;'}}">
  3 + <block wx:for="{{farr}}">
  4 + <!--悬浮窗口-->
  5 + <block wx:if="{{item.ename=='floatingWindow'}}" >
  6 + <view wx:for="{{item.content.data}}" wx:for-item="ite" style="margin: 10rpx 0;">
  7 + <floatingWindow object="{{ite}}"></floatingWindow>
  8 + </view>
  9 + </block>
  10 + <!--在线上客服-->
  11 + <view wx:if="{{item.ename=='onlineService'}}" style="margin: 10rpx 0;">
  12 + <service object="{{item.content}}"></service>
  13 + </view>
  14 + <!--扫一扫-->
  15 + <view wx:if="{{item.ename=='scan'}}" style="margin: 10rpx 0;">
  16 + <scan object="{{item.content}}"></scan>
  17 + </view>
  18 + <!--返回顶部-->
  19 + <view wx:if="{{item.ename=='backTop' && is_show_top==1}}" catchtap="scrollfn" class="backTop" style="margin: 10rpx 0;">
  20 + <!-- <scan object="{{item.content}}"></scan> -->
  21 + <image src="{{item.content.img}}" style="width: 50rpx;height: 50rpx;"></image>
  22 + </view>
  23 + </block>
  24 +</view>
0 25 \ No newline at end of file
... ...
components/diy_floatingBox/diy_floatingBox.wxss 0 → 100644
  1 +/* components/div_floatingBox/div_floatingBox.wxss */
  2 +
  3 +.floatingBox {
  4 + /* width: 100rpx; */
  5 + height: 750rpx;
  6 + position: fixed;
  7 + /* top:0; */
  8 + bottom: 300rpx;
  9 + /* margin: auto; */
  10 + /* background-color: red; */
  11 + display: flex;
  12 + align-items: center;
  13 + flex-direction: column;
  14 + justify-content: flex-end;
  15 + /* justify-content: space-around; */
  16 +}
  17 +
  18 +.backTop {
  19 + width: 80rpx;
  20 + height: 80rpx;
  21 + border-radius: 50%;
  22 + z-index: 100;
  23 + background-color: #fff;
  24 + border: 1px solid #adadad;
  25 + box-shadow: 0 0 10px 2px #adadad;
  26 + display: flex;
  27 + align-items: center;
  28 + justify-content: center;
  29 +}
0 30 \ No newline at end of file
... ...
components/diy_floatingWindow/diy_floatingWindow.wxss
1 1 .custom-service {
2   - width: 100rpx;
3   - height: 100rpx;
  2 + width: 80rpx;
  3 + height: 80rpx;
4 4 /* background-color: red; */
5 5 border-radius: 50%;
6 6 z-index: 100;
7 7 line-height: 28rpx;
8   - position: fixed;
  8 + /* position: fixed; */
9 9 top: 50%;
10 10  
11 11 /* background-position: 50%; */
... ...
components/diy_goodsGroup/diy_goodsGroup.js
... ... @@ -573,7 +573,7 @@ Component({
573 573 }
574 574  
575 575 })
576   - console.error(th.data.requestData);
  576 + // console.error(th.data.requestData);
577 577 //-----------------------
578 578 if (th.data.object.column_action_name) {
579 579 if (th.data.object.style == 6 || th.data.object.style == 5) {
... ... @@ -643,7 +643,7 @@ Component({
643 643 },
644 644 // 加购方法 hide
645 645 hide_add_purchase(){
646   - console.error('隐藏加购方法。。。。');
  646 + // console.error('隐藏加购方法。。。。');
647 647 setTimeout(()=>{
648 648 this.setData({
649 649 add_purchase:false
... ...
components/diy_scan/diy_scan.wxml
... ... @@ -3,7 +3,7 @@
3 3 style="top:{{top}}px;left:{{left}}px; background-color:{{object.bg_color}}; opacity: 0.5 " bindtouchmove="setTouchMove">
4 4 <view style="text-align: center;">
5 5 <image class="cs-img" src="{{object.img}}"></image>
6   - <view class="s_title" wx:if="{{object.title!=''}}">
  6 + <view class="s_title" style="line-height: 14rpx;" wx:if="{{object.title!=''}}">
7 7 <text wx:if="{{object.word_color}}" style="color:{{object.word_color}}">{{object.title}}</text>
8 8 <text wx:else >{{object.title}}</text>
9 9 </view>
... ... @@ -15,7 +15,7 @@
15 15 <view class="scan_view" disable-scroll="true" bindtap='getScancode' style="top:{{top}}px;left:{{left}}px;" bindtouchmove="setTouchMove">
16 16 <view style="text-align: center;">
17 17 <image class="cs-img" src="{{object.img}}"></image>
18   - <view class="s_title" wx:if="{{object.title!=''}}">
  18 + <view class="s_title" style="line-height: 14rpx;" wx:if="{{object.title!=''}}">
19 19 <text wx:if="{{object.word_color}}" style="color:{{object.word_color}}">{{object.title}}</text>
20 20 <text wx:else>{{object.title}}</text>
21 21 </view>
... ...
components/diy_scan/diy_scan.wxss
1 1 .scan_view{
2   - position: fixed;z-index: 100; left: 0; top: 0; width: 100rpx; height: 100rpx;
  2 + z-index: 100; left: 0; top: 0; width: 80rpx; height: 80rpx;
3 3 border-radius: 50%; background-color: rgba(125,125,2,0.5);box-shadow: #ccc 0px 0px 70px 1px;
4 4 display: flex;align-items: center;justify-content: center; color: #f8f8f8;
5 5 }
... ...
components/diy_service/diy_service.wxml
... ... @@ -4,14 +4,14 @@
4 4 <view wx:if="{{userInfo}}" class="custom-service" bindtap="go_user" >
5 5 <view style="text-align: center;">
6 6 <image class="cs-img" src="{{object.img}}"></image>
7   - <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view>
  7 + <view class="s_title" style="line-height: 14rpx;" wx:if="{{object.title!=''}}">{{object.title}}</view>
8 8 </view>
9 9 </view>
10 10  
11 11 <button wx:else class="custom-service" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
12 12 <view style="text-align: center;">
13 13 <image class="cs-img" src="{{object.img}}"></image>
14   - <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view>
  14 + <view class="s_title" style="line-height: 14rpx;" wx:if="{{object.title!=''}}">{{object.title}}</view>
15 15 </view>
16 16 </button>
17 17 </block>
... ... @@ -20,7 +20,7 @@
20 20 <view class="custom-service cart-ico new_split" bindtap="con_weixin">
21 21 <view style="text-align: center;">
22 22 <image class="cs-img" src="{{object.img}}"></image>
23   - <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view>
  23 + <view class="s_title" style="line-height: 14rpx;" wx:if="{{object.title!=''}}">{{object.title}}</view>
24 24 </view>
25 25 </view>
26 26 </block>
... ... @@ -29,7 +29,7 @@
29 29 <view class="custom-service cart-ico new_split" bindtap="contactService">
30 30 <view style="text-align: center;">
31 31 <image class="cs-img" src="{{object.img}}"></image>
32   - <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view>
  32 + <view class="s_title" style="line-height: 14rpx;" wx:if="{{object.title!=''}}">{{object.title}}</view>
33 33 </view>
34 34 </view>
35 35 </block>
36 36 \ No newline at end of file
... ...
components/diy_service/diy_service.wxss
1   -.custom-service{ width: 100rpx; height: 100rpx; border-radius: 50%; background-color: #fff;z-index: 100;
  1 +.custom-service{ width: 80rpx; height: 80rpx; border-radius: 50%; background-color: #fff;z-index: 100;
2 2 border: 1px solid #adadad; box-shadow: 0 0 10px 2px #adadad; line-height: 28rpx;
3   - position: fixed; top: 40%; right: 2rpx; display: flex;align-items: center;justify-content: center;}
  3 + right: 2rpx; display: flex;align-items: center;justify-content: center;}
4 4  
5 5 .cs-img{ width: 36rpx; height: 36rpx;}
6 6 .s_title{ font-size: 14rpx;}
7 7 \ No newline at end of file
... ...
components/diy_top_nav/diy_top_nav.js
... ... @@ -20,11 +20,11 @@ Component({
20 20 },
21 21 nav_frontColor:{
22 22 type:String,
23   - value:'#ffffff',
  23 + value:'#000',
24 24 },
25 25 nav_backgroundColor:{
26 26 type:String,
27   - value:'#ff7295',
  27 + value:'#ffffff',
28 28 },
29 29 is_share:{
30 30 type:Boolean,
... ...
packageB/pages/zuhegou/index/index.js
... ... @@ -20,6 +20,7 @@ Page({
20 20 showNum: false,
21 21 haveAdded: false,
22 22 imgDraw: {},
  23 + new_imgDraw:{},
23 24 id: 0, //获得活动id
24 25 page: 1, //第一页
25 26 no_more: 0, //没有更多
... ... @@ -38,6 +39,7 @@ Page({
38 39 sec_pick_index: 0, //门店选择的下标,地区选择之后的内页
39 40 userbuynum: false,//是否有超出购买次数,还是否可以购买。false 为可购买,true为不可购买
40 41 sales_map: {}, //线下销售的map
  42 + fxShow:false,//分享是否显示
41 43 },
42 44  
43 45 /**
... ... @@ -614,6 +616,8 @@ Page({
614 616 th.get_head_temp(function () {
615 617 var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件";
616 618 var imgDraw = th.data.imgDraw;
  619 + // console.error('头像地址1');
  620 + // console.error(th.data.share_head);
617 621 imgDraw.views[0].url = th.data.share_head;
618 622 imgDraw.views[1].text = userInfo.nickname;
619 623 imgDraw.views[3].text = txt;
... ... @@ -634,7 +638,14 @@ Page({
634 638 imgDraw.views[2].url = path22;
635 639 imgDraw.views[5].url = vpath;
636 640 th.setData({
637   - imgDraw: imgDraw
  641 + // ['imgDraw.views[0].url']:imgDraw.views[0].url,
  642 + // ['imgDraw.views[1].text']:imgDraw.views[1].text,
  643 + // ['imgDraw.views[2].text']:imgDraw.views[2].text,
  644 + // ['imgDraw.views[3].text']:imgDraw.views[3].text,
  645 + // ['imgDraw.views[4].text']:imgDraw.views[4].url,
  646 + imgDraw: imgDraw,
  647 + new_imgDraw:imgDraw,
  648 + fxShow:true
638 649 })
639 650 }
640 651 })
... ... @@ -649,6 +660,8 @@ Page({
649 660 th.get_head_temp(function () {
650 661 var imgDraw = th.data.imgDraw;
651 662 var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件";
  663 + // console.error('头像地址2');
  664 + // console.error(th.data.share_head);
652 665 imgDraw.views[0].url = th.data.share_head;
653 666 imgDraw.views[1].text = userInfo.nickname;
654 667 imgDraw.views[2].text = txt;
... ... @@ -670,7 +683,14 @@ Page({
670 683 var vpath = res.path;
671 684 imgDraw.views[4].url = vpath;
672 685 th.setData({
673   - imgDraw: imgDraw
  686 + // ['imgDraw.views[0].url']:imgDraw.views[0].url,
  687 + // ['imgDraw.views[1].text']:imgDraw.views[1].text,
  688 + // ['imgDraw.views[2].text']:imgDraw.views[2].text,
  689 + // ['imgDraw.views[3].text']:imgDraw.views[3].text,
  690 + // ['imgDraw.views[4].url']:imgDraw.views[4].url,
  691 + imgDraw: imgDraw,
  692 + new_imgDraw:imgDraw,
  693 + fxShow:true
674 694 })
675 695 }
676 696 })
... ... @@ -1442,7 +1462,9 @@ Page({
1442 1462 },
1443 1463  
1444 1464 onImgOK(e) {
1445   - console.log(e.detail.path);
  1465 + // console.error('绘制返回------------');
  1466 + // console.error(e);
  1467 + // console.log(e.detail.path);
1446 1468 this.setData({
1447 1469 myimg: e.detail.path,
1448 1470 });
... ... @@ -1541,7 +1563,8 @@ Page({
1541 1563 //---获取分享图片的本地地址,头像和商品图片----
1542 1564 var path2 = getApp().globalData.userInfo.head_pic;
1543 1565 if (path2 == "") {
1544   - ee.data.share_head = "../../../../images/share/hui_hear_pic.png";
  1566 + // ee.data.share_head = "../../../../images/share/hui_hear_pic.png";
  1567 + ee.data.share_head = "https://mshopimg.yolipai.net//miniapp/images/no-head.jpg";
1545 1568 tt();
1546 1569 } else {
1547 1570 path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
... ... @@ -1555,7 +1578,8 @@ Page({
1555 1578 tt();
1556 1579 },
1557 1580 fail: function () {
1558   - ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
  1581 + ee.data.share_head = "https://mshopimg.yolipai.net//miniapp/images/no-head.jpg";
  1582 + // ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
1559 1583 tt();
1560 1584 }
1561 1585 });
... ...
packageB/pages/zuhegou/index/index.wxml
... ... @@ -98,7 +98,7 @@
98 98 </view>
99 99 </view>
100 100 <!-- 分享 -->
101   - <view wx:if="{{imgDraw}}" class="share-container" bindtap="share">
  101 + <view wx:if="{{imgDraw && fxShow}}" class="share-container" bindtap="share">
102 102 <text class="iconfont icon-zhuanfa fs40"></text>
103 103 <view class="fs22 c-8">分享</view>
104 104 </view>
... ... @@ -155,7 +155,9 @@
155 155  
156 156 </view>
157 157  
158   -<painter style="position: absolute; top: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/>
  158 +
  159 + <painter style="position: absolute; top: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/>
  160 +
159 161 <!-- 活动异常提醒 -->
160 162 <catch wx:if="{{error}}">{{error}}</catch>
161 163 <warn id="warn"></warn>
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -577,7 +577,7 @@ Page({
577 577 if(!ite.is_gift) {
578 578 let obj = {
579 579 wareno: ite.goods_sn,
580   - price: ite.first_account, //account是平摊后的实收价格
  580 + price: ite.account_fir, //account是平摊后的实收价格
581 581 qty: ite.goods_num,
582 582 sumprice: parseFloat(ite.account_fir * ite.goods_num - ite.account_yu_fir-(ite.quan_num?ite.quan_num:0)).toFixed(2)
583 583 }
... ... @@ -2440,6 +2440,11 @@ Page({
2440 2440 var o_price = 0, q_conditin = 0;
2441 2441 //--------循环计算总价-----------
2442 2442 for (var j = 0; j < ord_goods.length; j++) {
  2443 +
  2444 + if (ord_goods[j].is_gift) continue;
  2445 + ord_goods[j].account_fir=ord_goods[j].goods_price; //初始实际价格
  2446 + ord_goods[j].account_yu_fir=0; //初始余数
  2447 +
2443 2448 if (ord_goods[j].whsle_id) continue;
2444 2449 o_price += ord_goods[j].goods_price * ord_goods[j].goods_num;
2445 2450 }
... ... @@ -2476,8 +2481,6 @@ Page({
2476 2481 item_map.zxlbtitle = get_data.zxlbtitle;
2477 2482  
2478 2483  
2479   -
2480   -
2481 2484 var rule=JSON.parse(get_data.rule);
2482 2485 if(rule.is_monthgiftbag && parseFloat(rule.is_monthgiftbag )>0){
2483 2486 //每月礼包
... ... @@ -2625,7 +2628,6 @@ Page({
2625 2628 if (!item_map.is_xz_yh) q_conditin = o_price;
2626 2629 }
2627 2630  
2628   -
2629 2631 //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表-----------
2630 2632 for (var j = 0; j < ord_goods.length; j++) {
2631 2633 if (ord_goods[j].whsle_id) continue;
... ... @@ -2633,10 +2635,11 @@ Page({
2633 2635 ord_goods[j].is_xz_yh = ord_goods[j].is_xz_yh ? ord_goods[j].is_xz_yh : item_map.is_xz_yh;
2634 2636 ord_goods[j].is_past = item_map.is_past;
2635 2637 if (ord_goods[j].is_gift) continue; //赠品不平摊
2636   - ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir;
2637   - ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir;
2638   - ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account;
2639   - ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu;
  2638 +
  2639 + // ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir;
  2640 + // ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir;
  2641 + // ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account;
  2642 + // ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu;
2640 2643  
2641 2644 //-- 如果有参与促销才来进行计算 --
2642 2645 if (item_map.cy_cx) {
... ... @@ -2650,10 +2653,15 @@ Page({
2650 2653 ord_goods[j].is_order_yh = item_map.is_order_yh;
2651 2654 ord_goods[j].is_post_temp = item_map.is_post_temp;
2652 2655  
2653   - ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir;
2654   - ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir;
2655   - ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account;
2656   - ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu;
  2656 + //-- 真的判断 --
  2657 + var fd_map_gd=th.item_map_get_goods(ord_goods[j].goods_id, item_map);
  2658 + if(fd_map_gd){
  2659 + if(fd_map_gd.account_fir!=undefined) ord_goods[j].account_fir = fd_map_gd.account_fir;
  2660 + if(fd_map_gd.account_yu_fir!=undefined) ord_goods[j].account_yu_fir = fd_map_gd.account_yu_fir;
  2661 + if(fd_map_gd.account!=undefined) ord_goods[j].account = fd_map_gd.account;
  2662 + if(fd_map_gd.account_yu!=undefined) ord_goods[j].account_yu = fd_map_gd.account_yu;
  2663 + }
  2664 +
2657 2665 }
2658 2666 }
2659 2667 }
... ...
packageE/pages/cart/cart_wk/cart_wk.js
... ... @@ -513,8 +513,14 @@ Page({
513 513 }).then(res => {
514 514  
515 515 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  516 +
516 517 quan_price = res.data.data[0].WareCashSum;
  518 +
  519 + if(quan_price>th.data.order.tail_money){
  520 + quan_price=th.data.order.tail_money
  521 + }
517 522 allpice=allpice-quan_price;
  523 +
518 524 }
519 525 })
520 526 }
... ... @@ -538,7 +544,7 @@ Page({
538 544 }
539 545  
540 546 //如果有使用优惠券,如何订单促销有控制使用优惠券不参与此活动的话
541   - if(quan_price>0 && ord_prom.is_xz_yh ){
  547 + if(quan_price>0 && ord_prom && ord_prom.is_xz_yh ){
542 548 ord_prom=null;
543 549 }
544 550 th.data.ord_prom=ord_prom;
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -149,6 +149,7 @@ Page({
149 149  
150 150 //商品的活动类型 0普通 1秒杀 2团购 3优惠 4 积分购 6拼单
151 151 prom_type: 0,
  152 + f_prom_type: 0, //前端判断要不要显示券
152 153 prom_time_text: "",
153 154 prom_price: null,
154 155 f_prom_price: null, //秒杀使用
... ... @@ -428,16 +429,85 @@ Page({
428 429 getApp().globalData.guide_id = res.data.data.id;
429 430 getApp().globalData.guide_pick_id = res.data.data.pickup_id;
430 431  
431   -
432 432 wxlog.info(getApp().globalData.user_id+'-分享的导购:'+getApp().globalData.guide_id);
433 433  
434 434 }
435 435 })
436 436  
  437 + }
  438 +
  439 + //先查看一下是不是系统会员
  440 + getApp().waitfor_login(()=>{
437 441 if (!getApp().globalData.user_id) {
438 442 ut.new_user_go(os.stoid, first_leader);
439 443 }
440   - }
  444 +
  445 + //----获取系统参数-----
  446 + getApp().getConfig2(function (e) {
  447 + ee.setData({
  448 + bconfig: e,
  449 + sales_rules: e.sales_rules,
  450 + });
  451 +
  452 + if (e.categoryset.indexOf("," + 1 + ",") != -1) {
  453 + ee.setData({
  454 + is_show_pl: 1
  455 + });
  456 + }
  457 + if (e.categoryset.indexOf("," + 3 + ",") != -1) {
  458 + ee.setData({
  459 + is_show_pp: 1
  460 + });
  461 + }
  462 + if (e.categoryset.indexOf("," + 2 + ",") != -1) {
  463 + ee.setData({
  464 + is_show_gb: 1
  465 + });
  466 + }
  467 + console.log('获取系统参数');
  468 + console.log(e);
  469 + var json_d = JSON.parse(e.switch_list);
  470 + ee.setData({
  471 + store_config: e,
  472 + sys_switch: json_d,
  473 + is_closecoupon: json_d.is_closecoupon,
  474 + is_newsales_rules: json_d.is_newsales_rules,
  475 + is_retail_price: json_d.is_retail_price || 0,
  476 + appoint_pick_keyid: json_d.appoint_pick_keyid,
  477 + // goods_bottomconent:e.goods_bottomconent
  478 + });
  479 +
  480 + if(e && e.goods_topconent && e.goods_ad_position.indexOf('1')>-1){
  481 + //商品详情广告----
  482 + a.wxParse("goodInfo_ad2", "html", ut.format_content(e.goods_topconent), ee, 6);
  483 + common.wxParseAddFullImageUrl(ee, "goodInfo_ad2");
  484 + //-------
  485 + }
  486 +
  487 + //判断商品详情要有东西
  488 + if(e && e.goods_bottomconent && e.goods_ad_position.indexOf('2')>-1) {
  489 + //商品详情广告----
  490 + a.wxParse("goodInfo_ad", "html", ut.format_content(e.goods_bottomconent), ee, 6);
  491 + common.wxParseAddFullImageUrl(ee, "goodInfo_ad");
  492 + //-------
  493 + }
  494 +
  495 + //------几人评价-------
  496 + //n.init(th, "", "comments");
  497 +
  498 + th.requestCardNum(), wx.pageScrollTo && th.setData({
  499 + supportPageScroll: !0
  500 + });
  501 +
  502 + //计算等级价相关
  503 + var swithc_list = e.switch_list;
  504 + var sw_arr = JSON.parse(swithc_list);
  505 + console.log('plus-111')
  506 + //---如果后台又开等级卡的开关---
  507 + ut.get_plus_name_price(sw_arr, ee);
  508 +
  509 + }, 1);
  510 + })
441 511  
442 512 //-- 如果有房间号 --
443 513 if (room_id) {
... ... @@ -482,71 +552,7 @@ Page({
482 552 })
483 553 })
484 554  
485   - //----获取系统参数-----
486   - getApp().getConfig2(function (e) {
487   - ee.setData({
488   - bconfig: e,
489   - sales_rules: e.sales_rules,
490   - });
491   -
492   - if (e.categoryset.indexOf("," + 1 + ",") != -1) {
493   - ee.setData({
494   - is_show_pl: 1
495   - });
496   - }
497   - if (e.categoryset.indexOf("," + 3 + ",") != -1) {
498   - ee.setData({
499   - is_show_pp: 1
500   - });
501   - }
502   - if (e.categoryset.indexOf("," + 2 + ",") != -1) {
503   - ee.setData({
504   - is_show_gb: 1
505   - });
506   - }
507   - console.log('获取系统参数');
508   - console.log(e);
509   - var json_d = JSON.parse(e.switch_list);
510   - ee.setData({
511   - store_config: e,
512   - sys_switch: json_d,
513   - is_closecoupon: json_d.is_closecoupon,
514   - is_newsales_rules: json_d.is_newsales_rules,
515   - is_retail_price: json_d.is_retail_price || 0,
516   - appoint_pick_keyid: json_d.appoint_pick_keyid,
517   - // goods_bottomconent:e.goods_bottomconent
518   - });
519 555  
520   - if(e && e.goods_topconent && e.goods_ad_position.indexOf('1')>-1){
521   - //商品详情广告----
522   - a.wxParse("goodInfo_ad2", "html", ut.format_content(e.goods_topconent), ee, 6);
523   - common.wxParseAddFullImageUrl(ee, "goodInfo_ad2");
524   - //-------
525   - }
526   -
527   - //判断商品详情要有东西
528   - if(e && e.goods_bottomconent && e.goods_ad_position.indexOf('2')>-1) {
529   - //商品详情广告----
530   - a.wxParse("goodInfo_ad", "html", ut.format_content(e.goods_bottomconent), ee, 6);
531   - common.wxParseAddFullImageUrl(ee, "goodInfo_ad");
532   - //-------
533   - }
534   -
535   - //------几人评价-------
536   - //n.init(th, "", "comments");
537   -
538   - th.requestCardNum(), wx.pageScrollTo && th.setData({
539   - supportPageScroll: !0
540   - });
541   -
542   - //计算等级价相关
543   - var swithc_list = e.switch_list;
544   - var sw_arr = JSON.parse(swithc_list);
545   - console.log('plus-111')
546   - //---如果后台又开等级卡的开关---
547   - ut.get_plus_name_price(sw_arr, th);
548   -
549   - }, 1);
550 556  
551 557 //获取用户设备信息,屏幕宽度
552 558 wx.getSystemInfo({
... ... @@ -2683,12 +2689,15 @@ Page({
2683 2689  
2684 2690 //判断积分购库存
2685 2691 if (!th.data.is_normal && th.data.prom_type == 4) {
2686   - var i_canbuy = th.data.prom_act.limitqty - th.data.prom_act.buy_num;
  2692 + var i_canbuy = th.data.prom_act.limitqty - th.data.prom_act.buy_num;
2687 2693 if (t > i_canbuy) {
2688 2694 wx.showToast({
2689 2695 title: '超出商品活动库存',
2690 2696 icon: 'none',
2691 2697 });
  2698 + th.setData({
  2699 + goodsInputNum: i_canbuy
  2700 + })
2692 2701 // s.my_warnning('超出商品活动库存', 0, th);
2693 2702 return false;
2694 2703 }
... ... @@ -3412,7 +3421,6 @@ Page({
3412 3421 if(this.data.sp_seleing){
3413 3422 return false;
3414 3423 }
3415   -
3416 3424 this.setData({sp_seleing:1,more_flash:null})
3417 3425  
3418 3426 var that = this;
... ... @@ -4762,6 +4770,7 @@ Page({
4762 4770 ee.setData({
4763 4771 prom_price: t.data.data.price,
4764 4772 prom_type: 2,
  4773 + f_prom_type: 2,
4765 4774 prom_id: prom_id,
4766 4775 prom_buy_limit: t.data.data.buy_limit,
4767 4776 prom_act: t.data.data,
... ... @@ -4860,7 +4869,9 @@ Page({
4860 4869 prom_price: t.data.data.user_price,
4861 4870 f_prom_price: t.data.data.user_price,
4862 4871 prom_type: 1,
  4872 + f_prom_type: 1,
4863 4873 prom_id: prom_id,
  4874 + f_prom_id: prom_id,
4864 4875 prom_buy_limit: t.data.data.buy_limit,
4865 4876 prom_act: t.data.data,
4866 4877 f_prom_act: t.data.data,
... ... @@ -4997,6 +5008,7 @@ Page({
4997 5008 prom_price: parseFloat(inte_data.addmoney),
4998 5009 prom_integral: parseFloat(inte_data.integral),
4999 5010 prom_type: 4,
  5011 + f_prom_type: 4,
5000 5012 prom_id: inte_data.id,
5001 5013 prom_buy_limit: inte_data.limitvipqty,
5002 5014 prom_act: inte_data,
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -327,6 +327,9 @@
327 327 <view class="flex jc_sb ai_c">
328 328 <view class="co-red" wx:if="{{prom_type==0 || prom_type==3}}">
329 329  
  330 +
  331 +
  332 +
330 333 <view class="market-price flex" style="align-items: baseline;">
331 334 <block wx:if="{{card_field && front_g[card_field]>0}}">
332 335 <view class="flex ai-center grade-card-frame">
... ... @@ -675,8 +678,8 @@
675 678 </view>
676 679  
677 680  
678   - <!-- 许程 7.24暂时注释 -->
679   - <view class="bdt16" wx:if="{{ prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && front_g.is_xz_yh !=1 && fir_quan.length>0 }}">
  681 + <!-- 许程 7.24暂时注释,秒杀,团购,积分,拼团的详情页面不显示券的领取 -->
  682 + <view class="bdt16" wx:if="{{ f_prom_type!=1 && f_prom_type!=2 && f_prom_type!=4 && f_prom_type!=6 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && front_g.is_xz_yh !=1 && fir_quan.length>0 }}">
680 683 <view data-coupon="1" bindtap="switchCoupon" class="cx-frame flex" style="position: relative">
681 684 <view class="cx-sizs fs30">领券</view>
682 685 <view class="flex ai_c f1 pdh20">
... ...
pages/goods/goodsList/goodsList.js
... ... @@ -68,166 +68,177 @@ Page({
68 68 getApp().globalData.guide_pick_id= res.data.data.pickup_id
69 69 }
70 70 })
71   - if(!getApp().globalData.user_id){
72   - ut.new_user_go(oo.stoid,first_leader);
73   - }
  71 +
  72 +
74 73 }
75 74  
76 75 var th=this;
77 76 var url = this.data.baseUrl;
78   - this.data.is_new=t.is_new;
79   - this.data.is_hot=t.is_hot;
80   - if (0 != t.cat_id && t.cat_id != undefined) {
81   - url += "&cat_id=" + t.cat_id;
82   - if (t.pid == undefined || t.pid == null){
83   - url += "&parent_id=0";
84   - }else{
85   - if(t.pid!="three"){
86   - url += "&parent_id="+t.pid;
  77 +
  78 + //优惠活动的凑单
  79 + if(t.prom_type==3){
  80 + if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }
  81 + if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }
  82 + //-- 获取 --
  83 + getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
  84 + data:{prom_id:t.prom_id }
  85 + }).then(res=>{
  86 + if(res.data.code==0){
  87 + var arr= res.data.data;
  88 + th.set_prom_list(arr);
87 89 }
  90 + })
  91 + if (t.prom_id) {
  92 + this.getprom(t.prom_id)
88 93 }
89   - this.data.cat_id=t.cat_id;
90 94 }
91 95  
92   - if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
93   - if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }
94   -
95   - if (0 != t.group_id && t.group_id != undefined) { url += "&group_id=" + t.group_id; this.data.gr_fir=1; }
96   - if (0 != t.gid && t.gid != undefined) { url += "&group_id=" + t.gid; this.data.gr_fir=1; }
97   -
98   - if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; }
99   -
100   - if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; }
101   - if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; }
102   - if (0 != t.ladder_id && t.ladder_id != undefined) {
103   - url += "&ladder_id=" + t.ladder_id;
104   - this.setData({
105   - ladder_id:t.ladder_id,
106   - baseUrl:url,
107   - })
108   - }
109 96  
110   - var user_id=getApp().globalData.user_id;
111   - if(!user_id) user_id=0;
112   - url += "&user_id="+user_id;
  97 + //先查看一下是不是系统会员
  98 + getApp().waitfor_login(()=> {
  99 + if (!getApp().globalData.user_id) {
  100 + ut.new_user_go(oo.stoid, first_leader);
  101 + }
113 102  
114   - // 优惠促销列表
115   - if(t.prom_goods_id) {
116   - url += '&prom_goods_id=' + t.prom_goods_id;
117   - };
118   -
119   -
120   - if(getApp().globalData.userInfo) {
121   - url += "&user_id=" + getApp().globalData.userInfo.user_id;
122   - }
123   -
124   -
125   - //优惠活动的凑单
126   - if(t.prom_type==3){
127   - if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }
128   - if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }
129   - //-- 获取 --
130   - getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
131   - data:{prom_id:t.prom_id }
132   - }).then(res=>{
133   - if(res.data.code==0){
134   - var arr= res.data.data;
135   - th.set_prom_list(arr);
136   - }
137   - })
138   - if (t.prom_id) {
139   - this.getprom(t.prom_id)
  103 + this.data.is_new=t.is_new;
  104 + this.data.is_hot=t.is_hot;
  105 + if (0 != t.cat_id && t.cat_id != undefined) {
  106 + url += "&cat_id=" + t.cat_id;
  107 + if (t.pid == undefined || t.pid == null){
  108 + url += "&parent_id=0";
  109 + }else{
  110 + if(t.pid!="three"){
  111 + url += "&parent_id="+t.pid;
  112 + }
  113 + }
  114 + this.data.cat_id=t.cat_id;
  115 + }
  116 +
  117 + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
  118 + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }
  119 +
  120 + if (0 != t.group_id && t.group_id != undefined) { url += "&group_id=" + t.group_id; this.data.gr_fir=1; }
  121 + if (0 != t.gid && t.gid != undefined) { url += "&group_id=" + t.gid; this.data.gr_fir=1; }
  122 +
  123 + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; }
  124 +
  125 + if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; }
  126 + if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; }
  127 + if (0 != t.ladder_id && t.ladder_id != undefined) {
  128 + url += "&ladder_id=" + t.ladder_id;
  129 + this.setData({
  130 + ladder_id:t.ladder_id,
  131 + baseUrl:url,
  132 + })
  133 + }
  134 +
  135 + var user_id=getApp().globalData.user_id;
  136 + if(!user_id) user_id=0;
  137 + url += "&user_id="+user_id;
  138 +
  139 + // 优惠促销列表
  140 + if(t.prom_goods_id) {
  141 + url += '&prom_goods_id=' + t.prom_goods_id;
  142 + };
  143 +
  144 +
  145 + if(getApp().globalData.userInfo) {
  146 + url += "&user_id=" + getApp().globalData.userInfo.user_id;
140 147 }
141   - }
142 148  
143   - //--- 阶梯优惠活动的凑单 ---
144   - if(t.ladder_id){
145   - var user_id=getApp().globalData.user_id;
146   - if(!user_id) user_id=0;
147   - getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/"+oo.stoid+"/"+user_id+"/"+t.ladder_id,{
148   - }).then(res=>{
149   - if(res.data.code==0 && res.data.data){
150   - var arr= res.data.data;
151   -
152   - if(arr.is_end==1){
153   - th.setData({show_all:0,err_txt:'活动已结束'});
154   - return false;
155   - }
156   - if(arr.start_time>ut.gettimestamp()){
157   - th.setData({show_all:0,err_txt:'活动还未开始'});
158   - return false;
  149 + //--- 阶梯优惠活动的凑单 ---
  150 + if(t.ladder_id){
  151 + var user_id=getApp().globalData.user_id;
  152 + if(!user_id) user_id=0;
  153 + getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/"+oo.stoid+"/"+user_id+"/"+t.ladder_id,{
  154 + }).then(res=>{
  155 + if(res.data.code==0 && res.data.data){
  156 + var arr= res.data.data;
  157 +
  158 + if(arr.is_end==1){
  159 + th.setData({show_all:0,err_txt:'活动已结束'});
  160 + return false;
  161 + }
  162 + if(arr.start_time>ut.gettimestamp()){
  163 + th.setData({show_all:0,err_txt:'活动还未开始'});
  164 + return false;
  165 + }
  166 + if(arr.end_time<ut.gettimestamp()){
  167 + th.setData({show_all:0});
  168 + th.setData({show_all:0,err_txt:'活动已结束'});
  169 + return false;
  170 + }
  171 +
  172 + var url1="/api/weshop/prom/ladderList/list?store_id="+oo.stoid+"&form_id="+arr.id;
  173 + getApp().request.promiseGet(url1, {}).then(rs=>{
  174 + if(rs.data.code==0 && rs.data.data && rs.data.data.length) {
  175 + var prom_content="";
  176 + for(let jj in rs.data.data){
  177 + if(rs.data.data[jj].discount==10){
  178 + prom_content+="第"+(parseInt(jj)+1)+"件原价,";
  179 + }else{
  180 + prom_content+="第"+(parseInt(jj)+1)+"件"+rs.data.data[jj].discount+"折,";
  181 + }
  182 + }
  183 + prom_content=ut.sub_last(prom_content);
  184 + th.setData({jieti_prom:prom_content})
  185 + }
  186 + })
159 187 }
160   - if(arr.end_time<ut.gettimestamp()){
161   - th.setData({show_all:0});
162   - th.setData({show_all:0,err_txt:'活动已结束'});
163   - return false;
  188 + else{
  189 + th.setData({show_all:0,err_txt:'未找到活动或者身份不符'});
164 190 }
  191 + })
  192 + }
  193 +
165 194  
166   - var url1="/api/weshop/prom/ladderList/list?store_id="+oo.stoid+"&form_id="+arr.id;
167   - getApp().request.promiseGet(url1, {}).then(rs=>{
168   - if(rs.data.code==0 && rs.data.data && rs.data.data.length) {
169   - var prom_content="";
170   - for(let jj in rs.data.data){
171   - if(rs.data.data[jj].discount==10){
172   - prom_content+="第"+(parseInt(jj)+1)+"件原价,";
173   - }else{
174   - prom_content+="第"+(parseInt(jj)+1)+"件"+rs.data.data[jj].discount+"折,";
  195 + this.data.old_req_url=url;
  196 + //进行筛选
  197 + this.set_screen(url);
  198 +
  199 + this.requestGoodsList(url);
  200 +
  201 + getApp().getConfig2(function(rs){
  202 + //计算等级价相关
  203 + var swithc_list=rs.switch_list;
  204 + var sw_arr=JSON.parse(swithc_list);
  205 + //---如果后台又开等级卡的开关---
  206 + if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
  207 + th.setData({rank_switch:true});
  208 + var user=getApp().globalData.userInfo;
  209 + var ti=setInterval(function(){
  210 + if(!user) return false;
  211 + clearInterval(ti);
  212 + //---回调卡的列表---
  213 + th.getPlusCardType(function(ob){
  214 + th.setData({card_list:ob.card_list});
  215 + if(user.card_field ){
  216 + var str = user['card_expiredate'].replace(/-/g, '/');
  217 + var end = new Date(str);
  218 + end = Date.parse(end) / 1000;
  219 + var now = ut.gettimestamp();
  220 +
  221 + //--- 判断是等级会员,且在有效期范围内 ---
  222 + if(user.card_field && now<end){
  223 + var card_name=ob.name_map.get(user.card_field);
  224 + // if(card_name.length>4) card_name=card_name.substring(0,4);
  225 + th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list});
175 226 }
176 227 }
177   - prom_content=ut.sub_last(prom_content);
178   - th.setData({jieti_prom:prom_content})
179   - }
180   - })
181   - }
182   - else{
183   - th.setData({show_all:0,err_txt:'未找到活动或者身份不符'});
  228 + })
  229 + },500)
184 230 }
185   - })
186   - }
187   -
188   -
189   - this.data.old_req_url=url;
190   - //进行筛选
191   - this.set_screen(url);
192   -
193   - this.requestGoodsList(url);
194   -
195   - getApp().getConfig2(function(rs){
196   - //计算等级价相关
197   - var swithc_list=rs.switch_list;
198   - var sw_arr=JSON.parse(swithc_list);
199   - //---如果后台又开等级卡的开关---
200   - if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
201   - th.setData({rank_switch:true});
202   - var user=getApp().globalData.userInfo;
203   - var ti=setInterval(function(){
204   - if(!user) return false;
205   - clearInterval(ti);
206   - //---回调卡的列表---
207   - th.getPlusCardType(function(ob){
208   - th.setData({card_list:ob.card_list});
209   - if(user.card_field ){
210   - var str = user['card_expiredate'].replace(/-/g, '/');
211   - var end = new Date(str);
212   - end = Date.parse(end) / 1000;
213   - var now = ut.gettimestamp();
214   -
215   - //--- 判断是等级会员,且在有效期范围内 ---
216   - if(user.card_field && now<end){
217   - var card_name=ob.name_map.get(user.card_field);
218   - // if(card_name.length>4) card_name=card_name.substring(0,4);
219   - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list});
220   - }
221   - }
222   - })
223   - },500)
224   - }
225 231  
226 232 if(sw_arr.is_retail_price){
227 233 th.setData({is_retail_price:1});
228 234 }
229 235  
230   - });
  236 + });
  237 +
  238 + })
  239 +
  240 +
  241 +
231 242  
232 243 //调用接口判断商家plus有没有过期
233 244 getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => {
... ... @@ -302,12 +313,18 @@ Page({
302 313 })
303 314 }
304 315 //--送赠品--
305   - if(parseInt(content.is_gift)) {
  316 + if(parseInt(content.is_gift) && content.zp_mode==0) {
306 317 //-- 获取 --
307 318 await getApp().request.promiseGet("/api/weshop/prom/gift/page?id="+content.gift+"&store_id="+oo.stoid, {
308 319 }).then(res => {
309 320 if(ut.ajax_ok(res))
  321 +
310 322 arr[i].content.gift_name=res.data.data.pageData[0].goods_name;
  323 + if(!content.zpname_type) content.zpname_type='';
  324 +
  325 + if(parseInt(content.zpname_type)>0){
  326 + arr[i].content.gift_name=res.data.data.pageData[0].title;
  327 + }
311 328 })
312 329 }
313 330  
... ...
pages/index/index/index.js
1 1 var e = function (e) {
2   - return e && e.__esModule ? e : {
3   - default: e
4   - };
  2 + return e && e.__esModule ? e : {
  3 + default: e
  4 + };
5 5 }(require("../../../utils/LoadMore.js")),
6   - t = getApp(),
7   - a = t.request,
8   - o = t.globalData.setting,
9   - os = o,
10   - i = require("../../../utils/util.js"),
11   - ut = i,
12   - s = require("../../../utils/common.js"),
13   - n = new e.default();
  6 + t = getApp(),
  7 + a = t.request,
  8 + o = t.globalData.setting,
  9 + os = o,
  10 + i = require("../../../utils/util.js"),
  11 + ut = i,
  12 + s = require("../../../utils/common.js"),
  13 + n = new e.default();
14 14 var regeneratorRuntime = require('../../../utils/runtime.js');
15 15 var api = require('../../../api/api.js');
16 16 var d = getApp().globalData;
17   -
  17 +
18 18 var full_screen = require('full_screen.js');
19 19  
20 20  
21 21 Page({
22   - data: {
23   - url: o.imghost,
24   - swiperimage: [{
25   - image: "/miniapp/images/title.png",
26   - nav_url: 0
27   - }],
28   - resourceUrl: o.resourceUrl,
29   - logo: o.appLogo,
30   - homeData: null,
31   - saleGoods: null,
32   - sale: {
33   - countTime: {
34   - hour: 0,
35   - minute: 0,
36   - second: 0
37   - },
38   - diffTime: 0,
39   - good: null,
40   - },
41   - timer: null,
42   - recommend: null,
43   - scrollTop: 0,
44   - currentPage: 1,
45   - banner: null,
46   -
47   - appdata: null,
48   - saleGoods: null, //秒杀数据
49   - pindGoods: null, //拼单数据
50   - newGoods: null, //新商品
51   - hotGoods: null, //hot商品
52   - preGoods: null, //预售商品
53   - //----控制是是否显示计时器---
54   - is_timer: 1,
55   - ishow: 0,
56   - //是不是显示自定义模板
57   - isTemplate: 0,
58   - template_arr: null,
59   - bgcolor_t: '',
60   -
61   - banner_index: 0,
62   - flash_index: 0,
63   - pt_index: 0,
64   -
65   - pt_timer_item: null,
66   - pt_timer_arr: null,
67   - pt_timer: null,
68   - pt_timer_active: 0,
69   - //看下商家是否开通会员权益
70   - is_boot: 0,
71   - gd_category: null,
72   - is_no_more: 0,
73   - max_sw_height: 0, //banner的最大高度
74   - is_disgraceful: 0, //是否显示新人广告
75   - new_image: "", //新人有礼弹窗图片
76   - new_nav: "", //新人页面跳转地址
77   - w_holiday_pop: 0,
78   -
79   - showHongbao: false,
80   - showHongbaoSmall: false,
81   - goodsGroupArr:[], //商品模块列表
82   - is_full_screen_show: 0, //全屏显示
83   - sec_show: 3, //倒计时的秒数
84   - full_ad: null, //全屏广告
85   - full_screen: 0, //全屏广告
86   - is_ok_h5: 0, //判断要不要显示关注二维码
87   - mb_banner:{},//首页广告
88   - container: null,
89   - is_retail_price:0,
90   - },
91   -
92   -
93   - onLoad: async function (tt) {
  22 + data: {
  23 + url: o.imghost,
  24 + swiperimage: [{
  25 + image: "/miniapp/images/title.png",
  26 + nav_url: 0
  27 + }],
  28 + resourceUrl: o.resourceUrl,
  29 + logo: o.appLogo,
  30 + homeData: null,
  31 + saleGoods: null,
  32 + sale: {
  33 + countTime: {
  34 + hour: 0,
  35 + minute: 0,
  36 + second: 0
  37 + },
  38 + diffTime: 0,
  39 + good: null,
  40 + },
  41 + timer: null,
  42 + recommend: null,
  43 + scrollTop: 0,
  44 + currentPage: 1,
  45 + banner: null,
  46 +
  47 + appdata: null,
  48 + saleGoods: null, //秒杀数据
  49 + pindGoods: null, //拼单数据
  50 + newGoods: null, //新商品
  51 + hotGoods: null, //hot商品
  52 + preGoods: null, //预售商品
  53 + //----控制是是否显示计时器---
  54 + is_timer: 1,
  55 + ishow: 0,
  56 + //是不是显示自定义模板
  57 + isTemplate: 0,
  58 + template_arr: null,
  59 + bgcolor_t: '',
  60 +
  61 + banner_index: 0,
  62 + flash_index: 0,
  63 + pt_index: 0,
  64 +
  65 + pt_timer_item: null,
  66 + pt_timer_arr: null,
  67 + pt_timer: null,
  68 + pt_timer_active: 0,
  69 + //看下商家是否开通会员权益
  70 + is_boot: 0,
  71 + gd_category: null,
  72 + is_no_more: 0,
  73 + max_sw_height: 0, //banner的最大高度
  74 + is_disgraceful: 0, //是否显示新人广告
  75 + new_image: "", //新人有礼弹窗图片
  76 + new_nav: "", //新人页面跳转地址
  77 + w_holiday_pop: 0,
  78 +
  79 + showHongbao: false,
  80 + showHongbaoSmall: false,
  81 + goodsGroupArr: [], //商品模块列表
  82 + is_full_screen_show: 0, //全屏显示
  83 + sec_show: 3, //倒计时的秒数
  84 + full_ad: null, //全屏广告
  85 + full_screen: 0, //全屏广告
  86 + is_ok_h5: 0, //判断要不要显示关注二维码
  87 + mb_banner: {},//首页广告
  88 + container: null,
  89 + is_retail_price: 0,
  90 + //满屏顶部导航参数------------
  91 + is_full_screen_navigation: false, //是否满屏
  92 + is_full_screen_navigation_index: -1, //广告轮播满屏下标
  93 + nav_title: '首页',
  94 + nav_frontColor: "#000",
  95 + old_nav_frontColor: "",
  96 + nav_backgroundColor: "#fff",
  97 + nav_type: 1, //导航类型
  98 + searchbox_transparent: 1, //搜索框背景是否透明
  99 + is_show_top:0, //是否置顶显示
  100 + // nav_but_color: '#32ACF9', //导航按钮颜色
  101 + // sele_pickup: null, //默认门店
  102 + // nav_bg_color:'#e823e8', //导航按钮颜色
  103 + //----------------
  104 + },
  105 +
  106 +
  107 + onLoad: async function (tt) {
94 108 wx.offCopyUrl()
95   - wx.showShareMenu({
96   - withShareTicket:true,
97   - menus:['shareAppMessage','shareTimeline']
98   - })
99   - var th = this;
  109 + wx.showShareMenu({
  110 + withShareTicket: true,
  111 + menus: ['shareAppMessage', 'shareTimeline']
  112 + })
  113 + var th = this;
100 114 var first_leader = tt.first_leader;
101   - //群id
102   - if(tt && tt.groupchat_id && tt.groupchat_id!='undefined' && tt.groupchat_id!='null'){
103   - getApp().globalData.groupchat_id=tt.groupchat_id
  115 + //群id
  116 + if (tt && tt.groupchat_id && tt.groupchat_id != 'undefined' && tt.groupchat_id != 'null') {
  117 + getApp().globalData.groupchat_id = tt.groupchat_id
104 118 }
105   - if (!first_leader && tt.scene) {
106   - var first_leader_str = decodeURIComponent(tt.scene);
107   - var f_arr = first_leader_str.split("_");
108   - first_leader = f_arr[0] && parseFloat(f_arr[0]) > 0 ? f_arr[0] : null;
109   - //注册门店
110   - if (f_arr[1] && parseFloat(f_arr[1]) > 0) {
111   - getApp().globalData.store_number = f_arr[1];
  119 + if (!first_leader && tt.scene) {
  120 + var first_leader_str = decodeURIComponent(tt.scene);
  121 + var f_arr = first_leader_str.split("_");
  122 + first_leader = f_arr[0] && parseFloat(f_arr[0]) > 0 ? f_arr[0] : null;
  123 + //注册门店
  124 + if (f_arr[1] && parseFloat(f_arr[1]) > 0) {
  125 + getApp().globalData.store_number = f_arr[1];
112 126 }
113 127 //企业微信群id
114   - if (f_arr[2] && parseFloat(f_arr[2]) > 0) {
115   - getApp().globalData.groupchat_id = f_arr[2];
  128 + if (f_arr[2] && parseFloat(f_arr[2]) > 0) {
  129 + getApp().globalData.groupchat_id = f_arr[2];
116 130 }
117   -
  131 +
118 132 }
119 133 // console.error('群id------------------------------------------');
120 134 // console.error(getApp().globalData.groupchat_id);
121 135 // console.error('群id------------------------------------------2222222222222222222222');
122 136 // getApp().globalData.groupchat_id=1
123   - console.log("first_leader:"+first_leader,"onload");
124   -
125   -
126   - getApp().getConfig(function (e) {
127   - //--首页的问题--
128   - if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) {
129   - wx.setNavigationBarTitle({
130   - title: getApp().globalData.config.store_name,
131   - });
132   - } else {
133   - wx.setNavigationBarTitle({
134   - title: getApp().globalData.setting.appName,
135   - });
136   - };
137   - });
138   -
139   -
140   - var th = this;
141   - getApp().getConfig2(function (config2) {
142   - var swithc_list = config2.switch_list;
143   - var sw_arr = JSON.parse(swithc_list);
144   - if(sw_arr.is_retail_price){
145   - th.setData({is_retail_price:1});
146   - }
147   -
148   - if (config2 && config2.is_overdue == 1) {
149   - getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => {
150   - var o = res;
151   - if (o.data.code == 0) {
152   - var ob = { isout: 0, isbuy: 1 };
153   - var arr = o.data.data.pageData;
154   - var isbuy = 0;
155   - //----如果数组不为空----
156   - if (arr.length > 0) {
157   - arr.forEach(function (val, ind) {
158   - if (val.is_sy == 0 && val.type == 5) {
159   - isbuy = 1;
160   - var now = ut.gettimestamp();
161   - if (now > val.end_time) ob.isout = 1;
162   - return false;
163   - }
164   - })
165   - }
166   - ob.isbuy = isbuy;
167   -
168   - var pages = getCurrentPages(); //获取加载的页面
169   - var currentPage = pages[pages.length - 1]; //获取当前页面的对象
170   -
171   - // console.log("当前路由");
172   - // console.log(currentPage.route);
173   -
174   -
175   - th.setappdata(ob);
176   -
177   - if (ob.isbuy && !ob.isout) {
178   - th.onload_init();
179   - }
180   - } else {
181   - th.onload_init();
182   - }
183   - })
184   - }
185   - else {
186   - th.onload_init();
187   - }
188   - })
189   -
190   - if (first_leader) {
191   - //-- user_id代过来免登录 --
192   - getApp().globalData.first_leader = first_leader;
193   - //调用接口判断是不是会员
194   - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
195   - if (res.data.code == 0) {
196   - getApp().globalData.guide_id = res.data.data.id;
197   - getApp().globalData.guide_pick_id= res.data.data.pickup_id
198   - }
199   - })
200   -
201   - if(!getApp().globalData.user_id){
202   - ut.new_user_go(os.stoid,first_leader);
203   - }
204   -
205   - }
206   -
207   - // 判断是否有红包活动
208   - getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, {
209   - data: {}
210   - }).then(function (data) {
  137 +
  138 + console.log("first_leader:" + first_leader, "onload");
  139 +
  140 +
  141 + getApp().getConfig(function (e) {
  142 + //--首页的问题--
  143 + if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) {
  144 + wx.setNavigationBarTitle({
  145 + title: getApp().globalData.config.store_name,
  146 + });
  147 + } else {
  148 + wx.setNavigationBarTitle({
  149 + title: getApp().globalData.setting.appName,
  150 + });
  151 + };
  152 + th.setData({
  153 + nav_title:getApp().globalData.config.store_name
  154 + })
  155 + });
  156 +
  157 +
  158 + var th = this;
  159 + getApp().getConfig2(function (config2) {
  160 + var swithc_list = config2.switch_list;
  161 + var sw_arr = JSON.parse(swithc_list);
  162 + if (sw_arr.is_retail_price) {
  163 + th.setData({ is_retail_price: 1 });
  164 + }
  165 +
  166 + if (config2 && config2.is_overdue == 1) {
  167 + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => {
  168 + var o = res;
  169 + if (o.data.code == 0) {
  170 + var ob = { isout: 0, isbuy: 1 };
  171 + var arr = o.data.data.pageData;
  172 + var isbuy = 0;
  173 + //----如果数组不为空----
  174 + if (arr.length > 0) {
  175 + arr.forEach(function (val, ind) {
  176 + if (val.is_sy == 0 && val.type == 5) {
  177 + isbuy = 1;
  178 + var now = ut.gettimestamp();
  179 + if (now > val.end_time) ob.isout = 1;
  180 + return false;
  181 + }
  182 + })
  183 + }
  184 + ob.isbuy = isbuy;
  185 +
  186 + var pages = getCurrentPages(); //获取加载的页面
  187 + var currentPage = pages[pages.length - 1]; //获取当前页面的对象
  188 +
  189 + // console.log("当前路由");
  190 + // console.log(currentPage.route);
  191 +
  192 +
  193 + th.setappdata(ob);
  194 +
  195 + if (ob.isbuy && !ob.isout) {
  196 + th.onload_init();
  197 + }
  198 + } else {
  199 + th.onload_init();
  200 + }
  201 + })
  202 + }
  203 + else {
  204 + th.onload_init();
  205 + }
  206 + })
  207 +
  208 + if (first_leader) {
  209 + //-- user_id代过来免登录 --
  210 + getApp().globalData.first_leader = first_leader;
  211 + //调用接口判断是不是会员
  212 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  213 + if (res.data.code == 0) {
  214 + getApp().globalData.guide_id = res.data.data.id;
  215 + getApp().globalData.guide_pick_id = res.data.data.pickup_id
  216 + }
  217 + })
  218 +
  219 + //先查看一下是不是系统会员
  220 + getApp().waitfor_login(()=> {
  221 + if (!getApp().globalData.user_id) {
  222 + ut.new_user_go(os.stoid, first_leader);
  223 + }
  224 + })
  225 +
  226 + }
  227 +
  228 + // 判断是否有红包活动
  229 + getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, {
  230 + data: {}
  231 + }).then(function (data) {
  232 +
211 233 let code = data.data.code;
212 234 let resdata = data.data.data;
213   - if (code == 0 && resdata.is_index) {
214   -
215   - th.setData({
216   - showHongbao: true,
217   - });
218   - } else if (code == -1) {
219   - th.setData({
220   - showHongbao: false,
221   - });
222   - };
223   - });
224   -
225   -
226   - // console.log(9090909);
227   - //看一下商家是否开通了权益
228   - //--初始化是否有打勾--
229   - getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
230   - data: {
231   - storeId: os.stoid
232   - }
233   - }).then(res => {
234   - if (res.data.data) {
235   - var is_init = res.data.data.isBool;
236   - th.setData({
237   - is_boot: is_init
238   - });
239   -
240   - if (!is_init) {
241   - th.setData({
242   - swiperimage: []
243   - });
244   - }
245   - }
246   - })
247   -
248   -
249   - var share_openid= tt.share_openid;
250   - if(share_openid){
251   - this.get_room_share_guide(share_openid);
252   - }
253   -
254   - //调用底部导航
255   - //getApp().globalData.url=th.data.url
256   - //t.editTabBar(th,o.stoid,th.data.url);
257   -
258   - },
259   -
260   -
261   - async get_room_share_guide(share_openid){
262   -
263   - var url="/api/weshop/users/page";
264   - var first_leader=0;
265   -
266   - //调用接口判断是不是会员
267   - await getApp().request.promiseGet(url, {
268   - data:{stoid:os.stoid,weapp_openid:share_openid}
269   - }).then(res => {
270   - if (ut.ajax_ok(res)) {
271   - first_leader=res.data.data.pageData[0].user_id;
272   - // getApp().globalData.guide_id = res.data.data.id;
273   - }
274   - })
275   - if(!first_leader) return false;
276   -
277   - getApp().globalData.first_leader = first_leader;
278   - //调用接口判断是不是会员
279   - await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
280   - if (res.data.code == 0) {
281   - getApp().globalData.guide_id = res.data.data.id;
282   - getApp().globalData.guide_pick_id= res.data.data.pickup_id
283   - }
284   - })
285   -
286   - },
287   -
288   -
289   - async onload_init() {
290   - var th = this;
291   - await this.init_load();
292   - //显示的时候要开启计时器
293   - this.data.is_timer = 1;
294   - //如果是自定义模板
295   - if (this.data.isTemplate) {
296   - //---先获取会员---
297   - //t.getUserFir(function () {
298   - if (getApp().globalData.user_id) {
299   - th.is_festival();
300   - var new_nav = th.data.new_nav;
301   - if (new_nav == "") {
302   - th.is_new();
303   - }
304   - // sty
305   - setTimeout(function () {
306   - if (getApp().globalData.user_id) getApp().requestCardNum(th);
307   - }, 500)
308   - }
309   -
310   - //});
311   - } else {
312   - await this.init_fir();
313   - wx.setNavigationBarColor({
314   - frontColor: '#ffffff', // 必写项
315   - backgroundColor: '#ff7295', // 必写项
316   - })
317   - }
318   -
319   - //--正再拼团中的处理--
320   - var url = "/api/weshop/order/pageTuanNew?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1"
321   - await getApp().request.promiseGet(url, {}).then(res => {
322   - if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
323   - th.data.pt_timer_arr = res.data.data.pageData;
324   - }
325   - })
326   - if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) {
327   - for (var i in th.data.pt_timer_arr) {
328   - var p_item = th.data.pt_timer_arr[i];
329   - await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {
330   - 1: 1
331   - }).then(res => {
332   - th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic;
333   - th.data.pt_timer_arr[i].nickname = res.data.data.nickname;
334   - })
335   - }
336   - th.Interval_pt();
337   - }
338   -
339   - //---处理正在6个分类----
340   - await getApp().request.promiseGet("/api/weshop/goodscategory/page", {
341   - data: {
342   - store_id: os.stoid,
343   - pageSize: 5,
344   - is_show: 1,
345   - level: 1
346   - }
347   - }).then(res => {
348   - if (res.data.data) {
349   - var gd_category = res.data.data.pageData;
350   - th.setData({
351   - gd_category: gd_category
352   - });
353   - }
354   - })
  235 + if (code == 0 && resdata.is_index) {
  236 +
  237 + th.setData({
  238 + showHongbao: true,
  239 + });
  240 + } else if (code == -1) {
  241 + th.setData({
  242 + showHongbao: false,
  243 + });
  244 + };
  245 + });
  246 +
  247 +
  248 + // console.log(9090909);
  249 + //看一下商家是否开通了权益
  250 + //--初始化是否有打勾--
  251 + getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
  252 + data: {
  253 + storeId: os.stoid
  254 + }
  255 + }).then(res => {
  256 + if (res.data.data) {
  257 + var is_init = res.data.data.isBool;
  258 + th.setData({
  259 + is_boot: is_init
  260 + });
  261 +
  262 + if (!is_init) {
  263 + th.setData({
  264 + swiperimage: []
  265 + });
  266 + }
  267 + }
  268 + })
  269 +
  270 +
  271 + var share_openid = tt.share_openid;
  272 + if (share_openid) {
  273 + this.get_room_share_guide(share_openid);
  274 + }
  275 +
  276 + //调用底部导航
  277 + //getApp().globalData.url=th.data.url
  278 + //t.editTabBar(th,o.stoid,th.data.url);
  279 +
355 280 },
356   - onReady(){
  281 +
  282 +
  283 + async get_room_share_guide(share_openid) {
  284 +
  285 + var url = "/api/weshop/users/page";
  286 + var first_leader = 0;
  287 +
  288 + //调用接口判断是不是会员
  289 + await getApp().request.promiseGet(url, {
  290 + data: { stoid: os.stoid, weapp_openid: share_openid }
  291 + }).then(res => {
  292 + if (ut.ajax_ok(res)) {
  293 + first_leader = res.data.data.pageData[0].user_id;
  294 + // getApp().globalData.guide_id = res.data.data.id;
  295 + }
  296 + })
  297 + if (!first_leader) return false;
  298 +
  299 + getApp().globalData.first_leader = first_leader;
  300 + //调用接口判断是不是会员
  301 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  302 + if (res.data.code == 0) {
  303 + getApp().globalData.guide_id = res.data.data.id;
  304 + getApp().globalData.guide_pick_id = res.data.data.pickup_id
  305 + }
  306 + })
  307 +
  308 + },
  309 +
  310 +
  311 + async onload_init() {
  312 + var th = this;
  313 + //显示的时候要开启计时器
  314 + this.data.is_timer = 1;
  315 +
  316 + //先查看一下是不是系统会员,要等一下会员默认登录
  317 + getApp().waitfor_login(async ()=> {
  318 + await this.init_load();
  319 + //如果是自定义模板
  320 + if (this.data.isTemplate) {
  321 + //---先获取会员---
  322 + //t.getUserFir(function () {
  323 + if (getApp().globalData.user_id) {
  324 + th.is_festival();
  325 + var new_nav = th.data.new_nav;
  326 + if (new_nav == "") {
  327 + th.is_new();
  328 + }
  329 + // sty
  330 + setTimeout(function () {
  331 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  332 + }, 500)
  333 + }
  334 +
  335 + //});
  336 + } else {
  337 + await this.init_fir();
  338 + wx.setNavigationBarColor({
  339 + frontColor: '#ffffff', // 必写项
  340 + backgroundColor: '#ff7295', // 必写项
  341 + })
  342 + this.setData({
  343 + nav_frontColor: '#000', // 必写项
  344 + nav_backgroundColor: '#fff', // 必写项
  345 + })
  346 + }
  347 + })
  348 +
  349 + //--正再拼团中的处理--
  350 + var url = "/api/weshop/order/pageTuanNew?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1"
  351 + await getApp().request.promiseGet(url, {}).then(res => {
  352 + if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
  353 + th.data.pt_timer_arr = res.data.data.pageData;
  354 + }
  355 + })
  356 + if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) {
  357 + for (var i in th.data.pt_timer_arr) {
  358 + var p_item = th.data.pt_timer_arr[i];
  359 + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {
  360 + 1: 1
  361 + }).then(res => {
  362 + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic;
  363 + th.data.pt_timer_arr[i].nickname = res.data.data.nickname;
  364 + })
  365 + }
  366 + th.Interval_pt();
  367 + }
  368 +
  369 + //---处理正在6个分类----
  370 + await getApp().request.promiseGet("/api/weshop/goodscategory/page", {
  371 + data: {
  372 + store_id: os.stoid,
  373 + pageSize: 5,
  374 + is_show: 1,
  375 + level: 1
  376 + }
  377 + }).then(res => {
  378 + if (res.data.data) {
  379 + var gd_category = res.data.data.pageData;
  380 + th.setData({
  381 + gd_category: gd_category
  382 + });
  383 + }
  384 + })
  385 + },
  386 + onReady() {
357 387 console.log('渲染完成----')
358 388 console.log(this.data.template_arr);
359 389 console.log('....................');
360 390 },
361 391  
362 392 //获取商品模块实例
363   - newGoodsGroup(){
364   - let arr=[]
  393 + newGoodsGroup() {
  394 + let arr = []
365 395 if (this.data.template_arr.length == 0) {
366 396 return
367 397 }
368   - this.data.template_arr.map((item,index)=>{
  398 + this.data.template_arr.map((item, index) => {
369 399 if (item.ename == 'goodsGroup') {
370 400 arr.push(`goodsGroup${index}`)
371 401 }
372 402 })
373 403 if (arr.length > 0) {
374 404 this.setData({
375   - goodsGroupArr : arr
  405 + goodsGroupArr: arr
376 406 })
377   - arr.map(item=>{
378   - let a = '.'+item
  407 + arr.map(item => {
  408 + let a = '.' + item
379 409 this[item] = this.selectComponent(a);
380 410 })
381 411 }
382 412 },
383 413  
384   - //关闭新用户领取广告
385   - close_disgraceful: function () {
386   - var th = this;
387   - th.setData({
388   - is_disgraceful: 0
389   - })
390   - },
391   -
392   - async onShow() {
393   -
394   - //-- 看一下隐私政策要不要显示 --
395   - var privacy_pop = this.selectComponent("#privacy_pop"); //组件的id
396   - if (privacy_pop) {
397   - privacy_pop.check_pri_show();
398   - }
399   -
400   - getApp().check_can_share();
401   - if (typeof this.getTabBar === 'function' && this.getTabBar()) {
402   - this.getTabBar().setData({
403   - cartGoodsNum: getApp().globalData.cartGoodsNum
404   - })
405   - }
406   - var th = this;
407   - //-- 登录回来判断弹框 --
408   - var user_id = getApp().globalData.user_id;
409   -
410   - if (!user_id) {
411   - var userinfo = wx.getStorageSync('userinfo');
412   - if (userinfo) user_id = userinfo.user_id
413   - }
414   -
415   - if (user_id) {
416   - th.is_festival();
417   - var new_nav = th.data.new_nav;
418   - if (new_nav == "") {
419   - th.is_new();
420   - }
421   - }
422   -
423   - console.log(this.data.isTemplate, '首页');
424   -
425   - if (!this.data.isTemplate) {
426   - //timetype: 1 仅查询已预售 置空查询全部,
427   - var pre_data = { store_id: os.stoid, is_end: 0, isuse: 1,timetype:3 };
428   - if (user_id) {
429   - pre_data.user_id = user_id;
430   - }
431   -
432   - getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {
433   - data: pre_data,
434   - success: function (e) {
435   - if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
436   - var pre_data = e.data.data.pageData;
  414 + //关闭新用户领取广告
  415 + close_disgraceful: function () {
  416 + var th = this;
  417 + th.setData({
  418 + is_disgraceful: 0
  419 + })
  420 + },
  421 +
  422 + async onShow() {
  423 +
  424 + //-- 看一下隐私政策要不要显示 --
  425 + var privacy_pop = this.selectComponent("#privacy_pop"); //组件的id
  426 + if (privacy_pop) {
  427 + privacy_pop.check_pri_show();
  428 + }
  429 + var th = this;
  430 +
  431 +
  432 + //要等一下会员默认登录
  433 + getApp().waitfor_login(async ()=> {
  434 +
  435 + getApp().check_can_share();
  436 + if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  437 + this.getTabBar().setData({
  438 + cartGoodsNum: getApp().globalData.cartGoodsNum
  439 + })
  440 + }
  441 +
  442 + //-- 登录回来判断弹框 --
  443 + var user_id = getApp().globalData.user_id;
  444 +
  445 + if (!user_id) {
  446 + var userinfo = wx.getStorageSync('userinfo');
  447 + if (userinfo) user_id = userinfo.user_id
  448 + }
  449 +
  450 + if (user_id) {
  451 + th.is_festival();
  452 + var new_nav = th.data.new_nav;
  453 + if (new_nav == "") {
  454 + th.is_new();
  455 + }
  456 + }
  457 +
  458 + console.log(this.data.isTemplate, '首页');
  459 +
  460 + if (!this.data.isTemplate) {
  461 + //timetype: 1 仅查询已预售 置空查询全部,
  462 + var pre_data = {store_id: os.stoid, is_end: 0, isuse: 1, timetype: 3};
  463 + if (user_id) {
  464 + pre_data.user_id = user_id;
  465 + }
  466 +
  467 + getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {
  468 + data: pre_data,
  469 + success: function (e) {
  470 + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
  471 + var pre_data = e.data.data.pageData;
  472 + //当前时间戳
  473 + var st = ut.gettimestamp();
  474 +
  475 + pre_data.forEach(function (val, ind) {
  476 +
  477 + if (val.user_price) val.price = val.user_price;
  478 + if (val.start_time > st) {
  479 + pre_data[ind].status = 0;
  480 + } else if (val.end_time > st) {
  481 + pre_data[ind].status = 1;
  482 + } else {
  483 + pre_data[ind].status = 2;
  484 + }
  485 +
  486 + // if (val.buy_num >= val.goods_num) {
  487 + // pre_data[ind].status = 2;
  488 + // }
  489 + });
  490 + var arr = new Array();
  491 + //--三个三个一组---
  492 + for (var i = 0; i < pre_data.length; i += 3) {
  493 + arr.push(pre_data.slice(i, i + 3));
  494 + }
  495 + th.setData({
  496 + preGoods: arr
  497 + });
  498 + } else {
  499 + th.setData({
  500 + preGoods: null
  501 + });
  502 + }
  503 + }
  504 + })
  505 +
  506 + // 获取幸运购活动列表
  507 + getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', {
  508 + data: {
  509 + store_id: getApp().globalData.setting.stoid,
  510 + is_end: 0,
  511 + timetype: 1,
  512 + }
  513 + }).then(res => {
  514 + if (res.data.code == 0) {
  515 + th.setData({
  516 + luckGo_list: res.data.data.pageData.slice(0, 3),
  517 + });
  518 + }
  519 + });
  520 +
  521 + //-----秒杀-----
  522 + var flash_data = null;
  523 + var f_req = {
  524 + store_id: os.stoid,
  525 + timetype: 2,
  526 + is_end: 0,
  527 + is_show: 1,
  528 + pageSize: 9,
  529 + user_id: 0
  530 + };
  531 + if (user_id) f_req.user_id = user_id;
  532 + //--获取活动--
  533 + await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
  534 + data: f_req,
  535 + }).then(res => {
  536 + var e = res;
  537 + if (e.data.code == 0) {
  538 + flash_data = e.data.data.pageData;
  539 + if (flash_data == null || flash_data.length <= 0) return false;
  540 +
437 541 //当前时间戳
438   - var st = ut.gettimestamp();
  542 + var nt = ut.gettimestamp();
439 543  
440   - pre_data.forEach(function (val, ind) {
  544 + flash_data.forEach(function (val, ind) {
441 545  
442 546 if (val.user_price) val.price = val.user_price;
443   - if (val.start_time > st) {
444   - pre_data[ind].status = 0;
445   - } else if (val.end_time > st) {
446   - pre_data[ind].status = 1;
447   - } else {
448   - pre_data[ind].status = 2;
  547 + if (val.start_time > nt) {
  548 + flash_data[ind].status = 0;
  549 + } else if (val.end_time > nt) {
  550 + flash_data[ind].status = 1;
  551 + }
  552 +
  553 + if (val.buy_num >= val.goods_num) {
  554 + flash_data[ind].status = 2;
  555 + }
  556 + });
  557 +
  558 + var promisies = [];
  559 + for (const key in flash_data) {
  560 + if (Object.hasOwnProperty.call(flash_data, key)) {
  561 + const val = flash_data[key];
  562 + promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  563 + os.stoid + "/1/" + val.id,
  564 + {}
  565 + ).then(res => {
  566 + if (res.data.code == 0) {
  567 + if (res.data.data <= 0) flash_data[key].status = 2;
  568 + }
  569 + ;
  570 + });
  571 + }
  572 + }
  573 +
  574 + Promise.all(promisies).then(() => {
  575 + var arr = new Array();
  576 + //--三个三个一组---
  577 + for (var i = 0; i < flash_data.length; i += 3) {
  578 + arr.push(flash_data.slice(i, i + 3));
449 579 }
450 580  
451   - // if (val.buy_num >= val.goods_num) {
452   - // pre_data[ind].status = 2;
453   - // }
  581 + th.setData({
  582 + saleGoods: arr
  583 + });
454 584 });
455   - var arr = new Array();
456   - //--三个三个一组---
457   - for (var i = 0; i < pre_data.length; i += 3) {
458   - arr.push(pre_data.slice(i, i + 3));
459   - }
460   - th.setData({
461   - preGoods: arr
462   - });
463   - } else {
464   - th.setData({
465   - preGoods: null
466   - });
467   - }
468   - }
469   - })
470   -
471   - // 获取幸运购活动列表
472   - getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', {
473   - data: {
474   - store_id: getApp().globalData.setting.stoid,
475   - is_end: 0,
476   - timetype: 1,
477   - }
478   - }).then(res => {
479   - if (res.data.code == 0) {
480   - th.setData({
481   - luckGo_list: res.data.data.pageData.slice(0, 3),
482   - });
483   - }
484   - });
485   -
486   - //-----秒杀-----
487   - var flash_data = null;
488   - var f_req = {
489   - store_id: os.stoid,
490   - timetype: 2,
491   - is_end: 0,
492   - is_show: 1,
493   - pageSize: 9,
494   - user_id: 0
495   - };
496   - if (user_id) f_req.user_id = user_id;
497   - //--获取活动--
498   - await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
499   - data: f_req,
500   - }).then(res => {
501   - var e = res;
502   - if (e.data.code == 0) {
503   - flash_data = e.data.data.pageData;
504   - if (flash_data == null || flash_data.length <= 0) return false;
505   -
506   - //当前时间戳
507   - var nt = ut.gettimestamp();
508   -
509   - flash_data.forEach(function (val, ind) {
510   -
511   - if (val.user_price) val.price = val.user_price;
512   - if (val.start_time > nt) {
513   - flash_data[ind].status = 0;
514   - } else if (val.end_time > nt) {
515   - flash_data[ind].status = 1;
516   - }
517   -
518   - if (val.buy_num >= val.goods_num) {
519   - flash_data[ind].status = 2;
520   - }
521   - });
522   -
523   - var promisies = [];
524   - for (const key in flash_data) {
525   - if (Object.hasOwnProperty.call(flash_data, key)) {
526   - const val = flash_data[key];
527   - promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
528   - os.stoid + "/1/" + val.id,
529   - {}
530   - ).then(res => {
531   - if (res.data.code == 0) {
532   - if (res.data.data <= 0) flash_data[key].status = 2;
533   - };
534   - });
535   - }
536   - }
537   -
538   - Promise.all(promisies).then(() => {
539   - var arr = new Array();
540   - //--三个三个一组---
541   - for (var i = 0; i < flash_data.length; i += 3) {
542   - arr.push(flash_data.slice(i, i + 3));
543   - }
544   -
545   - th.setData({
546   - saleGoods: arr
547   - });
548   - });
549   -
550   -
551   -
552   - }
553   - });
554   -
555   - }
556   -
557   -
558   -
559   -
560   -
561   -
562   -
563   -
564   -
565   - //优惠券要实时更新
566   - getApp().getConfig2(function (e) {
567   - var json_d = JSON.parse(e.switch_list);
568   - th.setData({ is_closecoupon: json_d.is_closecoupon })
569   - th.setData({ is_topstore: json_d.is_show_storeselect })
570   - if (json_d.is_gz_h5) th.setData({ is_gz_h5: json_d.is_gz_h5 })
571   - }, 1)
572   -
573   - if (typeof this.getTabBar === 'function' && this.getTabBar()) {
574   - var index = getApp().getPageIndex(this);
575   - this.getTabBar().setData({
576   - active: index //数字是当前页面在tabbar的索引
577   - })
578   -
579   -
580   - getApp().requestCardNum(this);
581   - }
582   -
583   - var th = this;
584   -
585   - var show = getApp().globalData.isLoad_ad;
586   -
587   - if (!show) {
588   - setTimeout(function () {
589   - full_screen.get_the_full_screen(th);
590   - }, 800);
591   - getApp().globalData.isLoad_ad = 1;
592   - if (!th.data.f_hidden) {
593   - setTimeout(function () {
594   - th.setData({ f_hidden: 1 })
595   - wx.hideLoading();
596   - }, 960)
597   - }
598   - } else {
599   - th.setData({ f_hidden: 1 })
600   - }
601   -
602   - setTimeout(function () {
603   - const query = wx.createSelectorQuery();
604   - query.select('#off_top').boundingClientRect();
605   - query.exec((res) => {
606   - if (res && res[0] && res[0].height > 0) {
607   - th.setData({ is_ok_h5: 1 });
608   - }
609   - })
610   - }, 3600);
611   -
612   - },
613   - //当隐藏的时候就关闭计时器
614   - onHide: function () {
615   - this.data.is_timer = 0;
616   - if (this.data.pt_timer) clearInterval(this.data.pt_timer);
617   - if (this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop);
618   - if (this.data.full_screen) clearInterval(this.data.full_screen);
619   - this.data.w_holiday_pop = 0;
620   -
621   - },
622   -
623   - //同步初始加载
624   - async init_load() {
625   - var th = this;
626   - //因为营销版本的功能包含了自定义模板的功能,是同时的
627   - //读取全局是否有弄自定义模板
628   - await api.get_template_fir(o.stoid).then(res => {
629   - var data = res.data.data;
630   - if (data && data.length > 0) {
631   - var temp_data = data[0];
632   - var t_arr = JSON.parse(temp_data.json_str);
633   - console.log('商品列表------------1')
634   - console.log(t_arr)
635   - console.log('商品列表------------2')
636   - th.setData({
637   - template_arr: t_arr,
638   - isTemplate: 1,
639   - bgcolor_t: temp_data.bkcolor
  585 +
  586 +
  587 + }
  588 + });
  589 +
  590 + }
  591 +
  592 + })
  593 +
  594 +
  595 +
  596 +
  597 + //优惠券要实时更新
  598 + getApp().getConfig2(function (e) {
  599 + var json_d = JSON.parse(e.switch_list);
  600 + th.setData({ is_closecoupon: json_d.is_closecoupon })
  601 + th.setData({ is_topstore: json_d.is_show_storeselect })
  602 + if (json_d.is_gz_h5) th.setData({ is_gz_h5: json_d.is_gz_h5 })
  603 + }, 1)
  604 +
  605 + if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  606 + var index = getApp().getPageIndex(this);
  607 + this.getTabBar().setData({
  608 + active: index //数字是当前页面在tabbar的索引
  609 + })
  610 +
  611 +
  612 + getApp().requestCardNum(this);
  613 + }
  614 +
  615 + var th = this;
  616 +
  617 + var show = getApp().globalData.isLoad_ad;
  618 +
  619 + if (!show) {
  620 + setTimeout(function () {
  621 + full_screen.get_the_full_screen(th);
  622 + }, 800);
  623 + getApp().globalData.isLoad_ad = 1;
  624 + if (!th.data.f_hidden) {
  625 + setTimeout(function () {
  626 + th.setData({ f_hidden: 1 })
  627 + wx.hideLoading();
  628 + }, 960)
  629 + }
  630 + } else {
  631 + th.setData({ f_hidden: 1 })
  632 + }
  633 +
  634 + setTimeout(function () {
  635 + const query = wx.createSelectorQuery();
  636 + query.select('#off_top').boundingClientRect();
  637 + query.exec((res) => {
  638 + if (res && res[0] && res[0].height > 0) {
  639 + th.setData({ is_ok_h5: 1 });
  640 + }
  641 + })
  642 + }, 3600);
  643 +
  644 + },
  645 + //当隐藏的时候就关闭计时器
  646 + onHide: function () {
  647 + this.data.is_timer = 0;
  648 + if (this.data.pt_timer) clearInterval(this.data.pt_timer);
  649 + if (this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop);
  650 + if (this.data.full_screen) clearInterval(this.data.full_screen);
  651 + this.data.w_holiday_pop = 0;
  652 +
  653 + },
  654 +
  655 + //同步初始加载
  656 + async init_load() {
  657 + var th = this;
  658 + //因为营销版本的功能包含了自定义模板的功能,是同时的
  659 + //读取全局是否有弄自定义模板
  660 + await api.get_template_fir(o.stoid).then(res => {
  661 + var data = res.data.data;
  662 + if (data && data.length > 0) {
  663 + var temp_data = data[0];
  664 + var t_arr = JSON.parse(temp_data.json_str);
  665 +
  666 + //增加判断是否是满屏
  667 + let is_full_screen_navigation = false
  668 + let is_full_screen_navigation_index = -1
  669 + let nav_but_color = "#32ACF9"
  670 + let left_arr = [] //左边悬浮
  671 + let right_arr=[] //右边悬浮
  672 + let floatw=null //悬浮窗口
  673 + if (t_arr) {
  674 + t_arr.map((item, index) => {
  675 + if (item && item.content && item.content.full_screen == 1 && !is_full_screen_navigation) {
  676 + is_full_screen_navigation = true
  677 + is_full_screen_navigation_index = index
  678 + try {
  679 + nav_but_color = item.content.data[0].but_color
  680 + } catch (error) { }
  681 + }
  682 + if (item.ename=='floatingWindow') {
  683 + floatw = item
  684 + }
  685 + if (item.ename=='backTop' || item.ename=='onlineService' || item.ename=='scan' || item.ename=='floatingWindow') {
  686 + right_arr.push(item)
  687 + }
  688 + })
  689 + }
  690 + if (floatw && floatw.content) {
  691 + let fi = right_arr.findIndex(ite=>ite.ename=='floatingWindow')
  692 + let datas={}
  693 + if (!floatw.content.data) { //兼容旧的悬浮窗口
  694 + datas.AppId= floatw.content.AppId
  695 + datas.feedId= floatw.content.feedId
  696 + datas.finderUserName= floatw.content.finderUserName
  697 + datas.img=floatw.content.img
  698 + datas.video_type= floatw.content.video_type
  699 + datas.wxapp_url= floatw.content.wxapp_url
  700 + datas.wxapp_url_title=floatw.content.wxapp_url_title
  701 + floatw.content.data=[datas]
  702 + }
  703 + if (floatw.content.loaction_index==1) {
  704 + right_arr.splice(fi,1,floatw)
  705 + // right_arr.unshift(floatw)
  706 + }else{
  707 + left_arr.unshift(floatw)
  708 + right_arr.splice(fi,1)
  709 + }
  710 + }
  711 + if (left_arr.length>0) {
  712 + let obj={
  713 + ename:'floatingBox',
  714 + content:left_arr,
  715 + loaction_index:0
  716 + }
  717 + t_arr.push(obj)
  718 + }
  719 + if (right_arr.length>0) {
  720 + let obj={
  721 + ename:'floatingBox',
  722 + content:right_arr,
  723 + loaction_index:1
  724 + }
  725 + t_arr.push(obj)
  726 + }
  727 +
  728 +
  729 + th.setData({
  730 + nav_but_color,
  731 + is_full_screen_navigation,
  732 + is_full_screen_navigation_index,
  733 + template_arr: t_arr,
  734 + isTemplate: 1,
  735 + bgcolor_t: temp_data.bkcolor
640 736 });
641   - setTimeout(()=>{
  737 + setTimeout(() => {
642 738 th.newGoodsGroup()
643   - },1000)
644   - //---如果有设定顶部的颜色的时候--
645   - if (temp_data.top_color && temp_data.top_color != 'null') {
646   -
647   - var top_w_color = "#ffffff";
648   - if (temp_data.top_word_color && temp_data.top_word_color == 'black') {
649   - top_w_color = "#000000";
650   - }
651   - wx.setNavigationBarColor({
652   - frontColor: top_w_color, // 必写项
653   - backgroundColor: temp_data.top_color, // 必写项
654   - })
655   - }
656   - }
657   - })
658   -
659   -
660   - },
661   - //---读取数据内容---
662   - async init_fir() {
663   - console.log('init_fir');
664   - var th = this;
665   - //----广告----
666   - var e = this;
667   - await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, {
668   - data: {
669   - enabled: 1
670   - }
671   - }).then(res => {
672   -
673   - if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) {
674   - var a = res.data.data.pageData;
675   - var arr = new Array();
676   - for (var i = 0; i < a.length; i++) {
677   - var tt = {
678   - 'ad_code': o.imghost + a[i].ad_code,
679   - 'media_link': '',
680   - 'ad_weapplink': a[i].ad_weapplink
681   - };
682   - arr.push(tt);
683   - }
684   - if (arr.length > 0) e.setData({
685   - banner: arr,
686   - });
687   -
688   - wx.stopPullDownRefresh();
689   - }
690   - })
691   - let user_id = getApp().globalData.user_id;
  739 + }, 1000)
  740 + //---如果有设定顶部的颜色的时候--
  741 + if (temp_data.top_color && temp_data.top_color != 'null') {
  742 +
  743 + var top_w_color = "#ffffff";
  744 + if (temp_data.top_word_color && temp_data.top_word_color == 'black') {
  745 + top_w_color = "#000000";
  746 + }
  747 + wx.setNavigationBarColor({
  748 + frontColor: top_w_color, // 必写项
  749 + backgroundColor: temp_data.top_color, // 必写项
  750 + })
  751 + th.setData({
  752 + nav_frontColor: top_w_color, // 必写项
  753 + nav_backgroundColor: temp_data.top_color, // 必写项
  754 + })
  755 + }
  756 + }
  757 + })
  758 +
  759 +
  760 + },
  761 + //---读取数据内容---
  762 + async init_fir() {
  763 + console.log('init_fir');
  764 + var th = this;
  765 + //----广告----
  766 + var e = this;
  767 + await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, {
  768 + data: {
  769 + enabled: 1
  770 + }
  771 + }).then(res => {
  772 +
  773 + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) {
  774 + var a = res.data.data.pageData;
  775 + var arr = new Array();
  776 + for (var i = 0; i < a.length; i++) {
  777 + var tt = {
  778 + 'ad_code': o.imghost + a[i].ad_code,
  779 + 'media_link': '',
  780 + 'ad_weapplink': a[i].ad_weapplink
  781 + };
  782 + arr.push(tt);
  783 + }
  784 + if (arr.length > 0) e.setData({
  785 + banner: arr,
  786 + });
  787 +
  788 + wx.stopPullDownRefresh();
  789 + }
  790 + })
  791 + let user_id = getApp().globalData.user_id;
692 792  
693 793 //---首页广告-------
694 794 await getApp().request.promiseGet("/api/weshop/ad/page?pids=300,301,302,303,304&store_id=" + o.stoid, {
695   - data: {
696   - enabled: 1
697   - }
698   - }).then(res => {
  795 + data: {
  796 + enabled: 1
  797 + }
  798 + }).then(res => {
699 799 console.log('首页广告--------------------------');
700 800 console.log(res);
701   - if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) {
702   - var a = res.data.data.pageData;
703   - var obj = {};
704   - for (var i = 0; i < a.length; i++) {
705   - var tt = {
706   - 'ad_code': o.imghost + a[i].ad_code,
707   - 'media_link': '',
  801 + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) {
  802 + var a = res.data.data.pageData;
  803 + var obj = {};
  804 + for (var i = 0; i < a.length; i++) {
  805 + var tt = {
  806 + 'ad_code': o.imghost + a[i].ad_code,
  807 + 'media_link': '',
708 808 'ad_weapplink': a[i].ad_weapplink,
709   - 'pid':a[i].pid
710   - };
  809 + 'pid': a[i].pid
  810 + };
711 811 // arr.push(tt);
712   - obj[a[i].pid]=tt
713   - }
714   - if (a.length > 0) e.setData({
715   - mb_banner: obj,
716   - });
717   -
718   - wx.stopPullDownRefresh();
719   - }
720   - })
721   -
722   -
723   - //----拼单-----
724   - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
725   - data: {
726   - store_id: os.stoid,
727   - is_end: 0,
728   - is_show: 1,
729   - pageSize: 6,
730   - user_id,
731   - }
732   - }).then(res => {
733   - var e = res;
734   - if (e.data.code == 0) {
735   - var pd_data = e.data.data.pageData;
736   -
737   - if (pd_data.length == 0) return;
738   -
739   - //获取当前
740   - var nt = ut.gettimestamp();
741   - pd_data.forEach(function (val, ind) {
742   - if (val.start_time > nt) pd_data[ind].status = 0;
743   - else if (val.end_time > nt) pd_data[ind].status = 1;
744   - if (val.buy_num >= val.goods_num) pd_data[ind].status = 2;
745   - });
746   -
747   - //获取当前时间,比较拼团中还在未开始
748   - var timestamp = new Date().getTime();
749   - var is_team_tepy;
750   - for (var j = 0; j < pd_data.length; j++) {
751   - pd_data[j].is_team_tepy = 1;
752   - if (timestamp < pd_data[j].start_time * 1000) {
753   - var is_team_tepy;
754   - pd_data[j].is_team_tepy = 0;
755   - }
756   - }
757   -
758   - var arr = new Array();
759   - //--2个2个一组---
760   - for (var i = 0; i < pd_data.length; i += 2) {
761   -
762   - arr.push(pd_data.slice(i, i + 2));
763   - }
764   -
765   - th.setData({
766   - pindGoods: arr
767   - });
768   - th.countDown2();
769   - }
770   - })
771   -
772   - //------新品-------
773   - await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
774   - data: {
775   - is_mainshow: 1,
776   - isonsale: 1,
777   - is_on_sale: 1,
778   - store_id: o.stoid,
779   - pageSize: 9,
780   - is_new: 1,
781   - orderField: "sort"
782   - }
783   - }).then(res => {
784   - var e = res;
785   - if (e.data.code == 0) {
786   - var new_data = e.data.data.pageData;
787   - var arr = new Array();
788   - //--三个三个一组---
789   - for (var i = 0; i < new_data.length; i += 3) {
790   - arr.push(new_data.slice(i, i + 3));
791   - }
792   - th.setData({
793   - newGoods: arr,
794   - });
795   - }
796   - })
797   -
798   - //------热卖-------
799   - await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
800   - data: {
801   - is_mainshow: 1,
802   - isonsale: 1,
803   - is_on_sale: 1,
804   - store_id: o.stoid,
805   - pageSize: 9,
806   - is_hot: 1,
807   - orderField: "sort"
808   - }
809   - }).then(res => {
810   - var e = res;
811   - if (e.data.code == 0) {
812   - var new_data = e.data.data.pageData;
813   - var arr = new Array();
814   - //--三个三个一组---
815   - for (var i = 0; i < new_data.length; i += 3) {
816   - arr.push(new_data.slice(i, i + 3));
817   - }
818   - console.log(arr);
819   - th.setData({
820   - hotGoods: arr,
821   - });
822   - }
823   - })
824   -
825   - //---调用信息---
826   - // this.requestRecommend();
827   - this.setData({
828   - ishow: 1
829   - });
830   -
831   - //---先获取会员---
832   - //t.getUserFir(function () {
833   - if (getApp().globalData.user_id) {
834   - th.is_festival();
835   - var new_nav = th.data.new_nav;
836   - if (new_nav == "") {
837   - th.is_new();
838   - }
839   -
840   - // sty
841   - setTimeout(function () {
842   - if (getApp().globalData.user_id) getApp().requestCardNum(th);
843   - }, 500)
844   - }
845   - //});
846   -
847   - setTimeout(function () {
848   - var goods_list = th.selectComponent("#goods_list"); //组件的id
849   - goods_list.init();
850   - goods_list.get_list();
851   - }, 2000)
852   - },
853   -
854   - //--判断小程序是否过期--
855   - setappdata: function (t) {
856   - if (t && t.isout == 1)
857   - wx.reLaunch({
858   - url: "/packageD/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel,
859   - });
860   - if (t && t.isbuy == 0)
861   - wx.reLaunch({
862   - url: "/packageD/pages/error/error?msg=还未购买小程序",
863   - });
864   - },
865   - //---加载更多是靠这个函数----
866   - onReachBottom: function () {
  812 + obj[a[i].pid] = tt
  813 + }
  814 + if (a.length > 0) e.setData({
  815 + mb_banner: obj,
  816 + });
  817 +
  818 + wx.stopPullDownRefresh();
  819 + }
  820 + })
  821 +
  822 +
  823 + //----拼单-----
  824 + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
  825 + data: {
  826 + store_id: os.stoid,
  827 + is_end: 0,
  828 + is_show: 1,
  829 + pageSize: 6,
  830 + user_id,
  831 + }
  832 + }).then(res => {
  833 + var e = res;
  834 + if (e.data.code == 0) {
  835 + var pd_data = e.data.data.pageData;
  836 +
  837 + if (pd_data.length == 0) return;
  838 +
  839 + //获取当前
  840 + var nt = ut.gettimestamp();
  841 + pd_data.forEach(function (val, ind) {
  842 + if (val.start_time > nt) pd_data[ind].status = 0;
  843 + else if (val.end_time > nt) pd_data[ind].status = 1;
  844 + if (val.buy_num >= val.goods_num) pd_data[ind].status = 2;
  845 + });
  846 +
  847 + //获取当前时间,比较拼团中还在未开始
  848 + var timestamp = new Date().getTime();
  849 + var is_team_tepy;
  850 + for (var j = 0; j < pd_data.length; j++) {
  851 + pd_data[j].is_team_tepy = 1;
  852 + if (timestamp < pd_data[j].start_time * 1000) {
  853 + var is_team_tepy;
  854 + pd_data[j].is_team_tepy = 0;
  855 + }
  856 + }
  857 +
  858 + var arr = new Array();
  859 + //--2个2个一组---
  860 + for (var i = 0; i < pd_data.length; i += 2) {
  861 +
  862 + arr.push(pd_data.slice(i, i + 2));
  863 + }
  864 +
  865 + th.setData({
  866 + pindGoods: arr
  867 + });
  868 + th.countDown2();
  869 + }
  870 + })
  871 +
  872 + //------新品-------
  873 + await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
  874 + data: {
  875 + is_mainshow: 1,
  876 + isonsale: 1,
  877 + is_on_sale: 1,
  878 + store_id: o.stoid,
  879 + pageSize: 9,
  880 + is_new: 1,
  881 + orderField: "sort"
  882 + }
  883 + }).then(res => {
  884 + var e = res;
  885 + if (e.data.code == 0) {
  886 + var new_data = e.data.data.pageData;
  887 + var arr = new Array();
  888 + //--三个三个一组---
  889 + for (var i = 0; i < new_data.length; i += 3) {
  890 + arr.push(new_data.slice(i, i + 3));
  891 + }
  892 + th.setData({
  893 + newGoods: arr,
  894 + });
  895 + }
  896 + })
  897 +
  898 + //------热卖-------
  899 + await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
  900 + data: {
  901 + is_mainshow: 1,
  902 + isonsale: 1,
  903 + is_on_sale: 1,
  904 + store_id: o.stoid,
  905 + pageSize: 9,
  906 + is_hot: 1,
  907 + orderField: "sort"
  908 + }
  909 + }).then(res => {
  910 + var e = res;
  911 + if (e.data.code == 0) {
  912 + var new_data = e.data.data.pageData;
  913 + var arr = new Array();
  914 + //--三个三个一组---
  915 + for (var i = 0; i < new_data.length; i += 3) {
  916 + arr.push(new_data.slice(i, i + 3));
  917 + }
  918 + console.log(arr);
  919 + th.setData({
  920 + hotGoods: arr,
  921 + });
  922 + }
  923 + })
  924 +
  925 + //---调用信息---
  926 + // this.requestRecommend();
  927 + this.setData({
  928 + ishow: 1
  929 + });
  930 +
  931 + //---先获取会员---
  932 + //t.getUserFir(function () {
  933 + if (getApp().globalData.user_id) {
  934 + th.is_festival();
  935 + var new_nav = th.data.new_nav;
  936 + if (new_nav == "") {
  937 + th.is_new();
  938 + }
  939 +
  940 + // sty
  941 + setTimeout(function () {
  942 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  943 + }, 500)
  944 + }
  945 + //});
  946 +
  947 + setTimeout(function () {
  948 + var goods_list = th.selectComponent("#goods_list"); //组件的id
  949 + goods_list.init();
  950 + goods_list.get_list();
  951 + }, 2000)
  952 + },
  953 +
  954 + //--判断小程序是否过期--
  955 + setappdata: function (t) {
  956 + if (t && t.isout == 1)
  957 + wx.reLaunch({
  958 + url: "/packageD/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel,
  959 + });
  960 + if (t && t.isbuy == 0)
  961 + wx.reLaunch({
  962 + url: "/packageD/pages/error/error?msg=还未购买小程序",
  963 + });
  964 + },
  965 + //---加载更多是靠这个函数----
  966 + onReachBottom: function () {
867 967 console.log('下拉加载2');
868 968  
869   - var goods_list = this.selectComponent("#goods_list"); //组件的id
870   - if (goods_list) goods_list.get_list();
  969 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  970 + if (goods_list) goods_list.get_list();
871 971  
872   - if (getApp().globalData.func_list) {
873   - for (let i in getApp().globalData.func_list) {
874   - let item = getApp().globalData.func_list[i];
875   - item.re_show();
876   - }
  972 + if (getApp().globalData.func_list) {
  973 + for (let i in getApp().globalData.func_list) {
  974 + let item = getApp().globalData.func_list[i];
  975 + item.re_show();
  976 + }
877 977 }
878   -
  978 +
879 979  
880 980 //自定义时商品自动加载更多
881 981 let goodsGroupArr = this.data.goodsGroupArr
882   - if (this.data.isTemplate && goodsGroupArr.length >0) {
883   - goodsGroupArr.map(item=>{
884   - if(this[item]) this[item].automore()
885   - })
  982 + if (this.data.isTemplate && goodsGroupArr.length > 0) {
  983 + goodsGroupArr.map(item => {
  984 + if (this[item]) this[item].automore()
  985 + })
886 986 }
887 987  
888   - },
889   -
890   - onPullDownRefresh: function (e) {
891   - this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(),
892   - this.requestRecommend();
893   - },
894   - requestRecommend() { },
895   - requestHomePage() { },
896   -
897   - onUnload: function () {
898   - this.destroyActivityTimer();
899   - },
900   - setCountTime: function (e) {
901   - e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({
902   - "sale.diffTime": e.diffTime
903   - }), this.setData({
904   - "sale.good": e.flash_sale_goods[0]
905   - }), this.destroyActivityTimer(), this.createActivityTimer();
906   - },
907   - createActivityTimer: function () {
908   - var e = this.data.sale,
909   - t = this;
910   - this.data.timer = setInterval(function () {
911   - var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime,
912   - o = i.transTime(a);
913   - a <= 0 ? t.requestHomePage() : t.setData({
914   - "sale.countTime": o
915   - });
916   - }, 1e3);
917   - },
918   - destroyActivityTimer: function () {
919   - this.data.timer && (clearInterval(this.data.timer), this.data.timer = null);
920   - },
921   - onPageScroll: function (e) {
922   - this.data.scrollTop = e.scrollTop;
923   - var t = getCurrentPages();
924   - "pages/index/index/index" == t[t.length - 1].route;
925   - /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({
926   - frontColor: "#ffffff",
927   - backgroundColor: "#f95959"
928   - }) : wx.setNavigationBarColor({
929   - frontColor: "#000000",
930   - backgroundColor: "#eeeeee"
931   - }));--*/
932   - },
933   - jumpSearch: function () {
934   - wx.navigateTo({
935   - url: "/packageG/pages/goods/search/search"
936   - });
937   - },
938   - onShareAppMessage: function (e) {
939   - getApp().globalData.no_clear = 1;
940   - var url = "/pages/index/index/index";
941   - var userInfo = getApp().globalData.userInfo;
942   - //是分销商才带
943   - if (userInfo) {
  988 + },
  989 +
  990 + onPullDownRefresh: function (e) {
  991 + this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(),
  992 + this.requestRecommend();
  993 + },
  994 + requestRecommend() { },
  995 + requestHomePage() { },
  996 +
  997 + onUnload: function () {
  998 + this.destroyActivityTimer();
  999 + },
  1000 + setCountTime: function (e) {
  1001 + e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({
  1002 + "sale.diffTime": e.diffTime
  1003 + }), this.setData({
  1004 + "sale.good": e.flash_sale_goods[0]
  1005 + }), this.destroyActivityTimer(), this.createActivityTimer();
  1006 + },
  1007 + createActivityTimer: function () {
  1008 + var e = this.data.sale,
  1009 + t = this;
  1010 + this.data.timer = setInterval(function () {
  1011 + var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime,
  1012 + o = i.transTime(a);
  1013 + a <= 0 ? t.requestHomePage() : t.setData({
  1014 + "sale.countTime": o
  1015 + });
  1016 + }, 1e3);
  1017 + },
  1018 + destroyActivityTimer: function () {
  1019 + this.data.timer && (clearInterval(this.data.timer), this.data.timer = null);
  1020 + },
  1021 + onPageScroll: function (e) {
  1022 + //满屏模式监听
  1023 + let num = e.scrollTop
  1024 + if (!this.data.old_nav_frontColor) {
  1025 + this.setData({
  1026 + old_nav_frontColor:this.data.nav_frontColor
  1027 + })
  1028 + }
  1029 + if (this.data.is_full_screen_navigation) {
  1030 + let nav_type = this.data.nav_type
  1031 + if (num >= 100 && nav_type) {
  1032 + this.setData({
  1033 + nav_type: 0,
  1034 + searchbox_transparent: 0,
  1035 + nav_frontColor: '#000'
  1036 + })
  1037 + // this.data.nav_type = 0
  1038 + }
  1039 + if (num < 100 && !nav_type) {
  1040 + this.setData({
  1041 + nav_type: 1,
  1042 + searchbox_transparent: 1,
  1043 + nav_frontColor: this.data.old_nav_frontColor
  1044 + })
  1045 + // this.data.nav_type = 1
  1046 + }
  1047 + }
  1048 +
  1049 + //-----------end-------
  1050 + //是否显示置顶
  1051 + if (num > 400) {
  1052 + this.setData({
  1053 + is_show_top:1
  1054 + })
  1055 + }else{
  1056 + this.setData({
  1057 + is_show_top:0
  1058 + })
  1059 + }
  1060 + //----end------
  1061 +
  1062 + this.data.scrollTop = e.scrollTop;
  1063 + var t = getCurrentPages();
  1064 + "pages/index/index/index" == t[t.length - 1].route;
  1065 + /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({
  1066 + frontColor: "#ffffff",
  1067 + backgroundColor: "#f95959"
  1068 + }) : wx.setNavigationBarColor({
  1069 + frontColor: "#000000",
  1070 + backgroundColor: "#eeeeee"
  1071 + }));--*/
  1072 + },
  1073 + jumpSearch: function () {
  1074 + wx.navigateTo({
  1075 + url: "/packageG/pages/goods/search/search"
  1076 + });
  1077 + },
  1078 + onShareAppMessage: function (e) {
  1079 + getApp().globalData.no_clear = 1;
  1080 + var url = "/pages/index/index/index";
  1081 + var userInfo = getApp().globalData.userInfo;
  1082 + //是分销商才带
  1083 + if (userInfo) {
944 1084 url += "?first_leader=" + userInfo.user_id;
945 1085 //群id分享
946 1086 if (getApp().globalData.groupchat_id) {
947   - url+="&groupchat_id="+getApp().globalData.groupchat_id
  1087 + url += "&groupchat_id=" + getApp().globalData.groupchat_id
948 1088 }
949   - }else{
  1089 + } else {
950 1090 //群id分享
951 1091 if (getApp().globalData.groupchat_id) {
952   - url+="?groupchat_id="+getApp().globalData.groupchat_id
  1092 + url += "?groupchat_id=" + getApp().globalData.groupchat_id
953 1093 }
954 1094 }
955   - console.log("---首页---分享--");
956   - var title = "商城首页"
957   - //分享
958   - if (getApp().globalData.config && getApp().globalData.config.store_name) {
959   - title = getApp().globalData.config.store_name;
960   - } else if (getApp().globalData.setting.appName) {
961   - title = getApp().globalData.setting.appName;
  1095 + console.log("---首页---分享--");
  1096 + var title = "商城首页"
  1097 + //分享
  1098 + if (getApp().globalData.config && getApp().globalData.config.store_name) {
  1099 + title = getApp().globalData.config.store_name;
  1100 + } else if (getApp().globalData.setting.appName) {
  1101 + title = getApp().globalData.setting.appName;
962 1102 }
963   -
964   -
965   -
966   - var ob = {
967   - title: title,
968   - path: url,
969   - };
970   - console.log(ob);
971   - return ob;
972   - },
973   -
974   - //图片失败,默认图片
975   - bind_bnerr: function (e) {
976   - var _errImg = e.target.dataset.errorimg;
977   - var _errObj = {};
978   - _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg";
979   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
980   - },
981   -
982   - //图片失败,默认图片
983   - bind_bnerr2: function (e) {
984   - var _errImg = e.target.dataset.errorimg;
985   - var _errurl = e.target.dataset.url;
986   - var _errObj = {};
987   - _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
988   - this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
989   -
990   - },
991   - //图片失败,默认图片
992   - bind_bnerr3: function (e) {
993   - var _errImg = e.target.dataset.errorimg;
994   - var _Img = e.target.dataset.img;
995   - if (_Img != undefined) {
996   - var _errObj = {};
997   - _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
998   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
999   - }
1000   - },
1001   -
1002   -
1003   - //秒杀倒计时
1004   - //---小于10的格式化函数----
1005   - timeFormat(param) {
1006   - return param < 10 ? '0' + param : param;
1007   - },
1008   -
1009   - //----秒杀倒计时函数-----
1010   - countDown() {
1011   - if (!this.data.is_timer) return false;
1012   - var th = this;
1013   - // 获取当前时间,同时得到活动结束时间数组
1014   - var newTime = ut.gettimestamp();
1015   - var List = this.data.saleGoods;
1016   - for (var j = 0; j < List.length; j++) {
1017   - var endTimeList = List[j];
1018   - // 对结束时间进行处理渲染到页面
1019   - for (var i = 0; i < endTimeList.length; i++) {
1020   - var o = endTimeList[i];
1021   - var endTime = o.end_time
1022   - if (o.status == 0) endTime = o.start_time
1023   -
1024   - var obj = null;
1025   - // 如果活动未结束,对时间进行处理
1026   - if (endTime - newTime > 0) {
1027   - var time = (endTime - newTime);
1028   - // 获取天、时、分、秒
1029   - var day = parseInt(time / (60 * 60 * 24));
1030   - var hou = parseInt(time % (60 * 60 * 24) / 3600);
1031   - var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
1032   - var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
1033   - obj = {
1034   - day: this.timeFormat(day),
1035   - hou: this.timeFormat(hou),
1036   - min: this.timeFormat(min),
1037   - sec: this.timeFormat(sec)
1038   - }
1039   - } else {
1040   - //活动已结束,全部设置为'00'
1041   - obj = {
1042   - day: '00',
1043   - hou: '00',
1044   - min: '00',
1045   - sec: '00'
1046   - }
1047   - }
1048   - var txt = "saleGoods[" + j + "][" + i + "].djs";
1049   - th.setData({
1050   - [txt]: obj
1051   - });
1052   - }
1053   -
1054   - }
1055   - setTimeout(th.countDown, 1000);
1056   - },
1057   -
1058   - //----拼单倒计时函数-----
1059   - countDown2() {
1060   - if (!this.data.is_timer) return false;
1061   -
1062   - var th = this;
1063   - // 获取当前时间,同时得到活动结束时间数组
1064   - var newTime = ut.gettimestamp();
1065   - var List = this.data.pindGoods;
1066   - for (var j = 0; j < List.length; j++) {
1067   - var endTimeList = List[j];
1068   - // 对结束时间进行处理渲染到页面
1069   - for (var i = 0; i < endTimeList.length; i++) {
1070   - var o = endTimeList[i];
1071   - var endTime = o.end_time;
1072   - if (o.status == 0) endTime = o.start_time;
1073   -
1074   - let obj = null;
1075   - // 如果活动未结束,对时间进行处理
1076   - if (endTime - newTime > 0) {
1077   - let time = (endTime - newTime);
1078   - // 获取天、时、分、秒
1079   - let day = parseInt(time / (60 * 60 * 24));
1080   - let hou = parseInt(time % (60 * 60 * 24) / 3600);
1081   - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
1082   - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
1083   - obj = {
1084   - day: this.timeFormat(day),
1085   - hou: this.timeFormat(hou),
1086   - min: this.timeFormat(min),
1087   - sec: this.timeFormat(sec)
1088   - }
1089   - } else {
1090   - //活动已结束,全部设置为'00'
1091   - obj = {
1092   - day: '00',
1093   - hou: '00',
1094   - min: '00',
1095   - sec: '00'
1096   - }
1097   - }
1098   - var txt = "pindGoods[" + j + "][" + i + "].djs";
1099   - th.setData({
1100   - [txt]: obj
1101   - });
1102   - }
1103   - }
1104   - setTimeout(th.countDown2, 1000);
1105   - },
1106   -
1107   - bannerSwiperChange: function (e) {
1108   - var index = e.detail.current;
1109   - this.setData({
1110   - banner_index: index
1111   - });
1112   - },
1113   - flashSwiperChange: function (e) {
1114   - var index = e.detail.current;
1115   - this.setData({
1116   - flash_index: index
1117   - });
1118   - },
1119   - ptSwiperChange: function (e) {
1120   - var index = e.detail.current;
1121   - this.setData({
1122   - pt_index: index
1123   - });
1124   - },
1125   -
1126   - Interval_pt() {
1127   - var th = this;
1128   - this.data.pt_timer = setInterval(function () {
1129   - var item = ut.get_rand_item(th.data.pt_timer_arr);
1130   - th.setData({
1131   - pt_timer_active: 1,
1132   - pt_timer_item: item
1133   - });
1134   - setTimeout(function () {
1135   - th.setData({
1136   - pt_timer_active: 0
1137   - });
1138   - }, 1500)
1139   - }, 4000);
1140   - },
1141   -
1142   -
1143   - //---扫一扫的函数---
1144   - getScancode: function () {
1145   - var _this = this;
1146   - getApp().globalData.no_clear = 1;
1147   - // 允许从相机和相册扫码
1148   - wx.scanCode({
1149   - success: (res) => {
1150   - var result = res.result;
1151   - wx.navigateTo({
1152   - url: "/packageG/pages/goods/search/search?s_key=" + result,
1153   - });
1154   - }
1155   - })
1156   - },
1157   - //广告跳转
1158   - go_mb(e){
1159   - let url=e.currentTarget.dataset.url
  1103 +
  1104 +
  1105 +
  1106 + var ob = {
  1107 + title: title,
  1108 + path: url,
  1109 + };
  1110 + console.log(ob);
  1111 + return ob;
  1112 + },
  1113 +
  1114 + //图片失败,默认图片
  1115 + bind_bnerr: function (e) {
  1116 + var _errImg = e.target.dataset.errorimg;
  1117 + var _errObj = {};
  1118 + _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg";
  1119 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  1120 + },
  1121 +
  1122 + //图片失败,默认图片
  1123 + bind_bnerr2: function (e) {
  1124 + var _errImg = e.target.dataset.errorimg;
  1125 + var _errurl = e.target.dataset.url;
  1126 + var _errObj = {};
  1127 + _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
  1128 + this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  1129 +
  1130 + },
  1131 + //图片失败,默认图片
  1132 + bind_bnerr3: function (e) {
  1133 + var _errImg = e.target.dataset.errorimg;
  1134 + var _Img = e.target.dataset.img;
  1135 + if (_Img != undefined) {
  1136 + var _errObj = {};
  1137 + _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
  1138 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  1139 + }
  1140 + },
  1141 +
  1142 +
  1143 + //秒杀倒计时
  1144 + //---小于10的格式化函数----
  1145 + timeFormat(param) {
  1146 + return param < 10 ? '0' + param : param;
  1147 + },
  1148 +
  1149 + //----秒杀倒计时函数-----
  1150 + countDown() {
  1151 + if (!this.data.is_timer) return false;
  1152 + var th = this;
  1153 + // 获取当前时间,同时得到活动结束时间数组
  1154 + var newTime = ut.gettimestamp();
  1155 + var List = this.data.saleGoods;
  1156 + for (var j = 0; j < List.length; j++) {
  1157 + var endTimeList = List[j];
  1158 + // 对结束时间进行处理渲染到页面
  1159 + for (var i = 0; i < endTimeList.length; i++) {
  1160 + var o = endTimeList[i];
  1161 + var endTime = o.end_time
  1162 + if (o.status == 0) endTime = o.start_time
  1163 +
  1164 + var obj = null;
  1165 + // 如果活动未结束,对时间进行处理
  1166 + if (endTime - newTime > 0) {
  1167 + var time = (endTime - newTime);
  1168 + // 获取天、时、分、秒
  1169 + var day = parseInt(time / (60 * 60 * 24));
  1170 + var hou = parseInt(time % (60 * 60 * 24) / 3600);
  1171 + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  1172 + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  1173 + obj = {
  1174 + day: this.timeFormat(day),
  1175 + hou: this.timeFormat(hou),
  1176 + min: this.timeFormat(min),
  1177 + sec: this.timeFormat(sec)
  1178 + }
  1179 + } else {
  1180 + //活动已结束,全部设置为'00'
  1181 + obj = {
  1182 + day: '00',
  1183 + hou: '00',
  1184 + min: '00',
  1185 + sec: '00'
  1186 + }
  1187 + }
  1188 + var txt = "saleGoods[" + j + "][" + i + "].djs";
  1189 + th.setData({
  1190 + [txt]: obj
  1191 + });
  1192 + }
  1193 +
  1194 + }
  1195 + setTimeout(th.countDown, 1000);
  1196 + },
  1197 +
  1198 + //----拼单倒计时函数-----
  1199 + countDown2() {
  1200 + if (!this.data.is_timer) return false;
  1201 +
  1202 + var th = this;
  1203 + // 获取当前时间,同时得到活动结束时间数组
  1204 + var newTime = ut.gettimestamp();
  1205 + var List = this.data.pindGoods;
  1206 + for (var j = 0; j < List.length; j++) {
  1207 + var endTimeList = List[j];
  1208 + // 对结束时间进行处理渲染到页面
  1209 + for (var i = 0; i < endTimeList.length; i++) {
  1210 + var o = endTimeList[i];
  1211 + var endTime = o.end_time;
  1212 + if (o.status == 0) endTime = o.start_time;
  1213 +
  1214 + let obj = null;
  1215 + // 如果活动未结束,对时间进行处理
  1216 + if (endTime - newTime > 0) {
  1217 + let time = (endTime - newTime);
  1218 + // 获取天、时、分、秒
  1219 + let day = parseInt(time / (60 * 60 * 24));
  1220 + let hou = parseInt(time % (60 * 60 * 24) / 3600);
  1221 + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  1222 + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  1223 + obj = {
  1224 + day: this.timeFormat(day),
  1225 + hou: this.timeFormat(hou),
  1226 + min: this.timeFormat(min),
  1227 + sec: this.timeFormat(sec)
  1228 + }
  1229 + } else {
  1230 + //活动已结束,全部设置为'00'
  1231 + obj = {
  1232 + day: '00',
  1233 + hou: '00',
  1234 + min: '00',
  1235 + sec: '00'
  1236 + }
  1237 + }
  1238 + var txt = "pindGoods[" + j + "][" + i + "].djs";
  1239 + th.setData({
  1240 + [txt]: obj
  1241 + });
  1242 + }
  1243 + }
  1244 + setTimeout(th.countDown2, 1000);
  1245 + },
  1246 +
  1247 + bannerSwiperChange: function (e) {
  1248 + var index = e.detail.current;
  1249 + this.setData({
  1250 + banner_index: index
  1251 + });
  1252 + },
  1253 + flashSwiperChange: function (e) {
  1254 + var index = e.detail.current;
  1255 + this.setData({
  1256 + flash_index: index
  1257 + });
  1258 + },
  1259 + ptSwiperChange: function (e) {
  1260 + var index = e.detail.current;
  1261 + this.setData({
  1262 + pt_index: index
  1263 + });
  1264 + },
  1265 +
  1266 + Interval_pt() {
  1267 + var th = this;
  1268 + this.data.pt_timer = setInterval(function () {
  1269 + var item = ut.get_rand_item(th.data.pt_timer_arr);
  1270 + th.setData({
  1271 + pt_timer_active: 1,
  1272 + pt_timer_item: item
  1273 + });
  1274 + setTimeout(function () {
  1275 + th.setData({
  1276 + pt_timer_active: 0
  1277 + });
  1278 + }, 1500)
  1279 + }, 4000);
  1280 + },
  1281 +
  1282 +
  1283 + //---扫一扫的函数---
  1284 + getScancode: function () {
  1285 + var _this = this;
  1286 + getApp().globalData.no_clear = 1;
  1287 + // 允许从相机和相册扫码
  1288 + wx.scanCode({
  1289 + success: (res) => {
  1290 + var result = res.result;
  1291 + wx.navigateTo({
  1292 + url: "/packageG/pages/goods/search/search?s_key=" + result,
  1293 + });
  1294 + }
  1295 + })
  1296 + },
  1297 + //广告跳转
  1298 + go_mb(e) {
  1299 + let url = e.currentTarget.dataset.url
1160 1300 getApp().goto(url);
1161 1301 },
1162 1302  
1163   - //跳转到分类
1164   - go_cate: function () {
1165   - getApp().goto("/pages/goods/categoryList/categoryList");
1166   - },
1167   -
1168   - // 幸运购跳转
1169   - go_url: function (e) {
1170   -
1171   - var url = e.currentTarget.dataset.url;
1172   - getApp().goto(url);
1173   -
1174   - }, //
1175   -
1176   - bind_bnerr_icon: function (e) {
1177   - var def = "/miniapp/images/no_cate_def.png";
1178   - var _err = e.currentTarget.dataset.err;
1179   - var ob = {};
1180   - ob[_err] = def;
1181   - this.setData(ob);
1182   - },
1183   -
1184   - //跳转到分类的商品列表
1185   - go_cate2: function (t) {
1186   - var cid = t.currentTarget.dataset.cid;
1187   - var pid = t.currentTarget.dataset.pid;
1188   - var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid;
1189   - wx.navigateTo({
1190   - url: lurl
1191   - });
1192   - },
1193   - new_nav: function (e) {
1194   - var th = this;
1195   - var new_nav = th.data.new_nav;
1196   - getApp().goto(new_nav);
1197   - },
1198   - //跳转到权益
1199   - go_quanyi: function (t) {
1200   - var user_info = getApp().globalData.userInfo;
1201   - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
1202   - wx.navigateTo({
1203   - url: '/packageE/pages/togoin/togoin',
1204   - //url: '/pages/getphone/getphone',
1205   - })
1206   - return false;
1207   - }
1208   - getApp().goto("/pages/user/userqy/userqy");
1209   - },
1210   -
1211   - imageLoad: function (e) {
1212   - var imgwidth = e.detail.width;
1213   - var imgheight = e.detail.height;
1214   - //宽高比
1215   - var ratio = imgwidth / imgheight;
1216   - //计算的高度值
1217   - var viewHeight = 715 / ratio;
1218   - if (this.data.max_sw_height < viewHeight) this.setData({
1219   - max_sw_height: viewHeight
1220   - });
1221   - },
1222   - //判断该用户是否是新会员
1223   - is_new: function () {
1224   - var th = this;
1225   - wx.hideLoading();
1226   - getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {
1227   - data: {
1228   - storeId: os.stoid,
1229   - userId: d.user_id
1230   - }
1231   - }).then(res => {
1232   - if (res.data.code == 0) {
1233   - var actid = res.data.data.id; //活动id
1234   - var giftBagId = res.data.data.giftBagId; //礼包id
1235   - var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;
1236   - var new_image = res.data.data.imageurl;
1237   - var swiperimage = th.data.swiperimage;
1238   - var img = {
1239   - image: "/miniapp/images/newpeople/newpeople.png",
1240   - nav_url: new_nav
1241   - }
1242   - swiperimage.unshift(img);
1243   - th.setData({
1244   - swiperimage: swiperimage,
1245   - new_image: new_image,
1246   - new_nav: new_nav
1247   - })
1248   -
1249   - getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", {
1250   - data: {
1251   - storeId: o.stoid,
1252   - userId: d.user_id
1253   - }
1254   - }).then(res => {
1255   - if (res.data.code == 0) {
1256   - th.setData({
1257   - is_disgraceful: 1
1258   - })
1259   - } else {
1260   - th.check_holiday_pop(); //节日的弹窗
1261   - }
1262   -
1263   - })
1264   - } else {
1265   - th.check_holiday_pop(); //节日的弹窗
1266   - }
1267   -
1268   - })
1269   -
1270   - },
1271   -
1272   - is_festival: function (e) {
1273   - var th = this;
1274   - var url = "/api/weshop/marketing/holiday/act/judge";
1275   - getApp().request.promiseGet(url, {
1276   - data: {
1277   - storeId: os.stoid,
1278   - userId: d.user_id
1279   - }
1280   - }).then(res => {
1281   - if (res.data.code == 0) {
1282   - var actid = res.data.data.id; //活动id
1283   - var giftBagId = res.data.data.gifBagId; //礼包id
1284   - var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId;
1285   - var swiperimage = th.data.swiperimage;
1286   - var actBoundImg = res.data.data.actBoundImg ? res.data.data.actBoundImg : '/miniapp/images/default_g_img.gif';
1287   -
1288   - th.data.holiday_image = res.data.data.actImg;
1289   - th.data.holiday_url = nav_url;
1290   -
1291   - var img = {
1292   - image: actBoundImg,
1293   - nav_url: nav_url,
1294   - id: res.data.data.id,
1295   - type: 'festival'
1296   - }
1297   -
1298   - for (var i in swiperimage) {
1299   - var item = swiperimage[i];
1300   - if (item.id == img.id && item.type == img.type) {
1301   - return false;
1302   - }
1303   - }
1304   -
1305   - swiperimage.unshift(img);
1306   - th.setData({
1307   - swiperimage: swiperimage,
1308   - new_nav: nav_url
1309   - })
1310   - }
1311   - })
1312   - },
1313   -
1314   - //弹出节日有礼
1315   - check_holiday_pop: function () {
1316   - var th = this;
1317   - getApp().waitfor2(th, 'w_holiday_pop', 'holiday_image', function () {
1318   - //等到结果才显示
1319   - if (th.data.holiday_image) {
1320   - th.setData({
1321   - new_image: th.data.holiday_image,
1322   - new_nav: th.data.holiday_url,
1323   - is_disgraceful: 1
1324   - })
1325   - }
1326   - })
1327   - },
1328   -
1329   - go_ad: function (e) {
1330   - var url = e.currentTarget.dataset.url;
1331   - if (!url || url == '') return;
1332   - if (url[0] != '/') url = '/' + url;
1333   - getApp().goto(url);
1334   - },
1335   -
1336   - //导航跳转
1337   - nav_goto: function (e) {
1338   - var url = e.currentTarget.dataset.url;
1339   - if (!url || url == '') return;
1340   - if (url[0] != '/') url = '/' + url;
1341   - getApp().goto(url);
1342   - if (this.data.showHongbao) {
1343   - this.setData({
1344   - showHongbao: false,
1345   - showHongbaoSmall: true, //显示抢红包小图标
1346   - });
1347   - }
1348   - },
1349   -
1350   - //----跳转到搭配购买----
1351   - go_test: function () {
1352   - wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", })
1353   - },
1354   - onShareTimeline() {
1355   - getApp().globalData.no_clear=1;
1356   - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
1357   - if (!store_name){
1358   - store_name = getApp().globalData.setting.appName;
1359   - }
1360   - var user_id=getApp().globalData.user_id;
1361   - if(!user_id) user_id=0;
1362   - var url=''
1363   - //群id分享
1364   - if (getApp().globalData.groupchat_id) {
1365   - url+="&groupchat_id="+getApp().globalData.groupchat_id
  1303 + //跳转到分类
  1304 + go_cate: function () {
  1305 + getApp().goto("/pages/goods/categoryList/categoryList");
  1306 + },
  1307 +
  1308 + // 幸运购跳转
  1309 + go_url: function (e) {
  1310 +
  1311 + var url = e.currentTarget.dataset.url;
  1312 + getApp().goto(url);
  1313 +
  1314 + }, //
  1315 +
  1316 + bind_bnerr_icon: function (e) {
  1317 + var def = "/miniapp/images/no_cate_def.png";
  1318 + var _err = e.currentTarget.dataset.err;
  1319 + var ob = {};
  1320 + ob[_err] = def;
  1321 + this.setData(ob);
  1322 + },
  1323 +
  1324 + //跳转到分类的商品列表
  1325 + go_cate2: function (t) {
  1326 + var cid = t.currentTarget.dataset.cid;
  1327 + var pid = t.currentTarget.dataset.pid;
  1328 + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid;
  1329 + wx.navigateTo({
  1330 + url: lurl
  1331 + });
  1332 + },
  1333 + new_nav: function (e) {
  1334 + var th = this;
  1335 + var new_nav = th.data.new_nav;
  1336 + getApp().goto(new_nav);
  1337 + },
  1338 + //跳转到权益
  1339 + go_quanyi: function (t) {
  1340 + var user_info = getApp().globalData.userInfo;
  1341 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  1342 + wx.navigateTo({
  1343 + url: '/packageE/pages/togoin/togoin',
  1344 + //url: '/pages/getphone/getphone',
  1345 + })
  1346 + return false;
  1347 + }
  1348 + getApp().goto("/pages/user/userqy/userqy");
  1349 + },
  1350 +
  1351 + imageLoad: function (e) {
  1352 + var imgwidth = e.detail.width;
  1353 + var imgheight = e.detail.height;
  1354 + //宽高比
  1355 + var ratio = imgwidth / imgheight;
  1356 + //计算的高度值
  1357 + var viewHeight = 715 / ratio;
  1358 + if (this.data.max_sw_height < viewHeight) this.setData({
  1359 + max_sw_height: viewHeight
  1360 + });
  1361 + },
  1362 + //判断该用户是否是新会员
  1363 + is_new: function () {
  1364 + var th = this;
  1365 + wx.hideLoading();
  1366 + getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {
  1367 + data: {
  1368 + storeId: os.stoid,
  1369 + userId: d.user_id
  1370 + }
  1371 + }).then(res => {
  1372 + if (res.data.code == 0) {
  1373 + var actid = res.data.data.id; //活动id
  1374 + var giftBagId = res.data.data.giftBagId; //礼包id
  1375 + var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;
  1376 + var new_image = res.data.data.imageurl;
  1377 + var swiperimage = th.data.swiperimage;
  1378 + var img = {
  1379 + image: "/miniapp/images/newpeople/newpeople.png",
  1380 + nav_url: new_nav
  1381 + }
  1382 + swiperimage.unshift(img);
  1383 + th.setData({
  1384 + swiperimage: swiperimage,
  1385 + new_image: new_image,
  1386 + new_nav: new_nav
  1387 + })
  1388 +
  1389 + getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", {
  1390 + data: {
  1391 + storeId: o.stoid,
  1392 + userId: d.user_id
  1393 + }
  1394 + }).then(res => {
  1395 + if (res.data.code == 0) {
  1396 + th.setData({
  1397 + is_disgraceful: 1
  1398 + })
  1399 + } else {
  1400 + th.check_holiday_pop(); //节日的弹窗
  1401 + }
  1402 +
  1403 + })
  1404 + } else {
  1405 + th.check_holiday_pop(); //节日的弹窗
  1406 + }
  1407 +
  1408 + })
  1409 +
  1410 + },
  1411 +
  1412 + is_festival: function (e) {
  1413 + var th = this;
  1414 + var url = "/api/weshop/marketing/holiday/act/judge";
  1415 + getApp().request.promiseGet(url, {
  1416 + data: {
  1417 + storeId: os.stoid,
  1418 + userId: d.user_id
  1419 + }
  1420 + }).then(res => {
  1421 + if (res.data.code == 0) {
  1422 + var actid = res.data.data.id; //活动id
  1423 + var giftBagId = res.data.data.gifBagId; //礼包id
  1424 + var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId;
  1425 + var swiperimage = th.data.swiperimage;
  1426 + var actBoundImg = res.data.data.actBoundImg ? res.data.data.actBoundImg : '/miniapp/images/default_g_img.gif';
  1427 +
  1428 + th.data.holiday_image = res.data.data.actImg;
  1429 + th.data.holiday_url = nav_url;
  1430 +
  1431 + var img = {
  1432 + image: actBoundImg,
  1433 + nav_url: nav_url,
  1434 + id: res.data.data.id,
  1435 + type: 'festival'
1366 1436 }
1367   - return {
1368   - title: '首页-' + '-' + store_name,
1369   - query: 'first_leader='+user_id+url
  1437 +
  1438 + for (var i in swiperimage) {
  1439 + var item = swiperimage[i];
  1440 + if (item.id == img.id && item.type == img.type) {
  1441 + return false;
  1442 + }
1370 1443 }
1371   - },
1372 1444  
1373   - // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标
1374   - closeHongbao() {
1375   - this.setData({
1376   - showHongbao: false, //关闭抢红包主弹窗
1377   - showHongbaoSmall: true, //显示抢红包小图标
1378   - });
1379   - },
1380   -
1381   - /*-- 全屏广告 --*/
1382   - close_full_screen() {
1383   - this.setData({ is_full_screen_show: 0, sec_show: 0 });
1384   - },
1385   - //-- 跳转到满屏广告的链接 --
1386   - go_full_ad() {
1387   - if (!this.data.full_ad) return false;
1388   - if (!this.data.full_ad.ad_weapplink) return false;
1389   - getApp().goto(this.data.full_ad.ad_weapplink);
1390   - this.close_full_screen();
1391   - },
1392   -
1393   - go_pre: function (e) {
1394   - var userInfo = getApp().globalData.userInfo;
1395   - if (!userInfo) {
1396   - getApp().goto("/packageE/pages/togoin/togoin");
1397   - return false;
1398   - }
1399   - var url = e.currentTarget.dataset.url;
1400   - getApp().goto(url);
1401   - },
  1445 + swiperimage.unshift(img);
  1446 + th.setData({
  1447 + swiperimage: swiperimage,
  1448 + new_nav: nav_url
  1449 + })
  1450 + }
  1451 + })
  1452 + },
  1453 +
  1454 + //弹出节日有礼
  1455 + check_holiday_pop: function () {
  1456 + var th = this;
  1457 + getApp().waitfor2(th, 'w_holiday_pop', 'holiday_image', function () {
  1458 + //等到结果才显示
  1459 + if (th.data.holiday_image) {
  1460 + th.setData({
  1461 + new_image: th.data.holiday_image,
  1462 + new_nav: th.data.holiday_url,
  1463 + is_disgraceful: 1
  1464 + })
  1465 + }
  1466 + })
  1467 + },
  1468 +
  1469 + go_ad: function (e) {
  1470 + var url = e.currentTarget.dataset.url;
  1471 + if (!url || url == '') return;
  1472 + if (url[0] != '/') url = '/' + url;
  1473 + getApp().goto(url);
  1474 + },
  1475 +
  1476 + //导航跳转
  1477 + nav_goto: function (e) {
  1478 + var url = e.currentTarget.dataset.url;
  1479 + if (!url || url == '') return;
  1480 + if (url[0] != '/') url = '/' + url;
  1481 + getApp().goto(url);
  1482 + if (this.data.showHongbao) {
  1483 + this.setData({
  1484 + showHongbao: false,
  1485 + showHongbaoSmall: true, //显示抢红包小图标
  1486 + });
  1487 + }
  1488 + },
  1489 +
  1490 + //----跳转到搭配购买----
  1491 + go_test: function () {
  1492 + wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", })
  1493 + },
  1494 + onShareTimeline() {
  1495 + getApp().globalData.no_clear = 1;
  1496 + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
  1497 + if (!store_name) {
  1498 + store_name = getApp().globalData.setting.appName;
  1499 + }
  1500 + var user_id = getApp().globalData.user_id;
  1501 + if (!user_id) user_id = 0;
  1502 + var url = ''
  1503 + //群id分享
  1504 + if (getApp().globalData.groupchat_id) {
  1505 + url += "&groupchat_id=" + getApp().globalData.groupchat_id
  1506 + }
  1507 + return {
  1508 + title: '首页-' + '-' + store_name,
  1509 + query: 'first_leader=' + user_id + url
  1510 + }
  1511 + },
  1512 +
  1513 + // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标
  1514 + closeHongbao() {
  1515 + this.setData({
  1516 + showHongbao: false, //关闭抢红包主弹窗
  1517 + showHongbaoSmall: true, //显示抢红包小图标
  1518 + });
  1519 + },
  1520 +
  1521 + /*-- 全屏广告 --*/
  1522 + close_full_screen() {
  1523 + this.setData({ is_full_screen_show: 0, sec_show: 0 });
  1524 + },
  1525 + //-- 跳转到满屏广告的链接 --
  1526 + go_full_ad() {
  1527 + if (!this.data.full_ad) return false;
  1528 + if (!this.data.full_ad.ad_weapplink) return false;
  1529 + getApp().goto(this.data.full_ad.ad_weapplink);
  1530 + this.close_full_screen();
  1531 + },
  1532 +
  1533 + go_pre: function (e) {
  1534 + var userInfo = getApp().globalData.userInfo;
  1535 + if (!userInfo) {
  1536 + getApp().goto("/packageE/pages/togoin/togoin");
  1537 + return false;
  1538 + }
  1539 + var url = e.currentTarget.dataset.url;
  1540 + getApp().goto(url);
  1541 + },
1402 1542  
1403 1543 //视频号跳转
1404   - nv_void(){
  1544 + nv_void() {
1405 1545 // getApp().openChannelsActivity()
1406 1546 wx.getChannelsLiveInfo({
1407   - finderUserName:'sphYA5FuPCZxHaw',
1408   - success:(res)=>{
  1547 + finderUserName: 'sphYA5FuPCZxHaw',
  1548 + success: (res) => {
1409 1549 console.log(res)
1410 1550 },
1411   - fail:(error)=>{
  1551 + fail: (error) => {
1412 1552 console.log(error)
1413 1553 }
1414 1554 })
1415 1555 },
1416   - getchir(){
  1556 + getchir() {
1417 1557 const child = this.selectComponent('.goodsg');
1418 1558 console.log('子组件--------111111------')
1419 1559 console.log(child)
... ...
pages/index/index/index.json
... ... @@ -2,6 +2,7 @@
2 2 "usingComponents": {
3 3 "goods_recommend":"/components/goods_list/goods_list",
4 4 "nav": "/components/diy_nav/diy_nav",
  5 + "top_nav": "/components/diy_top_nav/diy_top_nav",
5 6 "advertising":"/components/diy_advertising/diy_advertising",
6 7 "groupbuy": "/components/diy_groupbuy/diy_groupbuy",
7 8 "goodsGroup": "/components/diy_goodsGroup/diy_goodsGroup",
... ... @@ -28,8 +29,10 @@
28 29 "mp-dialog": "weui-miniprogram/dialog/dialog",
29 30 "mp-sticky": "/components/mp-sticky/mp-sticky",
30 31 "floatingWindow": "/components/diy_floatingWindow/diy_floatingWindow",
  32 + "floatingBox": "/components/diy_floatingBox/diy_floatingBox",
31 33 "privacy_pop": "/components/privacy_pop/privacy_pop"
32 34 },
33 35 "enablePullDownRefresh": false,
34   - "onReachBottomDistance":300
  36 + "onReachBottomDistance":300,
  37 + "navigationStyle":"custom"
35 38 }
36 39 \ No newline at end of file
... ...
pages/index/index/index.wxml
... ... @@ -23,6 +23,8 @@
23 23 </block>
24 24  
25 25 <view class="top-bar">
  26 + <top_nav nav_type="{{0}}" nav_frontColor="{{'#fff'}}" nav_backgroundColor="{{'#ff7295'}}" nav_title="{{nav_title}}"></top_nav>
  27 +
26 28 <!-- 顶部关注公众号 -->
27 29 <view id="off_top" wx:if="{{is_gz_h5}}">
28 30 <official-account></official-account>
... ... @@ -48,6 +50,7 @@
48 50 </view>
49 51 </view>
50 52 </view>
  53 + <top_nav nav_type="{{-1}}" nav_frontColor="{{nav_frontColor}}" nav_backgroundColor="{{nav_backgroundColor}}" nav_title="{{nav_title}}"></top_nav>
51 54  
52 55 <!-- 如果有关注,要顶开位置,不能注释 -->
53 56 <view wx:if="{{is_gz_h5 && is_ok_h5}}" style="height: 84px;;flex-shrink:0"></view>
... ... @@ -137,23 +140,23 @@
137 140 <view class="mb_box">
138 141 <view class="mb_top">
139 142 <view class="mb_top_item" data-url="{{mb_banner['300'].ad_weapplink}}" wx:if="{{mb_banner['300']}}" catchtap="go_mb">
140   - <image src="{{mb_banner['300'].ad_code}}" style="max-width: 100%;max-height: 360rpx;"></image>
  143 + <image src="{{mb_banner['300'].ad_code}}" style="max-width: 100%;max-height: 360rpx;"></image>
141 144 </view>
142 145 <view class="mb_top_item">
143 146 <view wx:if="{{mb_banner['301']}}" data-url="{{mb_banner['301'].ad_weapplink}}" catchtap="go_mb">
144   - <image src="{{mb_banner['301'].ad_code}}" style="max-width: 100%;max-height: 180rpx;"></image>
  147 + <image src="{{mb_banner['301'].ad_code}}" style="max-width: 100%;max-height: 180rpx;"></image>
145 148 </view>
146 149 <view wx:if="{{mb_banner['302']}}" data-url="{{mb_banner['302'].ad_weapplink}}" catchtap="go_mb">
147   - <image src="{{mb_banner['302'].ad_code}}" style="max-width: 100%;max-height: 180rpx;"></image>
  150 + <image src="{{mb_banner['302'].ad_code}}" style="max-width: 100%;max-height: 180rpx;"></image>
148 151 </view>
149 152 </view>
150 153 </view>
151 154 <view class="mb_bottom">
152 155 <view wx:if="{{mb_banner['303']}}" data-url="{{mb_banner['303'].ad_weapplink}}" catchtap="go_mb">
153   - <image src="{{mb_banner['303'].ad_code}}" style="max-width: 100%;max-height:200rpx;"></image>
  156 + <image src="{{mb_banner['303'].ad_code}}" style="max-width: 100%;max-height:200rpx;"></image>
154 157 </view>
155 158 <view wx:if="{{mb_banner['304']}}" data-url="{{mb_banner['304'].ad_weapplink}}" catchtap="go_mb">
156   - <image src="{{mb_banner['304'].ad_code}}" style="max-width: 100%;max-height: 200rpx;"></image>
  159 + <image src="{{mb_banner['304'].ad_code}}" style="max-width: 100%;max-height: 200rpx;"></image>
157 160 </view>
158 161 </view>
159 162 </view>
... ... @@ -412,14 +415,13 @@
412 415 <!--是否是自定义-->
413 416 <view class="container" wx:if="{{isTemplate}}" style="background-color:{{bgcolor_t}}; padding-bottom: 10rpx">
414 417 <!-- 置顶层 -->
415   - <view class="dis_top" style="position:fixed">
416   - <!-- 关注公众号的显示 -->
417   - <view id="off_top" wx:if="{{is_gz_h5}}">
  418 + <!-- <view class="dis_top" style="position:fixed"> -->
  419 + <!-- 关注公众号的显示 -->
  420 + <!-- <view id="off_top" wx:if="{{is_gz_h5}}">
418 421 <official-account></official-account>
419 422 </view>
420 423 <block wx:for="{{template_arr}}">
421 424 <block wx:if="{{item.content.is_top==1}}">
422   - <!--如果是搜索框的时候 -->
423 425 <block wx:if="{{item.ename=='searchbox'}}">
424 426 <searchbox object="{{item.content}}"></searchbox>
425 427 </block>
... ... @@ -428,19 +430,87 @@
428 430 </block>
429 431 </block>
430 432 </block>
431   - </view>
  433 + </view> -->
432 434  
433 435 <!-- 撑开层 -->
434   - <view>
  436 + <!-- <view>
435 437 <view wx:if="{{is_gz_h5 && is_ok_h5}}" style="height: 84px;flex-shrink:0"></view>
436 438 <block wx:for="{{template_arr}}">
437 439 <block wx:if="{{item.content.is_top==1}}">
438   - <!-- <view style="height:88rpx"></view> -->
439 440 <view style="height:{{item.content.style==1 ? 110 : 88}}rpx"></view>
440 441 </block>
  442 + </block>
  443 +
  444 + </view> -->
  445 +
  446 + <block wx:if="{{is_full_screen_navigation}}">
  447 + <view class="dis_top" style="position: fixed;">
  448 + <top_nav nav_type="{{nav_type}}" nav_frontColor="{{nav_frontColor}}" nav_backgroundColor="{{nav_backgroundColor ? '#fff' :'#fff'}}" nav_title="{{nav_title}}"></top_nav>
  449 +
  450 + <!-- <js_store_select bindup_storid="get_new_storid" id="js_store_select" transparent="{{searchbox_transparent}}" bgcoler="{{nav_backgroundColor ? '#fff' :'#fff'}}" anclor="{{nav_but_color}}" ></js_store_select> -->
  451 +
  452 + <block wx:for="{{template_arr}}">
  453 + <block wx:if="{{item.content.is_top==1}}">
  454 + <!--如果是搜索框的时候 -->
  455 + <block wx:if="{{item.ename=='searchbox'}}">
  456 + <searchbox object="{{item.content}}" transparent="{{searchbox_transparent}}" nav_backgroundColor="{{nav_backgroundColor ? '#fff' :'#fff'}}"></searchbox>
  457 + </block>
  458 + <!-- <block wx:if="{{item.ename=='store_select'}}">
  459 + <store_select object="{{item.content}}"></store_select>
  460 + </block> -->
  461 + </block>
  462 + </block>
  463 + </view>
  464 + <block wx:for="{{template_arr}}">
  465 + <!--广告组合-->
  466 + <block wx:if="{{item.ename=='advertising' && item.content.full_screen==1 && is_full_screen_navigation_index==index}}">
  467 + <advertising object="{{item.content}}" bindbutColorEvent="bindbut_color_event_fn" is_full_screen_navigation_index="{{is_full_screen_navigation_index}}"></advertising>
  468 + </block>
441 469 </block>
  470 + </block>
  471 +
  472 + <block wx:else>
  473 + <!-- 置顶层 -->
  474 + <view class="dis_top" style="position:fixed">
  475 + <top_nav nav_type="{{0}}" nav_frontColor="{{nav_frontColor}}" nav_backgroundColor="{{nav_backgroundColor}}" nav_title="{{nav_title}}"></top_nav>
  476 + <!-- 关注公众号的显示 -->
  477 + <view id="off_top" wx:if="{{is_gz_h5}}">
  478 + <official-account></official-account>
  479 + </view>
  480 +
  481 + <!-- <js_store_select id="js_store_select" bindup_storid="get_new_storid" transparent="{{0}}" bgcoler="{{nav_backgroundColor}}" anclor="{{nav_but_color}}" ></js_store_select> -->
  482 +
  483 + <block wx:for="{{template_arr}}">
  484 + <block wx:if="{{item.content.is_top==1}}">
  485 + <!--如果是搜索框的时候 -->
  486 + <block wx:if="{{item.ename=='searchbox'}}">
  487 + <searchbox object="{{item.content}}"></searchbox>
  488 + </block>
  489 + <!-- <block wx:if="{{item.ename=='store_select'}}">-->
  490 + <!-- <store_select object="{{item.content}}"></store_select>-->
  491 + <!-- </block>-->
  492 +
  493 + </block>
  494 + </block>
  495 + </view>
  496 +
  497 + <!-- 撑开层 -->
  498 + <view>
  499 + <!-- 顶部导航撑开层 -->
  500 + <top_nav nav_type="{{-1}}" nav_frontColor="{{nav_frontColor}}" nav_backgroundColor="{{nav_backgroundColor}}" nav_title="{{nav_title}}"></top_nav>
  501 + <!-- 即时零售,门店选择撑开层 -->
  502 + <!-- <view style="width: 100%;height: 88rpx;"></view> -->
  503 + <view wx:if="{{is_gz_h5 && is_ok_h5}}" style="height: 84px;flex-shrink:0"></view>
  504 + <block wx:for="{{template_arr}}">
  505 + <block wx:if="{{item.content.is_top==1}}">
  506 + <view style="height:{{item.content.style==1 ? 110 : 88 }}rpx"></view>
  507 + </block>
  508 + </block>
  509 +
  510 + </view>
  511 + </block>
  512 +
442 513  
443   - </view>
444 514  
445 515 <block wx:for="{{template_arr}}" wx:key="index">
446 516 <view>
... ... @@ -453,13 +523,12 @@
453 523 <shopname object="{{item.content}}"></shopname>
454 524 </block>
455 525 <!--广告组合-->
456   - <block wx:if="{{item.ename=='advertising'}}">
  526 + <block wx:if="{{item.ename=='advertising' && item.content.full_screen!=1}}">
457 527 <advertising object="{{item.content}}"></advertising>
458 528 </block>
459 529 <!--商品分组-->
460 530 <block wx:if="{{item.ename=='goodsGroup' || item.ename=='goodsGroupNew'}}">
461 531 <goodsGroup class="{{'goodsGroup' + index}}" object="{{item.content}}" sticky="{{template_arr[0].content.is_top}}"></goodsGroup>
462   -
463 532 </block>
464 533 <!--通知-->
465 534 <block wx:if="{{item.ename=='notice'}}">
... ... @@ -490,16 +559,28 @@
490 559 </block>
491 560 <!-- 热区切图 -->
492 561 <block wx:if="{{item.ename=='heatCutDiagram'}}">
493   - <heat_img object="{{item.content}}" ></heat_img>
  562 + <heat_img object="{{item.content}}"></heat_img>
494 563 </block>
495 564 <!--标题-->
496 565 <block wx:if="{{item.ename=='title'}}">
497 566 <title object="{{item.content}}"></title>
498 567 </block>
  568 + <!--悬浮集-->
  569 + <block wx:if="{{item.ename=='floatingBox'}}">
  570 + <floatingBox farr="{{item.content}}" is_show_top="{{is_show_top}}" loaction_index="{{item.loaction_index}}"></floatingBox>
  571 + </block>
499 572 <!--悬浮窗口-->
500   - <block wx:if="{{item.ename=='floatingWindow'}}">
  573 + <!-- <block wx:if="{{item.ename=='floatingWindow'}}">
501 574 <floatingWindow object="{{item.content}}"></floatingWindow>
502   - </block>
  575 + </block> -->
  576 + <!--在线上客服-->
  577 + <!-- <block wx:if="{{item.ename=='onlineService'}}">
  578 + <service object="{{item.content}}"></service>
  579 + </block> -->
  580 + <!--扫一扫-->
  581 + <!-- <block wx:if="{{item.ename=='scan'}}">
  582 + <scan object="{{item.content}}"></scan>
  583 + </block> -->
503 584 <!--辅助空白-->
504 585 <block wx:if="{{item.ename=='white'}}">
505 586 <assist object="{{item.content}}"></assist>
... ... @@ -508,14 +589,7 @@
508 589 <block wx:if="{{item.ename=='picMix'}}">
509 590 <picMax object="{{item.content}}"></picMax>
510 591 </block>
511   - <!--在线上客服-->
512   - <block wx:if="{{item.ename=='onlineService'}}">
513   - <service object="{{item.content}}"></service>
514   - </block>
515   - <!--扫一扫-->
516   - <block wx:if="{{item.ename=='scan'}}">
517   - <scan object="{{item.content}}"></scan>
518   - </block>
  592 +
519 593 <!-- 门店选择 -->
520 594 <block wx:if="{{item.ename=='store_select' && item.content.is_top!=1}}">
521 595 <store_select object="{{item.content}}"></store_select>
... ... @@ -526,8 +600,8 @@
526 600 <presell object="{{item.content}}"></presell>
527 601 </block>
528 602 <block wx:if="{{item.ename=='presaleNew'}}">
529   - <diy_public object="{{item.content}}" prom_type="8"></diy_public>
530   - </block>
  603 + <diy_public object="{{item.content}}" prom_type="8"></diy_public>
  604 + </block>
531 605 <!-- 团购 -->
532 606 <block wx:if="{{item.ename=='groupbuy'}}">
533 607 <groupbuy object="{{item.content}}"></groupbuy>
... ...
pages/template/index.js
... ... @@ -4,81 +4,115 @@ var t = getApp(),
4 4 os = t.globalData.setting,
5 5 ut = require("../../utils/util.js"),
6 6 com = require("../../utils/common.js");
7   - var regeneratorRuntime = require('../../utils/runtime.js');
8   - var api = require('../../api/api.js');
9   - var appd = getApp().globalData;
  7 +var regeneratorRuntime = require('../../utils/runtime.js');
  8 +var api = require('../../api/api.js');
  9 +var appd = getApp().globalData;
10 10  
11 11 Page({
12 12 data: {
13 13 url: os.imghost,
14   - temp_id:0,
15   - goodsGroupArr:[]
  14 + temp_id: 0,
  15 + goodsGroupArr: [],
  16 + //满屏顶部导航参数------------
  17 + is_full_screen_navigation: false, //是否满屏
  18 + is_full_screen_navigation_index: -1, //广告轮播满屏下标
  19 + nav_title: '首页',
  20 + nav_frontColor: "#000",
  21 + nav_backgroundColor: "#fff",
  22 + nav_type: 1, //导航类型
  23 + searchbox_transparent: 1, //搜索框背景是否透明
  24 +
  25 + nav_but_color: '#32ACF9', //导航按钮颜色
  26 + sele_pickup: null, //默认门店
  27 + // nav_bg_color:'#e823e8', //导航按钮颜色
  28 + //----------------
  29 + is_show_top: 0, //是否置顶显示
16 30 },
17 31  
18   - onLoad: function(e) {
  32 + onLoad: function (e) {
19 33 var th = this;
20   - this.data.temp_id=e.scene;
21   - if(!this.data.temp_id)
22   - this.data.temp_id=e.sence;
23   - if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,})
24   -
25   - var first_leader = e.first_leader;
26   - if (first_leader) {
27   - //-- user_id代过来免登录 --
28   - getApp().globalData.first_leader = first_leader;
29   - //调用接口判断是不是会员
30   - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
31   - if (res.data.code == 0) {
32   - getApp().globalData.guide_id = res.data.data.id;
33   - getApp().globalData.guide_pick_id= res.data.data.pickup_id
34   - }
35   - })
36   - }
  34 + this.data.temp_id = e.scene;
  35 + if (!this.data.temp_id)
  36 + this.data.temp_id = e.sence;
  37 + if (!this.data.temp_id) wx.showModal({ title: "未读取到模板ID", })
  38 +
  39 + var first_leader = e.first_leader;
  40 + if (first_leader) {
  41 + //-- user_id代过来免登录 --
  42 + getApp().globalData.first_leader = first_leader;
  43 + //调用接口判断是不是会员
  44 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  45 + if (res.data.code == 0) {
  46 + getApp().globalData.guide_id = res.data.data.id;
  47 + getApp().globalData.guide_pick_id = res.data.data.pickup_id
  48 + }
  49 + })
  50 +
  51 + }
  52 +
  53 + getApp().getConfig(function (e) {
  54 + //--首页的问题--
  55 + if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) {
  56 + wx.setNavigationBarTitle({
  57 + title: getApp().globalData.config.store_name,
  58 + });
  59 + th.setData({
  60 + nav_title: getApp().globalData.config.store_name
  61 + })
  62 + } else {
  63 + wx.setNavigationBarTitle({
  64 + title: getApp().globalData.setting.appName,
  65 + });
  66 + th.setData({
  67 + nav_title: getApp().globalData.setting.appName,
  68 + })
  69 + };
  70 + });
  71 +
37 72  
38 73  
39   -
40 74 },
41 75  
42 76 async onShow() {
43   - getApp().check_can_share();
  77 + getApp().check_can_share();
44 78 var th = this;
45 79 await this.init_load();
46 80 //如果是自定义模板
47 81 if (this.data.isTemplate) {
48   -
49   - }
  82 +
  83 + }
50 84 },
51 85 //获取商品模块实例
52   - newGoodsGroup(){
53   - let arr=[]
  86 + newGoodsGroup() {
  87 + let arr = []
54 88 if (this.data.template_arr.length == 0) {
55 89 return
56 90 }
57   - this.data.template_arr.map((item,index)=>{
  91 + this.data.template_arr.map((item, index) => {
58 92 if (item.ename == 'goodsGroup') {
59 93 arr.push(`goodsGroup${index}`)
60 94 }
61 95 })
62 96 if (arr.length > 0) {
63 97 this.setData({
64   - goodsGroupArr : arr
  98 + goodsGroupArr: arr
65 99 })
66   - arr.map(item=>{
67   - let a = '.'+item
  100 + arr.map(item => {
  101 + let a = '.' + item
68 102 this[item] = this.selectComponent(a);
69 103 })
70 104 }
71 105 },
72 106 //当隐藏的时候就关闭计时器
73   - onHide: function() {
74   -
  107 + onHide: function () {
  108 +
75 109 },
76 110 //同步初始加载
77 111 async init_load() {
78 112 var th = this;
79 113 //因为营销版本的功能包含了自定义模板的功能,是同时的
80 114 //读取全局是否有弄自定义模板
81   - await getApp().request.promiseGet("/api/weshop/store_module/get/"+th.data.temp_id+"/4",{1:1} ).then(res => {
  115 + await getApp().request.promiseGet("/api/weshop/store_module/get/" + th.data.temp_id + "/4", { 1: 1 }).then(res => {
82 116 var data = res.data.data;
83 117 if (data) {
84 118 var temp_data = data;
... ... @@ -86,114 +120,228 @@ Page({
86 120 title: temp_data.page_title,
87 121 });
88 122 var t_arr = JSON.parse(temp_data.json_str);
  123 + //增加判断是否是满屏
  124 + let is_full_screen_navigation = false
  125 + let is_full_screen_navigation_index = -1
  126 + let nav_but_color = "#32ACF9"
  127 + let left_arr = [] //左边悬浮
  128 + let right_arr=[] //右边悬浮
  129 + let floatw=null //悬浮窗口
  130 + if (t_arr) {
  131 + t_arr.map((item, index) => {
  132 + if (item && item.content && item.content.full_screen == 1 && !is_full_screen_navigation) {
  133 + is_full_screen_navigation = true
  134 + is_full_screen_navigation_index = index
  135 + try {
  136 + nav_but_color = item.content.data[0].but_color
  137 + } catch (error) { }
  138 + }
  139 + if (item.ename=='floatingWindow') {
  140 + floatw = item
  141 + }
  142 + if (item.ename=='backTop' || item.ename=='onlineService' || item.ename=='scan' || item.ename=='floatingWindow') {
  143 + right_arr.push(item)
  144 + }
  145 + })
  146 + }
  147 + if (floatw && floatw.content) {
  148 + let fi = right_arr.findIndex(ite=>ite.ename=='floatingWindow')
  149 + let datas={}
  150 + if (!floatw.content.data) { //兼容旧的悬浮窗口
  151 + datas.AppId= floatw.content.AppId
  152 + datas.feedId= floatw.content.feedId
  153 + datas.finderUserName= floatw.content.finderUserName
  154 + datas.img=floatw.content.img
  155 + datas.video_type= floatw.content.video_type
  156 + datas.wxapp_url= floatw.content.wxapp_url
  157 + datas.wxapp_url_title=floatw.content.wxapp_url_title
  158 + floatw.content.data=[datas]
  159 + }
  160 + if (floatw.content.loaction_index==1) {
  161 + right_arr.splice(fi,1,floatw)
  162 + // right_arr.unshift(floatw)
  163 + }else{
  164 + left_arr.unshift(floatw)
  165 + right_arr.splice(fi,1)
  166 + }
  167 + }
  168 + if (left_arr.length>0) {
  169 + let obj={
  170 + ename:'floatingBox',
  171 + content:left_arr,
  172 + loaction_index:0
  173 + }
  174 + t_arr.push(obj)
  175 + }
  176 + if (right_arr.length>0) {
  177 + let obj={
  178 + ename:'floatingBox',
  179 + content:right_arr,
  180 + loaction_index:1
  181 + }
  182 + t_arr.push(obj)
  183 + }
  184 +
89 185 th.setData({
90   - share_title:temp_data.page_title,
  186 + nav_but_color,
  187 + is_full_screen_navigation,
  188 + is_full_screen_navigation_index,
  189 + share_title: temp_data.page_title,
91 190 template_arr: t_arr,
92 191 isTemplate: 1,
93 192 bgcolor_t: temp_data.bkcolor
94 193 });
95   - setTimeout(()=>{
  194 + setTimeout(() => {
96 195 th.newGoodsGroup()
97   - },1000)
  196 + }, 1000)
98 197  
99 198 //---如果有设定顶部的颜色的时候--
100   - if(temp_data.top_color && temp_data.top_color!='null' ){
  199 + if (temp_data.top_color && temp_data.top_color != 'null') {
101 200  
102   - var top_w_color="#ffffff";
103   - if(temp_data.top_word_color && temp_data.top_word_color=='black'){
104   - top_w_color="#000000";
105   - }
  201 + var top_w_color = "#ffffff";
  202 + if (temp_data.top_word_color && temp_data.top_word_color == 'black') {
  203 + top_w_color = "#000000";
  204 + }
106 205  
107 206 wx.setNavigationBarColor({
108 207 frontColor: top_w_color, // 必写项
109 208 backgroundColor: temp_data.top_color, // 必写项
110 209 })
  210 + th.setData({
  211 + // nav_frontColor: top_w_color, // 必写项
  212 + nav_backgroundColor: temp_data.top_color, // 必写项
  213 + })
111 214 }
112   -
  215 +
113 216 }
114 217 })
115   -
116 218  
117   -
  219 +
  220 +
  221 + },
  222 + //广告轮播满屏按钮颜色传递方法
  223 + bindbut_color_event_fn(even) {
  224 + let nav_but_color = even.detail.but_color
  225 + this.setData({
  226 + nav_but_color
  227 + })
118 228 },
  229 + onPageScroll: function (e) {
  230 + //满屏模式监听
  231 + let num = e.scrollTop
  232 + if (this.data.is_full_screen_navigation) {
  233 + let nav_type = this.data.nav_type
  234 + if (num >= 100 && nav_type) {
  235 + this.setData({
  236 + nav_type: 0,
  237 + searchbox_transparent: 0,
  238 + nav_frontColor: '#000'
  239 + })
  240 + // this.data.nav_type = 0
  241 + }
  242 + if (num < 100 && !nav_type) {
  243 + this.setData({
  244 + nav_type: 1,
  245 + searchbox_transparent: 1,
  246 + nav_frontColor: '#000'
  247 + })
  248 + // this.data.nav_type = 1
  249 + }
  250 + }
  251 + //-----------end-------
  252 + //是否显示置顶
  253 + if (num > 400) {
  254 + this.setData({
  255 + is_show_top: 1
  256 + })
  257 + } else {
  258 + this.setData({
  259 + is_show_top: 0
  260 + })
  261 + }
  262 + //----end------
  263 +
  264 + // this.data.scrollTop = e.scrollTop;
  265 + // var t = getCurrentPages();
  266 + // "pages/index/index/index" == t[t.length - 1].route;
119 267  
120   - onPullDownRefresh: function(e) {
121   -
122 268 },
  269 + onPullDownRefresh: function (e) {
123 270  
124   -
125   - onShareAppMessage:async function(e) {
126   - var th=this;
127   - getApp().globalData.no_clear=1;
128   - getApp().getConfig(await function(e){
129   - th.setData({
130   - store_config:e
131   - })
132   - }.bind(this))
  271 + },
133 272  
134   - var url= `pages/template/index?sence=`+this.data.temp_id;
135   - var userInfo = getApp().globalData.userInfo;
136   - //是分销商才带
137   - if (userInfo) {
138   - url += "&first_leader=" + userInfo.user_id;
139   - }
140 273  
141   - var ob = {
142   - title: this.data.share_title,
143   - path: url,
144   - //imageUrl:this.data.url+this.data.store_config.store_logo,
145   - };
146   - return ob;
  274 + onShareAppMessage: async function (e) {
  275 + var th = this;
  276 + getApp().globalData.no_clear = 1;
  277 + getApp().getConfig(await function (e) {
  278 + th.setData({
  279 + store_config: e
  280 + })
  281 + }.bind(this))
  282 +
  283 + var url = `pages/template/index?sence=` + this.data.temp_id;
  284 + var userInfo = getApp().globalData.userInfo;
  285 + //是分销商才带
  286 + if (userInfo) {
  287 + url += "&first_leader=" + userInfo.user_id;
  288 + }
  289 +
  290 + var ob = {
  291 + title: this.data.share_title,
  292 + path: url,
  293 + //imageUrl:this.data.url+this.data.store_config.store_logo,
  294 + };
  295 + return ob;
147 296 },
148 297  
149 298 /**
150 299 * 用户分享朋友圈
151 300 */
152   - async onShareTimeline(){
  301 + async onShareTimeline() {
153 302  
154   - var th=this;
155   - getApp().globalData.no_clear=1;
156   - getApp().getConfig(await function(e){
  303 + var th = this;
  304 + getApp().globalData.no_clear = 1;
  305 + getApp().getConfig(await function (e) {
157 306 th.setData({
158   - store_config:e
  307 + store_config: e
159 308 })
160 309 }.bind(this))
161   - var {share_title,temp_id,store_config} = this.data;
162   - var url= `sence=${temp_id}`;
  310 + var { share_title, temp_id, store_config } = this.data;
  311 + var url = `sence=${temp_id}`;
163 312  
164   - var userInfo = getApp().globalData.userInfo;
165   - //是分销商才带
166   - if (userInfo) {
167   - url += "&first_leader=" + userInfo.user_id;
168   - }
  313 + var userInfo = getApp().globalData.userInfo;
  314 + //是分销商才带
  315 + if (userInfo) {
  316 + url += "&first_leader=" + userInfo.user_id;
  317 + }
169 318  
170 319 var ob = {
171   - title:share_title,
172   - query:url,
173   - //imageUrl:this.data.url+store_config.store_logo,
  320 + title: share_title,
  321 + query: url,
  322 + //imageUrl:this.data.url+store_config.store_logo,
174 323 };
175 324 console.log(ob);
176 325 return ob;
177   -},
178   - //---加载更多是靠这个函数----
179   - onReachBottom: function() {
180   - if(getApp().globalData.func_list)
181   - {
182   - for(let i in getApp().globalData.func_list){
183   - let item=getApp().globalData.func_list[i];
184   - item.re_show();
185   - }
186   - }
187   -
188   - //自定义时商品自动加载更多
189   - let goodsGroupArr = this.data.goodsGroupArr
190   - if (this.data.isTemplate && goodsGroupArr.length >0) {
191   - goodsGroupArr.map(item=>{
192   - this[item].automore()
193   - })
  326 + },
  327 + //---加载更多是靠这个函数----
  328 + onReachBottom: function () {
  329 + if (getApp().globalData.func_list) {
  330 + for (let i in getApp().globalData.func_list) {
  331 + let item = getApp().globalData.func_list[i];
  332 + item.re_show();
194 333 }
195   - },
  334 + }
  335 +
  336 + //自定义时商品自动加载更多
  337 + let goodsGroupArr = this.data.goodsGroupArr
  338 + if (this.data.isTemplate && goodsGroupArr.length > 0) {
  339 + goodsGroupArr.map(item => {
  340 + this[item].automore()
  341 + })
  342 + }
  343 + },
  344 +
  345 +
196 346  
197   -
198   -
199 347 });
200 348 \ No newline at end of file
... ...
pages/template/index.json
... ... @@ -4,6 +4,7 @@
4 4 "usingComponents": {
5 5 "goods_recommend":"/components/goods_list/goods_list",
6 6 "nav": "/components/diy_nav/diy_nav",
  7 + "top_nav": "/components/diy_top_nav/diy_top_nav",
7 8 "advertising":"/components/diy_advertising/diy_advertising",
8 9 "groupbuy": "/components/diy_groupbuy/diy_groupbuy",
9 10 "goodsGroup": "/components/diy_goodsGroup/diy_goodsGroup",
... ... @@ -24,8 +25,10 @@
24 25 "service": "/components/diy_service/diy_service",
25 26 "scan": "/components/diy_scan/diy_scan",
26 27 "floatingWindow": "/components/diy_floatingWindow/diy_floatingWindow",
  28 + "floatingBox": "/components/diy_floatingBox/diy_floatingBox",
27 29 "presell": "/components/diy_pregoods/diy_pregoods"
28   - },
  30 + },
29 31 "enablePullDownRefresh": false,
30   - "onReachBottomDistance":300
  32 + "onReachBottomDistance":300,
  33 + "navigationStyle":"custom"
31 34 }
32 35 \ No newline at end of file
... ...
pages/template/index.wxml
1 1 <view class="container" style="background-color:{{bgcolor_t}}">
  2 +
  3 +
  4 + <block wx:if="{{is_full_screen_navigation}}">
  5 + <view class="dis_top" style="position: fixed;">
  6 + <top_nav nav_type="{{nav_type}}" nav_frontColor="{{nav_frontColor}}" nav_backgroundColor="{{nav_backgroundColor ? '#fff' :'#fff'}}" nav_title="{{nav_title}}"></top_nav>
  7 +
  8 + <!-- <js_store_select bindup_storid="get_new_storid" id="js_store_select" transparent="{{searchbox_transparent}}" bgcoler="{{nav_backgroundColor ? '#fff' :'#fff'}}" anclor="{{nav_but_color}}" ></js_store_select> -->
  9 +
  10 + <block wx:for="{{template_arr}}">
  11 + <block wx:if="{{item.content.is_top==1}}">
  12 + <!--如果是搜索框的时候 -->
  13 + <block wx:if="{{item.ename=='searchbox'}}">
  14 + <searchbox object="{{item.content}}" transparent="{{searchbox_transparent}}" nav_backgroundColor="{{nav_backgroundColor ? '#fff' :'#fff'}}"></searchbox>
  15 + </block>
  16 + <!-- <block wx:if="{{item.ename=='store_select'}}">
  17 + <store_select object="{{item.content}}"></store_select>
  18 + </block> -->
  19 + </block>
  20 + </block>
  21 + </view>
  22 + <block wx:for="{{template_arr}}">
  23 + <!--广告组合-->
  24 + <block wx:if="{{item.ename=='advertising' && item.content.full_screen==1 && is_full_screen_navigation_index==index}}">
  25 + <advertising object="{{item.content}}" bindbutColorEvent="bindbut_color_event_fn" is_full_screen_navigation_index="{{is_full_screen_navigation_index}}"></advertising>
  26 + </block>
  27 + </block>
  28 + </block>
  29 +
  30 + <block wx:else>
  31 + <!-- 置顶层 -->
  32 + <view class="dis_top" style="position:fixed">
  33 + <top_nav nav_type="{{0}}" nav_frontColor="{{nav_frontColor}}" nav_backgroundColor="{{nav_backgroundColor}}" nav_title="{{nav_title}}"></top_nav>
  34 + <!-- 关注公众号的显示 -->
  35 + <view id="off_top" wx:if="{{is_gz_h5}}">
  36 + <official-account></official-account>
  37 + </view>
  38 +
  39 + <!-- <js_store_select id="js_store_select" bindup_storid="get_new_storid" transparent="{{0}}" bgcoler="{{nav_backgroundColor}}" anclor="{{nav_but_color}}" ></js_store_select> -->
  40 +
  41 + <block wx:for="{{template_arr}}">
  42 + <block wx:if="{{item.content.is_top==1}}">
  43 + <!--如果是搜索框的时候 -->
  44 + <block wx:if="{{item.ename=='searchbox'}}">
  45 + <searchbox object="{{item.content}}"></searchbox>
  46 + </block>
  47 + <!-- <block wx:if="{{item.ename=='store_select'}}">-->
  48 + <!-- <store_select object="{{item.content}}"></store_select>-->
  49 + <!-- </block>-->
  50 +
  51 + </block>
  52 + </block>
  53 + </view>
  54 +
  55 + <!-- 撑开层 -->
  56 + <view>
  57 + <!-- 顶部导航撑开层 -->
  58 + <top_nav nav_type="{{-1}}" nav_frontColor="{{nav_frontColor}}" nav_backgroundColor="{{nav_backgroundColor}}" nav_title="{{nav_title}}"></top_nav>
  59 + <!-- 即时零售,门店选择撑开层 -->
  60 + <!-- <view style="width: 100%;height: 88rpx;"></view> -->
  61 + <view wx:if="{{is_gz_h5 && is_ok_h5}}" style="height: 84px;flex-shrink:0"></view>
  62 + <block wx:for="{{template_arr}}">
  63 + <block wx:if="{{item.content.is_top==1}}">
  64 + <view style="height:{{item.content.style==1 ? 110 : 88 }}rpx"></view>
  65 + </block>
  66 + </block>
  67 +
  68 + </view>
  69 + </block>
  70 +
  71 +
2 72 <block wx:for="{{template_arr}}" wx:key="{{index}}">
3 73 <view>
4 74 <!--导航-->
... ... @@ -10,10 +80,10 @@
10 80 <shopname object="{{item.content}}"></shopname>
11 81 </block>
12 82 <!--广告组合-->
13   - <block wx:if="{{item.ename=='advertising'}}">
  83 + <block wx:if="{{item.ename=='advertising' && item.content.full_screen!=1}}">
14 84 <advertising object="{{item.content}}"></advertising>
15 85 </block>
16   - <!--商品分组-->
  86 + <!--商品分组-->
17 87 <block wx:if="{{item.ename=='goodsGroup' || item.ename=='goodsGroupNew'}}">
18 88 <goodsGroup class="{{'goodsGroup' + index}}" object="{{item.content}}"></goodsGroup>
19 89 </block>
... ... @@ -33,7 +103,7 @@
33 103 <mvideo object="{{item.content}}"></mvideo>
34 104 </block>
35 105 <!--搜索-->
36   - <block wx:if="{{item.ename=='searchbox'}}">
  106 + <block wx:if="{{item.ename=='searchbox' && item.content.is_top!=1}}">
37 107 <searchbox object="{{item.content}}"></searchbox>
38 108 </block>
39 109 <!--天天拼单-->
... ... @@ -49,7 +119,7 @@
49 119 </block>
50 120 <!-- 热区切图 -->
51 121 <block wx:if="{{item.ename=='heatCutDiagram'}}">
52   - <heat_img object="{{item.content}}" ></heat_img>
  122 + <heat_img object="{{item.content}}"></heat_img>
53 123 </block>
54 124 <!-- <block wx:if="{{item.ename=='seckillNew'}}">
55 125 <diy_public object="{{item.content}}" prom_type="1"></diy_public>
... ... @@ -62,22 +132,27 @@
62 132 <block wx:if="{{item.ename=='white'}}">
63 133 <assist object="{{item.content}}"></assist>
64 134 </block>
65   - <!--悬浮窗口-->
66   - <block wx:if="{{item.ename=='floatingWindow'}}">
67   - <floatingWindow object="{{item.content}}"></floatingWindow>
68   - </block>
69   - <!--图片组合-->
  135 +
  136 + <!--图片组合-->
70 137 <block wx:if="{{item.ename=='picMix'}}">
71 138 <picMax object="{{item.content}}"></picMax>
72 139 </block>
73   - <!--在线上客服-->
74   - <block wx:if="{{item.ename=='onlineService'}}">
75   - <service object="{{item.content}}"></service>
76   - </block>
77   - <!--扫一扫-->
78   - <block wx:if="{{item.ename=='scan'}}">
79   - <scan object="{{item.content}}"></scan>
80   - </block>
  140 + <!--悬浮集-->
  141 + <block wx:if="{{item.ename=='floatingBox'}}">
  142 + <floatingBox farr="{{item.content}}" is_show_top="{{is_show_top}}" loaction_index="{{item.loaction_index}}"></floatingBox>
  143 + </block>
  144 + <!--悬浮窗口-->
  145 + <!-- <block wx:if="{{item.ename=='floatingWindow'}}">
  146 + <floatingWindow object="{{item.content}}"></floatingWindow>
  147 + </block> -->
  148 + <!--在线上客服-->
  149 + <!-- <block wx:if="{{item.ename=='onlineService'}}">
  150 + <service object="{{item.content}}"></service>
  151 + </block> -->
  152 + <!--扫一扫-->
  153 + <!-- <block wx:if="{{item.ename=='scan'}}">
  154 + <scan object="{{item.content}}"></scan>
  155 + </block> -->
81 156  
82 157 <!-- 预售 -->
83 158 <block wx:if="{{item.ename=='presale'}}">
... ... @@ -86,22 +161,22 @@
86 161 <block wx:if="{{item.ename=='presaleNew'}}">
87 162 <diy_public object="{{item.content}}" prom_type="8"></diy_public>
88 163 </block>
89   - <!-- 团购 -->
90   - <block wx:if="{{item.ename=='groupbuy'}}">
91   - <groupbuy object="{{item.content}}"></groupbuy>
92   - </block>
93   - <block wx:if="{{item.ename=='groupbuyNew'}}">
  164 + <!-- 团购 -->
  165 + <block wx:if="{{item.ename=='groupbuy'}}">
  166 + <groupbuy object="{{item.content}}"></groupbuy>
  167 + </block>
  168 + <block wx:if="{{item.ename=='groupbuyNew'}}">
94 169 <diy_public object="{{item.content}}" prom_type="2"></diy_public>
95 170 </block>
96 171  
97 172 <!-- 幸运购 -->
98   - <block wx:if="{{item.ename=='luckyactivity'}}">
99   - <luckyGo object="{{item.content}}"></luckyGo>
100   - </block>
101   - <block wx:if="{{item.ename=='luckyactivityNew'}}">
102   - <!-- <luckyGo object="{{item.content}}"></luckyGo> -->
103   - <diy_public object="{{item.content}}" prom_type="9"></diy_public>
104   - </block>
  173 + <block wx:if="{{item.ename=='luckyactivity'}}">
  174 + <luckyGo object="{{item.content}}"></luckyGo>
  175 + </block>
  176 + <block wx:if="{{item.ename=='luckyactivityNew'}}">
  177 + <!-- <luckyGo object="{{item.content}}"></luckyGo> -->
  178 + <diy_public object="{{item.content}}" prom_type="9"></diy_public>
  179 + </block>
105 180 </view>
106 181 </block>
107 182 </view>
... ...
pages/template/index.wxss
... ... @@ -15,6 +15,13 @@
15 15 width: 50rpx;
16 16 height: 45rpx;
17 17 }
  18 +.dis_top {
  19 + position: sticky;
  20 + top: 0;
  21 + left: 0;
  22 + width: 100%;
  23 + z-index: 100000;
  24 +}
18 25  
19 26 .logo {
20 27 width: 48rpx;
... ...
pages/user/index/index.js
... ... @@ -53,8 +53,10 @@ Page({
53 53 is_close_chuzhi:0,
54 54 brcode:'',
55 55 showvipcode:false,
56   - pshow:0
  56 + pshow:0,
57 57  
  58 +
  59 + is_show_yq:0, //是不是要显示邀请
58 60 },
59 61 goto_nav: function (e) {
60 62 var th = this;
... ... @@ -103,9 +105,6 @@ Page({
103 105 }
104 106 })
105 107  
106   - if(!getApp().globalData.user_id){
107   - ut.new_user_go(os.stoid,first_leader);
108   - }
109 108  
110 109 }else{
111 110 // app.getUserFir();
... ... @@ -201,362 +200,369 @@ Page({
201 200 need_money = 0,
202 201 cur_g_num = 0;
203 202  
204   - /*------会员登录------*/
205   - var e = getApp().globalData.userInfo;
206   -
207 203  
208   -
209   - if (e != undefined && e != null && e.mobile) {
210   -
211   - if (e.card_field != '' && e.card_field != null && e.card_field != undefined && e.card_expiredate) {
212   - var now = ut.gettimestamp();
213   - var str = e.card_expiredate.replace(/-/g, '/');;
214   - var end = new Date(str);
215   - end = Date.parse(end) / 1000;
216   - if (now < end) {
217   - this.puls_user();
  204 + //先查看一下是不是系统会员
  205 + getApp().waitfor_login(()=> {
  206 + if (!getApp().globalData.user_id) {
  207 + if(!this.data.is_show_yq){
  208 + ut.new_user_go(os.stoid, getApp().globalData.first_leader);
  209 + this.data.is_show_yq=1; //只显示一次
218 210 }
219   - }
  211 + }else{
  212 + /*------会员登录------*/
  213 + var e = getApp().globalData.userInfo;
  214 + if (e != undefined && e != null && e.mobile) {
220 215  
  216 + if (e.card_field != '' && e.card_field != null && e.card_field != undefined && e.card_expiredate) {
  217 + var now = ut.gettimestamp();
  218 + var str = e.card_expiredate.replace(/-/g, '/');;
  219 + var end = new Date(str);
  220 + end = Date.parse(end) / 1000;
  221 + if (now < end) {
  222 + this.puls_user();
  223 + }
  224 + }
221 225  
222 226  
223   - if(this.data.has_rj==0){
224   - var portrait_req = {
225   - ApiName:'api.slimming.member.portrait',
226   - store_id: e.store_id,
227   - //StaffId: that.idd,
228   - vipid: e.erpvipid,
229   - };
230 227  
231   - getApp().getConfig(()=>{
232   - var url = '/api/weshop/delphiapi/pageErpApi?accdb='+getApp().globalData.config.erpid;
233   - getApp().request.promiseGet(url, {
234   - data: portrait_req
235   - })
236   - .then((res) => {
237   - if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
238   - th.setData({has_rj:1})
239   - }else {
240   - th.setData({has_rj:-1})
241   - }
  228 + if(this.data.has_rj==0){
  229 + var portrait_req = {
  230 + ApiName:'api.slimming.member.portrait',
  231 + store_id: e.store_id,
  232 + //StaffId: that.idd,
  233 + vipid: e.erpvipid,
  234 + };
242 235  
  236 + getApp().getConfig(()=>{
  237 + var url = '/api/weshop/delphiapi/pageErpApi?accdb='+getApp().globalData.config.erpid;
  238 + getApp().request.promiseGet(url, {
  239 + data: portrait_req
  240 + })
  241 + .then((res) => {
  242 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
  243 + th.setData({has_rj:1})
  244 + }else {
  245 + th.setData({has_rj:-1})
  246 + }
  247 +
  248 + })
243 249 })
244   - })
245 250  
246 251  
247   - }
  252 + }
248 253  
249 254  
250   - // 判断是否开启美业
251   - getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => {
252   - if (res.data.code == 0) {
253   - th.setData({
254   - enableMeiye: res.data.data.EnableMeiye,
  255 + // 判断是否开启美业
  256 + getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => {
  257 + if (res.data.code == 0) {
  258 + th.setData({
  259 + enableMeiye: res.data.data.EnableMeiye,
  260 + });
  261 + };
255 262 });
256   - };
257   - });
258 263  
259   - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => {
260   - if (res.data.code == 0) {
261   - var plusCard = res.data.data;
262   - for (var i = 0; i < plusCard.length; i++) {
263   - if (!plusCard[i].IsStopBuy) { th.setData({ show_buy_plus: 1 }); break; }
264   - }
265   - }
266   - })
  264 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => {
  265 + if (res.data.code == 0) {
  266 + var plusCard = res.data.data;
  267 + for (var i = 0; i < plusCard.length; i++) {
  268 + if (!plusCard[i].IsStopBuy) { th.setData({ show_buy_plus: 1 }); break; }
  269 + }
  270 + }
  271 + })
267 272  
268 273  
269   - this.birthday();
270   - this.is_assistance();
271   -
272   - s.setData({
273   - userInfo: e
274   - });
275   -
276   - //--查询会员权益是否成绩
277   - s.getVison()
278   -
279   - //-- 要调用接口,获取卡的钱 --
280   - var url = "/api/weshop/wxuser/getWxCardInfo?storeId=" + os.stoid + "&userId=" + e.user_id;
281   - rq.get(url, {
282   - isShowLoading: 0,
283   - success: function (su) {
284   - if (su.data.code == 0) {
285   - s.setData({
286   - add_card_data: su.data.data,
287   - });
288   - }
289   - }
290   - });
  274 + this.birthday();
  275 + this.is_assistance();
291 276  
292   - /*-----统计-----*/
293   - rq.get("/api/weshop/order/waitlist", {
294   - isShowLoading: 0,
295   - data: {
296   - user_id: app_d.user_id,isdel:0
297   - },
298   - success: function (su) {
299 277 s.setData({
300   - toji: su.data.data,
  278 + userInfo: e
301 279 });
302   - }
303   - })
304   - /*-----获取线下会员的预存款和优惠券的数量-----*/
305   - rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, {
306   - isShowLoading: 0,
307   - success: function (su) {
308   - if (su.data.code == 0 && su.data.data) {
309   - var data = su.data.data;
310   - if (!data) data = {};
311   - data.cashcount = parseInt(data.cashcount);
312   - s.setData({
313   - udata: data,
314   - });
315   - }
316   -
317   - }
318   - })
319   - /*-----获取会员提现金额-----*/
320   - rq.get("/api/weshop/withdrawals/summoney", {
321   - isShowLoading: 0,
322   - data: {
323   - user_id: e.user_id,
324   - store_id: os.stoid,
325   - status: 0
326   - },
327   - success: function (su) {
328   - if (su.data.code == 0) {
329   - var yuer = parseFloat(th.data.userInfo.user_money -
330   - th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2);
331   - th.setData({
332   - txmon: su.data.data.summoney,
333   - yuer: yuer
334   - });
335   - }
336   - }
337   - })
338 280  
339   - /*-----获取会员包邮券的数量-----*/
340   - rq.get("/api/weshop/userfeemail/page", {
341   - isShowLoading: 0,
342   - data: {
343   - user_id: e.user_id,
344   - store_id: os.stoid,
345   - pageSize: 1,
346   - isuse: 0
347   - },
348   - success: function (su) {
349   - if (su.data.code == 0) {
350   - th.setData({
351   - byquan: parseInt(su.data.data.total)
352   - });
353   - }
354   - }
355   - });
356   -
357   - /*-----物流信息提醒-----*/
358   - rq.get('/api/weshop/order/countDadaOrder', {
359   - isShowLoading: 0,
360   - data: {
361   - user_id: e.user_id,
362   - store_id: os.stoid,
363   - },
364   - success: function (su) {
365   - if (su.data.code == 0) {
366   - th.setData({
367   - countDadaOrder: su.data.data
368   - });
369   - }
370   - }
371   - });
  281 + //--查询会员权益是否成绩
  282 + s.getVison()
  283 +
  284 + //-- 要调用接口,获取卡的钱 --
  285 + var url = "/api/weshop/wxuser/getWxCardInfo?storeId=" + os.stoid + "&userId=" + e.user_id;
  286 + rq.get(url, {
  287 + isShowLoading: 0,
  288 + success: function (su) {
  289 + if (su.data.code == 0) {
  290 + s.setData({
  291 + add_card_data: su.data.data,
  292 + });
  293 + }
  294 + }
  295 + });
372 296  
  297 + /*-----统计-----*/
  298 + rq.get("/api/weshop/order/waitlist", {
  299 + isShowLoading: 0,
  300 + data: {
  301 + user_id: app_d.user_id,isdel:0
  302 + },
  303 + success: function (su) {
  304 + s.setData({
  305 + toji: su.data.data,
  306 + });
  307 + }
  308 + })
  309 + /*-----获取线下会员的预存款和优惠券的数量-----*/
  310 + rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, {
  311 + isShowLoading: 0,
  312 + success: function (su) {
  313 + if (su.data.code == 0 && su.data.data) {
  314 + var data = su.data.data;
  315 + if (!data) data = {};
  316 + data.cashcount = parseInt(data.cashcount);
  317 + s.setData({
  318 + udata: data,
  319 + });
  320 + }
373 321  
  322 + }
  323 + })
  324 + /*-----获取会员提现金额-----*/
  325 + rq.get("/api/weshop/withdrawals/summoney", {
  326 + isShowLoading: 0,
  327 + data: {
  328 + user_id: e.user_id,
  329 + store_id: os.stoid,
  330 + status: 0
  331 + },
  332 + success: function (su) {
  333 + if (su.data.code == 0) {
  334 + var yuer = parseFloat(th.data.userInfo.user_money -
  335 + th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2);
  336 + th.setData({
  337 + txmon: su.data.data.summoney,
  338 + yuer: yuer
  339 + });
  340 + }
  341 + }
  342 + })
374 343  
  344 + /*-----获取会员包邮券的数量-----*/
  345 + rq.get("/api/weshop/userfeemail/page", {
  346 + isShowLoading: 0,
  347 + data: {
  348 + user_id: e.user_id,
  349 + store_id: os.stoid,
  350 + pageSize: 1,
  351 + isuse: 0
  352 + },
  353 + success: function (su) {
  354 + if (su.data.code == 0) {
  355 + th.setData({
  356 + byquan: parseInt(su.data.data.total)
  357 + });
  358 + }
  359 + }
  360 + });
375 361  
376   - //--初始化是否有打勾--
377   - getApp().request.get("/api/weshop/users/grade/vip/init/get", {
378   - data: {
379   - storeId: os.stoid
380   - },
381   - success: function (rs) {
382   - if (rs.data.code == 0 && rs.data.data.isBool) {
383   - th.setData({ is_init: 1 });
384   - /*-----获取会员权益列表-----*/
385   - rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", {
386   - isShowLoading: 0,
387   - data: {
388   - storeId: os.stoid,
389   - pageSize: 100
390   - },
391   - success: async function (res) {
  362 + /*-----物流信息提醒-----*/
  363 + rq.get('/api/weshop/order/countDadaOrder', {
  364 + isShowLoading: 0,
  365 + data: {
  366 + user_id: e.user_id,
  367 + store_id: os.stoid,
  368 + },
  369 + success: function (su) {
  370 + if (su.data.code == 0) {
  371 + th.setData({
  372 + countDadaOrder: su.data.data
  373 + });
  374 + }
  375 + }
  376 + });
392 377  
393   - //判断有没有值,没有值返回
394   - if (!ut.ajax_ok(res)) return false;
395 378  
396   - var arr_data = res.data.data.pageData;
397   - var gid = null,
398   - g_qy_list = null,
399   - cz_vals = 0,
400   - need_money = 0,
401   - backClass = null,
402 379  
403   - GradeName = '';
404 380  
405   - //获取成长值
406   - await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", {
  381 + //--初始化是否有打勾--
  382 + getApp().request.get("/api/weshop/users/grade/vip/init/get", {
  383 + data: {
  384 + storeId: os.stoid
  385 + },
  386 + success: function (rs) {
  387 + if (rs.data.code == 0 && rs.data.data.isBool) {
  388 + th.setData({ is_init: 1 });
  389 + /*-----获取会员权益列表-----*/
  390 + rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", {
  391 + isShowLoading: 0,
407 392 data: {
408 393 storeId: os.stoid,
409   - userId: app_d.user_id
410   - }
411   - }).then(res => {
412   - if (res.data.code == 0 && res.data.data) {
413   - gid = res.data.data.GradeId;
414   - var cz_val = res.data.data.GradeSum;
415   - cz_vals = parseInt(cz_val);
416   - GradeName = res.data.data.GradeName;
417   - }
418   - //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid});
419   - })
420   - var obj = {
421   - cz_val: cz_vals,
422   - GradeName: GradeName,
423   - gradeId: gid,
424   - is_grad_get: 1
425   - };
426   -
427   - // 获取最大值
428   - await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", {
429   - data: {
430   - storeId: os.stoid
431   - }
432   - }).then(res => {
433   - if (res.data.data)
434   - backClass = res.data.data.pageData;
435   - if (backClass) {
436   - var full_cz_val = backClass[backClass.length - 1].BuyGradeSum;
437   - //th.setData({ full_cz_val: full_cz_val});
438   - obj.full_cz_val = full_cz_val
  394 + pageSize: 100
  395 + },
  396 + success: async function (res) {
  397 +
  398 + //判断有没有值,没有值返回
  399 + if (!ut.ajax_ok(res)) return false;
  400 +
  401 + var arr_data = res.data.data.pageData;
  402 + var gid = null,
  403 + g_qy_list = null,
  404 + cz_vals = 0,
  405 + need_money = 0,
  406 + backClass = null,
  407 +
  408 + GradeName = '';
  409 +
  410 + //获取成长值
  411 + await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", {
  412 + data: {
  413 + storeId: os.stoid,
  414 + userId: app_d.user_id
  415 + }
  416 + }).then(res => {
  417 + if (res.data.code == 0 && res.data.data) {
  418 + gid = res.data.data.GradeId;
  419 + var cz_val = res.data.data.GradeSum;
  420 + cz_vals = parseInt(cz_val);
  421 + GradeName = res.data.data.GradeName;
  422 + }
  423 + //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid});
  424 + })
  425 + var obj = {
  426 + cz_val: cz_vals,
  427 + GradeName: GradeName,
  428 + gradeId: gid,
  429 + is_grad_get: 1
  430 + };
  431 +
  432 + // 获取最大值
  433 + await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", {
  434 + data: {
  435 + storeId: os.stoid
  436 + }
  437 + }).then(res => {
  438 + if (res.data.data)
  439 + backClass = res.data.data.pageData;
  440 + if (backClass) {
  441 + var full_cz_val = backClass[backClass.length - 1].BuyGradeSum;
  442 + //th.setData({ full_cz_val: full_cz_val});
  443 + obj.full_cz_val = full_cz_val
  444 + }
  445 + })
  446 +
  447 + //--会员权益中心页的修改--
  448 + for (var i in backClass) {
  449 + var im = backClass[i];
  450 + if (cz_vals < im.BuyGradeSum && need_money == 0) {
  451 + need_money = im.BuyGradeSum;
  452 + obj.need_money = need_money;
  453 + obj.nextGradeName=im.GradeName;
  454 + break;
  455 + }
  456 + }
  457 +
  458 + //获取当前等级的特权
  459 + await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", {
  460 + data: {
  461 + storeId: os.stoid,
  462 + GradeId: gid,
  463 + userId: app_d.user_id,
  464 + pageSize: 100
  465 + }
  466 + }).then(res => {
  467 + if (res.data.data)
  468 + g_qy_list = res.data.data.pageData;
  469 + });
  470 +
  471 + for (var i in arr_data) {
  472 + var item = arr_data[i];
  473 + var FromId = th.check_is_has_qy(item, g_qy_list);
  474 + arr_data[i].ishas = 0;
  475 + if (FromId) {
  476 + arr_data[i].ishas = 1;
  477 + arr_data[i].FromId = FromId;
  478 + }
  479 + }
  480 + arr_data.sort(function (a, b) {
  481 + return b.ishas - a.ishas
  482 + })
  483 +
  484 + //4个4个一组
  485 + var arr = new Array();
  486 + for (var i = 0; i < arr_data.length; i += 4) {
  487 + arr.push(arr_data.slice(i, i + 4));
  488 + }
  489 + //th.setData({ qy_list: arr, need_money: need_money});
  490 + obj.qy_list = arr;
  491 + th.setData(obj);
  492 + obj.is_init=1;
  493 + obj.old_qy_list = arr_data;
  494 + th.setData({qy_data:obj})
439 495 }
440 496 })
  497 + }
  498 + }
  499 + })
441 500  
442   - //--会员权益中心页的修改--
443   - for (var i in backClass) {
444   - var im = backClass[i];
445   - if (cz_vals < im.BuyGradeSum && need_money == 0) {
446   - need_money = im.BuyGradeSum;
447   - obj.need_money = need_money;
448   - obj.nextGradeName=im.GradeName;
449   - break;
450   - }
451   - }
452   -
453   - //获取当前等级的特权
454   - await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", {
455   - data: {
456   - storeId: os.stoid,
457   - GradeId: gid,
458   - userId: app_d.user_id,
459   - pageSize: 100
460   - }
461   - }).then(res => {
462   - if (res.data.data)
463   - g_qy_list = res.data.data.pageData;
464   - });
  501 + /*-- 获取 --*/
  502 + th.requestRecommend();
  503 +
  504 + /*-------系统是否开通等级卡,会员是等级卡-----*/
  505 + getApp().getConfig2(function (e) {
  506 + var t_swi = e.switch_list;
  507 + if (t_swi) t_swi = JSON.parse(t_swi)
  508 + if (t_swi) {
  509 + th.setData({ sys_switch: t_swi });
  510 + var user_tool = [];
  511 + if (t_swi.usertool) user_tool = JSON.parse(t_swi.usertool);
  512 + th.setData({ c_list: user_tool });
  513 + if (t_swi.usercode_vailtime!=null && parseInt(t_swi.usercode_vailtime)>0)
  514 + {
  515 + th.setData({ getusercode_vailtime: t_swi.usercode_vailtime });
  516 + }
  517 + }
465 518  
466   - for (var i in arr_data) {
467   - var item = arr_data[i];
468   - var FromId = th.check_is_has_qy(item, g_qy_list);
469   - arr_data[i].ishas = 0;
470   - if (FromId) {
471   - arr_data[i].ishas = 1;
472   - arr_data[i].FromId = FromId;
473   - }
  519 + if (parseInt(t_swi.rank_switch) == 2) {
  520 + var userInfo = th.data.userInfo;
  521 + if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") {
  522 + var now = ut.gettimestamp();
  523 + var str = userInfo.card_expiredate;
  524 + var end = new Date(str);
  525 + end = Date.parse(end) / 1000;
  526 + //---判断是不是有过期---
  527 + if (now < end) {
  528 + th.setData({
  529 + is_dengji: 1
  530 + })
  531 + } else {
  532 + th.setData({
  533 + is_dengji: 3
  534 + })
474 535 }
475   - arr_data.sort(function (a, b) {
476   - return b.ishas - a.ishas
  536 + } else {
  537 + th.setData({
  538 + is_dengji: 2
477 539 })
478   -
479   - //4个4个一组
480   - var arr = new Array();
481   - for (var i = 0; i < arr_data.length; i += 4) {
482   - arr.push(arr_data.slice(i, i + 4));
483   - }
484   - //th.setData({ qy_list: arr, need_money: need_money});
485   - obj.qy_list = arr;
486   - th.setData(obj);
487   - obj.is_init=1;
488   - obj.old_qy_list = arr_data;
489   - th.setData({qy_data:obj})
490 540 }
491   - })
492   - }
493   - }
494   - })
495   -
496   - /*-- 获取 --*/
497   - th.requestRecommend();
498   -
499   - /*-------系统是否开通等级卡,会员是等级卡-----*/
500   - getApp().getConfig2(function (e) {
501   - var t_swi = e.switch_list;
502   - if (t_swi) t_swi = JSON.parse(t_swi)
503   - if (t_swi) {
504   - th.setData({ sys_switch: t_swi });
505   - var user_tool = [];
506   - if (t_swi.usertool) user_tool = JSON.parse(t_swi.usertool);
507   - th.setData({ c_list: user_tool });
508   - if (t_swi.usercode_vailtime!=null && parseInt(t_swi.usercode_vailtime)>0)
509   - {
510   - th.setData({ getusercode_vailtime: t_swi.usercode_vailtime });
511   - }
512   - }
513   -
514   - if (parseInt(t_swi.rank_switch) == 2) {
515   - var userInfo = th.data.userInfo;
516   - if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") {
517   - var now = ut.gettimestamp();
518   - var str = userInfo.card_expiredate;
519   - var end = new Date(str);
520   - end = Date.parse(end) / 1000;
521   - //---判断是不是有过期---
522   - if (now < end) {
523   - th.setData({
524   - is_dengji: 1
525   - })
526   - } else {
527   - th.setData({
528   - is_dengji: 3
529   - })
530 541 }
531   - } else {
532   - th.setData({
533   - is_dengji: 2
534   - })
535   - }
536   - }
537   - })
538   - //th.requestRecommend();
539   -
540   - //自定义组件一定要等到页面加载完了,才来调用selectComponnent
541   - setTimeout(function () {
  542 + })
  543 + //th.requestRecommend();
542 544  
543   - th.setData({ is_show_recommend:true })
544   - if (getApp().globalData.user_id) getApp().requestCardNum(th);
545   - var goods_list = th.selectComponent("#goods_recommend"); //组件的id
  545 + //自定义组件一定要等到页面加载完了,才来调用selectComponnent
  546 + setTimeout(function () {
546 547  
547   - if(goods_list){
548   - goods_list.init();
549   - goods_list.get_list();
550   - }
  548 + th.setData({ is_show_recommend:true })
  549 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  550 + var goods_list = th.selectComponent("#goods_recommend"); //组件的id
551 551  
552   - }, 1200)
  552 + if(goods_list){
  553 + goods_list.init();
  554 + goods_list.get_list();
  555 + }
553 556  
554   - }
  557 + }, 1200)
555 558  
556   - setTimeout(()=>{
557   - th.setData({ pshow:1 })
558   - },500)
  559 + }
  560 + }
559 561  
  562 + setTimeout(()=>{
  563 + th.setData({ pshow:1 })
  564 + },500)
  565 + })
560 566 },
561 567  
562 568 //获取会员权益等级是否升级
... ...
pages/user/order_detail/order_detail.js
... ... @@ -799,39 +799,44 @@ Page({
799 799  
800 800 } else {
801 801  
802   - //因为商品的prom_type=0,所以商品的实际活动要重新获取
803   - var url = '/api/weshop/activitylist/listGoodActInfo2New';
804   - var req_d = {
805   - "store_id": os.stoid,
806   - "goods_id": good.goods_id,
807   - "user_id": user_id,
808   - }
809   - await getApp().request.promiseGet(url, {
810   - data: req_d
811   - }).then(res => {
812   - if (res.data.code == 0 && res.data.data) {
813   - var arr = res.data.data;
814   - //-- 预热也要计算 --
815   - var arr2 = arr.filter(function (e) {
816   - return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
817   - })
818   - if (arr2.length == 1) {
819   - gg.prom_type=arr2[0].prom_type;
820   - gg.prom_id=arr2[0].act_id;
821   - }
822   - else if (arr2.length > 1){
823   - //如果是多活动的时候,要看good参与的活动有没有结束,是不是有效
824   - var fd=arr2.find(function (e) {
825   - return e.prom_type==good.prom_type && e.act_id==good.prom_id
  802 +
  803 + if(good.is_pd_normal || good.is_integral_normal){
  804 + gg.prom_type=good.prom_type;
  805 + gg.prom_id=good.prom_id;
  806 + }else {
  807 +
  808 + //因为商品的prom_type=0,所以商品的实际活动要重新获取
  809 + var url = '/api/weshop/activitylist/listGoodActInfo2New';
  810 + var req_d = {
  811 + "store_id": os.stoid,
  812 + "goods_id": good.goods_id,
  813 + "user_id": user_id,
  814 + }
  815 + await getApp().request.promiseGet(url, {
  816 + data: req_d
  817 + }).then(res => {
  818 + if (res.data.code == 0 && res.data.data) {
  819 + var arr = res.data.data;
  820 + //-- 预热也要计算 --
  821 + var arr2 = arr.filter(function (e) {
  822 + return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
826 823 })
827   - if(fd){
828   - gg.prom_type=good.prom_type;
829   - gg.prom_id=good.prom_id;
  824 + if (arr2.length == 1) {
  825 + gg.prom_type = arr2[0].prom_type;
  826 + gg.prom_id = arr2[0].act_id;
  827 + } else if (arr2.length > 1) {
  828 + //如果是多活动的时候,要看good参与的活动有没有结束,是不是有效
  829 + var fd = arr2.find(function (e) {
  830 + return e.prom_type == good.prom_type && e.act_id == good.prom_id
  831 + })
  832 + if (fd) {
  833 + gg.prom_type = good.prom_type;
  834 + gg.prom_id = good.prom_id;
  835 + }
830 836 }
831   - }
832   - }
833   - })
834   -
  837 + }
  838 + })
  839 + }
835 840  
836 841 if(gg.prom_type==3){
837 842 var prom_pc=null;
... ... @@ -1144,6 +1149,7 @@ Page({
1144 1149 if (!good.is_gift && !good.is_collocation && gg.prom_type != 9) {
1145 1150  
1146 1151 //-- 优惠促销的时候控制取价规则 --
  1152 + // gg.prom_type!=3 && gg.prom_type!=10 同时商品不是普通购买的时候,又参与优惠促销,阶梯促销
1147 1153 if((gg.prom_type!=3 && gg.prom_type!=10) || gg.discount_field==undefined || gg.discount_field==0 ) {
1148 1154 if (card_field && gg[card_field] > 0) {
1149 1155 if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
... ...
pages/user/order_list/order_list.js
... ... @@ -1091,38 +1091,43 @@ Page({
1091 1091  
1092 1092 } else {
1093 1093  
1094   - //因为商品的prom_type=0,所以商品的实际活动要重新获取
1095   - var url = '/api/weshop/activitylist/listGoodActInfo2New';
1096   - var req_d = {
1097   - "store_id": os.stoid,
1098   - "goods_id": good.goods_id,
1099   - "user_id": user_id,
1100   - }
1101   - await getApp().request.promiseGet(url, {
1102   - data: req_d
1103   - }).then(res => {
1104   - if (res.data.code == 0 && res.data.data) {
  1094 + //-- 如果是活动的普通购买的时候 --
  1095 + if(good.is_pd_normal || good.is_integral_normal){
  1096 + gg.prom_type=good.prom_type;
  1097 + gg.prom_id=good.prom_id;
  1098 + }else {
  1099 + //因为商品的prom_type=0,所以商品的实际活动要重新获取
  1100 + var url = '/api/weshop/activitylist/listGoodActInfo2New';
  1101 + var req_d = {
  1102 + "store_id": os.stoid,
  1103 + "goods_id": good.goods_id,
  1104 + "user_id": user_id,
  1105 + }
  1106 + await getApp().request.promiseGet(url, {
  1107 + data: req_d
  1108 + }).then(res => {
  1109 + if (res.data.code == 0 && res.data.data) {
1105 1110 var arr = res.data.data;
1106 1111 //-- 预热也要计算 --
1107 1112 var arr2 = arr.filter(function (e) {
1108 1113 return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
1109 1114 })
1110 1115 if (arr2.length == 1) {
1111   - gg.prom_type=arr2[0].prom_type;
1112   - gg.prom_id=arr2[0].act_id;
1113   - }
1114   - else if (arr2.length > 1){
1115   - //如果是多活动的时候,要看good参与的活动有没有结束,是不是有效
1116   - var fd=arr2.find(function (e) {
1117   - return e.prom_type==good.prom_type && e.act_id==good.prom_id
1118   - })
1119   - if(fd){
1120   - gg.prom_type=good.prom_type;
1121   - gg.prom_id=good.prom_id;
1122   - }
  1116 + gg.prom_type = arr2[0].prom_type;
  1117 + gg.prom_id = arr2[0].act_id;
  1118 + } else if (arr2.length > 1) {
  1119 + //如果是多活动的时候,要看good参与的活动有没有结束,是不是有效
  1120 + var fd = arr2.find(function (e) {
  1121 + return e.prom_type == good.prom_type && e.act_id == good.prom_id
  1122 + })
  1123 + if (fd) {
  1124 + gg.prom_type = good.prom_type;
  1125 + gg.prom_id = good.prom_id;
  1126 + }
1123 1127 }
1124   - }
1125   - })
  1128 + }
  1129 + })
  1130 + }
1126 1131  
1127 1132  
1128 1133 //优惠促销获取取价规则
... ... @@ -1439,7 +1444,8 @@ Page({
1439 1444  
1440 1445  
1441 1446 //-- 优惠促销的时候控制取价规则 --
1442   - if( (gg.prom_type!=3 && gg.prom_type!=10 ) || gg.discount_field==undefined || gg.discount_field==0 ){
  1447 + // gg.prom_type!=3 && gg.prom_type!=10 同时商品不是普通购买的时候,又参与优惠促销,阶梯促销
  1448 + if((gg.prom_type!=3 && gg.prom_type!=10) || gg.discount_field==undefined || gg.discount_field==0 ){
1443 1449 if (card_field && gg[card_field] > 0) {
1444 1450 if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
1445 1451 if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
... ...
utils/LoadMore2.js deleted
1   -var oo = require("../setting.js");
2   -var ut = require('util.js');
3   -
4   -function a(a, t, e) {
5   - return t in a ? Object.defineProperty(a, t, {
6   - value: e,
7   - enumerable: !0,
8   - configurable: !0,
9   - writable: !0
10   - }) : a[t] = e, a;
11   -}
12   -
13   -function t(a, t) {
14   - if (!(a instanceof t)) throw new TypeError("Cannot call a class as a function");
15   -}
16   -
17   -Object.defineProperty(exports, "__esModule", {
18   - value: !0
19   -});
20   -
21   -var e = function() {
22   - function a(a, t) {
23   - for (var e = 0; e < t.length; e++) {
24   - var o = t[e];
25   - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
26   - Object.defineProperty(a, o.key, o);
27   - }
28   - }
29   - return function(t, e, o) {
30   - return e && a(t.prototype, e), o && a(t, o), t;
31   - };
32   -}(), o = getApp(), n = o.request, i = function() {
33   - function i() {
34   - t(this, i), this.data = {
35   - page: null,
36   - listName: "",
37   - resultName: "",
38   - resultListName: "",
39   - scrollTimeStamp: 0,
40   - goodsLoadFinishFlag: !1,
41   - goodsLoading: !1
42   - };
43   - }
44   - return e(i, [ {
45   - key: "init",
46   - value: function(a, t, e, o) {
47   - this.data.scrollTimeStamp = 0, this.data.page = a, this.data.listName = t, this.data.resultName = e,
48   - this.data.resultListName = void 0 == o ? t : o, this.data.goodsLoadFinishFlag = !1,
49   - this.data.goodsLoading = !1;
50   - }
51   - }, {
52   - key: "request",
53   - value: function(t, e, i,dd) {
54   - if(dd==undefined) dd=null;
55   - var s = this,rurl=t;
56   - return !s.data.goodsLoading && (s.data.goodsLoading = !0, n.get(t, {
57   - data:dd,
58   - success: function(t) {
59   - var n = !0;
60   -
61   - var i, r = s.data.listName, l = s.data.resultName, d = s.data.resultListName;
62   - i = "" != r ? t.data.data[r] : t.data.data.pageData; //data.pageData是接口固定会出现的,封装好了
63   - var u = !1, g = null, c = s.data.page;
64   -
65   - console.log('loadmore');
66   - console.log(t.data.data.pageData);
67   - console.log(c );
68   - if(t.data.data.pageData.length==0){
69   - (s.data.goodsLoadFinishFlag = !0, o.showWarning("加载完啦", null, 500, !1));
70   - return false;
71   - }
72   -
73   - //如果已经的第二页的时候,就是把数据加入数组
74   - if (c !=undefined && c.data[l]) {
75   - u = !0;
76   - var f = null;
77   - f = "" != d ? c.data[l][d] : c.data[l], [].push.apply(f, i), g = c.data[l];
78   - } else g = t.data.data.pageData;
79   -
80   - c.setData(a({}, l, g));
81   - if ("function" == typeof e && (n = e(t)), !1 === n) return !1;
82   - i && 0 != i.length || (s.data.goodsLoadFinishFlag = !0, u && o.showWarning("加载完啦", null, 500, !1));
83   - return false;
84   - },
85   -
86   -
87   - fail: function(a) {
88   - var t = !0;
89   - return console.log(a), "function" == typeof i && (t = i(a)), t;
90   - },
91   - complete: function(a) {
92   - s.data.goodsLoading = !1;
93   - }
94   - }), !0);
95   - }
96   - }, {
97   - key: "canloadMore",
98   - value: function() {
99   - console.log("loadMore...Finish:", this.data.goodsLoadFinishFlag);
100   - var a = this;
101   - if (a.data.goodsLoadFinishFlag) return o.showWarning("加载完啦", null, 500, !1), !1;
102   - var t = new Date().getTime();
103   - return console.log("loadMore...time:", t), t - a.data.scrollTimeStamp > 300 && (a.data.scrollTimeStamp = t,
104   - !0);
105   - }
106   - }, {
107   - key: "resetConfig",
108   - value: function() {
109   - this.data.goodsLoadFinishFlag = !1;
110   - }
111   - } ]), i;
112   -}();
113   -
114   -exports.default = i;
utils/util.js
... ... @@ -692,6 +692,7 @@ module.exports = {
692 692  
693 693 //分享注册,跳转到授权
694 694 new_user_go:function (stoid,first_leader) {
  695 + if(!first_leader) return false;
695 696 getApp().request.get("/api/weshop/users/get/" + stoid + "/" + first_leader,{
696 697 success: function(e) {
697 698 if (e.data.code == 0 && e.data.data ) {
... ...