Commit 13c179ddb6b917651353ab71d1768b6283c58baa

Authored by antploy
1 parent 55bdaf46

我的礼包优化

@@ -51,7 +51,7 @@ App({ @@ -51,7 +51,7 @@ App({
51 config2: null, //门店配置 51 config2: null, //门店配置
52 code: null, 52 code: null,
53 heigth:0, 53 heigth:0,
54 - user_id:null,// 3674923,// 4379287,// null,// 5682068, 54 + user_id:6520013,// 3674923,// 4379287,// null,// 5682068,
55 buy_now:null, 55 buy_now:null,
56 picklist:null, //门店列表 56 picklist:null, //门店列表
57 wuliuprice: null, //物流价格表 57 wuliuprice: null, //物流价格表
components/my_confirm/my_confirm.wxml
@@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
6 <view class="shut" bindtap="close_yu_e">ⅹ</view> 6 <view class="shut" bindtap="close_yu_e">ⅹ</view>
7 <view class="fs32 xc-black3 flex jc-center ai-center" style="padding: 10rpx 20rpx;min-height:220rpx;"><text>{{title}}</text></view> 7 <view class="fs32 xc-black3 flex jc-center ai-center" style="padding: 10rpx 20rpx;min-height:220rpx;"><text>{{title}}</text></view>
8 <view class="flex jc-center ai_center" style="width: 100%;height: 75rpx;"> 8 <view class="flex jc-center ai_center" style="width: 100%;height: 75rpx;">
9 - <view bindtap="go_sure" class="fs30 white flex jc-center ai-center ck_btn color color" style="margin-right: 20rpx;">{{s_text}}</view>  
10 - <view bindtap='go_cancle' class="fs30 xc-ash flex jc-center ai-center ck_btn"style="background:#ececea;">{{c_text}}</view> 9 + <view bindtap="go_sure" class="fs30 white flex jc-center ai-center ck_btn" style="margin-right: 20rpx;background:#ececea;">{{s_text}}</view>
  10 + <view bindtap='go_cancle' class="fs30 xc-ash flex jc-center ai-center ck_btn color" >{{c_text}}</view>
11 </view> 11 </view>
12 </view> 12 </view>
13 </view> 13 </view>
components/my_confirm/my_confirm.wxss
@@ -33,9 +33,9 @@ @@ -33,9 +33,9 @@
33 color: #fff; 33 color: #fff;
34 text-align: center; 34 text-align: center;
35 position: fixed; 35 position: fixed;
36 - margin-top: -23rpx; 36 + margin-top: -25rpx;
37 z-index: 66666; 37 z-index: 66666;
38 - right: 60rpx; 38 + right: 65rpx;
39 background: #c8162c; 39 background: #c8162c;
40 } 40 }
41 .xc-qr-frame{ 41 .xc-qr-frame{
components/qr_code/qr_code.wxss
@@ -117,9 +117,8 @@ margin-top: -5.5rpx; @@ -117,9 +117,8 @@ margin-top: -5.5rpx;
117 text-align: center; 117 text-align: center;
118 position: fixed; 118 position: fixed;
119 top:940rpx; 119 top:940rpx;
120 - left:345rpx;  
121 -  
122 - 120 + left:50%;
  121 + transform: translateX(-50%);
123 } 122 }
124 123
125 .mt{ margin-top:130rpx} 124 .mt{ margin-top:130rpx}
packageA/pages/myGift/myGift.js
@@ -144,8 +144,9 @@ Page({ @@ -144,8 +144,9 @@ Page({
144 isShowLoading: true, 144 isShowLoading: true,
145 }) 145 })
146 .then(function(res) { 146 .then(function(res) {
  147 +
147 if(res.data.code == 0) { 148 if(res.data.code == 0) {
148 - 149 +
149 self.setData({ 150 self.setData({
150 isLoading: false 151 isLoading: false
151 }); 152 });
@@ -154,10 +155,12 @@ Page({ @@ -154,10 +155,12 @@ Page({
154 self.setData({ 155 self.setData({
155 list: res.data.data 156 list: res.data.data
156 }); 157 });
  158 + // console.log(this.data.list);
157 } else { 159 } else {
158 self.setData({ 160 self.setData({
159 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) 161 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData)
160 }); 162 });
  163 +
161 }; 164 };
162 165
163 if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { 166 if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) {
packageA/pages/myGift/myGift.wxml
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 <view class="fs24 c-a4">已售{{item.salenum}}件</view> 33 <view class="fs24 c-a4">已售{{item.salenum}}件</view>
34 </view> 34 </view>
35 <!-- 时间 --> 35 <!-- 时间 -->
36 - <view class="date">活动截止日期 {{filter.format_time(item.expdate)}}</view> 36 + <view class="date">活动截止日期 {{filter.format_time(item.endtime)}}</view>
37 <!-- 按钮 --> 37 <!-- 按钮 -->
38 </view> 38 </view>
39 </view> 39 </view>
@@ -52,10 +52,10 @@ @@ -52,10 +52,10 @@
52 <!-- 标题 --> 52 <!-- 标题 -->
53 <view class="mgb10 ellipsis-2 lh taj">{{item.lbtitle}}</view> 53 <view class="mgb10 ellipsis-2 lh taj">{{item.lbtitle}}</view>
54 <!-- 时间 --> 54 <!-- 时间 -->
55 - <view class="date pdb20">活动截止日期 {{filter.format_time(item.endtime)}}</view> 55 + <view class="date pdb20">兑换截止日期 {{filter.format_time(item.endtime)}}</view>
56 </view> 56 </view>
57 <!-- 说明 --> 57 <!-- 说明 -->
58 - <view class="c-red fs24">*请到线下门店兑换</view> 58 + <!-- <view class="c-red fs24">*请到线下门店兑换</view> -->
59 </view> 59 </view>
60 </view> 60 </view>
61 </block> 61 </block>
packageA/pages/myGiftDetails/myGiftDetails.js
@@ -72,7 +72,7 @@ Page({ @@ -72,7 +72,7 @@ Page({
72 if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ 72 if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
73 var da= res.data.data.pageData[0] 73 var da= res.data.data.pageData[0]
74 self.setData({ details:da, }); 74 self.setData({ details:da, });
75 - 75 + console.log(da);
76 //礼包有俩种类型 76 //礼包有俩种类型
77 if(da.lbtype==1){ 77 if(da.lbtype==1){
78 app.request.promiseGet('/api/weshop/libao/libaoList/page', { 78 app.request.promiseGet('/api/weshop/libao/libaoList/page', {
@@ -94,6 +94,7 @@ Page({ @@ -94,6 +94,7 @@ Page({
94 }, 94 },
95 isShowLoading: true, 95 isShowLoading: true,
96 }).then(function(res) { 96 }).then(function(res) {
  97 + console.log(res);
97 if(res.data.code==0){ 98 if(res.data.code==0){
98 self.setData({ 99 self.setData({
99 list: res.data.data, 100 list: res.data.data,
@@ -150,6 +151,7 @@ Page({ @@ -150,6 +151,7 @@ Page({
150 }, 151 },
151 isShowLoading: true, 152 isShowLoading: true,
152 }).then(function(res) { 153 }).then(function(res) {
  154 + console.log(res);
153 // console.log('res4-->', res); 155 // console.log('res4-->', res);
154 if(res.data.code==0 && res.data.data) { 156 if(res.data.code==0 && res.data.data) {
155 self.setData({ 157 self.setData({
@@ -290,6 +292,7 @@ Page({ @@ -290,6 +292,7 @@ Page({
290 getApp().request.get("/api/weshop/libao/libaoListvip/getLibaoCode",{ 292 getApp().request.get("/api/weshop/libao/libaoListvip/getLibaoCode",{
291 data:data, 293 data:data,
292 success:function (res){ 294 success:function (res){
  295 + console.log(res);
293 if(res.data.code==0){ 296 if(res.data.code==0){
294 th.data.qr_code_object.val=res.data.data; 297 th.data.qr_code_object.val=res.data.data;
295 var qc_com = th.selectComponent("#qrcode"); //组件的id 298 var qc_com = th.selectComponent("#qrcode"); //组件的id
packageA/pages/myGiftDetails/myGiftDetails.wxml
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <!-- 图片 --> 3 <!-- 图片 -->
4 <view><image src="{{imghost + (details.lburl ? details.lburl:'miniapp/images/default_g_img.gif')}}" class="img" mode="widthFix"/></view> 4 <view><image src="{{imghost + (details.lburl ? details.lburl:'miniapp/images/default_g_img.gif')}}" class="img" mode="widthFix"/></view>
5 5
6 - <view wx:if="{{index==1}}" class="fs26 exp_title">兑换结束时间:{{filter.format_time(details.expdate,1)}}</view> 6 + <view wx:if="{{index==1}}" class="fs26 exp_title">兑换结束时间:{{filter.format_time(details.endtime,1)}}</view>
7 <!-- 描述--> 7 <!-- 描述-->
8 <view class="desc-container"> 8 <view class="desc-container">
9 <!-- 标题 --> 9 <!-- 标题 -->
@@ -72,15 +72,13 @@ @@ -72,15 +72,13 @@
72 72
73 <view wx:if="{{details.lbtype==2}}" class="flex" style="flex-wrap: wrap;"> 73 <view wx:if="{{details.lbtype==2}}" class="flex" style="flex-wrap: wrap;">
74 <block wx:for="{{list}}"> 74 <block wx:for="{{list}}">
75 - <block wx:for="{{item.goods_num-0}}" wx:for-item="nitem" wx:for-index="idx">  
76 <view class="lb_quan" style="background-image: url({{imghost}}/miniapp/images/yhq_{{index%2+1}}.png)"> 75 <view class="lb_quan" style="background-image: url({{imghost}}/miniapp/images/yhq_{{index%2+1}}.png)">
77 <view class="flex fs28 fir_view"> 76 <view class="flex fs28 fir_view">
78 - <view>满1000.00使用</view>  
79 - <view class="fs38" style="text-align: right">¥1000</view> 77 + <view>满{{item.condition}}使用</view>
  78 + <view class="fs8" style="text-align: right">¥{{item.money}}</view>
80 </view> 79 </view>
81 - <view style="font-size: 16rpx; text-align: center">活动结束日期: 2022-06-02 00:00:00 </view> 80 + <view style="font-size: 16rpx; text-align: center">活动结束日期{{filter.format_time(item.use_end_time,1)}}</view>
82 </view> 81 </view>
83 - </block>  
84 </block> 82 </block>
85 </view> 83 </view>
86 84
@@ -106,7 +104,7 @@ @@ -106,7 +104,7 @@
106 <view wx:if="{{details.lbprice>0}}" bindtap="GetBuyPrice" class="btn pink">立即购买</view> 104 <view wx:if="{{details.lbprice>0}}" bindtap="GetBuyPrice" class="btn pink">立即购买</view>
107 </block> 105 </block>
108 <block wx:else> 106 <block wx:else>
109 - <view wx:if="{{details.isget}}" data-type="1" class="btn" style="background-color:#aaa;color: #fff">已领</view> 107 + <view wx:if="{{details.isget}}" data-type="1" class="btn" style="background-color:#aaa;color: #fff">已领</view>
110 <view wx:else bindtap="show_get_quan" data-type="1" class="btn red">一键领取优惠券→</view> 108 <view wx:else bindtap="show_get_quan" data-type="1" class="btn red">一键领取优惠券→</view>
111 </block> 109 </block>
112 </view> 110 </view>
pages/index/index/index.js
1 -var e = function(e) {  
2 - return e && e.__esModule ? e : {  
3 - default: e  
4 - };  
5 - }(require("../../../utils/LoadMore.js")), 1 +var e = function (e) {
  2 + return e && e.__esModule ? e : {
  3 + default: e
  4 + };
  5 +}(require("../../../utils/LoadMore.js")),
6 t = getApp(), 6 t = getApp(),
7 a = t.request, 7 a = t.request,
8 o = t.globalData.setting, 8 o = t.globalData.setting,
@@ -72,1003 +72,1001 @@ Page({ @@ -72,1003 +72,1001 @@ Page({
72 is_disgraceful: 0, //是否显示新人广告 72 is_disgraceful: 0, //是否显示新人广告
73 new_image: "", //新人有礼弹窗图片 73 new_image: "", //新人有礼弹窗图片
74 new_nav: "", //新人页面跳转地址 74 new_nav: "", //新人页面跳转地址
75 - w_holiday_pop:0,  
76 -  
77 - showHongbao: false,  
78 - showHongbaoSmall: false,  
79 -  
80 - is_full_screen_show:0, //全屏显示  
81 - sec_show:3, //倒计时的秒数  
82 - full_ad:null, //全屏广告  
83 - full_screen:0, //全屏广告  
84 - 75 + w_holiday_pop: 0,
  76 + showHongbao: false,
  77 + showHongbaoSmall: false,
  78 + is_full_screen_show: 0, //全屏显示
  79 + sec_show: 3, //倒计时的秒数
  80 + full_ad: null, //全屏广告
  81 + full_screen: 0, //全屏广告
  82 +
85 }, 83 },
  84 + onLoad: async function (tt) {
  85 + console.log("进入首页-------------");
  86 + console.log(tt);
  87 + var th = this;
  88 + var first_leader = tt.first_leader;
  89 + if (!first_leader && tt.scene) {
  90 + var first_leader_str = decodeURIComponent(tt.scene);
  91 + var f_arr = first_leader_str.split("_");
  92 + first_leader = f_arr[0] && parseFloat(f_arr[0]) > 0 ? f_arr[0] : null;
  93 + //注册门店
  94 + if (f_arr[1] && parseFloat(f_arr[1]) > 0) {
  95 + getApp().globalData.store_number = f_arr[1];
  96 + }
  97 + }
  98 +
  99 + getApp().getConfig(function (e) {
  100 + //--首页的问题--
  101 + if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) {
  102 + wx.setNavigationBarTitle({
  103 + title: getApp().globalData.config.store_name,
  104 + });
  105 + } else {
  106 + wx.setNavigationBarTitle({
  107 + title: getApp().globalData.setting.appName,
  108 + });
  109 + };
  110 + });
  111 +
  112 +
  113 + var th = this;
  114 + getApp().getConfig2(function (config2) {
  115 + if (config2 && config2.is_overdue == 1) {
  116 + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => {
  117 + var o = res;
  118 + if (o.data.code == 0) {
  119 + var ob = { isout: 0, isbuy: 1 };
  120 + var arr = o.data.data.pageData;
  121 + var isbuy = 0;
  122 + //----如果数组不为空----
  123 + if (arr.length > 0) {
  124 + arr.forEach(function (val, ind) {
  125 + if (val.is_sy == 0 && val.type == 5) {
  126 + isbuy = 1;
  127 + var now = ut.gettimestamp();
  128 + if (now > val.end_time) ob.isout = 1;
  129 + return false;
  130 + }
  131 + })
  132 + }
  133 + ob.isbuy = isbuy;
  134 +
  135 + var pages = getCurrentPages(); //获取加载的页面
  136 + var currentPage = pages[pages.length - 1]; //获取当前页面的对象
  137 +
  138 + console.log("当前路由");
  139 + console.log(currentPage.route);
  140 +
86 141
87 - onLoad: async function(tt) {  
88 - console.log("进入首页-------------");  
89 - console.log(tt);  
90 - var th = this;  
91 - var first_leader=tt.first_leader;  
92 - if(!first_leader && tt.scene){  
93 - var first_leader_str= decodeURIComponent(tt.scene);  
94 - var f_arr=first_leader_str.split("_");  
95 - first_leader=f_arr[0] && parseFloat(f_arr[0])>0?f_arr[0]:null;  
96 - //注册门店  
97 - if(f_arr[1] && parseFloat(f_arr[1])>0){  
98 - getApp().globalData.store_number=f_arr[1]; 142 + th.setappdata(ob);
  143 +
  144 + if (ob.isbuy && !ob.isout) {
  145 + th.onload_init();
  146 + }
  147 + } else {
  148 + th.onload_init();
99 } 149 }
100 - }  
101 -  
102 - getApp().getConfig(function(e){  
103 - //--首页的问题--  
104 - if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) {  
105 - wx.setNavigationBarTitle({  
106 - title: getApp().globalData.config.store_name,  
107 - });  
108 - } else {  
109 - wx.setNavigationBarTitle({  
110 - title: getApp().globalData.setting.appName,  
111 - });  
112 - };  
113 - });  
114 -  
115 -  
116 - var th = this;  
117 - getApp().getConfig2(function(config2){  
118 - if(config2 && config2.is_overdue==1){  
119 - getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{  
120 - var o=res;  
121 - if (o.data.code == 0) {  
122 - var ob = { isout: 0, isbuy: 1 };  
123 - var arr = o.data.data.pageData;  
124 - var isbuy = 0;  
125 - //----如果数组不为空----  
126 - if (arr.length > 0) {  
127 - arr.forEach(function (val, ind) {  
128 - if (val.is_sy == 0 && val.type == 5) {  
129 - isbuy = 1;  
130 - var now = ut.gettimestamp();  
131 - if (now > val.end_time) ob.isout = 1;  
132 - return false;  
133 - }  
134 - })  
135 - }  
136 - ob.isbuy = isbuy;  
137 -  
138 - var pages = getCurrentPages(); //获取加载的页面  
139 - var currentPage = pages[pages.length - 1]; //获取当前页面的对象  
140 -  
141 - console.log("当前路由");  
142 - console.log(currentPage.route);  
143 -  
144 -  
145 - th.setappdata(ob);  
146 -  
147 - if(ob.isbuy && !ob.isout){  
148 - th.onload_init();  
149 - }  
150 - }else{  
151 - th.onload_init();  
152 - }  
153 - })  
154 - }  
155 -  
156 - else{  
157 - th.onload_init();  
158 - }  
159 - })  
160 -  
161 - if(first_leader){  
162 - //-- user_id代过来免登录 --  
163 - getApp().globalData.first_leader=first_leader;  
164 - //调用接口判断是不是会员  
165 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{  
166 - if(res.data.code==0){  
167 - getApp().globalData.guide_id=res.data.data.id;  
168 - }  
169 - })  
170 - }  
171 -  
172 - // 判断是否有红包活动  
173 - getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/'+getApp().globalData.setting.stoid, {  
174 - data: {}  
175 - }).then(function(data) {  
176 - // console.log('909090909090----->', data.data.code);  
177 - let code = data.data.code;  
178 - if(code == 0) {  
179 -  
180 - th.setData({  
181 - showHongbao: true,  
182 - });  
183 - } else if(code == -1) {  
184 - th.setData({  
185 - showHongbao: false,  
186 - });  
187 - };  
188 - });  
189 -  
190 -  
191 - // console.log(9090909);  
192 - //看一下商家是否开通了权益  
193 - //--初始化是否有打勾--  
194 - getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {  
195 - data: {  
196 - storeId: os.stoid 150 + })
  151 + }
  152 +
  153 + else {
  154 + th.onload_init();
  155 + }
  156 + })
  157 +
  158 + if (first_leader) {
  159 + //-- user_id代过来免登录 --
  160 + getApp().globalData.first_leader = first_leader;
  161 + //调用接口判断是不是会员
  162 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
  163 + if (res.data.code == 0) {
  164 + getApp().globalData.guide_id = res.data.data.id;
197 } 165 }
198 - }).then(res => {  
199 - if (res.data.data) {  
200 - var is_init = res.data.data.isBool; 166 + })
  167 + }
  168 +
  169 + // 判断是否有红包活动
  170 + getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, {
  171 + data: {}
  172 + }).then(function (data) {
  173 + // console.log('909090909090----->', data.data.code);
  174 + let code = data.data.code;
  175 + if (code == 0) {
  176 +
  177 + th.setData({
  178 + showHongbao: true,
  179 + });
  180 + } else if (code == -1) {
  181 + th.setData({
  182 + showHongbao: false,
  183 + });
  184 + };
  185 + });
  186 +
  187 +
  188 + // console.log(9090909);
  189 + //看一下商家是否开通了权益
  190 + //--初始化是否有打勾--
  191 + getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
  192 + data: {
  193 + storeId: os.stoid
  194 + }
  195 + }).then(res => {
  196 + if (res.data.data) {
  197 + var is_init = res.data.data.isBool;
  198 + th.setData({
  199 + is_boot: is_init
  200 + });
  201 +
  202 + if (!is_init) {
201 th.setData({ 203 th.setData({
202 - is_boot: is_init 204 + swiperimage: []
203 }); 205 });
204 -  
205 - if(!is_init){  
206 - th.setData({  
207 - swiperimage: []  
208 - });  
209 - }  
210 } 206 }
211 - }) 207 + }
  208 + })
212 209
213 - //调用底部导航  
214 - //getApp().globalData.url=th.data.url  
215 - //t.editTabBar(th,o.stoid,th.data.url); 210 + //调用底部导航
  211 + //getApp().globalData.url=th.data.url
  212 + //t.editTabBar(th,o.stoid,th.data.url);
216 213
217 - },  
218 -  
219 - async onload_init(){  
220 - var th=this;  
221 - await this.init_load();  
222 - //显示的时候要开启计时器  
223 - this.data.is_timer = 1;  
224 - //如果是自定义模板  
225 - if (this.data.isTemplate) {  
226 - //---先获取会员---  
227 - t.getUserFir(function() {  
228 - th.is_festival();  
229 - var new_nav = th.data.new_nav;  
230 - if (new_nav == "") {  
231 - th.is_new();  
232 - }  
233 - setTimeout(function () {  
234 - if (getApp().globalData.user_id) getApp().requestCardNum(th);  
235 - },500)  
236 -  
237 - });  
238 - } else {  
239 - await this.init_fir();  
240 - wx.setNavigationBarColor({  
241 - frontColor: '#ffffff', // 必写项  
242 - backgroundColor: '#ff7295', // 必写项  
243 - })  
244 - }  
245 -  
246 - //--正再拼团中的处理--  
247 - var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1"  
248 - await getApp().request.promiseGet(url, {}).then(res => {  
249 - if (res.data.code == 0 && res.data.data && res.data.data.pageData) {  
250 - th.data.pt_timer_arr = res.data.data.pageData;  
251 - }  
252 - })  
253 - if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) {  
254 - for (var i in th.data.pt_timer_arr) {  
255 - var p_item = th.data.pt_timer_arr[i];  
256 - await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {  
257 - 1: 1  
258 - }).then(res => {  
259 - th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic;  
260 - th.data.pt_timer_arr[i].nickname = res.data.data.nickname;  
261 - })  
262 - }  
263 - th.Interval_pt();  
264 - }  
265 -  
266 - //---处理正在6个分类----  
267 - await getApp().request.promiseGet("/api/weshop/goodscategory/page", {  
268 - data: {  
269 - store_id: os.stoid,  
270 - pageSize: 5,  
271 - is_show: 1,  
272 - level:1  
273 - }  
274 - }).then(res => {  
275 - if (res.data.data) {  
276 - var gd_category = res.data.data.pageData;  
277 - th.setData({  
278 - gd_category: gd_category  
279 - });  
280 - }  
281 - })  
282 - },  
283 -  
284 -  
285 - //关闭新用户领取广告  
286 - close_disgraceful: function() {  
287 - var th = this;  
288 - th.setData({  
289 - is_disgraceful: 0  
290 - })  
291 - }, 214 +},
292 215
293 - async onShow() {  
294 - var th=this;  
295 - //-- 登录回来判断弹框 --  
296 - var userInfo=getApp().globalData.userInfo;  
297 - if(userInfo){  
298 - th.is_festival();  
299 - var new_nav = th.data.new_nav;  
300 - if (new_nav == "") {  
301 - th.is_new();  
302 - } 216 + async onload_init() {
  217 + var th = this;
  218 + await this.init_load();
  219 + //显示的时候要开启计时器
  220 + this.data.is_timer = 1;
  221 + //如果是自定义模板
  222 + if(this.data.isTemplate) {
  223 + //---先获取会员---
  224 + t.getUserFir(function () {
  225 + th.is_festival();
  226 + var new_nav = th.data.new_nav;
  227 + if (new_nav == "") {
  228 + th.is_new();
303 } 229 }
  230 + setTimeout(function () {
  231 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  232 + }, 500)
304 233
305 - //优惠券要实时更新  
306 - getApp().getConfig2(function(e) {  
307 - var json_d = JSON.parse(e.switch_list);  
308 - th.setData({is_closecoupon: json_d.is_closecoupon})  
309 - th.setData({is_topstore: json_d.is_show_storeselect})  
310 - },1)  
311 -  
312 - if (typeof this.getTabBar === 'function' && this.getTabBar()) {  
313 - var index=getApp().getPageIndex(this);  
314 - this.getTabBar().setData({  
315 - active: index //数字是当前页面在tabbar的索引  
316 - })  
317 -  
318 - getApp().requestCardNum(this);  
319 - }  
320 -  
321 - var th = this;  
322 -  
323 - var show=getApp().globalData.isLoad_ad;  
324 - setTimeout(function(){  
325 - //user没有及时更新  
326 - var userInfo=getApp().globalData.userInfo;  
327 - if(!userInfo || !userInfo.user_id) userInfo=null;  
328 - //有加载过一次首页,就显示  
329 - if(show || userInfo || getApp().globalData.user_id){  
330 - setTimeout(function(){  
331 - full_screen.get_the_full_screen(th);  
332 - },800)  
333 - //动画效果  
334 - if(!th.data.f_hidden){  
335 - wx.showLoading({  
336 - title:'加载中..'  
337 - });  
338 - setTimeout(function(){  
339 - th.setData({f_hidden:1})  
340 - wx.hideLoading();  
341 - },960)  
342 - }  
343 - }else{  
344 - getApp().globalData.isLoad_ad=1;  
345 - }  
346 - },500)  
347 -  
348 -  
349 -  
350 - },  
351 - //当隐藏的时候就关闭计时器  
352 - onHide: function() {  
353 - this.data.is_timer = 0;  
354 - if(this.data.pt_timer) clearInterval(this.data.pt_timer);  
355 - if(this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop);  
356 - if(this.data.full_screen) clearInterval(this.data.full_screen);  
357 - this.data.w_holiday_pop=0; 234 + });
  235 +} else {
  236 + await this.init_fir();
  237 + wx.setNavigationBarColor({
  238 + frontColor: '#ffffff', // 必写项
  239 + backgroundColor: '#ff7295', // 必写项
  240 + })
  241 +}
358 242
  243 +//--正再拼团中的处理--
  244 +var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1"
  245 +await getApp().request.promiseGet(url, {}).then(res => {
  246 + if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
  247 + th.data.pt_timer_arr = res.data.data.pageData;
  248 + }
  249 +})
  250 +if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) {
  251 + for (var i in th.data.pt_timer_arr) {
  252 + var p_item = th.data.pt_timer_arr[i];
  253 + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {
  254 + 1: 1
  255 + }).then(res => {
  256 + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic;
  257 + th.data.pt_timer_arr[i].nickname = res.data.data.nickname;
  258 + })
  259 + }
  260 + th.Interval_pt();
  261 +}
  262 +
  263 +//---处理正在6个分类----
  264 +await getApp().request.promiseGet("/api/weshop/goodscategory/page", {
  265 + data: {
  266 + store_id: os.stoid,
  267 + pageSize: 5,
  268 + is_show: 1,
  269 + level: 1
  270 + }
  271 +}).then(res => {
  272 + if (res.data.data) {
  273 + var gd_category = res.data.data.pageData;
  274 + th.setData({
  275 + gd_category: gd_category
  276 + });
  277 + }
  278 +})
359 }, 279 },
360 280
361 - //同步初始加载  
362 - async init_load() {  
363 - var th=this;  
364 - //因为营销版本的功能包含了自定义模板的功能,是同时的  
365 - //读取全局是否有弄自定义模板  
366 - await api.get_template_fir(o.stoid).then(res => {  
367 - var data = res.data.data;  
368 - if (data && data.length > 0) {  
369 - var temp_data = data[0];  
370 - var t_arr = JSON.parse(temp_data.json_str);  
371 - th.setData({  
372 - template_arr: t_arr,  
373 - isTemplate: 1,  
374 - bgcolor_t: temp_data.bkcolor  
375 - });  
376 281
377 - //---如果有设定顶部的颜色的时候--  
378 - if(temp_data.top_color && temp_data.top_color!='null' ){  
379 - wx.setNavigationBarColor({  
380 - frontColor: '#ffffff', // 必写项  
381 - backgroundColor: temp_data.top_color, // 必写项  
382 - })  
383 - } 282 +//关闭新用户领取广告
  283 +close_disgraceful: function () {
  284 + var th = this;
  285 + th.setData({
  286 + is_disgraceful: 0
  287 + })
  288 +},
384 289
385 - }  
386 - }) 290 +async onShow() {
  291 + var th = this;
  292 + //-- 登录回来判断弹框 --
  293 + var userInfo = getApp().globalData.userInfo;
  294 + if (userInfo) {
  295 + th.is_festival();
  296 + var new_nav = th.data.new_nav;
  297 + if (new_nav == "") {
  298 + th.is_new();
  299 + }
  300 + }
387 301
388 - 302 + //优惠券要实时更新
  303 + getApp().getConfig2(function (e) {
  304 + var json_d = JSON.parse(e.switch_list);
  305 + th.setData({ is_closecoupon: json_d.is_closecoupon })
  306 + th.setData({ is_topstore: json_d.is_show_storeselect })
  307 + }, 1)
389 308
390 -  
391 -  
392 -  
393 -  
394 - },  
395 - //---读取数据内容---  
396 - async init_fir() {  
397 - var th = this;  
398 - //----广告----  
399 - var e = this;  
400 - await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, {  
401 - data: {  
402 - enabled: 1  
403 - }  
404 - }).then(res => {  
405 -  
406 - if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){  
407 - var a = res.data.data.pageData;  
408 - var arr = new Array();  
409 - for (var i = 0; i < a.length; i++) {  
410 - var tt = {  
411 - 'ad_code': o.imghost + a[i].ad_code,  
412 - 'media_link': '',  
413 - 'ad_weapplink':a[i].ad_weapplink  
414 - };  
415 - arr.push(tt);  
416 - }  
417 - if (arr.length > 0) e.setData({  
418 - banner: arr,  
419 - });  
420 -  
421 - wx.stopPullDownRefresh();  
422 - } 309 + if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  310 + var index = getApp().getPageIndex(this);
  311 + this.getTabBar().setData({
  312 + active: index //数字是当前页面在tabbar的索引
423 }) 313 })
424 314
425 - //-----秒杀-----  
426 - var flash_data = null;  
427 - //--获取活动--  
428 - await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {  
429 - data: {  
430 - store_id: os.stoid,  
431 - timetype: 2,  
432 - is_end: 0,  
433 - is_show: 1,  
434 - pageSize: 9  
435 - },  
436 - }).then(res => {  
437 - var e = res;  
438 - if (e.data.code == 0) {  
439 - flash_data = e.data.data.pageData;  
440 - if (flash_data == null || flash_data.length <= 0) return false;  
441 -  
442 - //当前时间戳  
443 - var nt = ut.gettimestamp();  
444 -  
445 - flash_data.forEach(function(val, ind) {  
446 - if (val.start_time > nt) flash_data[ind].status = 0;  
447 - else if (val.end_time > nt) flash_data[ind].status = 1;  
448 - if (val.buy_num >= val.goods_num) flash_data[ind].status = 2;  
449 - }); 315 + getApp().requestCardNum(this);
  316 + }
450 317
451 - var arr = new Array();  
452 - //--三个三个一组---  
453 - for (var i = 0; i < flash_data.length; i += 3) {  
454 - arr.push(flash_data.slice(i, i + 3));  
455 - }  
456 - th.setData({  
457 - saleGoods: arr 318 + var th = this;
  319 +
  320 + var show = getApp().globalData.isLoad_ad;
  321 + setTimeout(function () {
  322 + //user没有及时更新
  323 + var userInfo = getApp().globalData.userInfo;
  324 + if (!userInfo || !userInfo.user_id) userInfo = null;
  325 + //有加载过一次首页,就显示
  326 + if (show || userInfo || getApp().globalData.user_id) {
  327 + setTimeout(function () {
  328 + full_screen.get_the_full_screen(th);
  329 + }, 800)
  330 + //动画效果
  331 + if (!th.data.f_hidden) {
  332 + wx.showLoading({
  333 + title: '加载中..'
458 }); 334 });
459 - //th.countDown(); 335 + setTimeout(function () {
  336 + th.setData({ f_hidden: 1 })
  337 + wx.hideLoading();
  338 + }, 960)
460 } 339 }
461 - }); 340 + } else {
  341 + getApp().globalData.isLoad_ad = 1;
  342 + }
  343 + }, 500)
  344 +
  345 +
  346 +
  347 +},
  348 +//当隐藏的时候就关闭计时器
  349 +onHide: function () {
  350 + this.data.is_timer = 0;
  351 + if (this.data.pt_timer) clearInterval(this.data.pt_timer);
  352 + if (this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop);
  353 + if (this.data.full_screen) clearInterval(this.data.full_screen);
  354 + this.data.w_holiday_pop = 0;
  355 +
  356 +},
  357 +
  358 +//同步初始加载
  359 +async init_load() {
  360 + var th = this;
  361 + //因为营销版本的功能包含了自定义模板的功能,是同时的
  362 + //读取全局是否有弄自定义模板
  363 + await api.get_template_fir(o.stoid).then(res => {
  364 + var data = res.data.data;
  365 + if (data && data.length > 0) {
  366 + var temp_data = data[0];
  367 + var t_arr = JSON.parse(temp_data.json_str);
  368 + th.setData({
  369 + template_arr: t_arr,
  370 + isTemplate: 1,
  371 + bgcolor_t: temp_data.bkcolor
  372 + });
462 373
463 - //----拼单-----  
464 - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {  
465 - data: {  
466 - store_id: os.stoid,  
467 - is_end: 0,  
468 - is_show: 1,  
469 - pageSize: 6 374 + //---如果有设定顶部的颜色的时候--
  375 + if (temp_data.top_color && temp_data.top_color != 'null') {
  376 + wx.setNavigationBarColor({
  377 + frontColor: '#ffffff', // 必写项
  378 + backgroundColor: temp_data.top_color, // 必写项
  379 + })
470 } 380 }
471 - }).then(res => {  
472 - var e = res;  
473 - if (e.data.code == 0) {  
474 - var pd_data = e.data.data.pageData;  
475 -  
476 - if (pd_data.length == 0) return;  
477 -  
478 - //获取当前  
479 - var nt = ut.gettimestamp();  
480 - pd_data.forEach(function(val, ind) {  
481 - if (val.start_time > nt) pd_data[ind].status = 0;  
482 - else if (val.end_time > nt) pd_data[ind].status = 1;  
483 - if (val.buy_num >= val.goods_num) pd_data[ind].status = 2;  
484 - });  
485 381
486 - //获取当前时间,比较拼团中还在未开始  
487 - var timestamp = new Date().getTime();  
488 - var is_team_tepy;  
489 - for (var j = 0; j < pd_data.length; j++) {  
490 - pd_data[j].is_team_tepy = 1;  
491 - if (timestamp < pd_data[j].start_time * 1000) {  
492 - var is_team_tepy;  
493 - pd_data[j].is_team_tepy = 0;  
494 - }  
495 - } 382 + }
  383 + })
496 384
497 - var arr = new Array();  
498 - //--2个2个一组---  
499 - for (var i = 0; i < pd_data.length; i += 2) {  
500 385
501 - arr.push(pd_data.slice(i, i + 2));  
502 - }  
503 386
504 - th.setData({  
505 - pindGoods: arr  
506 - });  
507 - th.countDown2(); 387 +
  388 +
  389 +
  390 +
  391 +},
  392 +//---读取数据内容---
  393 +async init_fir() {
  394 + var th = this;
  395 + //----广告----
  396 + var e = this;
  397 + await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, {
  398 + data: {
  399 + enabled: 1
  400 + }
  401 + }).then(res => {
  402 +
  403 + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) {
  404 + var a = res.data.data.pageData;
  405 + var arr = new Array();
  406 + for (var i = 0; i < a.length; i++) {
  407 + var tt = {
  408 + 'ad_code': o.imghost + a[i].ad_code,
  409 + 'media_link': '',
  410 + 'ad_weapplink': a[i].ad_weapplink
  411 + };
  412 + arr.push(tt);
508 } 413 }
509 - }) 414 + if (arr.length > 0) e.setData({
  415 + banner: arr,
  416 + });
  417 +
  418 + wx.stopPullDownRefresh();
  419 + }
  420 + })
  421 +
  422 + //-----秒杀-----
  423 + var flash_data = null;
  424 + //--获取活动--
  425 + await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
  426 + data: {
  427 + store_id: os.stoid,
  428 + timetype: 2,
  429 + is_end: 0,
  430 + is_show: 1,
  431 + pageSize: 9
  432 + },
  433 + }).then(res => {
  434 + var e = res;
  435 + if (e.data.code == 0) {
  436 + flash_data = e.data.data.pageData;
  437 + if (flash_data == null || flash_data.length <= 0) return false;
  438 +
  439 + //当前时间戳
  440 + var nt = ut.gettimestamp();
  441 +
  442 + flash_data.forEach(function (val, ind) {
  443 + if (val.start_time > nt) flash_data[ind].status = 0;
  444 + else if (val.end_time > nt) flash_data[ind].status = 1;
  445 + if (val.buy_num >= val.goods_num) flash_data[ind].status = 2;
  446 + });
510 447
511 - //------新品-------  
512 - await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {  
513 - data: {  
514 - is_mainshow: 1,  
515 - isonsale: 1,  
516 - is_on_sale: 1,  
517 - store_id: o.stoid,  
518 - pageSize: 9,  
519 - is_new: 1,  
520 - orderField: "sort" 448 + var arr = new Array();
  449 + //--三个三个一组---
  450 + for (var i = 0; i < flash_data.length; i += 3) {
  451 + arr.push(flash_data.slice(i, i + 3));
521 } 452 }
522 - }).then(res => {  
523 - var e = res;  
524 - if (e.data.code == 0) {  
525 - var new_data = e.data.data.pageData;  
526 - var arr = new Array();  
527 - //--三个三个一组---  
528 - for (var i = 0; i < new_data.length; i += 3) {  
529 - arr.push(new_data.slice(i, i + 3)); 453 + th.setData({
  454 + saleGoods: arr
  455 + });
  456 + //th.countDown();
  457 + }
  458 + });
  459 +
  460 + //----拼单-----
  461 + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
  462 + data: {
  463 + store_id: os.stoid,
  464 + is_end: 0,
  465 + is_show: 1,
  466 + pageSize: 6
  467 + }
  468 + }).then(res => {
  469 + var e = res;
  470 + if (e.data.code == 0) {
  471 + var pd_data = e.data.data.pageData;
  472 +
  473 + if (pd_data.length == 0) return;
  474 +
  475 + //获取当前
  476 + var nt = ut.gettimestamp();
  477 + pd_data.forEach(function (val, ind) {
  478 + if (val.start_time > nt) pd_data[ind].status = 0;
  479 + else if (val.end_time > nt) pd_data[ind].status = 1;
  480 + if (val.buy_num >= val.goods_num) pd_data[ind].status = 2;
  481 + });
  482 +
  483 + //获取当前时间,比较拼团中还在未开始
  484 + var timestamp = new Date().getTime();
  485 + var is_team_tepy;
  486 + for (var j = 0; j < pd_data.length; j++) {
  487 + pd_data[j].is_team_tepy = 1;
  488 + if (timestamp < pd_data[j].start_time * 1000) {
  489 + var is_team_tepy;
  490 + pd_data[j].is_team_tepy = 0;
530 } 491 }
531 - th.setData({  
532 - newGoods: arr,  
533 - });  
534 } 492 }
535 - })  
536 493
537 - //------热卖-------  
538 - await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {  
539 - data: {  
540 - is_mainshow: 1,  
541 - isonsale: 1,  
542 - is_on_sale: 1,  
543 - store_id: o.stoid,  
544 - pageSize: 9,  
545 - is_hot: 1,  
546 - orderField: "sort"  
547 - }  
548 - }).then(res => {  
549 - var e = res;  
550 - if (e.data.code == 0) {  
551 - var new_data = e.data.data.pageData;  
552 - var arr = new Array();  
553 - //--三个三个一组---  
554 - for (var i = 0; i < new_data.length; i += 3) {  
555 - arr.push(new_data.slice(i, i + 3));  
556 - }  
557 - th.setData({  
558 - hotGoods: arr,  
559 - }); 494 + var arr = new Array();
  495 + //--2个2个一组---
  496 + for (var i = 0; i < pd_data.length; i += 2) {
  497 +
  498 + arr.push(pd_data.slice(i, i + 2));
560 } 499 }
561 - })  
562 - //---调用信息---  
563 - // this.requestRecommend();  
564 - this.setData({  
565 - ishow: 1  
566 - });  
567 -  
568 - //---先获取会员---  
569 - t.getUserFir(function() {  
570 - th.is_festival();  
571 - var new_nav = th.data.new_nav;  
572 - if (new_nav == "") {  
573 - th.is_new();  
574 - }  
575 -  
576 - setTimeout(function () {  
577 - if (getApp().globalData.user_id) getApp().requestCardNum(th);  
578 - },500)  
579 -  
580 - });  
581 -  
582 - setTimeout(function() {  
583 - var goods_list = th.selectComponent("#goods_list"); //组件的id  
584 - goods_list.init();  
585 - goods_list.get_list();  
586 - }, 2000)  
587 - },  
588 500
589 - //--判断小程序是否过期--  
590 - setappdata: function(t) {  
591 - if (t.isout == 1)  
592 - wx.reLaunch({  
593 - url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+getApp().globalData.config.store_tel,  
594 - });  
595 - if (t.isbuy == 0)  
596 - wx.reLaunch({  
597 - url: "/pages/error/error?msg=还未购买小程序", 501 + th.setData({
  502 + pindGoods: arr
598 }); 503 });
599 - },  
600 - //---加载更多是靠这个函数----  
601 - onReachBottom: function() {  
602 - var goods_list = this.selectComponent("#goods_list"); //组件的id  
603 - if (goods_list) goods_list.get_list();  
604 - }, 504 + th.countDown2();
  505 + }
  506 + })
605 507
606 - onPullDownRefresh: function(e) {  
607 - this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(),  
608 - this.requestRecommend();  
609 - },  
610 - requestRecommend(){},  
611 - requestHomePage(){}, 508 + //------新品-------
  509 + await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
  510 + data: {
  511 + is_mainshow: 1,
  512 + isonsale: 1,
  513 + is_on_sale: 1,
  514 + store_id: o.stoid,
  515 + pageSize: 9,
  516 + is_new: 1,
  517 + orderField: "sort"
  518 + }
  519 + }).then(res => {
  520 + var e = res;
  521 + if (e.data.code == 0) {
  522 + var new_data = e.data.data.pageData;
  523 + var arr = new Array();
  524 + //--三个三个一组---
  525 + for (var i = 0; i < new_data.length; i += 3) {
  526 + arr.push(new_data.slice(i, i + 3));
  527 + }
  528 + th.setData({
  529 + newGoods: arr,
  530 + });
  531 + }
  532 + })
612 533
613 - onUnload: function() {  
614 - this.destroyActivityTimer();  
615 - },  
616 - setCountTime: function(e) {  
617 - e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({  
618 - "sale.diffTime": e.diffTime  
619 - }), this.setData({  
620 - "sale.good": e.flash_sale_goods[0]  
621 - }), this.destroyActivityTimer(), this.createActivityTimer();  
622 - },  
623 - createActivityTimer: function() {  
624 - var e = this.data.sale,  
625 - t = this;  
626 - this.data.timer = setInterval(function() {  
627 - var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime,  
628 - o = i.transTime(a);  
629 - a <= 0 ? t.requestHomePage() : t.setData({  
630 - "sale.countTime": o 534 + //------热卖-------
  535 + await getApp().request.promiseGet("/api/weshop/goods/page?page=1", {
  536 + data: {
  537 + is_mainshow: 1,
  538 + isonsale: 1,
  539 + is_on_sale: 1,
  540 + store_id: o.stoid,
  541 + pageSize: 9,
  542 + is_hot: 1,
  543 + orderField: "sort"
  544 + }
  545 + }).then(res => {
  546 + var e = res;
  547 + if (e.data.code == 0) {
  548 + var new_data = e.data.data.pageData;
  549 + var arr = new Array();
  550 + //--三个三个一组---
  551 + for (var i = 0; i < new_data.length; i += 3) {
  552 + arr.push(new_data.slice(i, i + 3));
  553 + }
  554 + th.setData({
  555 + hotGoods: arr,
631 }); 556 });
632 - }, 1e3);  
633 - },  
634 - destroyActivityTimer: function() {  
635 - this.data.timer && (clearInterval(this.data.timer), this.data.timer = null);  
636 - },  
637 - onPageScroll: function(e) {  
638 - this.data.scrollTop=e.scrollTop;  
639 - var t = getCurrentPages();  
640 - "pages/index/index/index" == t[t.length - 1].route;  
641 - /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({  
642 - frontColor: "#ffffff",  
643 - backgroundColor: "#f95959"  
644 - }) : wx.setNavigationBarColor({  
645 - frontColor: "#000000",  
646 - backgroundColor: "#eeeeee"  
647 - }));--*/  
648 - },  
649 - jumpSearch: function() {  
650 - wx.navigateTo({  
651 - url: "/pages/goods/search/search" 557 + }
  558 + })
  559 + //---调用信息---
  560 + // this.requestRecommend();
  561 + this.setData({
  562 + ishow: 1
  563 + });
  564 +
  565 + //---先获取会员---
  566 + t.getUserFir(function () {
  567 + th.is_festival();
  568 + var new_nav = th.data.new_nav;
  569 + if (new_nav == "") {
  570 + th.is_new();
  571 + }
  572 +
  573 + setTimeout(function () {
  574 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  575 + }, 500)
  576 +
  577 + });
  578 +
  579 + setTimeout(function () {
  580 + var goods_list = th.selectComponent("#goods_list"); //组件的id
  581 + goods_list.init();
  582 + goods_list.get_list();
  583 + }, 2000)
  584 +},
  585 +
  586 +//--判断小程序是否过期--
  587 +setappdata: function (t) {
  588 + if (t.isout == 1)
  589 + wx.reLaunch({
  590 + url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel,
652 }); 591 });
653 - },  
654 - onShareAppMessage: function(e) {  
655 - var url="/pages/index/index/index";  
656 - var userInfo=getApp().globalData.userInfo;  
657 - //是分销商才带  
658 - if(userInfo){  
659 - url+="?first_leader="+userInfo.user_id;  
660 - }  
661 - console.log("---首页---分享--");  
662 - var title="商城首页"  
663 - //分享  
664 - if(getApp().globalData.config && getApp().globalData.config.store_name){  
665 - title=getApp().globalData.config.store_name;  
666 - }else if(getApp().globalData.setting.appName){  
667 - title=getApp().globalData.setting.appName;  
668 - }  
669 -  
670 - var ob={  
671 - title: title,  
672 - path:url,  
673 - };  
674 - console.log(ob);  
675 - return ob;  
676 - }, 592 + if (t.isbuy == 0)
  593 + wx.reLaunch({
  594 + url: "/pages/error/error?msg=还未购买小程序",
  595 + });
  596 +},
  597 +//---加载更多是靠这个函数----
  598 +onReachBottom: function () {
  599 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  600 + if (goods_list) goods_list.get_list();
  601 +},
677 602
678 - //图片失败,默认图片  
679 - bind_bnerr: function(e) {  
680 - var _errImg = e.target.dataset.errorimg;  
681 - var _errObj = {};  
682 - _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg";  
683 - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;  
684 - }, 603 +onPullDownRefresh: function (e) {
  604 + this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(),
  605 + this.requestRecommend();
  606 +},
  607 +requestRecommend() { },
  608 +requestHomePage() { },
  609 +
  610 +onUnload: function () {
  611 + this.destroyActivityTimer();
  612 +},
  613 +setCountTime: function (e) {
  614 + e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({
  615 + "sale.diffTime": e.diffTime
  616 + }), this.setData({
  617 + "sale.good": e.flash_sale_goods[0]
  618 + }), this.destroyActivityTimer(), this.createActivityTimer();
  619 +},
  620 +createActivityTimer: function () {
  621 + var e = this.data.sale,
  622 + t = this;
  623 + this.data.timer = setInterval(function () {
  624 + var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime,
  625 + o = i.transTime(a);
  626 + a <= 0 ? t.requestHomePage() : t.setData({
  627 + "sale.countTime": o
  628 + });
  629 + }, 1e3);
  630 +},
  631 +destroyActivityTimer: function () {
  632 + this.data.timer && (clearInterval(this.data.timer), this.data.timer = null);
  633 +},
  634 +onPageScroll: function (e) {
  635 + this.data.scrollTop = e.scrollTop;
  636 + var t = getCurrentPages();
  637 + "pages/index/index/index" == t[t.length - 1].route;
  638 + /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({
  639 + frontColor: "#ffffff",
  640 + backgroundColor: "#f95959"
  641 + }) : wx.setNavigationBarColor({
  642 + frontColor: "#000000",
  643 + backgroundColor: "#eeeeee"
  644 + }));--*/
  645 +},
  646 +jumpSearch: function () {
  647 + wx.navigateTo({
  648 + url: "/pages/goods/search/search"
  649 + });
  650 +},
  651 +onShareAppMessage: function (e) {
  652 + var url = "/pages/index/index/index";
  653 + var userInfo = getApp().globalData.userInfo;
  654 + //是分销商才带
  655 + if (userInfo) {
  656 + url += "?first_leader=" + userInfo.user_id;
  657 + }
  658 + console.log("---首页---分享--");
  659 + var title = "商城首页"
  660 + //分享
  661 + if (getApp().globalData.config && getApp().globalData.config.store_name) {
  662 + title = getApp().globalData.config.store_name;
  663 + } else if (getApp().globalData.setting.appName) {
  664 + title = getApp().globalData.setting.appName;
  665 + }
  666 +
  667 + var ob = {
  668 + title: title,
  669 + path: url,
  670 + };
  671 + console.log(ob);
  672 + return ob;
  673 +},
685 674
686 - //图片失败,默认图片  
687 - bind_bnerr2: function(e) {  
688 - var _errImg = e.target.dataset.errorimg;  
689 - var _errurl = e.target.dataset.url; 675 +//图片失败,默认图片
  676 +bind_bnerr: function (e) {
  677 + var _errImg = e.target.dataset.errorimg;
  678 + var _errObj = {};
  679 + _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg";
  680 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  681 +},
  682 +
  683 +//图片失败,默认图片
  684 +bind_bnerr2: function (e) {
  685 + var _errImg = e.target.dataset.errorimg;
  686 + var _errurl = e.target.dataset.url;
  687 + var _errObj = {};
  688 + _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
  689 + this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  690 +
  691 +},
  692 +//图片失败,默认图片
  693 +bind_bnerr3: function (e) {
  694 + var _errImg = e.target.dataset.errorimg;
  695 + var _Img = e.target.dataset.img;
  696 + if (_Img != undefined) {
690 var _errObj = {}; 697 var _errObj = {};
691 - _errObj[_errImg] = "/miniapp/images/default_g_img.gif";  
692 - this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; 698 + _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
  699 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  700 + }
  701 +},
693 702
694 - },  
695 - //图片失败,默认图片  
696 - bind_bnerr3: function(e) {  
697 - var _errImg = e.target.dataset.errorimg;  
698 - var _Img = e.target.dataset.img;  
699 - if (_Img != undefined) {  
700 - var _errObj = {};  
701 - _errObj[_errImg] = "/public/images/default_goods_image_240.gif";  
702 - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;  
703 - }  
704 - },  
705 703
  704 +//秒杀倒计时
  705 +//---小于10的格式化函数----
  706 +timeFormat(param) {
  707 + return param < 10 ? '0' + param : param;
  708 +},
706 709
707 - //秒杀倒计时  
708 - //---小于10的格式化函数----  
709 - timeFormat(param) {  
710 - return param < 10 ? '0' + param : param;  
711 - }, 710 +//----秒杀倒计时函数-----
  711 +countDown() {
  712 + if (!this.data.is_timer) return false;
  713 + var th = this;
  714 + // 获取当前时间,同时得到活动结束时间数组
  715 + var newTime = ut.gettimestamp();
  716 + var List = this.data.saleGoods;
  717 + for (var j = 0; j < List.length; j++) {
  718 + var endTimeList = List[j];
  719 + // 对结束时间进行处理渲染到页面
  720 + for (var i = 0; i < endTimeList.length; i++) {
  721 + var o = endTimeList[i];
  722 + var endTime = o.end_time
  723 + if (o.status == 0) endTime = o.start_time
712 724
713 - //----秒杀倒计时函数-----  
714 - countDown() {  
715 - if (!this.data.is_timer) return false;  
716 - var th = this;  
717 - // 获取当前时间,同时得到活动结束时间数组  
718 - var newTime = ut.gettimestamp();  
719 - var List = this.data.saleGoods;  
720 - for (var j = 0; j < List.length; j++) {  
721 - var endTimeList = List[j];  
722 - // 对结束时间进行处理渲染到页面  
723 - for (var i = 0; i < endTimeList.length; i++) {  
724 - var o = endTimeList[i];  
725 - var endTime = o.end_time  
726 - if (o.status == 0) endTime = o.start_time  
727 -  
728 - var obj = null;  
729 - // 如果活动未结束,对时间进行处理  
730 - if (endTime - newTime > 0) {  
731 - var time = (endTime - newTime);  
732 - // 获取天、时、分、秒  
733 - var day = parseInt(time / (60 * 60 * 24));  
734 - var hou = parseInt(time % (60 * 60 * 24) / 3600);  
735 - var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);  
736 - var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);  
737 - obj = {  
738 - day: this.timeFormat(day),  
739 - hou: this.timeFormat(hou),  
740 - min: this.timeFormat(min),  
741 - sec: this.timeFormat(sec)  
742 - }  
743 - } else {  
744 - //活动已结束,全部设置为'00'  
745 - obj = {  
746 - day: '00',  
747 - hou: '00',  
748 - min: '00',  
749 - sec: '00'  
750 - } 725 + var obj = null;
  726 + // 如果活动未结束,对时间进行处理
  727 + if (endTime - newTime > 0) {
  728 + var time = (endTime - newTime);
  729 + // 获取天、时、分、秒
  730 + var day = parseInt(time / (60 * 60 * 24));
  731 + var hou = parseInt(time % (60 * 60 * 24) / 3600);
  732 + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  733 + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  734 + obj = {
  735 + day: this.timeFormat(day),
  736 + hou: this.timeFormat(hou),
  737 + min: this.timeFormat(min),
  738 + sec: this.timeFormat(sec)
  739 + }
  740 + } else {
  741 + //活动已结束,全部设置为'00'
  742 + obj = {
  743 + day: '00',
  744 + hou: '00',
  745 + min: '00',
  746 + sec: '00'
751 } 747 }
752 - var txt = "saleGoods[" + j + "][" + i + "].djs";  
753 - th.setData({  
754 - [txt]: obj  
755 - });  
756 } 748 }
757 - 749 + var txt = "saleGoods[" + j + "][" + i + "].djs";
  750 + th.setData({
  751 + [txt]: obj
  752 + });
758 } 753 }
759 - setTimeout(th.countDown, 1000);  
760 - },  
761 754
762 - //----拼单倒计时函数-----  
763 - countDown2() {  
764 - if (!this.data.is_timer) return false;  
765 -  
766 - var th = this;  
767 - // 获取当前时间,同时得到活动结束时间数组  
768 - var newTime = ut.gettimestamp();  
769 - var List = this.data.pindGoods;  
770 - for (var j = 0; j < List.length; j++) {  
771 - var endTimeList = List[j];  
772 - // 对结束时间进行处理渲染到页面  
773 - for (var i = 0; i < endTimeList.length; i++) {  
774 - var o = endTimeList[i];  
775 - var endTime = o.end_time;  
776 - if (o.status == 0) endTime = o.start_time;  
777 -  
778 - let obj = null;  
779 - // 如果活动未结束,对时间进行处理  
780 - if (endTime - newTime > 0) {  
781 - let time = (endTime - newTime);  
782 - // 获取天、时、分、秒  
783 - let day = parseInt(time / (60 * 60 * 24));  
784 - let hou = parseInt(time % (60 * 60 * 24) / 3600);  
785 - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);  
786 - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);  
787 - obj = {  
788 - day: this.timeFormat(day),  
789 - hou: this.timeFormat(hou),  
790 - min: this.timeFormat(min),  
791 - sec: this.timeFormat(sec)  
792 - }  
793 - } else {  
794 - //活动已结束,全部设置为'00'  
795 - obj = {  
796 - day: '00',  
797 - hou: '00',  
798 - min: '00',  
799 - sec: '00'  
800 - } 755 + }
  756 + setTimeout(th.countDown, 1000);
  757 +},
  758 +
  759 +//----拼单倒计时函数-----
  760 +countDown2() {
  761 + if (!this.data.is_timer) return false;
  762 +
  763 + var th = this;
  764 + // 获取当前时间,同时得到活动结束时间数组
  765 + var newTime = ut.gettimestamp();
  766 + var List = this.data.pindGoods;
  767 + for (var j = 0; j < List.length; j++) {
  768 + var endTimeList = List[j];
  769 + // 对结束时间进行处理渲染到页面
  770 + for (var i = 0; i < endTimeList.length; i++) {
  771 + var o = endTimeList[i];
  772 + var endTime = o.end_time;
  773 + if (o.status == 0) endTime = o.start_time;
  774 +
  775 + let obj = null;
  776 + // 如果活动未结束,对时间进行处理
  777 + if (endTime - newTime > 0) {
  778 + let time = (endTime - newTime);
  779 + // 获取天、时、分、秒
  780 + let day = parseInt(time / (60 * 60 * 24));
  781 + let hou = parseInt(time % (60 * 60 * 24) / 3600);
  782 + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  783 + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  784 + obj = {
  785 + day: this.timeFormat(day),
  786 + hou: this.timeFormat(hou),
  787 + min: this.timeFormat(min),
  788 + sec: this.timeFormat(sec)
  789 + }
  790 + } else {
  791 + //活动已结束,全部设置为'00'
  792 + obj = {
  793 + day: '00',
  794 + hou: '00',
  795 + min: '00',
  796 + sec: '00'
801 } 797 }
802 - var txt = "pindGoods[" + j + "][" + i + "].djs";  
803 - th.setData({  
804 - [txt]: obj  
805 - });  
806 } 798 }
  799 + var txt = "pindGoods[" + j + "][" + i + "].djs";
  800 + th.setData({
  801 + [txt]: obj
  802 + });
807 } 803 }
808 - setTimeout(th.countDown2, 1000);  
809 - }, 804 + }
  805 + setTimeout(th.countDown2, 1000);
  806 +},
810 807
811 - bannerSwiperChange: function(e) {  
812 - var index = e.detail.current;  
813 - this.setData({  
814 - banner_index: index  
815 - });  
816 - },  
817 - flashSwiperChange: function(e) {  
818 - var index = e.detail.current;  
819 - this.setData({  
820 - flash_index: index  
821 - });  
822 - },  
823 - ptSwiperChange: function(e) {  
824 - var index = e.detail.current;  
825 - this.setData({  
826 - pt_index: index  
827 - });  
828 - }, 808 +bannerSwiperChange: function (e) {
  809 + var index = e.detail.current;
  810 + this.setData({
  811 + banner_index: index
  812 + });
  813 +},
  814 +flashSwiperChange: function (e) {
  815 + var index = e.detail.current;
  816 + this.setData({
  817 + flash_index: index
  818 + });
  819 +},
  820 +ptSwiperChange: function (e) {
  821 + var index = e.detail.current;
  822 + this.setData({
  823 + pt_index: index
  824 + });
  825 +},
829 826
830 - Interval_pt() {  
831 - var th = this;  
832 - this.data.pt_timer = setInterval(function() {  
833 - var item = ut.get_rand_item(th.data.pt_timer_arr); 827 +Interval_pt() {
  828 + var th = this;
  829 + this.data.pt_timer = setInterval(function () {
  830 + var item = ut.get_rand_item(th.data.pt_timer_arr);
  831 + th.setData({
  832 + pt_timer_active: 1,
  833 + pt_timer_item: item
  834 + });
  835 + setTimeout(function () {
834 th.setData({ 836 th.setData({
835 - pt_timer_active: 1,  
836 - pt_timer_item: item 837 + pt_timer_active: 0
837 }); 838 });
838 - setTimeout(function() {  
839 - th.setData({  
840 - pt_timer_active: 0  
841 - });  
842 - }, 1500)  
843 - }, 4000);  
844 - }, 839 + }, 1500)
  840 + }, 4000);
  841 +},
845 842
846 843
847 - //---扫一扫的函数---  
848 - getScancode: function() {  
849 - var _this = this;  
850 - // 允许从相机和相册扫码  
851 - wx.scanCode({  
852 - success: (res) => {  
853 - var result = res.result;  
854 - wx.navigateTo({  
855 - url: "/pages/goods/search/search?s_key=" + result,  
856 - });  
857 - }  
858 - })  
859 - }, 844 +//---扫一扫的函数---
  845 +getScancode: function () {
  846 + var _this = this;
  847 + // 允许从相机和相册扫码
  848 + wx.scanCode({
  849 + success: (res) => {
  850 + var result = res.result;
  851 + wx.navigateTo({
  852 + url: "/pages/goods/search/search?s_key=" + result,
  853 + });
  854 + }
  855 + })
  856 +},
860 857
861 - //跳转到分类  
862 - go_cate: function() {  
863 - getApp().goto("/pages/goods/categoryList/categoryList");  
864 - }, 858 +//跳转到分类
  859 +go_cate: function () {
  860 + getApp().goto("/pages/goods/categoryList/categoryList");
  861 +},
865 862
866 - go_url: function(e) {  
867 - var url = e.currentTarget.dataset.url;  
868 - getApp().goto(url);  
869 - }, 863 +go_url: function (e) {
  864 + var url = e.currentTarget.dataset.url;
  865 + getApp().goto(url);
  866 +},
870 867
871 - bind_bnerr_icon: function(e) {  
872 - var def = "/miniapp/images/no_cate_def.png";  
873 - var _err = e.currentTarget.dataset.err;  
874 - var ob = {};  
875 - ob[_err] = def;  
876 - this.setData(ob);  
877 - }, 868 +bind_bnerr_icon: function (e) {
  869 + var def = "/miniapp/images/no_cate_def.png";
  870 + var _err = e.currentTarget.dataset.err;
  871 + var ob = {};
  872 + ob[_err] = def;
  873 + this.setData(ob);
  874 +},
878 875
879 - //跳转到分类的商品列表  
880 - go_cate2: function(t) {  
881 - var cid = t.currentTarget.dataset.cid;  
882 - var pid = t.currentTarget.dataset.pid;  
883 - var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; 876 +//跳转到分类的商品列表
  877 +go_cate2: function (t) {
  878 + var cid = t.currentTarget.dataset.cid;
  879 + var pid = t.currentTarget.dataset.pid;
  880 + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid;
  881 + wx.navigateTo({
  882 + url: lurl
  883 + });
  884 +},
  885 +new_nav: function (e) {
  886 + var th = this;
  887 + var new_nav = th.data.new_nav;
  888 + getApp().goto(new_nav);
  889 +},
  890 +//跳转到权益
  891 +go_quanyi: function (t) {
  892 + var user_info = getApp().globalData.userInfo;
  893 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
884 wx.navigateTo({ 894 wx.navigateTo({
885 - url: lurl  
886 - });  
887 - },  
888 - new_nav: function(e) {  
889 - var th = this;  
890 - var new_nav = th.data.new_nav;  
891 - getApp().goto(new_nav);  
892 - },  
893 - //跳转到权益  
894 - go_quanyi: function(t) {  
895 - var user_info = getApp().globalData.userInfo;  
896 - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {  
897 - wx.navigateTo({  
898 - url: '/pages/togoin/togoin',  
899 - //url: '/pages/getphone/getphone',  
900 - })  
901 - return false;  
902 - }  
903 - getApp().goto("/pages/user/userqy/userqy");  
904 - }, 895 + url: '/pages/togoin/togoin',
  896 + //url: '/pages/getphone/getphone',
  897 + })
  898 + return false;
  899 + }
  900 + getApp().goto("/pages/user/userqy/userqy");
  901 +},
905 902
906 - imageLoad: function(e) {  
907 - var imgwidth = e.detail.width;  
908 - var imgheight = e.detail.height;  
909 - //宽高比  
910 - var ratio = imgwidth / imgheight;  
911 - //计算的高度值  
912 - var viewHeight = 715 / ratio;  
913 - if (this.data.max_sw_height < viewHeight) this.setData({  
914 - max_sw_height: viewHeight  
915 - });  
916 - },  
917 - //判断该用户是否是新会员  
918 - is_new: function() {  
919 - var th = this;  
920 - wx.hideLoading();  
921 - getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {  
922 - data: {  
923 - storeId: os.stoid,  
924 - userId: d.user_id 903 +imageLoad: function (e) {
  904 + var imgwidth = e.detail.width;
  905 + var imgheight = e.detail.height;
  906 + //宽高比
  907 + var ratio = imgwidth / imgheight;
  908 + //计算的高度值
  909 + var viewHeight = 715 / ratio;
  910 + if (this.data.max_sw_height < viewHeight) this.setData({
  911 + max_sw_height: viewHeight
  912 + });
  913 +},
  914 +//判断该用户是否是新会员
  915 +is_new: function () {
  916 + var th = this;
  917 + wx.hideLoading();
  918 + getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {
  919 + data: {
  920 + storeId: os.stoid,
  921 + userId: d.user_id,
  922 + }
  923 + }).then(res => {
  924 + if (res.data.code == 0) {
  925 + var actid = res.data.data.id; //活动id
  926 + var giftBagId = res.data.data.giftBagId; //礼包id
  927 + var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;
  928 + var new_image = res.data.data.imageurl;
  929 + var swiperimage = th.data.swiperimage;
  930 + var img = {
  931 + image: "/miniapp/images/newpeople/newpeople.png",
  932 + nav_url: new_nav
925 } 933 }
926 - }).then(res => {  
927 - if (res.data.code == 0) {  
928 - var actid = res.data.data.id; //活动id  
929 - var giftBagId = res.data.data.giftBagId; //礼包id  
930 - var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;  
931 - var new_image = res.data.data.imageurl;  
932 - var swiperimage = th.data.swiperimage;  
933 - var img = {  
934 - image: "/miniapp/images/newpeople/newpeople.png",  
935 - nav_url: new_nav 934 + swiperimage.unshift(img);
  935 + th.setData({
  936 + swiperimage: swiperimage,
  937 + new_image: new_image,
  938 + new_nav: new_nav
  939 + })
  940 +
  941 + getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", {
  942 + data: {
  943 + storeId: o.stoid,
  944 + userId: d.user_id
  945 + }
  946 + }).then(res => {
  947 + if (res.data.code == 0) {
  948 + th.setData({
  949 + is_disgraceful: 1
  950 + })
  951 + } else {
  952 + th.check_holiday_pop(); //节日的弹窗
936 } 953 }
937 - swiperimage.unshift(img);  
938 - th.setData({  
939 - swiperimage: swiperimage,  
940 - new_image: new_image,  
941 - new_nav: new_nav  
942 - })  
943 954
944 - getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", {  
945 - data: {  
946 - storeId: o.stoid,  
947 - userId: d.user_id  
948 - }  
949 - }).then(res => {  
950 - if (res.data.code == 0) {  
951 - th.setData({  
952 - is_disgraceful: 1  
953 - })  
954 - }else{  
955 - th.check_holiday_pop(); //节日的弹窗  
956 - }  
957 -  
958 - })  
959 - }else{  
960 - th.check_holiday_pop(); //节日的弹窗  
961 - }  
962 -  
963 - }) 955 + })
  956 + } else {
  957 + th.check_holiday_pop(); //节日的弹窗
  958 + }
964 959
965 - },  
966 -  
967 - is_festival: function(e) {  
968 - var th = this;  
969 - var url = "/api/weshop/marketing/holiday/act/judge";  
970 - getApp().request.promiseGet(url, {  
971 - data: {  
972 - storeId: os.stoid,  
973 - userId: d.user_id  
974 - }  
975 - }).then(res => {  
976 - if (res.data.code == 0) {  
977 - var actid = res.data.data.id; //活动id  
978 - var giftBagId = res.data.data.gifBagId; //礼包id  
979 - var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId;  
980 - var swiperimage = th.data.swiperimage;  
981 - var actBoundImg = res.data.data.actBoundImg;  
982 -  
983 - th.data.holiday_image= res.data.data.actImg;  
984 - th.data.holiday_url=nav_url;  
985 -  
986 - var img = {  
987 - image: actBoundImg,  
988 - nav_url: nav_url  
989 - }  
990 - swiperimage.unshift(img);  
991 - th.setData({  
992 - swiperimage: swiperimage,  
993 - new_nav: nav_url  
994 - }) 960 + })
  961 +
  962 +},
  963 +
  964 +is_festival: function (e) {
  965 + var th = this;
  966 + var url = "/api/weshop/marketing/holiday/act/judge";
  967 + getApp().request.promiseGet(url, {
  968 + data: {
  969 + storeId: os.stoid,
  970 + userId: d.user_id,
  971 + id:th.data.actid //
  972 + }
  973 + }).then(res => {
  974 + if (res.data.code == 0) {
  975 + var actid = res.data.data.id; //活动id
  976 + var giftBagId = res.data.data.gifBagId; //礼包id
  977 + var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId;
  978 + var swiperimage = th.data.swiperimage;
  979 + var actBoundImg = res.data.data.actBoundImg;
  980 +
  981 + th.data.holiday_image = res.data.data.actImg;
  982 + th.data.holiday_url = nav_url;
  983 +
  984 + var img = {
  985 + image: actBoundImg,
  986 + nav_url: nav_url
995 } 987 }
  988 + swiperimage.unshift(img);
  989 + th.setData({
  990 + swiperimage: swiperimage,
  991 + new_nav: nav_url
  992 + })
  993 + }
  994 + })
  995 +},
  996 +
  997 +//弹出节日有礼
  998 +check_holiday_pop: function () {
  999 + var th = this;
  1000 + getApp().waitfor(th, 'w_holiday_pop', th.data.holiday_image, function () {
  1001 + console.log(th.data.holiday_image);
  1002 + th.setData({
  1003 + new_image: th.data.holiday_image,
  1004 + new_nav: th.data.holiday_url,
  1005 + is_disgraceful: 1
996 }) 1006 })
997 - },  
998 -  
999 - //弹出节日有礼  
1000 - check_holiday_pop:function(){  
1001 - var th=this;  
1002 - getApp().waitfor(th,'w_holiday_pop',th.data.holiday_image,function(){  
1003 - console.log(th.data.holiday_image);  
1004 - th.setData({  
1005 - new_image: th.data.holiday_image,  
1006 - new_nav: th.data.holiday_url,  
1007 - is_disgraceful: 1  
1008 - })  
1009 - })  
1010 - },  
1011 -  
1012 - go_ad:function(e){  
1013 - var url=e.currentTarget.dataset.url;  
1014 - if(!url || url=='') return;  
1015 - if(url[0]!='/') url='/'+url;  
1016 - getApp().goto(url);  
1017 - },  
1018 -  
1019 - //导航跳转  
1020 - nav_goto:function(e){  
1021 - var url=e.currentTarget.dataset.url;  
1022 - if(!url || url=='') return;  
1023 - if(url[0]!='/') url='/'+url;  
1024 - getApp().goto(url);  
1025 - if(this.data.showHongbao) {  
1026 - this.setData({  
1027 - showHongbao: false,  
1028 - showHongbaoSmall: true, //显示抢红包小图标  
1029 - });  
1030 - }  
1031 - },  
1032 -  
1033 - //----跳转到搭配购买----  
1034 - go_test:function () {  
1035 - wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", })  
1036 - },  
1037 -  
1038 -  
1039 - onShareTimeline() {  
1040 - // getApp().getConfig(function(t) {  
1041 - // return {  
1042 - // title: '首页-' + getApp().globalData.config.store_name,  
1043 - // }  
1044 - // });  
1045 - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:'';  
1046 - if(!store_name)  
1047 - store_name=getApp().globalData.setting.appName;  
1048 - return {  
1049 - title: '首页-' + store_name,  
1050 - }  
1051 - },  
1052 -  
1053 -  
1054 - // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标  
1055 - closeHongbao() {  
1056 - this.setData({  
1057 - showHongbao: false, //关闭抢红包主弹窗  
1058 - showHongbaoSmall: true, //显示抢红包小图标  
1059 - });  
1060 - },  
1061 -  
1062 - /*-- 全屏广告 --*/  
1063 - close_full_screen(){  
1064 - this.setData({is_full_screen_show:0,sec_show:0});  
1065 - },  
1066 - //-- 跳转到满屏广告的链接 --  
1067 - go_full_ad(){  
1068 - if(!this.data.full_ad) return false;  
1069 - if(!this.data.full_ad.ad_weapplink) return false;  
1070 - getApp().goto(this.data.full_ad.ad_weapplink);  
1071 - this.close_full_screen();  
1072 - }, 1007 + })
  1008 +},
  1009 +
  1010 +go_ad: function (e) {
  1011 + var url = e.currentTarget.dataset.url;
  1012 + if (!url || url == '') return;
  1013 + if (url[0] != '/') url = '/' + url;
  1014 + getApp().goto(url);
  1015 +},
  1016 +
  1017 +//导航跳转
  1018 +nav_goto: function (e) {
  1019 + var url = e.currentTarget.dataset.url;
  1020 + if (!url || url == '') return;
  1021 + if (url[0] != '/') url = '/' + url;
  1022 + getApp().goto(url);
  1023 + if (this.data.showHongbao) {
  1024 + this.setData({
  1025 + showHongbao: false,
  1026 + showHongbaoSmall: true, //显示抢红包小图标
  1027 + });
  1028 + }
  1029 +},
  1030 +
  1031 +//----跳转到搭配购买----
  1032 +go_test: function () {
  1033 + wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", })
  1034 +},
  1035 +
  1036 +
  1037 +onShareTimeline() {
  1038 + // getApp().getConfig(function(t) {
  1039 + // return {
  1040 + // title: '首页-' + getApp().globalData.config.store_name,
  1041 + // }
  1042 + // });
  1043 + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
  1044 + if (!store_name)
  1045 + store_name = getApp().globalData.setting.appName;
  1046 + return {
  1047 + title: '首页-' + store_name,
  1048 + }
  1049 +},
  1050 +
  1051 +
  1052 +// 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标
  1053 +closeHongbao() {
  1054 + this.setData({
  1055 + showHongbao: false, //关闭抢红包主弹窗
  1056 + showHongbaoSmall: true, //显示抢红包小图标
  1057 + });
  1058 +},
  1059 +
  1060 +/*-- 全屏广告 --*/
  1061 +close_full_screen() {
  1062 + this.setData({ is_full_screen_show: 0, sec_show: 0 });
  1063 +},
  1064 +//-- 跳转到满屏广告的链接 --
  1065 +go_full_ad() {
  1066 + if (!this.data.full_ad) return false;
  1067 + if (!this.data.full_ad.ad_weapplink) return false;
  1068 + getApp().goto(this.data.full_ad.ad_weapplink);
  1069 + this.close_full_screen();
  1070 +},
1073 1071
1074 }); 1072 });
1075 \ No newline at end of file 1073 \ No newline at end of file
project.config.json
@@ -21,21 +21,22 @@ @@ -21,21 +21,22 @@
21 "checkSiteMap": true, 21 "checkSiteMap": true,
22 "uploadWithSourceMap": true, 22 "uploadWithSourceMap": true,
23 "compileHotReLoad": false, 23 "compileHotReLoad": false,
24 - "useMultiFrameRuntime": true,  
25 - "useApiHook": true, 24 + "lazyloadPlaceholderEnable": false,
  25 + "useMultiFrameRuntime": false,
  26 + "useApiHook": false,
26 "useApiHostProcess": false, 27 "useApiHostProcess": false,
27 "babelSetting": { 28 "babelSetting": {
28 "ignore": [], 29 "ignore": [],
29 "disablePlugins": [], 30 "disablePlugins": [],
30 "outputPath": "" 31 "outputPath": ""
31 }, 32 },
  33 + "enableEngineNative": false,
32 "useIsolateContext": true, 34 "useIsolateContext": true,
33 - "useCompilerModule": false,  
34 - "userConfirmedUseCompilerModuleSwitch": false,  
35 "userConfirmedBundleSwitch": false, 35 "userConfirmedBundleSwitch": false,
36 "packNpmManually": false, 36 "packNpmManually": false,
37 "packNpmRelationList": [], 37 "packNpmRelationList": [],
38 - "minifyWXSS": true 38 + "minifyWXSS": true,
  39 + "showES6CompileOption": false
39 }, 40 },
40 "compileType": "miniprogram", 41 "compileType": "miniprogram",
41 "libVersion": "2.16.0", 42 "libVersion": "2.16.0",