Commit 3e8752536e82282df8953a82a1f654ab5afa783c

Authored by vking
1 parent 20e92328

商家红包活动

... ... @@ -8,9 +8,12 @@
<view class="line"></view>
<view class="type">
<view class="card_title">{{quan.card_title}}</view>
<view class="card-date">
<view class="card-date" wx:if="{{quan.start_time>0}}">
{{util.unixtoTime(quan.start_time,"YYYY.MM.DD")}}-{{util.unixtoTime(quan.end_time,"YYYY.MM.DD")}}
</view>
<view class="card-date" wx:else="">
长期有效
</view>
</view>
<view class="opt">
<slot></slot>
... ...
... ... @@ -32,9 +32,12 @@ Component({
})
},
hide(){
this.setData({
display:false,
})
this.triggerEvent('event',{act:'reflush'});
setTimeout(()=>{
this.setData({
display:false,
})
},300)
},
discountFormat(checkout){
if(!checkout) return;
... ... @@ -42,7 +45,7 @@ Component({
let disObj={}
let subsidy_price=0;
checkout.discount.forEach(q=>{
checkout.disabled=false
q.disabled=false
if(q.checked){
num++;
disObj[q.owner+'-'+q.receive_condition]=true
... ... @@ -51,7 +54,7 @@ Component({
})
checkout.discount.forEach(q=>{
if(!q.checked && disObj[q.owner+'-'+q.receive_condition]){
checkout.disabled=true
q.disabled=true
}
})
checkout.subsidy_price=subsidy_price
... ... @@ -59,11 +62,13 @@ Component({
checkedNum:num,
checkoutObj:checkout
})
console.log('discountFormat',checkout)
},
discountChecked(e) {
console.log('discountChecked', e)
let index = util.attr(e, 'index')
let checkout = this.data.checkout
if(checkout.discount[index].disabled) return false;
checkout.discount[index].checked = !checkout.discount[index].checked
this.discountFormat(checkout)
App.Customer.ChangeDiscountCombination({
... ... @@ -72,7 +77,7 @@ Component({
owner:checkout.discount[index].owner,
status:checkout.discount[index].checked?1:0,
}).then(()=>{
this.triggerEvent('event',{act:'reflush'});
//this.triggerEvent('event',{act:'reflush'});
})
},
}
... ...
... ... @@ -13,8 +13,10 @@
</view>
<view class="list">
<view class="quan" wx:for="{{checkoutObj.discount}}" wx:key="discount">
<quan quan="{{item}}">
<radio data-index="{{index}}" checked="{{item.checked}}" color="#F05522"
<quan quan="{{item}}" cla="{{item.disabled?'quan-disabled':''}}">
<radio data-index="{{index}}"
disabled="{{item.disabled}}"
checked="{{item.checked}}" color="#F05522"
bindtap="discountChecked"/>
</quan>
</view>
... ...
// pack-checkout/components/xfCard.js
import App from '../../utils/api'
Component({
/**
* 组件的属性列表
*/
properties: {
checkout:Object,
},
/**
* 组件的初始数据
*/
data: {
display:false,
},
/**
* 组件的方法列表
*/
methods: {
show(){
App.Customer.SetCardRel({
sid:this.data.checkout.sid,
//price:3,
price:this.data.checkout.should_price,
receive_type:4,//任务领取
}).then(res=>{
if(res.data){
this.setData({
card:res.data,
display:true,
})
}
})
},
hide(){
this.setData({
display:false,
})
},
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pack-checkout/components/xfCard.wxml-->
<view class="mask flex-vc" wx:if="{{display}}">
<view class="card">
<view class="close" bindtap="hide"></view>
</view>
</view>
... ...
/* pack-checkout/components/xfCard.wxss */
@import "/app.wxss";
.card{
width: 578rpx;
height: calc(686rpx - 60rpx);
background-image: url("http://nosqn.colorcun.com/sellerbaobao/baobao.png");
background-size: 100% 100%;
position: relative;
}
.close{
background-image: url("http://nosqn.colorcun.com/sellerbaobao/close2.png");
background-size: 100% 100%;
width:48rpx;
height:48rpx;
position: absolute;
top:-60rpx;
right:0;
}
\ No newline at end of file
... ...
... ... @@ -159,6 +159,8 @@ Page({
App.PushMsg.SendUrgeMsg({rid:this.data.checkout.rid})
},
pay(){
this.selectComponent('#xfCard').show();
return;
App.PayOnline.CombineTransactions({
rid:this.data.checkout.rid,
}).then(res=>{
... ... @@ -167,6 +169,7 @@ Page({
wx.requestPayment({
...res.data,
success:res=>{
this.selectComponent('#xfCard').show();
this.GetCheckout()
},
})
... ...
... ... @@ -8,6 +8,7 @@
"invoice":"/components/userinfo/invoice",
"subscribe":"/components/userinfo/subscribe",
"jinduBar":"../components/jinduBar",
"discount":"../components/discount"
"discount":"../components/discount",
"xfCard":"../components/xfCard"
}
}
\ No newline at end of file
... ...
... ... @@ -140,4 +140,5 @@
</block>
</view>
<showModal id="showModal" confirmText="知道了" bindshowModal="showModal" cla="checkout"></showModal>
<discount id="discount" checkout="{{checkout}}" bindevent="discountEvent"></discount>
\ No newline at end of file
<discount id="discount" checkout="{{checkout}}" bindevent="discountEvent"></discount>
<xfCard id="xfCard" checkout="{{checkout}}"></xfCard>
\ No newline at end of file
... ...