Commit 938f16dd7f40d2a0796f378a4b3092165799182a

Authored by vking
1 parent 71c46d29

商家红包活动

// pack-checkout/components/discount.js
Component({
/**
* 组件的属性列表
*/
properties: {
checkout:Object,
},
/**
* 组件的初始数据
*/
data: {
checkedNum:0,
display:false,
},
observers: {
'checkout': function(checkout) {
if(!checkout) return;
let num=0;
checkout.discount.forEach(q=>{
if(q.checked){
num++;
}
})
this.setData({
checkedNum:num,
})
}
},
/**
* 组件的方法列表
*/
methods: {
show(){
this.setData({
display:true,
})
},
hide(){
this.setData({
display:false,
})
},
}
})
... ...
{
"component": true,
"usingComponents": {
"quan":"/components/reserve/seller/quan"
}
}
\ No newline at end of file
... ...
<!--pack-checkout/components/discount.wxml-->
<view class="mask" wx:if="{{display}}">
<view class="discount" catchtap="catchtap">
<view class="header flex-lr">
<view class=""></view>
<view class="title">红包</view>
<view class="close" bindtap="hide"></view>
</view>
<view class="tips">红包均为一次使用,不找零、不兑现,每次买单抵扣不超过消费总额</view>
<view class="content">
<view class="msg flex-ll">
你选中了<text class="light">{{checkedNum}}</text>个红包,共可抵扣<text class="light">{{checkout.subsidy_price}}</text>
</view>
<view class="list">
<view class="quan" wx:for="{{checkout.discount}}" wx:key="discount">
<quan quan="{{item}}">
<radio value="r1" checked="{{item.checked}}" color="#F05522"/>
</quan>
</view>
</view>
</view>
</view>
</view>
... ...
/* pack-checkout/components/discount.wxss */
@import "/app.wxss";
.discount{
width:100%;
background:rgba(255,255,255,1);
border-radius:40rpx 40rpx 0rpx 0rpx;
position: fixed;
bottom: 0;
left: 0;
padding-bottom: 40rpx;
padding-top: 20rpx;
}
.list{
max-height:930rpx;
overflow-y: auto;
box-sizing: border-box;
}
.header{
height:88rpx;
padding: 0 42rpx;
}
.title{
font-size:32rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(53,53,53,1);
line-height:88rpx;
}
.close{
width:28rpx;
height:29rpx;
background-size: 100% 100%;
background-image: url("http://nosqn.colorcun.com/sellerbaobao/close.png");
}
.tips{
height:50rpx;
background:rgba(255,222,185,0.5);
font-size:24rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(240,85,34,1);
line-height:50rpx;
padding-left: 16rpx;
}
.content{
padding: 30rpx 40rpx 0;
}
.msg{
height:40rpx;
font-size:28rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(53,53,53,1);
line-height:40rpx;
}
.light{
color:#F05522;
}
.quan{
margin-top: 20rpx;
}
... ...
... ... @@ -176,4 +176,12 @@ Page({
})
}
},
discountShow(){
if(this.data.checkout.discount.length>0){
this.selectComponent('#discount').show();
}
},
discountEvent(e){
console.log('discountEvent',e)
},
})
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@
"showModal":"/components/tips/showModal/showModal",
"invoice":"/components/userinfo/invoice",
"subscribe":"/components/userinfo/subscribe",
"jinduBar":"../components/jinduBar"
"jinduBar":"../components/jinduBar",
"discount":"../components/discount"
}
}
\ No newline at end of file
... ...
... ... @@ -41,9 +41,12 @@
<view class="list-name">消费总额</view>
<view class="list-val">¥ {{checkout.price}}</view>
</view>
<view class="list flex-lr">
<view class="list flex-lr" bindtap="discountShow">
<view class="list-name">红  包</view>
<view class="list-val">-¥ {{checkout.subsidy_price}}</view>
<view class="list-val flex-rr">
-¥ {{checkout.subsidy_price}}
<view class="more" style="margin-left: 20rpx;" wx:if="{{checkout.discount.length>0}}"></view>
</view>
</view>
<view class="list flex-lr">
<view class="list-name">应付金额</view>
... ... @@ -136,4 +139,5 @@
</view>
</block>
</view>
<showModal id="showModal" confirmText="知道了" bindshowModal="showModal" cla="checkout"></showModal>
\ No newline at end of file
<showModal id="showModal" confirmText="知道了" bindshowModal="showModal" cla="checkout"></showModal>
<discount id="discount" checkout="{{checkout}}" bindevent="discountEvent"></discount>
\ No newline at end of file
... ...
... ... @@ -644,7 +644,7 @@
"id": 80,
"name": "pack-checkout/pages/index",
"pathName": "pack-checkout/pages/index",
"query": "rid=62202&sid=80",
"query": "rid=64793&sid=80",
"scene": null
},
{
... ... @@ -672,6 +672,7 @@
"id": -1,
"name": "pack-activity/pack/list",
"pathName": "pack-activity/pack/list",
"query": "",
"scene": null
}
]
... ...