Commit 5a363051c1bc2162fb250763860c91ccaf410e27
1 parent
dce80cdc
我的礼包的券的功能优化
Showing
4 changed files
with
163 additions
and
54 deletions
packageA/pages/myGift/myGift.wxml
| ... | ... | @@ -17,18 +17,18 @@ |
| 17 | 17 | <view class="flex ai-center"> |
| 18 | 18 | <view class="c-red fs28"> |
| 19 | 19 | <block wx:if="{{item.lbprice>0 && item.lbintegral}}"> |
| 20 | - <text class="rmb">{{item.lbprice}}</text>/{{item.lbintegral}}积分 | |
| 20 | + <text class="rmb">{{filter.toFix(item.lbprice,2)}}</text>/{{item.lbintegral}}积分 | |
| 21 | 21 | </block> |
| 22 | 22 | <block wx:elif="{{item.lbprice>0 || item.lbintegral}}"> |
| 23 | 23 | <block wx:if="{{item.lbprice>0}}" > |
| 24 | - <text class="rmb">{{item.lbprice}}</text> | |
| 24 | + <text class="rmb">{{filter.toFix(item.lbprice,2) }}</text> | |
| 25 | 25 | </block> |
| 26 | 26 | <block wx:if="{{item.lbintegral>0}}"> |
| 27 | 27 | {{item.lbintegral}}积分 |
| 28 | 28 | </block> |
| 29 | 29 | </block> |
| 30 | 30 | </view> |
| 31 | - <view class="fs22 c-a4 line-through mgl10">零售价{{item.oldprice}}</view> | |
| 31 | + <view class="fs22 c-a4 line-through mgl10">零售价{{filter.toFix(item.oldprice,2)}}</view> | |
| 32 | 32 | </view> |
| 33 | 33 | <view class="fs24 c-a4">已售{{item.salenum}}件</view> |
| 34 | 34 | </view> | ... | ... |
packageA/pages/myGiftDetails/myGiftDetails.js
| ... | ... | @@ -57,7 +57,7 @@ Page({ |
| 57 | 57 | // store_id: app.globalData.setting.stoid, |
| 58 | 58 | // user_id: app.globalData.user_id, |
| 59 | 59 | // }; |
| 60 | - | |
| 60 | + //购买的时候是0,购买后是1 | |
| 61 | 61 | if(this.data.index == 0) { |
| 62 | 62 | // data.lbid = this.data.id; |
| 63 | 63 | // 请求数据 |
| ... | ... | @@ -68,60 +68,100 @@ Page({ |
| 68 | 68 | }, |
| 69 | 69 | isShowLoading: true, |
| 70 | 70 | }).then(function(res) { |
| 71 | - self.setData({ | |
| 72 | - details: res.data.data.pageData[0], | |
| 73 | - }); | |
| 74 | - }); | |
| 75 | - | |
| 76 | - app.request.promiseGet('/api/weshop/libao/libaoList/page', { | |
| 77 | - data: { | |
| 78 | - store_id: app.globalData.setting.stoid, | |
| 79 | - lbid: this.data.id, | |
| 80 | - }, | |
| 81 | - isShowLoading: true, | |
| 82 | - }).then(function(res) { | |
| 83 | - self.setData({ | |
| 84 | - list: res.data.data.pageData, | |
| 85 | - }); | |
| 71 | + | |
| 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] | |
| 74 | + self.setData({ details:da, }); | |
| 75 | + | |
| 76 | + //礼包有俩种类型 | |
| 77 | + if(da.lbtype==1){ | |
| 78 | + app.request.promiseGet('/api/weshop/libao/libaoList/page', { | |
| 79 | + data: { | |
| 80 | + store_id: app.globalData.setting.stoid, | |
| 81 | + lbid: self.data.id,pageSize:500 | |
| 82 | + }, | |
| 83 | + isShowLoading: true, | |
| 84 | + }).then(function(res) { | |
| 85 | + self.setData({ | |
| 86 | + list: res.data.data.pageData, | |
| 87 | + }); | |
| 88 | + }); | |
| 89 | + }else{ | |
| 90 | + app.request.promiseGet('/api/weshop/libao/libaoList/listLQ', { | |
| 91 | + data: { | |
| 92 | + store_id: app.globalData.setting.stoid, | |
| 93 | + lbid: self.data.id, | |
| 94 | + }, | |
| 95 | + isShowLoading: true, | |
| 96 | + }).then(function(res) { | |
| 97 | + if(res.data.code==0){ | |
| 98 | + self.setData({ | |
| 99 | + list: res.data.data, | |
| 100 | + }); | |
| 101 | + } | |
| 102 | + }); | |
| 103 | + } | |
| 104 | + | |
| 105 | + } | |
| 86 | 106 | }); |
| 107 | + | |
| 87 | 108 | } else if(this.data.index == 1) { |
| 88 | 109 | app.request.promiseGet('/api/weshop/libao/libaoFormvip/page', { |
| 89 | 110 | data: { |
| 90 | 111 | store_id: app.globalData.setting.stoid, |
| 91 | 112 | user_id: app.globalData.user_id, |
| 92 | - id: this.data.id, | |
| 113 | + id: this.data.id | |
| 93 | 114 | }, |
| 94 | 115 | isShowLoading: true, |
| 95 | 116 | }).then(function(res) { |
| 96 | 117 | // console.log('res3-->', res); |
| 97 | 118 | if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ |
| 119 | + | |
| 120 | + var da= res.data.data.pageData[0] | |
| 98 | 121 | self.setData({ |
| 99 | - details: res.data.data.pageData[0], | |
| 122 | + details:da, | |
| 100 | 123 | }); |
| 101 | - } | |
| 102 | - }); | |
| 103 | - | |
| 104 | - app.request.promiseGet('/api/weshop/libao/libaoListvip/page', { | |
| 105 | - data: { | |
| 106 | - store_id: app.globalData.setting.stoid, | |
| 107 | - lbvipid: this.data.id, | |
| 108 | - }, | |
| 109 | - isShowLoading: true, | |
| 110 | - }).then(function(res) { | |
| 111 | - // console.log('res4-->', res); | |
| 112 | - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0) { | |
| 113 | - var list_arr=res.data.data.pageData; | |
| 114 | - for(var i in list_arr){ | |
| 115 | - list_arr[i].alsonum= list_arr[i]['goods_num'] - list_arr[i]['usenum'];//剩余次数 | |
| 124 | + | |
| 125 | + if(da.lbtype==1){ | |
| 126 | + app.request.promiseGet('/api/weshop/libao/libaoListvip/page', { | |
| 127 | + data: { | |
| 128 | + store_id: app.globalData.setting.stoid, | |
| 129 | + lbvipid: self.data.id,pageSize:500 | |
| 130 | + }, | |
| 131 | + isShowLoading: true, | |
| 132 | + }).then(function(res) { | |
| 133 | + // console.log('res4-->', res); | |
| 134 | + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0) { | |
| 135 | + var list_arr=res.data.data.pageData; | |
| 136 | + for(var i in list_arr){ | |
| 137 | + list_arr[i].alsonum= list_arr[i]['goods_num'] - list_arr[i]['usenum'];//剩余次数 | |
| 138 | + } | |
| 139 | + self.setData({ | |
| 140 | + list: res.data.data.pageData, | |
| 141 | + }); | |
| 142 | + } | |
| 143 | + }); | |
| 144 | + }else{ | |
| 145 | + app.request.promiseGet('/api/weshop/libao/libaoListvip/listLQ', { | |
| 146 | + data: { | |
| 147 | + store_id: app.globalData.setting.stoid, | |
| 148 | + lbvipid: self.data.id, | |
| 149 | + user_id:app.globalData.user_id | |
| 150 | + }, | |
| 151 | + isShowLoading: true, | |
| 152 | + }).then(function(res) { | |
| 153 | + // console.log('res4-->', res); | |
| 154 | + if(res.data.code==0 && res.data.data) { | |
| 155 | + self.setData({ | |
| 156 | + list: res.data.data, | |
| 157 | + }); | |
| 158 | + } | |
| 159 | + }); | |
| 116 | 160 | } |
| 117 | - self.setData({ | |
| 118 | - list: res.data.data.pageData, | |
| 119 | - }); | |
| 161 | + | |
| 120 | 162 | } |
| 121 | 163 | }); |
| 122 | 164 | }; |
| 123 | - | |
| 124 | - | |
| 125 | 165 | }; |
| 126 | 166 | }; |
| 127 | 167 | }, |
| ... | ... | @@ -260,14 +300,32 @@ Page({ |
| 260 | 300 | icon: 'none', |
| 261 | 301 | duration: 2000 |
| 262 | 302 | }) |
| 263 | - | |
| 264 | - | |
| 265 | - | |
| 303 | + | |
| 266 | 304 | } |
| 267 | 305 | } |
| 268 | 306 | }) |
| 269 | 307 | |
| 270 | - } | |
| 308 | + }, | |
| 309 | + | |
| 310 | + //一键领取券 | |
| 311 | + show_get_quan:function (e) { | |
| 312 | + this.setData({'details.isget':1}); | |
| 313 | + var json = { | |
| 314 | + | |
| 315 | + }; | |
| 316 | + var url = ""; | |
| 317 | + getApp().request.post(url,{ | |
| 318 | + data:json, | |
| 319 | + success:function(res) { | |
| 320 | + if (res.data.code == 0) { | |
| 321 | + | |
| 322 | + } else { | |
| 323 | + | |
| 324 | + } | |
| 325 | + }, | |
| 326 | + }) | |
| 327 | + | |
| 328 | + } | |
| 271 | 329 | |
| 272 | 330 | |
| 273 | 331 | }) |
| 274 | 332 | \ No newline at end of file | ... | ... |
packageA/pages/myGiftDetails/myGiftDetails.wxml
| ... | ... | @@ -11,11 +11,11 @@ |
| 11 | 11 | <view class="flex ai-center"> |
| 12 | 12 | <view class="c-red fs36"> |
| 13 | 13 | <block wx:if="{{details.lbprice>0 && details.lbintegral>0 }}"> |
| 14 | - <text class="rmb">{{details.lbprice}}</text>/{{details.lbintegral}}积分 | |
| 14 | + <text class="rmb">{{filter.toFix(details.lbprice,2)}}</text>/{{details.lbintegral}}积分 | |
| 15 | 15 | </block> |
| 16 | 16 | <block wx:elif="{{details.lbprice>0 || details.lbintegral>0 }}"> |
| 17 | 17 | <block wx:if="{{details.lbprice>0}}" > |
| 18 | - <text class="rmb">{{details.lbprice}}</text> | |
| 18 | + <text class="rmb">{{filter.toFix(details.lbprice,2)}}</text> | |
| 19 | 19 | </block> |
| 20 | 20 | <block wx:if="{{details.lbintegral>0}}" > |
| 21 | 21 | {{details.lbintegral}}积分 |
| ... | ... | @@ -23,15 +23,18 @@ |
| 23 | 23 | </block> |
| 24 | 24 | |
| 25 | 25 | </view> |
| 26 | - <view class="fs22 c-a4 line-through mgl10">零售价{{details.oldprice}}</view> | |
| 26 | + <view class="fs22 c-a4 line-through mgl10">零售价{{filter.toFix(details.oldprice,2)}}</view> | |
| 27 | 27 | </view> |
| 28 | 28 | <view class="fs24 c-a4">已售{{details.salenum}}件</view> |
| 29 | 29 | </view> |
| 30 | 30 | <!-- 时间 --> |
| 31 | 31 | <view class="date">活动截止日期 {{details.expdate ? filter.format_time(details.expdate):filter.format_time(details.endtime)}}</view> |
| 32 | 32 | </view> |
| 33 | + | |
| 34 | + | |
| 35 | + <!-- 领券和兑换商品 --> | |
| 33 | 36 | <!-- 单品 --> |
| 34 | - <view class="goods-container"> | |
| 37 | + <view class="goods-container" wx:if="{{details.lbtype==1}}"> | |
| 35 | 38 | <view class="pd20 bold bdb">可到线下门店兑换以下单品</view> |
| 36 | 39 | <view wx:if="{{index==1 && details.codetype==1}}" class=""> |
| 37 | 40 | <view class="flex pd20 jc_sb"> |
| ... | ... | @@ -53,7 +56,6 @@ |
| 53 | 56 | </view> |
| 54 | 57 | </view> |
| 55 | 58 | |
| 56 | - | |
| 57 | 59 | <view wx:else class=""> |
| 58 | 60 | <view class="flex pd20 jc_sb"> |
| 59 | 61 | <view>单品名称</view> |
| ... | ... | @@ -65,15 +67,48 @@ |
| 65 | 67 | </view> |
| 66 | 68 | </view> |
| 67 | 69 | </view> |
| 68 | - | |
| 70 | + | |
| 71 | + <view wx:if="{{details.lbtype==2}}" class="flex" style="flex-wrap: wrap;"> | |
| 72 | + <block wx:for="{{list}}"> | |
| 73 | + <block wx:for="{{item.goods_num-0}}" wx:for-item="nitem" wx:for-index="idx"> | |
| 74 | + <view class="lb_quan" style="background-image: url({{imghost}}/miniapp/images/yhq_{{index%2+1}}.png)"> | |
| 75 | + <view class="flex fs28 fir_view"> | |
| 76 | + <view>满1000.00使用</view> | |
| 77 | + <view class="fs38" style="text-align: right">¥1000</view> | |
| 78 | + </view> | |
| 79 | + <view style="font-size: 16rpx; text-align: center">活动结束日期: 2022-06-02 00:00:00 </view> | |
| 80 | + </view> | |
| 81 | + </block> | |
| 82 | + </block> | |
| 83 | + </view> | |
| 84 | + | |
| 85 | + <view style="height: 20rpx"></view> | |
| 69 | 86 | <!-- 按钮 --> |
| 70 | - <view class="btn-container"> | |
| 87 | + <view class="btn-container" wx:if="{{details.lbtype==1}}"> | |
| 88 | + <block wx:if="{{index == 0}}"> | |
| 89 | + <view wx:if="{{details.lbintegral>0}}" bindtap="GetBuyIntegral" class="btn red">立即兑换</view> | |
| 90 | + <view wx:if="{{details.lbprice>0}}" bindtap="GetBuyPrice" class="btn pink">立即购买</view> | |
| 91 | + </block> | |
| 92 | + | |
| 93 | + <block wx:else> | |
| 94 | + <view wx:if="{{details.isget}}" data-type="1" class="btn" style="background-color:#aaa;color: #fff"> | |
| 95 | + 已领取{{list[0].freebh}} | |
| 96 | + </view> | |
| 97 | + <view wx:else bindtap="show_hxm" data-type="1" class="btn red">立即使用</view> | |
| 98 | + </block> | |
| 99 | + </view> | |
| 100 | + | |
| 101 | + <view class="btn-container" wx:if="{{details.lbtype==2}}"> | |
| 71 | 102 | <block wx:if="{{index == 0}}"> |
| 72 | 103 | <view wx:if="{{details.lbintegral>0}}" bindtap="GetBuyIntegral" class="btn red">立即兑换</view> |
| 73 | 104 | <view wx:if="{{details.lbprice>0}}" bindtap="GetBuyPrice" class="btn pink">立即购买</view> |
| 74 | 105 | </block> |
| 75 | - <view wx:else bindtap="show_hxm" data-type="1" class="btn red">立即使用</view> | |
| 106 | + <block wx:else> | |
| 107 | + <view wx:if="{{details.isget}}" data-type="1" class="btn" style="background-color:#aaa;color: #fff">已领</view> | |
| 108 | + <view wx:else bindtap="show_get_quan" data-type="1" class="btn red">一键领取优惠券→</view> | |
| 109 | + </block> | |
| 76 | 110 | </view> |
| 111 | + | |
| 77 | 112 | </view> |
| 78 | 113 | |
| 79 | 114 | <!-- 引入提示组件 --> | ... | ... |
packageA/pages/myGiftDetails/myGiftDetails.wxss
| ... | ... | @@ -81,4 +81,20 @@ page { |
| 81 | 81 | .ling_btn{ background: #c0283a; color: #fff; width: 100rpx; height: 50rpx; |
| 82 | 82 | display: inline-block; line-height: 50rpx; border-radius: 10rpx} |
| 83 | 83 | |
| 84 | -.ling_btn.c_a{ background: darkgrey} | |
| 85 | 84 | \ No newline at end of file |
| 85 | +.ling_btn.c_a{ background: darkgrey} | |
| 86 | + | |
| 87 | +.lb_quan{ | |
| 88 | + width: 48%; | |
| 89 | + height: 120rpx; | |
| 90 | + background-size: 100% 100%; | |
| 91 | + background-position: center; | |
| 92 | + background-repeat: no-repeat; | |
| 93 | + color: #fff; | |
| 94 | + font-size: 22rpx; | |
| 95 | + text-align: center; | |
| 96 | + margin-top:20rpx; | |
| 97 | + margin-left:10rpx; | |
| 98 | +} | |
| 99 | +.fir_view{ | |
| 100 | + justify-content: space-between; height: 98rpx; line-height: 98rpx; padding: 0 8rpx; | |
| 101 | +} | |
| 86 | 102 | \ No newline at end of file | ... | ... |