From 5a363051c1bc2162fb250763860c91ccaf410e27 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Thu, 22 Jul 2021 18:05:13 +0800 Subject: [PATCH] 我的礼包的券的功能优化 --- packageA/pages/myGift/myGift.wxml | 6 +++--- packageA/pages/myGiftDetails/myGiftDetails.js | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------ packageA/pages/myGiftDetails/myGiftDetails.wxml | 51 +++++++++++++++++++++++++++++++++++++++++++-------- packageA/pages/myGiftDetails/myGiftDetails.wxss | 18 +++++++++++++++++- 4 files changed, 163 insertions(+), 54 deletions(-) diff --git a/packageA/pages/myGift/myGift.wxml b/packageA/pages/myGift/myGift.wxml index 52eca65..ccc9103 100644 --- a/packageA/pages/myGift/myGift.wxml +++ b/packageA/pages/myGift/myGift.wxml @@ -17,18 +17,18 @@ - {{item.lbprice}}/{{item.lbintegral}}积分 + {{filter.toFix(item.lbprice,2)}}/{{item.lbintegral}}积分 - {{item.lbprice}} + {{filter.toFix(item.lbprice,2) }} {{item.lbintegral}}积分 - 零售价{{item.oldprice}} + 零售价{{filter.toFix(item.oldprice,2)}} 已售{{item.salenum}}件 diff --git a/packageA/pages/myGiftDetails/myGiftDetails.js b/packageA/pages/myGiftDetails/myGiftDetails.js index f0f4798..64e4105 100644 --- a/packageA/pages/myGiftDetails/myGiftDetails.js +++ b/packageA/pages/myGiftDetails/myGiftDetails.js @@ -57,7 +57,7 @@ Page({ // store_id: app.globalData.setting.stoid, // user_id: app.globalData.user_id, // }; - + //购买的时候是0,购买后是1 if(this.data.index == 0) { // data.lbid = this.data.id; // 请求数据 @@ -68,60 +68,100 @@ Page({ }, isShowLoading: true, }).then(function(res) { - self.setData({ - details: res.data.data.pageData[0], - }); - }); - - app.request.promiseGet('/api/weshop/libao/libaoList/page', { - data: { - store_id: app.globalData.setting.stoid, - lbid: this.data.id, - }, - isShowLoading: true, - }).then(function(res) { - self.setData({ - list: res.data.data.pageData, - }); + + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ + var da= res.data.data.pageData[0] + self.setData({ details:da, }); + + //礼包有俩种类型 + if(da.lbtype==1){ + app.request.promiseGet('/api/weshop/libao/libaoList/page', { + data: { + store_id: app.globalData.setting.stoid, + lbid: self.data.id,pageSize:500 + }, + isShowLoading: true, + }).then(function(res) { + self.setData({ + list: res.data.data.pageData, + }); + }); + }else{ + app.request.promiseGet('/api/weshop/libao/libaoList/listLQ', { + data: { + store_id: app.globalData.setting.stoid, + lbid: self.data.id, + }, + isShowLoading: true, + }).then(function(res) { + if(res.data.code==0){ + self.setData({ + list: res.data.data, + }); + } + }); + } + + } }); + } else if(this.data.index == 1) { app.request.promiseGet('/api/weshop/libao/libaoFormvip/page', { data: { store_id: app.globalData.setting.stoid, user_id: app.globalData.user_id, - id: this.data.id, + id: this.data.id }, isShowLoading: true, }).then(function(res) { // console.log('res3-->', res); if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ + + var da= res.data.data.pageData[0] self.setData({ - details: res.data.data.pageData[0], + details:da, }); - } - }); - - app.request.promiseGet('/api/weshop/libao/libaoListvip/page', { - data: { - store_id: app.globalData.setting.stoid, - lbvipid: this.data.id, - }, - isShowLoading: true, - }).then(function(res) { - // console.log('res4-->', res); - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0) { - var list_arr=res.data.data.pageData; - for(var i in list_arr){ - list_arr[i].alsonum= list_arr[i]['goods_num'] - list_arr[i]['usenum'];//剩余次数 + + if(da.lbtype==1){ + app.request.promiseGet('/api/weshop/libao/libaoListvip/page', { + data: { + store_id: app.globalData.setting.stoid, + lbvipid: self.data.id,pageSize:500 + }, + isShowLoading: true, + }).then(function(res) { + // console.log('res4-->', res); + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0) { + var list_arr=res.data.data.pageData; + for(var i in list_arr){ + list_arr[i].alsonum= list_arr[i]['goods_num'] - list_arr[i]['usenum'];//剩余次数 + } + self.setData({ + list: res.data.data.pageData, + }); + } + }); + }else{ + app.request.promiseGet('/api/weshop/libao/libaoListvip/listLQ', { + data: { + store_id: app.globalData.setting.stoid, + lbvipid: self.data.id, + user_id:app.globalData.user_id + }, + isShowLoading: true, + }).then(function(res) { + // console.log('res4-->', res); + if(res.data.code==0 && res.data.data) { + self.setData({ + list: res.data.data, + }); + } + }); } - self.setData({ - list: res.data.data.pageData, - }); + } }); }; - - }; }; }, @@ -260,14 +300,32 @@ Page({ icon: 'none', duration: 2000 }) - - - + } } }) - } + }, + + //一键领取券 + show_get_quan:function (e) { + this.setData({'details.isget':1}); + var json = { + + }; + var url = ""; + getApp().request.post(url,{ + data:json, + success:function(res) { + if (res.data.code == 0) { + + } else { + + } + }, + }) + + } }) \ No newline at end of file diff --git a/packageA/pages/myGiftDetails/myGiftDetails.wxml b/packageA/pages/myGiftDetails/myGiftDetails.wxml index 74e8787..561c7dc 100644 --- a/packageA/pages/myGiftDetails/myGiftDetails.wxml +++ b/packageA/pages/myGiftDetails/myGiftDetails.wxml @@ -11,11 +11,11 @@ - {{details.lbprice}}/{{details.lbintegral}}积分 + {{filter.toFix(details.lbprice,2)}}/{{details.lbintegral}}积分 - {{details.lbprice}} + {{filter.toFix(details.lbprice,2)}} {{details.lbintegral}}积分 @@ -23,15 +23,18 @@ - 零售价{{details.oldprice}} + 零售价{{filter.toFix(details.oldprice,2)}} 已售{{details.salenum}}件 活动截止日期 {{details.expdate ? filter.format_time(details.expdate):filter.format_time(details.endtime)}} + + + - + 可到线下门店兑换以下单品 @@ -53,7 +56,6 @@ - 单品名称 @@ -65,15 +67,48 @@ - + + + + + + + 满1000.00使用 + ¥1000 + + 活动结束日期: 2022-06-02 00:00:00 + + + + + + - + + + 立即兑换 + 立即购买 + + + + + 已领取{{list[0].freebh}} + + 立即使用 + + + + 立即兑换 立即购买 - 立即使用 + + 已领 + 一键领取优惠券→ + + diff --git a/packageA/pages/myGiftDetails/myGiftDetails.wxss b/packageA/pages/myGiftDetails/myGiftDetails.wxss index 2431c64..efeb1a4 100644 --- a/packageA/pages/myGiftDetails/myGiftDetails.wxss +++ b/packageA/pages/myGiftDetails/myGiftDetails.wxss @@ -81,4 +81,20 @@ page { .ling_btn{ background: #c0283a; color: #fff; width: 100rpx; height: 50rpx; display: inline-block; line-height: 50rpx; border-radius: 10rpx} -.ling_btn.c_a{ background: darkgrey} \ No newline at end of file +.ling_btn.c_a{ background: darkgrey} + +.lb_quan{ + width: 48%; + height: 120rpx; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; + color: #fff; + font-size: 22rpx; + text-align: center; + margin-top:20rpx; + margin-left:10rpx; +} +.fir_view{ + justify-content: space-between; height: 98rpx; line-height: 98rpx; padding: 0 8rpx; +} \ No newline at end of file -- libgit2 0.21.4