Commit 185c2c9885b78d2a03038182129155a2dbfbc280
1 parent
fa7bdcb3
优惠券bug修复
Showing
5 changed files
with
55 additions
and
27 deletions
app.js
@@ -40,7 +40,7 @@ App({ | @@ -40,7 +40,7 @@ App({ | ||
40 | ], | 40 | ], |
41 | 41 | ||
42 | globalData: { | 42 | globalData: { |
43 | - cartGoodsNum:0, //购物车总数量 | 43 | + cartGoodsNum:0, //购物车总数量 |
44 | isTabBar :false, | 44 | isTabBar :false, |
45 | isIpx: false, //适配IPhoneX | 45 | isIpx: false, //适配IPhoneX |
46 | url:"", | 46 | url:"", |
@@ -523,6 +523,7 @@ App({ | @@ -523,6 +523,7 @@ App({ | ||
523 | //-------获取购物车数量---------- | 523 | //-------获取购物车数量---------- |
524 | requestCardNum: function(th) { | 524 | requestCardNum: function(th) { |
525 | if(!this.globalData.user_id) return false; | 525 | if(!this.globalData.user_id) return false; |
526 | + var that=this; | ||
526 | this.request.get("/api/weshop/cart/page", { | 527 | this.request.get("/api/weshop/cart/page", { |
527 | isShoeLoading:false, | 528 | isShoeLoading:false, |
528 | data: { | 529 | data: { |
@@ -538,14 +539,30 @@ App({ | @@ -538,14 +539,30 @@ App({ | ||
538 | num += e.data.data.pageData[i].goods_num; | 539 | num += e.data.data.pageData[i].goods_num; |
539 | } | 540 | } |
540 | } | 541 | } |
541 | - getApp().globalData.cartGoodsNum=num; | 542 | + |
542 | /*--- | 543 | /*--- |
543 | wx.setTabBarBadge({ //tabbar右上角添加文本 | 544 | wx.setTabBarBadge({ //tabbar右上角添加文本 |
544 | index: 2, ////tabbar下标 | 545 | index: 2, ////tabbar下标 |
545 | text: '' + num //显示的内容 | 546 | text: '' + num //显示的内容 |
546 | });--*/ | 547 | });--*/ |
547 | - th.getTabBar().setData({cartGoodsNum:num}); | ||
548 | - th.data.up_dating = 0 | 548 | + |
549 | + //-- 读取服务卡的数量 -- | ||
550 | + that.promiseGet("/api/weshop/cartService/page",{ | ||
551 | + data:{ | ||
552 | + store_id: that.globalData.setting.stoid, | ||
553 | + user_id: that.globalData.user_id, | ||
554 | + } | ||
555 | + }).then(res=>{ | ||
556 | + | ||
557 | + for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
558 | + num += res.data.data.pageData[i].goods_num; | ||
559 | + } | ||
560 | + | ||
561 | + that.globalData.cartGoodsNum=num; | ||
562 | + th.data.up_dating = 0 | ||
563 | + th.getTabBar().setData({cartGoodsNum:num}); | ||
564 | + }) | ||
565 | + | ||
549 | } | 566 | } |
550 | }); | 567 | }); |
551 | }, | 568 | }, |
app.json
@@ -139,7 +139,7 @@ | @@ -139,7 +139,7 @@ | ||
139 | "pages/profile/profile", | 139 | "pages/profile/profile", |
140 | "pages/parseHtml/parseHtml", | 140 | "pages/parseHtml/parseHtml", |
141 | "pages/myGift/myGift", | 141 | "pages/myGift/myGift", |
142 | - "pages/myGiftDetails/myGiftDetails", | 142 | + "pages/myGiftDetails/myGiftDetails", |
143 | "pages/cart2_ser/cart2_ser" | 143 | "pages/cart2_ser/cart2_ser" |
144 | ] | 144 | ] |
145 | 145 |
packageA/pages/quan_list/quan_list.js
@@ -25,19 +25,21 @@ Page({ | @@ -25,19 +25,21 @@ Page({ | ||
25 | onLoad: function(t) { | 25 | onLoad: function(t) { |
26 | var th=this; | 26 | var th=this; |
27 | getApp().getConfig2(function (conf) { | 27 | getApp().getConfig2(function (conf) { |
28 | - conf.couponset=conf.couponset.replace(/\<img/g,'<img style="width:100%;height:auto;display:block"'); | 28 | + if(conf.couponset) conf.couponset=conf.couponset.replace(/\<img/g,'<img style="width:100%;height:auto;display:block"'); |
29 | th.setData({config2:conf}); | 29 | th.setData({config2:conf}); |
30 | }) | 30 | }) |
31 | }, | 31 | }, |
32 | //---展示--- | 32 | //---展示--- |
33 | onShow: function() { | 33 | onShow: function() { |
34 | + | ||
35 | + console.log("onShow:1"); | ||
34 | this.data.curpage=1; | 36 | this.data.curpage=1; |
35 | this.setData({dataList:null}); | 37 | this.setData({dataList:null}); |
38 | + console.log("onShow:2"); | ||
36 | this.get_quan_list(); | 39 | this.get_quan_list(); |
37 | //券的模拟数据 | 40 | //券的模拟数据 |
38 | //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}]; | 41 | //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}]; |
39 | //th.setData({dataList: data}); | 42 | //th.setData({dataList: data}); |
40 | - | ||
41 | this.setData({getcurday:ut.gettimestamp()}); | 43 | this.setData({getcurday:ut.gettimestamp()}); |
42 | }, | 44 | }, |
43 | 45 | ||
@@ -47,20 +49,31 @@ Page({ | @@ -47,20 +49,31 @@ Page({ | ||
47 | 49 | ||
48 | //--券的列表页面的函数-- | 50 | //--券的列表页面的函数-- |
49 | get_quan_list:function(){ | 51 | get_quan_list:function(){ |
52 | + console.log("onShow:3"); | ||
50 | var th=this; | 53 | var th=this; |
51 | if(th.data.loading) return false; | 54 | if(th.data.loading) return false; |
52 | th.data.loading=1; | 55 | th.data.loading=1; |
53 | var user_id=getApp().globalData.user_id; | 56 | var user_id=getApp().globalData.user_id; |
54 | - getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | ||
55 | - data:{store_id:os.stoid,type:1,pageSize:10,page:th.data.curpage,user_id:user_id,is_share:0} | ||
56 | - }).then(res => { | ||
57 | - th.data.loading=0; | ||
58 | - if(res.data.code==0){ | ||
59 | - if(!th.data.dataList) th.data.dataList=new Array(); | ||
60 | - th.data.dataList=th.data.dataList.concat(res.data.data.pageData); | ||
61 | - th.data.curpage++; | ||
62 | - th.setData({dataList:th.data.dataList}); | ||
63 | - } | 57 | + console.log("onShow:4"); |
58 | + var data={store_id:os.stoid,type:1,pageSize:10,page:th.data.curpage,user_id:user_id,is_share:0}; | ||
59 | + console.log(data); | ||
60 | + getApp().request.get("/api/weshop/prom/coupon/pageCouponList", { | ||
61 | + data:data, | ||
62 | + success:function (res){ | ||
63 | + console.log("onShow:5"); | ||
64 | + console.log(res); | ||
65 | + th.data.loading=0; | ||
66 | + if(res.data.code==0){ | ||
67 | + if(!th.data.dataList) th.data.dataList=new Array(); | ||
68 | + th.data.dataList=th.data.dataList.concat(res.data.data.pageData); | ||
69 | + th.data.curpage++; | ||
70 | + th.setData({dataList:th.data.dataList}); | ||
71 | + } | ||
72 | + }, | ||
73 | + fail:function (e){ | ||
74 | + console.log("onShow:6"); | ||
75 | + console.log(e); | ||
76 | + } | ||
64 | }); | 77 | }); |
65 | }, | 78 | }, |
66 | 79 |
packageA/pages/quan_list/quan_list.wxml
@@ -2,9 +2,11 @@ | @@ -2,9 +2,11 @@ | ||
2 | <wxs module="g_filters" src="g_filter.wxs"></wxs> | 2 | <wxs module="g_filters" src="g_filter.wxs"></wxs> |
3 | <wxs module="tool" src="filter.wxs"></wxs> | 3 | <wxs module="tool" src="filter.wxs"></wxs> |
4 | 4 | ||
5 | -<view class="header"> | ||
6 | - <rich-text nodes="{{config2.couponset}}" class="r_txt fs26"></rich-text> | ||
7 | -</view> | 5 | +<block wx:if="{{config2.couponset}}"> |
6 | + <view class="header"> | ||
7 | + <rich-text nodes="{{config2.couponset}}" class="r_txt fs26"></rich-text> | ||
8 | + </view> | ||
9 | +</block> | ||
8 | <view class="content"> | 10 | <view class="content"> |
9 | <view bindtap="go_detail" data-ind="{{index}}" class="quan_item flex fs30" wx:for="{{dataList}}"> | 11 | <view bindtap="go_detail" data-ind="{{index}}" class="quan_item flex fs30" wx:for="{{dataList}}"> |
10 | <!-- 左边 --> | 12 | <!-- 左边 --> |
pages/index/index/index.js
@@ -351,14 +351,10 @@ Page({ | @@ -351,14 +351,10 @@ Page({ | ||
351 | //当隐藏的时候就关闭计时器 | 351 | //当隐藏的时候就关闭计时器 |
352 | onHide: function() { | 352 | onHide: function() { |
353 | this.data.is_timer = 0; | 353 | this.data.is_timer = 0; |
354 | - clearInterval(this.data.pt_timer); | ||
355 | - clearInterval(this.data.w_holiday_pop); | ||
356 | - clearInterval(this.data.full_screen); | ||
357 | - | 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); | ||
358 | this.data.w_holiday_pop=0; | 357 | this.data.w_holiday_pop=0; |
359 | - for(var i = 1; i < 100; i++) { | ||
360 | - clearInterval(i); | ||
361 | - } | ||
362 | 358 | ||
363 | }, | 359 | }, |
364 | 360 |