Commit aed8e6584ba23972c863c8a14a49f8d79b29f58f
1 parent
f3225f83
会员登陆 弹出框邀请登陆的优化
Showing
8 changed files
with
739 additions
and
818 deletions
app.js
... | ... | @@ -109,9 +109,14 @@ App({ |
109 | 109 | if (!app.globalData.userInfo) { |
110 | 110 | var user = wx.getStorageSync("userinfo"); |
111 | 111 | if (user && user.user_id) { |
112 | + | |
112 | 113 | //--生成会员 -- |
113 | 114 | app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id, {}).then(res => { |
115 | + | |
116 | + app.globalData.is_get_login=1; | |
117 | + | |
114 | 118 | if (res.data.code == 0) { |
119 | + | |
115 | 120 | user = res.data.data; |
116 | 121 | //-- 小程序会员被解绑了,就要清空会员 -- |
117 | 122 | if (user['is_weappuser'] == 0) { |
... | ... | @@ -141,7 +146,9 @@ App({ |
141 | 146 | }) |
142 | 147 | } |
143 | 148 | else if(app.globalData.user_id){ //-- 启用默认的user_id -- |
149 | + | |
144 | 150 | app.promiseGet("/api/weshop/users/get/" + app.globalData.setting.stoid + "/" + app.globalData.user_id,{}).then(res=>{ |
151 | + app.globalData.is_get_login=1; | |
145 | 152 | if(res.data.code==0){ |
146 | 153 | app.globalData.userInfo = res.data.data; |
147 | 154 | wx.setStorageSync("userinfo",app.globalData.userInfo); |
... | ... | @@ -803,21 +810,30 @@ App({ |
803 | 810 | |
804 | 811 | //--- 最多十秒 --- |
805 | 812 | waitfor_login(func){ |
806 | - var n = 0; | |
807 | - var that=this; | |
808 | - if (!this.globalData.is_get_login) { | |
809 | - var inter = setInterval(function () { | |
810 | - n++; | |
811 | - if (that.globalData.is_get_login) { | |
812 | - clearInterval(inter); | |
813 | - func(); | |
814 | - } | |
815 | - if (n > 20) { | |
816 | - clearInterval(inter); | |
817 | - func(); | |
818 | - } | |
819 | - }, 500); | |
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 | + } | |
820 | 834 | } |
835 | + | |
836 | + | |
821 | 837 | }, |
822 | 838 | |
823 | 839 | //------定时等待某个值,有值才进行运算-------- | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -429,22 +429,85 @@ Page({ |
429 | 429 | getApp().globalData.guide_id = res.data.data.id; |
430 | 430 | getApp().globalData.guide_pick_id = res.data.data.pickup_id; |
431 | 431 | |
432 | - | |
433 | 432 | wxlog.info(getApp().globalData.user_id+'-分享的导购:'+getApp().globalData.guide_id); |
434 | 433 | |
435 | 434 | } |
436 | 435 | }) |
437 | 436 | |
437 | + } | |
438 | 438 | |
439 | + //先查看一下是不是系统会员 | |
440 | + getApp().waitfor_login(()=>{ | |
441 | + if (!getApp().globalData.user_id) { | |
442 | + ut.new_user_go(os.stoid, first_leader); | |
443 | + } | |
439 | 444 | |
440 | - //先查看一下是不是系统会员 | |
441 | - getApp().waitfor_login(()=>{ | |
442 | - if (!getApp().globalData.user_id) { | |
443 | - ut.new_user_go(os.stoid, first_leader); | |
444 | - } | |
445 | - }) | |
445 | + //----获取系统参数----- | |
446 | + getApp().getConfig2(function (e) { | |
447 | + ee.setData({ | |
448 | + bconfig: e, | |
449 | + sales_rules: e.sales_rules, | |
450 | + }); | |
446 | 451 | |
447 | - } | |
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 | + }) | |
448 | 511 | |
449 | 512 | //-- 如果有房间号 -- |
450 | 513 | if (room_id) { |
... | ... | @@ -489,71 +552,7 @@ Page({ |
489 | 552 | }) |
490 | 553 | }) |
491 | 554 | |
492 | - //----获取系统参数----- | |
493 | - getApp().getConfig2(function (e) { | |
494 | - ee.setData({ | |
495 | - bconfig: e, | |
496 | - sales_rules: e.sales_rules, | |
497 | - }); | |
498 | - | |
499 | - if (e.categoryset.indexOf("," + 1 + ",") != -1) { | |
500 | - ee.setData({ | |
501 | - is_show_pl: 1 | |
502 | - }); | |
503 | - } | |
504 | - if (e.categoryset.indexOf("," + 3 + ",") != -1) { | |
505 | - ee.setData({ | |
506 | - is_show_pp: 1 | |
507 | - }); | |
508 | - } | |
509 | - if (e.categoryset.indexOf("," + 2 + ",") != -1) { | |
510 | - ee.setData({ | |
511 | - is_show_gb: 1 | |
512 | - }); | |
513 | - } | |
514 | - console.log('获取系统参数'); | |
515 | - console.log(e); | |
516 | - var json_d = JSON.parse(e.switch_list); | |
517 | - ee.setData({ | |
518 | - store_config: e, | |
519 | - sys_switch: json_d, | |
520 | - is_closecoupon: json_d.is_closecoupon, | |
521 | - is_newsales_rules: json_d.is_newsales_rules, | |
522 | - is_retail_price: json_d.is_retail_price || 0, | |
523 | - appoint_pick_keyid: json_d.appoint_pick_keyid, | |
524 | - // goods_bottomconent:e.goods_bottomconent | |
525 | - }); | |
526 | - | |
527 | - if(e && e.goods_topconent && e.goods_ad_position.indexOf('1')>-1){ | |
528 | - //商品详情广告---- | |
529 | - a.wxParse("goodInfo_ad2", "html", ut.format_content(e.goods_topconent), ee, 6); | |
530 | - common.wxParseAddFullImageUrl(ee, "goodInfo_ad2"); | |
531 | - //------- | |
532 | - } | |
533 | - | |
534 | - //判断商品详情要有东西 | |
535 | - if(e && e.goods_bottomconent && e.goods_ad_position.indexOf('2')>-1) { | |
536 | - //商品详情广告---- | |
537 | - a.wxParse("goodInfo_ad", "html", ut.format_content(e.goods_bottomconent), ee, 6); | |
538 | - common.wxParseAddFullImageUrl(ee, "goodInfo_ad"); | |
539 | - //------- | |
540 | - } | |
541 | - | |
542 | - //------几人评价------- | |
543 | - //n.init(th, "", "comments"); | |
544 | - | |
545 | - th.requestCardNum(), wx.pageScrollTo && th.setData({ | |
546 | - supportPageScroll: !0 | |
547 | - }); | |
548 | - | |
549 | - //计算等级价相关 | |
550 | - var swithc_list = e.switch_list; | |
551 | - var sw_arr = JSON.parse(swithc_list); | |
552 | - console.log('plus-111') | |
553 | - //---如果后台又开等级卡的开关--- | |
554 | - ut.get_plus_name_price(sw_arr, th); | |
555 | 555 | |
556 | - }, 1); | |
557 | 556 | |
558 | 557 | //获取用户设备信息,屏幕宽度 |
559 | 558 | wx.getSystemInfo({ | ... | ... |
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"> | ... | ... |
pages/goods/goodsList/goodsList.js
... | ... | @@ -69,169 +69,176 @@ Page({ |
69 | 69 | } |
70 | 70 | }) |
71 | 71 | |
72 | - //先查看一下是不是系统会员 | |
73 | - getApp().waitfor_login(()=> { | |
74 | - if (!getApp().globalData.user_id) { | |
75 | - ut.new_user_go(oo.stoid, first_leader); | |
76 | - } | |
77 | - }) | |
72 | + | |
78 | 73 | } |
79 | 74 | |
80 | 75 | var th=this; |
81 | 76 | var url = this.data.baseUrl; |
82 | - this.data.is_new=t.is_new; | |
83 | - this.data.is_hot=t.is_hot; | |
84 | - if (0 != t.cat_id && t.cat_id != undefined) { | |
85 | - url += "&cat_id=" + t.cat_id; | |
86 | - if (t.pid == undefined || t.pid == null){ | |
87 | - url += "&parent_id=0"; | |
88 | - }else{ | |
89 | - if(t.pid!="three"){ | |
90 | - 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); | |
91 | 89 | } |
90 | + }) | |
91 | + if (t.prom_id) { | |
92 | + this.getprom(t.prom_id) | |
92 | 93 | } |
93 | - this.data.cat_id=t.cat_id; | |
94 | 94 | } |
95 | 95 | |
96 | - if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; } | |
97 | - if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; } | |
98 | - | |
99 | - if (0 != t.group_id && t.group_id != undefined) { url += "&group_id=" + t.group_id; this.data.gr_fir=1; } | |
100 | - if (0 != t.gid && t.gid != undefined) { url += "&group_id=" + t.gid; this.data.gr_fir=1; } | |
101 | - | |
102 | - if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; } | |
103 | - | |
104 | - if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; } | |
105 | - if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; } | |
106 | - if (0 != t.ladder_id && t.ladder_id != undefined) { | |
107 | - url += "&ladder_id=" + t.ladder_id; | |
108 | - this.setData({ | |
109 | - ladder_id:t.ladder_id, | |
110 | - baseUrl:url, | |
111 | - }) | |
112 | - } | |
113 | 96 | |
114 | - var user_id=getApp().globalData.user_id; | |
115 | - if(!user_id) user_id=0; | |
116 | - 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 | + } | |
117 | 102 | |
118 | - // 优惠促销列表 | |
119 | - if(t.prom_goods_id) { | |
120 | - url += '&prom_goods_id=' + t.prom_goods_id; | |
121 | - }; | |
122 | - | |
123 | - | |
124 | - if(getApp().globalData.userInfo) { | |
125 | - url += "&user_id=" + getApp().globalData.userInfo.user_id; | |
126 | - } | |
127 | - | |
128 | - | |
129 | - //优惠活动的凑单 | |
130 | - if(t.prom_type==3){ | |
131 | - if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; } | |
132 | - if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; } | |
133 | - //-- 获取 -- | |
134 | - getApp().request.promiseGet("/api/weshop/promgoodslist/list",{ | |
135 | - data:{prom_id:t.prom_id } | |
136 | - }).then(res=>{ | |
137 | - if(res.data.code==0){ | |
138 | - var arr= res.data.data; | |
139 | - th.set_prom_list(arr); | |
140 | - } | |
141 | - }) | |
142 | - if (t.prom_id) { | |
143 | - 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; | |
144 | 147 | } |
145 | - } | |
146 | 148 | |
147 | - //--- 阶梯优惠活动的凑单 --- | |
148 | - if(t.ladder_id){ | |
149 | - var user_id=getApp().globalData.user_id; | |
150 | - if(!user_id) user_id=0; | |
151 | - getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/"+oo.stoid+"/"+user_id+"/"+t.ladder_id,{ | |
152 | - }).then(res=>{ | |
153 | - if(res.data.code==0 && res.data.data){ | |
154 | - var arr= res.data.data; | |
155 | - | |
156 | - if(arr.is_end==1){ | |
157 | - th.setData({show_all:0,err_txt:'活动已结束'}); | |
158 | - return false; | |
159 | - } | |
160 | - if(arr.start_time>ut.gettimestamp()){ | |
161 | - th.setData({show_all:0,err_txt:'活动还未开始'}); | |
162 | - 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 | + }) | |
163 | 187 | } |
164 | - if(arr.end_time<ut.gettimestamp()){ | |
165 | - th.setData({show_all:0}); | |
166 | - th.setData({show_all:0,err_txt:'活动已结束'}); | |
167 | - return false; | |
188 | + else{ | |
189 | + th.setData({show_all:0,err_txt:'未找到活动或者身份不符'}); | |
168 | 190 | } |
191 | + }) | |
192 | + } | |
193 | + | |
169 | 194 | |
170 | - var url1="/api/weshop/prom/ladderList/list?store_id="+oo.stoid+"&form_id="+arr.id; | |
171 | - getApp().request.promiseGet(url1, {}).then(rs=>{ | |
172 | - if(rs.data.code==0 && rs.data.data && rs.data.data.length) { | |
173 | - var prom_content=""; | |
174 | - for(let jj in rs.data.data){ | |
175 | - if(rs.data.data[jj].discount==10){ | |
176 | - prom_content+="第"+(parseInt(jj)+1)+"件原价,"; | |
177 | - }else{ | |
178 | - 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}); | |
179 | 226 | } |
180 | 227 | } |
181 | - prom_content=ut.sub_last(prom_content); | |
182 | - th.setData({jieti_prom:prom_content}) | |
183 | - } | |
184 | - }) | |
185 | - } | |
186 | - else{ | |
187 | - th.setData({show_all:0,err_txt:'未找到活动或者身份不符'}); | |
228 | + }) | |
229 | + },500) | |
188 | 230 | } |
189 | - }) | |
190 | - } | |
191 | - | |
192 | - | |
193 | - this.data.old_req_url=url; | |
194 | - //进行筛选 | |
195 | - this.set_screen(url); | |
196 | - | |
197 | - this.requestGoodsList(url); | |
198 | - | |
199 | - getApp().getConfig2(function(rs){ | |
200 | - //计算等级价相关 | |
201 | - var swithc_list=rs.switch_list; | |
202 | - var sw_arr=JSON.parse(swithc_list); | |
203 | - //---如果后台又开等级卡的开关--- | |
204 | - if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){ | |
205 | - th.setData({rank_switch:true}); | |
206 | - var user=getApp().globalData.userInfo; | |
207 | - var ti=setInterval(function(){ | |
208 | - if(!user) return false; | |
209 | - clearInterval(ti); | |
210 | - //---回调卡的列表--- | |
211 | - th.getPlusCardType(function(ob){ | |
212 | - th.setData({card_list:ob.card_list}); | |
213 | - if(user.card_field ){ | |
214 | - var str = user['card_expiredate'].replace(/-/g, '/'); | |
215 | - var end = new Date(str); | |
216 | - end = Date.parse(end) / 1000; | |
217 | - var now = ut.gettimestamp(); | |
218 | - | |
219 | - //--- 判断是等级会员,且在有效期范围内 --- | |
220 | - if(user.card_field && now<end){ | |
221 | - var card_name=ob.name_map.get(user.card_field); | |
222 | - // if(card_name.length>4) card_name=card_name.substring(0,4); | |
223 | - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list}); | |
224 | - } | |
225 | - } | |
226 | - }) | |
227 | - },500) | |
228 | - } | |
229 | 231 | |
230 | 232 | if(sw_arr.is_retail_price){ |
231 | 233 | th.setData({is_retail_price:1}); |
232 | 234 | } |
233 | 235 | |
234 | - }); | |
236 | + }); | |
237 | + | |
238 | + }) | |
239 | + | |
240 | + | |
241 | + | |
235 | 242 | |
236 | 243 | //调用接口判断商家plus有没有过期 |
237 | 244 | getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => { | ... | ... |
pages/index/index/index.js
... | ... | @@ -310,37 +310,41 @@ Page({ |
310 | 310 | |
311 | 311 | async onload_init() { |
312 | 312 | var th = this; |
313 | - await this.init_load(); | |
314 | 313 | //显示的时候要开启计时器 |
315 | 314 | this.data.is_timer = 1; |
316 | - //如果是自定义模板 | |
317 | - if (this.data.isTemplate) { | |
318 | - //---先获取会员--- | |
319 | - //t.getUserFir(function () { | |
320 | - if (getApp().globalData.user_id) { | |
321 | - th.is_festival(); | |
322 | - var new_nav = th.data.new_nav; | |
323 | - if (new_nav == "") { | |
324 | - th.is_new(); | |
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) | |
325 | 333 | } |
326 | - // sty | |
327 | - setTimeout(function () { | |
328 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
329 | - }, 500) | |
330 | - } | |
331 | 334 | |
332 | - //}); | |
333 | - } else { | |
334 | - await this.init_fir(); | |
335 | - wx.setNavigationBarColor({ | |
336 | - frontColor: '#ffffff', // 必写项 | |
337 | - backgroundColor: '#ff7295', // 必写项 | |
338 | - }) | |
339 | - this.setData({ | |
340 | - nav_frontColor: '#000', // 必写项 | |
341 | - nav_backgroundColor: '#fff', // 必写项 | |
342 | - }) | |
343 | - } | |
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 | + }) | |
344 | 348 | |
345 | 349 | //--正再拼团中的处理-- |
346 | 350 | var url = "/api/weshop/order/pageTuanNew?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" |
... | ... | @@ -422,168 +426,170 @@ Page({ |
422 | 426 | if (privacy_pop) { |
423 | 427 | privacy_pop.check_pri_show(); |
424 | 428 | } |
425 | - | |
426 | - getApp().check_can_share(); | |
427 | - if (typeof this.getTabBar === 'function' && this.getTabBar()) { | |
428 | - this.getTabBar().setData({ | |
429 | - cartGoodsNum: getApp().globalData.cartGoodsNum | |
430 | - }) | |
431 | - } | |
432 | 429 | var th = this; |
433 | - //-- 登录回来判断弹框 -- | |
434 | - var user_id = getApp().globalData.user_id; | |
435 | 430 | |
436 | - if (!user_id) { | |
437 | - var userinfo = wx.getStorageSync('userinfo'); | |
438 | - if (userinfo) user_id = userinfo.user_id | |
439 | - } | |
440 | 431 | |
441 | - if (user_id) { | |
442 | - th.is_festival(); | |
443 | - var new_nav = th.data.new_nav; | |
444 | - if (new_nav == "") { | |
445 | - th.is_new(); | |
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 | + }) | |
446 | 440 | } |
447 | - } | |
448 | 441 | |
449 | - console.log(this.data.isTemplate, '首页'); | |
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 | + } | |
450 | 449 | |
451 | - if (!this.data.isTemplate) { | |
452 | - //timetype: 1 仅查询已预售 置空查询全部, | |
453 | - var pre_data = { store_id: os.stoid, is_end: 0, isuse: 1, timetype: 3 }; | |
454 | 450 | if (user_id) { |
455 | - pre_data.user_id = user_id; | |
451 | + th.is_festival(); | |
452 | + var new_nav = th.data.new_nav; | |
453 | + if (new_nav == "") { | |
454 | + th.is_new(); | |
455 | + } | |
456 | 456 | } |
457 | 457 | |
458 | - getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { | |
459 | - data: pre_data, | |
460 | - success: function (e) { | |
461 | - if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
462 | - var pre_data = e.data.data.pageData; | |
463 | - //当前时间戳 | |
464 | - var st = ut.gettimestamp(); | |
458 | + console.log(this.data.isTemplate, '首页'); | |
465 | 459 | |
466 | - pre_data.forEach(function (val, ind) { | |
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 | + } | |
467 | 466 | |
468 | - if (val.user_price) val.price = val.user_price; | |
469 | - if (val.start_time > st) { | |
470 | - pre_data[ind].status = 0; | |
471 | - } else if (val.end_time > st) { | |
472 | - pre_data[ind].status = 1; | |
473 | - } else { | |
474 | - pre_data[ind].status = 2; | |
475 | - } | |
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 | + } | |
476 | 485 | |
477 | - // if (val.buy_num >= val.goods_num) { | |
478 | - // pre_data[ind].status = 2; | |
479 | - // } | |
480 | - }); | |
481 | - var arr = new Array(); | |
482 | - //--三个三个一组--- | |
483 | - for (var i = 0; i < pre_data.length; i += 3) { | |
484 | - arr.push(pre_data.slice(i, i + 3)); | |
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 | + }); | |
485 | 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) { | |
486 | 515 | th.setData({ |
487 | - preGoods: arr | |
488 | - }); | |
489 | - } else { | |
490 | - th.setData({ | |
491 | - preGoods: null | |
516 | + luckGo_list: res.data.data.pageData.slice(0, 3), | |
492 | 517 | }); |
493 | 518 | } |
494 | - } | |
495 | - }) | |
519 | + }); | |
496 | 520 | |
497 | - // 获取幸运购活动列表 | |
498 | - getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { | |
499 | - data: { | |
500 | - store_id: getApp().globalData.setting.stoid, | |
521 | + //-----秒杀----- | |
522 | + var flash_data = null; | |
523 | + var f_req = { | |
524 | + store_id: os.stoid, | |
525 | + timetype: 2, | |
501 | 526 | is_end: 0, |
502 | - timetype: 1, | |
503 | - } | |
504 | - }).then(res => { | |
505 | - if (res.data.code == 0) { | |
506 | - th.setData({ | |
507 | - luckGo_list: res.data.data.pageData.slice(0, 3), | |
508 | - }); | |
509 | - } | |
510 | - }); | |
511 | - | |
512 | - //-----秒杀----- | |
513 | - var flash_data = null; | |
514 | - var f_req = { | |
515 | - store_id: os.stoid, | |
516 | - timetype: 2, | |
517 | - is_end: 0, | |
518 | - is_show: 1, | |
519 | - pageSize: 9, | |
520 | - user_id: 0 | |
521 | - }; | |
522 | - if (user_id) f_req.user_id = user_id; | |
523 | - //--获取活动-- | |
524 | - await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { | |
525 | - data: f_req, | |
526 | - }).then(res => { | |
527 | - var e = res; | |
528 | - if (e.data.code == 0) { | |
529 | - flash_data = e.data.data.pageData; | |
530 | - if (flash_data == null || flash_data.length <= 0) return false; | |
531 | - | |
532 | - //当前时间戳 | |
533 | - var nt = ut.gettimestamp(); | |
534 | - | |
535 | - flash_data.forEach(function (val, ind) { | |
536 | - | |
537 | - if (val.user_price) val.price = val.user_price; | |
538 | - if (val.start_time > nt) { | |
539 | - flash_data[ind].status = 0; | |
540 | - } else if (val.end_time > nt) { | |
541 | - flash_data[ind].status = 1; | |
542 | - } | |
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; | |
543 | 540 | |
544 | - if (val.buy_num >= val.goods_num) { | |
545 | - flash_data[ind].status = 2; | |
546 | - } | |
547 | - }); | |
541 | + //当前时间戳 | |
542 | + var nt = ut.gettimestamp(); | |
548 | 543 | |
549 | - var promisies = []; | |
550 | - for (const key in flash_data) { | |
551 | - if (Object.hasOwnProperty.call(flash_data, key)) { | |
552 | - const val = flash_data[key]; | |
553 | - promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
554 | - os.stoid + "/1/" + val.id, | |
555 | - {} | |
556 | - ).then(res => { | |
557 | - if (res.data.code == 0) { | |
558 | - if (res.data.data <= 0) flash_data[key].status = 2; | |
559 | - }; | |
560 | - }); | |
561 | - } | |
562 | - } | |
544 | + flash_data.forEach(function (val, ind) { | |
563 | 545 | |
564 | - Promise.all(promisies).then(() => { | |
565 | - var arr = new Array(); | |
566 | - //--三个三个一组--- | |
567 | - for (var i = 0; i < flash_data.length; i += 3) { | |
568 | - arr.push(flash_data.slice(i, i + 3)); | |
569 | - } | |
546 | + if (val.user_price) val.price = val.user_price; | |
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 | + } | |
570 | 552 | |
571 | - th.setData({ | |
572 | - saleGoods: arr | |
553 | + if (val.buy_num >= val.goods_num) { | |
554 | + flash_data[ind].status = 2; | |
555 | + } | |
573 | 556 | }); |
574 | - }); | |
575 | - | |
576 | - | |
577 | 557 | |
578 | - } | |
579 | - }); | |
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 | + } | |
580 | 573 | |
581 | - } | |
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)); | |
579 | + } | |
582 | 580 | |
581 | + th.setData({ | |
582 | + saleGoods: arr | |
583 | + }); | |
584 | + }); | |
583 | 585 | |
584 | 586 | |
587 | + } | |
588 | + }); | |
585 | 589 | |
590 | + } | |
586 | 591 | |
592 | + }) | |
587 | 593 | |
588 | 594 | |
589 | 595 | ... | ... |
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,12 +105,6 @@ Page({ |
103 | 105 | } |
104 | 106 | }) |
105 | 107 | |
106 | - //先查看一下是不是系统会员 | |
107 | - getApp().waitfor_login(()=> { | |
108 | - if (!getApp().globalData.user_id) { | |
109 | - ut.new_user_go(os.stoid, first_leader); | |
110 | - } | |
111 | - }) | |
112 | 108 | |
113 | 109 | }else{ |
114 | 110 | // app.getUserFir(); |
... | ... | @@ -204,362 +200,369 @@ Page({ |
204 | 200 | need_money = 0, |
205 | 201 | cur_g_num = 0; |
206 | 202 | |
207 | - /*------会员登录------*/ | |
208 | - var e = getApp().globalData.userInfo; | |
209 | - | |
210 | 203 | |
211 | - | |
212 | - if (e != undefined && e != null && e.mobile) { | |
213 | - | |
214 | - if (e.card_field != '' && e.card_field != null && e.card_field != undefined && e.card_expiredate) { | |
215 | - var now = ut.gettimestamp(); | |
216 | - var str = e.card_expiredate.replace(/-/g, '/');; | |
217 | - var end = new Date(str); | |
218 | - end = Date.parse(end) / 1000; | |
219 | - if (now < end) { | |
220 | - 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; //只显示一次 | |
221 | 210 | } |
222 | - } | |
211 | + }else{ | |
212 | + /*------会员登录------*/ | |
213 | + var e = getApp().globalData.userInfo; | |
214 | + if (e != undefined && e != null && e.mobile) { | |
223 | 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 | + } | |
224 | 225 | |
225 | 226 | |
226 | - if(this.data.has_rj==0){ | |
227 | - var portrait_req = { | |
228 | - ApiName:'api.slimming.member.portrait', | |
229 | - store_id: e.store_id, | |
230 | - //StaffId: that.idd, | |
231 | - vipid: e.erpvipid, | |
232 | - }; | |
233 | 227 | |
234 | - getApp().getConfig(()=>{ | |
235 | - var url = '/api/weshop/delphiapi/pageErpApi?accdb='+getApp().globalData.config.erpid; | |
236 | - getApp().request.promiseGet(url, { | |
237 | - data: portrait_req | |
238 | - }) | |
239 | - .then((res) => { | |
240 | - if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { | |
241 | - th.setData({has_rj:1}) | |
242 | - }else { | |
243 | - th.setData({has_rj:-1}) | |
244 | - } | |
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 | + }; | |
245 | 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 | + }) | |
246 | 249 | }) |
247 | - }) | |
248 | 250 | |
249 | 251 | |
250 | - } | |
252 | + } | |
251 | 253 | |
252 | 254 | |
253 | - // 判断是否开启美业 | |
254 | - getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => { | |
255 | - if (res.data.code == 0) { | |
256 | - th.setData({ | |
257 | - 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 | + }; | |
258 | 262 | }); |
259 | - }; | |
260 | - }); | |
261 | 263 | |
262 | - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => { | |
263 | - if (res.data.code == 0) { | |
264 | - var plusCard = res.data.data; | |
265 | - for (var i = 0; i < plusCard.length; i++) { | |
266 | - if (!plusCard[i].IsStopBuy) { th.setData({ show_buy_plus: 1 }); break; } | |
267 | - } | |
268 | - } | |
269 | - }) | |
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 | + }) | |
270 | 272 | |
271 | 273 | |
272 | - this.birthday(); | |
273 | - this.is_assistance(); | |
274 | - | |
275 | - s.setData({ | |
276 | - userInfo: e | |
277 | - }); | |
278 | - | |
279 | - //--查询会员权益是否成绩 | |
280 | - s.getVison() | |
281 | - | |
282 | - //-- 要调用接口,获取卡的钱 -- | |
283 | - var url = "/api/weshop/wxuser/getWxCardInfo?storeId=" + os.stoid + "&userId=" + e.user_id; | |
284 | - rq.get(url, { | |
285 | - isShowLoading: 0, | |
286 | - success: function (su) { | |
287 | - if (su.data.code == 0) { | |
288 | - s.setData({ | |
289 | - add_card_data: su.data.data, | |
290 | - }); | |
291 | - } | |
292 | - } | |
293 | - }); | |
274 | + this.birthday(); | |
275 | + this.is_assistance(); | |
294 | 276 | |
295 | - /*-----统计-----*/ | |
296 | - rq.get("/api/weshop/order/waitlist", { | |
297 | - isShowLoading: 0, | |
298 | - data: { | |
299 | - user_id: app_d.user_id,isdel:0 | |
300 | - }, | |
301 | - success: function (su) { | |
302 | 277 | s.setData({ |
303 | - toji: su.data.data, | |
278 | + userInfo: e | |
304 | 279 | }); |
305 | - } | |
306 | - }) | |
307 | - /*-----获取线下会员的预存款和优惠券的数量-----*/ | |
308 | - rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { | |
309 | - isShowLoading: 0, | |
310 | - success: function (su) { | |
311 | - if (su.data.code == 0 && su.data.data) { | |
312 | - var data = su.data.data; | |
313 | - if (!data) data = {}; | |
314 | - data.cashcount = parseInt(data.cashcount); | |
315 | - s.setData({ | |
316 | - udata: data, | |
317 | - }); | |
318 | - } | |
319 | 280 | |
320 | - } | |
321 | - }) | |
322 | - /*-----获取会员提现金额-----*/ | |
323 | - rq.get("/api/weshop/withdrawals/summoney", { | |
324 | - isShowLoading: 0, | |
325 | - data: { | |
326 | - user_id: e.user_id, | |
327 | - store_id: os.stoid, | |
328 | - status: 0 | |
329 | - }, | |
330 | - success: function (su) { | |
331 | - if (su.data.code == 0) { | |
332 | - var yuer = parseFloat(th.data.userInfo.user_money - | |
333 | - th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2); | |
334 | - th.setData({ | |
335 | - txmon: su.data.data.summoney, | |
336 | - yuer: yuer | |
337 | - }); | |
338 | - } | |
339 | - } | |
340 | - }) | |
341 | - | |
342 | - /*-----获取会员包邮券的数量-----*/ | |
343 | - rq.get("/api/weshop/userfeemail/page", { | |
344 | - isShowLoading: 0, | |
345 | - data: { | |
346 | - user_id: e.user_id, | |
347 | - store_id: os.stoid, | |
348 | - pageSize: 1, | |
349 | - isuse: 0 | |
350 | - }, | |
351 | - success: function (su) { | |
352 | - if (su.data.code == 0) { | |
353 | - th.setData({ | |
354 | - byquan: parseInt(su.data.data.total) | |
355 | - }); | |
356 | - } | |
357 | - } | |
358 | - }); | |
359 | - | |
360 | - /*-----物流信息提醒-----*/ | |
361 | - rq.get('/api/weshop/order/countDadaOrder', { | |
362 | - isShowLoading: 0, | |
363 | - data: { | |
364 | - user_id: e.user_id, | |
365 | - store_id: os.stoid, | |
366 | - }, | |
367 | - success: function (su) { | |
368 | - if (su.data.code == 0) { | |
369 | - th.setData({ | |
370 | - countDadaOrder: su.data.data | |
371 | - }); | |
372 | - } | |
373 | - } | |
374 | - }); | |
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 | + }); | |
375 | 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 | + } | |
376 | 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 | + }) | |
377 | 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 | + }); | |
378 | 361 | |
379 | - //--初始化是否有打勾-- | |
380 | - getApp().request.get("/api/weshop/users/grade/vip/init/get", { | |
381 | - data: { | |
382 | - storeId: os.stoid | |
383 | - }, | |
384 | - success: function (rs) { | |
385 | - if (rs.data.code == 0 && rs.data.data.isBool) { | |
386 | - th.setData({ is_init: 1 }); | |
387 | - /*-----获取会员权益列表-----*/ | |
388 | - rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", { | |
389 | - isShowLoading: 0, | |
390 | - data: { | |
391 | - storeId: os.stoid, | |
392 | - pageSize: 100 | |
393 | - }, | |
394 | - 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 | + }); | |
395 | 377 | |
396 | - //判断有没有值,没有值返回 | |
397 | - if (!ut.ajax_ok(res)) return false; | |
398 | 378 | |
399 | - var arr_data = res.data.data.pageData; | |
400 | - var gid = null, | |
401 | - g_qy_list = null, | |
402 | - cz_vals = 0, | |
403 | - need_money = 0, | |
404 | - backClass = null, | |
405 | 379 | |
406 | - GradeName = ''; | |
407 | 380 | |
408 | - //获取成长值 | |
409 | - 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, | |
410 | 392 | data: { |
411 | 393 | storeId: os.stoid, |
412 | - userId: app_d.user_id | |
413 | - } | |
414 | - }).then(res => { | |
415 | - if (res.data.code == 0 && res.data.data) { | |
416 | - gid = res.data.data.GradeId; | |
417 | - var cz_val = res.data.data.GradeSum; | |
418 | - cz_vals = parseInt(cz_val); | |
419 | - GradeName = res.data.data.GradeName; | |
420 | - } | |
421 | - //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid}); | |
422 | - }) | |
423 | - var obj = { | |
424 | - cz_val: cz_vals, | |
425 | - GradeName: GradeName, | |
426 | - gradeId: gid, | |
427 | - is_grad_get: 1 | |
428 | - }; | |
429 | - | |
430 | - // 获取最大值 | |
431 | - await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", { | |
432 | - data: { | |
433 | - storeId: os.stoid | |
434 | - } | |
435 | - }).then(res => { | |
436 | - if (res.data.data) | |
437 | - backClass = res.data.data.pageData; | |
438 | - if (backClass) { | |
439 | - var full_cz_val = backClass[backClass.length - 1].BuyGradeSum; | |
440 | - //th.setData({ full_cz_val: full_cz_val}); | |
441 | - 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}) | |
442 | 495 | } |
443 | 496 | }) |
497 | + } | |
498 | + } | |
499 | + }) | |
444 | 500 | |
445 | - //--会员权益中心页的修改-- | |
446 | - for (var i in backClass) { | |
447 | - var im = backClass[i]; | |
448 | - if (cz_vals < im.BuyGradeSum && need_money == 0) { | |
449 | - need_money = im.BuyGradeSum; | |
450 | - obj.need_money = need_money; | |
451 | - obj.nextGradeName=im.GradeName; | |
452 | - break; | |
453 | - } | |
454 | - } | |
455 | - | |
456 | - //获取当前等级的特权 | |
457 | - await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", { | |
458 | - data: { | |
459 | - storeId: os.stoid, | |
460 | - GradeId: gid, | |
461 | - userId: app_d.user_id, | |
462 | - pageSize: 100 | |
463 | - } | |
464 | - }).then(res => { | |
465 | - if (res.data.data) | |
466 | - g_qy_list = res.data.data.pageData; | |
467 | - }); | |
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 | + } | |
468 | 518 | |
469 | - for (var i in arr_data) { | |
470 | - var item = arr_data[i]; | |
471 | - var FromId = th.check_is_has_qy(item, g_qy_list); | |
472 | - arr_data[i].ishas = 0; | |
473 | - if (FromId) { | |
474 | - arr_data[i].ishas = 1; | |
475 | - arr_data[i].FromId = FromId; | |
476 | - } | |
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 | + }) | |
477 | 535 | } |
478 | - arr_data.sort(function (a, b) { | |
479 | - return b.ishas - a.ishas | |
536 | + } else { | |
537 | + th.setData({ | |
538 | + is_dengji: 2 | |
480 | 539 | }) |
481 | - | |
482 | - //4个4个一组 | |
483 | - var arr = new Array(); | |
484 | - for (var i = 0; i < arr_data.length; i += 4) { | |
485 | - arr.push(arr_data.slice(i, i + 4)); | |
486 | - } | |
487 | - //th.setData({ qy_list: arr, need_money: need_money}); | |
488 | - obj.qy_list = arr; | |
489 | - th.setData(obj); | |
490 | - obj.is_init=1; | |
491 | - obj.old_qy_list = arr_data; | |
492 | - th.setData({qy_data:obj}) | |
493 | 540 | } |
494 | - }) | |
495 | - } | |
496 | - } | |
497 | - }) | |
498 | - | |
499 | - /*-- 获取 --*/ | |
500 | - th.requestRecommend(); | |
501 | - | |
502 | - /*-------系统是否开通等级卡,会员是等级卡-----*/ | |
503 | - getApp().getConfig2(function (e) { | |
504 | - var t_swi = e.switch_list; | |
505 | - if (t_swi) t_swi = JSON.parse(t_swi) | |
506 | - if (t_swi) { | |
507 | - th.setData({ sys_switch: t_swi }); | |
508 | - var user_tool = []; | |
509 | - if (t_swi.usertool) user_tool = JSON.parse(t_swi.usertool); | |
510 | - th.setData({ c_list: user_tool }); | |
511 | - if (t_swi.usercode_vailtime!=null && parseInt(t_swi.usercode_vailtime)>0) | |
512 | - { | |
513 | - th.setData({ getusercode_vailtime: t_swi.usercode_vailtime }); | |
514 | - } | |
515 | - } | |
516 | - | |
517 | - if (parseInt(t_swi.rank_switch) == 2) { | |
518 | - var userInfo = th.data.userInfo; | |
519 | - if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") { | |
520 | - var now = ut.gettimestamp(); | |
521 | - var str = userInfo.card_expiredate; | |
522 | - var end = new Date(str); | |
523 | - end = Date.parse(end) / 1000; | |
524 | - //---判断是不是有过期--- | |
525 | - if (now < end) { | |
526 | - th.setData({ | |
527 | - is_dengji: 1 | |
528 | - }) | |
529 | - } else { | |
530 | - th.setData({ | |
531 | - is_dengji: 3 | |
532 | - }) | |
533 | 541 | } |
534 | - } else { | |
535 | - th.setData({ | |
536 | - is_dengji: 2 | |
537 | - }) | |
538 | - } | |
539 | - } | |
540 | - }) | |
541 | - //th.requestRecommend(); | |
542 | - | |
543 | - //自定义组件一定要等到页面加载完了,才来调用selectComponnent | |
544 | - setTimeout(function () { | |
542 | + }) | |
543 | + //th.requestRecommend(); | |
545 | 544 | |
546 | - th.setData({ is_show_recommend:true }) | |
547 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
548 | - var goods_list = th.selectComponent("#goods_recommend"); //组件的id | |
545 | + //自定义组件一定要等到页面加载完了,才来调用selectComponnent | |
546 | + setTimeout(function () { | |
549 | 547 | |
550 | - if(goods_list){ | |
551 | - goods_list.init(); | |
552 | - goods_list.get_list(); | |
553 | - } | |
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 | |
554 | 551 | |
555 | - }, 1200) | |
552 | + if(goods_list){ | |
553 | + goods_list.init(); | |
554 | + goods_list.get_list(); | |
555 | + } | |
556 | 556 | |
557 | - } | |
557 | + }, 1200) | |
558 | 558 | |
559 | - setTimeout(()=>{ | |
560 | - th.setData({ pshow:1 }) | |
561 | - },500) | |
559 | + } | |
560 | + } | |
562 | 561 | |
562 | + setTimeout(()=>{ | |
563 | + th.setData({ pshow:1 }) | |
564 | + },500) | |
565 | + }) | |
563 | 566 | }, |
564 | 567 | |
565 | 568 | //获取会员权益等级是否升级 | ... | ... |
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 ) { | ... | ... |