Commit bf03e8aee840957a2b8b76ec52348eeefb4d169c

Authored by taiyuan
2 parents e2c0db78 185c2c98

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

... ... @@ -40,7 +40,7 @@ App({
40 40 ],
41 41  
42 42 globalData: {
43   - cartGoodsNum:0, //购物车总数量
  43 + cartGoodsNum:0, //购物车总数量
44 44 isTabBar :false,
45 45 isIpx: false, //适配IPhoneX
46 46 url:"",
... ... @@ -523,6 +523,7 @@ App({
523 523 //-------获取购物车数量----------
524 524 requestCardNum: function(th) {
525 525 if(!this.globalData.user_id) return false;
  526 + var that=this;
526 527 this.request.get("/api/weshop/cart/page", {
527 528 isShoeLoading:false,
528 529 data: {
... ... @@ -538,14 +539,30 @@ App({
538 539 num += e.data.data.pageData[i].goods_num;
539 540 }
540 541 }
541   - getApp().globalData.cartGoodsNum=num;
  542 +
542 543 /*---
543 544 wx.setTabBarBadge({ //tabbar右上角添加文本
544 545 index: 2, ////tabbar下标
545 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 139 "pages/profile/profile",
140 140 "pages/parseHtml/parseHtml",
141 141 "pages/myGift/myGift",
142   - "pages/myGiftDetails/myGiftDetails"
  142 + "pages/myGiftDetails/myGiftDetails",
143 143 "pages/cart2_ser/cart2_ser"
144 144 ]
145 145  
... ...
packageA/pages/quan_list/quan_list.js
... ... @@ -25,19 +25,21 @@ Page({
25 25 onLoad: function(t) {
26 26 var th=this;
27 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 29 th.setData({config2:conf});
30 30 })
31 31 },
32 32 //---展示---
33 33 onShow: function() {
  34 +
  35 + console.log("onShow:1");
34 36 this.data.curpage=1;
35 37 this.setData({dataList:null});
  38 + console.log("onShow:2");
36 39 this.get_quan_list();
37 40 //券的模拟数据
38 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 42 //th.setData({dataList: data});
40   -
41 43 this.setData({getcurday:ut.gettimestamp()});
42 44 },
43 45  
... ... @@ -47,20 +49,31 @@ Page({
47 49  
48 50 //--券的列表页面的函数--
49 51 get_quan_list:function(){
  52 + console.log("onShow:3");
50 53 var th=this;
51 54 if(th.data.loading) return false;
52 55 th.data.loading=1;
53 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 2 <wxs module="g_filters" src="g_filter.wxs"></wxs>
3 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 10 <view class="content">
9 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 351 //当隐藏的时候就关闭计时器
352 352 onHide: function() {
353 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 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  
... ...