Showing
8 changed files
with
157 additions
and
5 deletions
pack-checkout/components/discount.js
0 → 100644
| 1 | +// pack-checkout/components/discount.js | ||
| 2 | +Component({ | ||
| 3 | + /** | ||
| 4 | + * 组件的属性列表 | ||
| 5 | + */ | ||
| 6 | + properties: { | ||
| 7 | + checkout:Object, | ||
| 8 | + }, | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * 组件的初始数据 | ||
| 12 | + */ | ||
| 13 | + data: { | ||
| 14 | + checkedNum:0, | ||
| 15 | + display:false, | ||
| 16 | + }, | ||
| 17 | + observers: { | ||
| 18 | + 'checkout': function(checkout) { | ||
| 19 | + if(!checkout) return; | ||
| 20 | + let num=0; | ||
| 21 | + checkout.discount.forEach(q=>{ | ||
| 22 | + if(q.checked){ | ||
| 23 | + num++; | ||
| 24 | + } | ||
| 25 | + }) | ||
| 26 | + this.setData({ | ||
| 27 | + checkedNum:num, | ||
| 28 | + }) | ||
| 29 | + } | ||
| 30 | + }, | ||
| 31 | + /** | ||
| 32 | + * 组件的方法列表 | ||
| 33 | + */ | ||
| 34 | + methods: { | ||
| 35 | + show(){ | ||
| 36 | + this.setData({ | ||
| 37 | + display:true, | ||
| 38 | + }) | ||
| 39 | + }, | ||
| 40 | + hide(){ | ||
| 41 | + this.setData({ | ||
| 42 | + display:false, | ||
| 43 | + }) | ||
| 44 | + }, | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | +}) |
pack-checkout/components/discount.json
0 → 100644
pack-checkout/components/discount.wxml
0 → 100644
| 1 | +<!--pack-checkout/components/discount.wxml--> | ||
| 2 | +<view class="mask" wx:if="{{display}}"> | ||
| 3 | + <view class="discount" catchtap="catchtap"> | ||
| 4 | + <view class="header flex-lr"> | ||
| 5 | + <view class=""></view> | ||
| 6 | + <view class="title">红包</view> | ||
| 7 | + <view class="close" bindtap="hide"></view> | ||
| 8 | + </view> | ||
| 9 | + <view class="tips">红包均为一次使用,不找零、不兑现,每次买单抵扣不超过消费总额</view> | ||
| 10 | + <view class="content"> | ||
| 11 | + <view class="msg flex-ll"> | ||
| 12 | + 你选中了<text class="light">{{checkedNum}}</text>个红包,共可抵扣<text class="light">{{checkout.subsidy_price}}</text> | ||
| 13 | + </view> | ||
| 14 | + <view class="list"> | ||
| 15 | + <view class="quan" wx:for="{{checkout.discount}}" wx:key="discount"> | ||
| 16 | + <quan quan="{{item}}"> | ||
| 17 | + <radio value="r1" checked="{{item.checked}}" color="#F05522"/> | ||
| 18 | + </quan> | ||
| 19 | + </view> | ||
| 20 | + | ||
| 21 | + </view> | ||
| 22 | + </view> | ||
| 23 | + </view> | ||
| 24 | +</view> |
pack-checkout/components/discount.wxss
0 → 100644
| 1 | +/* pack-checkout/components/discount.wxss */ | ||
| 2 | +@import "/app.wxss"; | ||
| 3 | +.discount{ | ||
| 4 | + width:100%; | ||
| 5 | + background:rgba(255,255,255,1); | ||
| 6 | + border-radius:40rpx 40rpx 0rpx 0rpx; | ||
| 7 | + position: fixed; | ||
| 8 | + bottom: 0; | ||
| 9 | + left: 0; | ||
| 10 | + padding-bottom: 40rpx; | ||
| 11 | + padding-top: 20rpx; | ||
| 12 | +} | ||
| 13 | +.list{ | ||
| 14 | + max-height:930rpx; | ||
| 15 | + overflow-y: auto; | ||
| 16 | + box-sizing: border-box; | ||
| 17 | +} | ||
| 18 | +.header{ | ||
| 19 | + height:88rpx; | ||
| 20 | + padding: 0 42rpx; | ||
| 21 | +} | ||
| 22 | +.title{ | ||
| 23 | + font-size:32rpx; | ||
| 24 | + font-family:PingFangSC-Medium,PingFang SC; | ||
| 25 | + font-weight:500; | ||
| 26 | + color:rgba(53,53,53,1); | ||
| 27 | + line-height:88rpx; | ||
| 28 | +} | ||
| 29 | +.close{ | ||
| 30 | + width:28rpx; | ||
| 31 | + height:29rpx; | ||
| 32 | + background-size: 100% 100%; | ||
| 33 | + background-image: url("http://nosqn.colorcun.com/sellerbaobao/close.png"); | ||
| 34 | +} | ||
| 35 | +.tips{ | ||
| 36 | + height:50rpx; | ||
| 37 | + background:rgba(255,222,185,0.5); | ||
| 38 | + font-size:24rpx; | ||
| 39 | + font-family:PingFangSC-Regular,PingFang SC; | ||
| 40 | + font-weight:400; | ||
| 41 | + color:rgba(240,85,34,1); | ||
| 42 | + line-height:50rpx; | ||
| 43 | + padding-left: 16rpx; | ||
| 44 | +} | ||
| 45 | +.content{ | ||
| 46 | + padding: 30rpx 40rpx 0; | ||
| 47 | +} | ||
| 48 | +.msg{ | ||
| 49 | + height:40rpx; | ||
| 50 | + font-size:28rpx; | ||
| 51 | + font-family:PingFangSC-Regular,PingFang SC; | ||
| 52 | + font-weight:400; | ||
| 53 | + color:rgba(53,53,53,1); | ||
| 54 | + line-height:40rpx; | ||
| 55 | +} | ||
| 56 | +.light{ | ||
| 57 | + color:#F05522; | ||
| 58 | +} | ||
| 59 | +.quan{ | ||
| 60 | + margin-top: 20rpx; | ||
| 61 | +} |
| @@ -176,4 +176,12 @@ Page({ | @@ -176,4 +176,12 @@ Page({ | ||
| 176 | }) | 176 | }) |
| 177 | } | 177 | } |
| 178 | }, | 178 | }, |
| 179 | + discountShow(){ | ||
| 180 | + if(this.data.checkout.discount.length>0){ | ||
| 181 | + this.selectComponent('#discount').show(); | ||
| 182 | + } | ||
| 183 | + }, | ||
| 184 | + discountEvent(e){ | ||
| 185 | + console.log('discountEvent',e) | ||
| 186 | + }, | ||
| 179 | }) | 187 | }) |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | "showModal":"/components/tips/showModal/showModal", | 7 | "showModal":"/components/tips/showModal/showModal", |
| 8 | "invoice":"/components/userinfo/invoice", | 8 | "invoice":"/components/userinfo/invoice", |
| 9 | "subscribe":"/components/userinfo/subscribe", | 9 | "subscribe":"/components/userinfo/subscribe", |
| 10 | - "jinduBar":"../components/jinduBar" | 10 | + "jinduBar":"../components/jinduBar", |
| 11 | + "discount":"../components/discount" | ||
| 11 | } | 12 | } |
| 12 | } | 13 | } |
| @@ -41,9 +41,12 @@ | @@ -41,9 +41,12 @@ | ||
| 41 | <view class="list-name">消费总额</view> | 41 | <view class="list-name">消费总额</view> |
| 42 | <view class="list-val">¥ {{checkout.price}}</view> | 42 | <view class="list-val">¥ {{checkout.price}}</view> |
| 43 | </view> | 43 | </view> |
| 44 | - <view class="list flex-lr"> | 44 | + <view class="list flex-lr" bindtap="discountShow"> |
| 45 | <view class="list-name">红 包</view> | 45 | <view class="list-name">红 包</view> |
| 46 | - <view class="list-val">-¥ {{checkout.subsidy_price}}</view> | 46 | + <view class="list-val flex-rr"> |
| 47 | + -¥ {{checkout.subsidy_price}} | ||
| 48 | + <view class="more" style="margin-left: 20rpx;" wx:if="{{checkout.discount.length>0}}"></view> | ||
| 49 | + </view> | ||
| 47 | </view> | 50 | </view> |
| 48 | <view class="list flex-lr"> | 51 | <view class="list flex-lr"> |
| 49 | <view class="list-name">应付金额</view> | 52 | <view class="list-name">应付金额</view> |
| @@ -136,4 +139,5 @@ | @@ -136,4 +139,5 @@ | ||
| 136 | </view> | 139 | </view> |
| 137 | </block> | 140 | </block> |
| 138 | </view> | 141 | </view> |
| 139 | -<showModal id="showModal" confirmText="知道了" bindshowModal="showModal" cla="checkout"></showModal> | ||
| 142 | +<showModal id="showModal" confirmText="知道了" bindshowModal="showModal" cla="checkout"></showModal> | ||
| 143 | +<discount id="discount" checkout="{{checkout}}" bindevent="discountEvent"></discount> |
| @@ -644,7 +644,7 @@ | @@ -644,7 +644,7 @@ | ||
| 644 | "id": 80, | 644 | "id": 80, |
| 645 | "name": "pack-checkout/pages/index", | 645 | "name": "pack-checkout/pages/index", |
| 646 | "pathName": "pack-checkout/pages/index", | 646 | "pathName": "pack-checkout/pages/index", |
| 647 | - "query": "rid=62202&sid=80", | 647 | + "query": "rid=64793&sid=80", |
| 648 | "scene": null | 648 | "scene": null |
| 649 | }, | 649 | }, |
| 650 | { | 650 | { |
| @@ -672,6 +672,7 @@ | @@ -672,6 +672,7 @@ | ||
| 672 | "id": -1, | 672 | "id": -1, |
| 673 | "name": "pack-activity/pack/list", | 673 | "name": "pack-activity/pack/list", |
| 674 | "pathName": "pack-activity/pack/list", | 674 | "pathName": "pack-activity/pack/list", |
| 675 | + "query": "", | ||
| 675 | "scene": null | 676 | "scene": null |
| 676 | } | 677 | } |
| 677 | ] | 678 | ] |
-
Please register or login to post a comment