Commit 078426784263a97072c710578e6e3437fa8cf31b

Authored by vking
1 parent 2a2df7ca

商家红包活动

1 // pack-checkout/components/discount.js 1 // pack-checkout/components/discount.js
2 import util from '../../utils/util' 2 import util from '../../utils/util'
3 -import App from '../../utils/uri' 3 +import App from '../../utils/api'
4 Component({ 4 Component({
5 /** 5 /**
6 * 组件的属性列表 6 * 组件的属性列表
@@ -60,12 +60,20 @@ Component({ @@ -60,12 +60,20 @@ Component({
60 checkoutObj:checkout 60 checkoutObj:checkout
61 }) 61 })
62 }, 62 },
63 - discountChecked(e){  
64 - console.log('discountChecked',e)  
65 - let index=util.attr(e,'index')  
66 - let checkout=this.data.checkout  
67 - checkout.discount[index].checked=!checkout.discount[index].checked 63 + discountChecked(e) {
  64 + console.log('discountChecked', e)
  65 + let index = util.attr(e, 'index')
  66 + let checkout = this.data.checkout
  67 + checkout.discount[index].checked = !checkout.discount[index].checked
68 this.discountFormat(checkout) 68 this.discountFormat(checkout)
  69 + App.Customer.ChangeDiscountCombination({
  70 + id:checkout.id,
  71 + rel_id:checkout.discount[index].rel_id,
  72 + owner:checkout.discount[index].owner,
  73 + status:checkout.discount[index].checked?1:0,
  74 + }).then(()=>{
  75 + this.triggerEvent('event',{act:'reflush'});
  76 + })
69 }, 77 },
70 } 78 }
71 }) 79 })
@@ -14,7 +14,8 @@ @@ -14,7 +14,8 @@
14 <view class="list"> 14 <view class="list">
15 <view class="quan" wx:for="{{checkoutObj.discount}}" wx:key="discount"> 15 <view class="quan" wx:for="{{checkoutObj.discount}}" wx:key="discount">
16 <quan quan="{{item}}"> 16 <quan quan="{{item}}">
17 - <radio data-index="{{index}}" checked="{{item.checked}}" color="#F05522" bindtap="discountChecked"/> 17 + <radio data-index="{{index}}" checked="{{item.checked}}" color="#F05522"
  18 + bindtap="discountChecked"/>
18 </quan> 19 </quan>
19 </view> 20 </view>
20 21
@@ -192,5 +192,6 @@ Page({ @@ -192,5 +192,6 @@ Page({
192 }, 192 },
193 discountEvent(e){ 193 discountEvent(e){
194 console.log('discountEvent',e) 194 console.log('discountEvent',e)
  195 + this.GetCheckout()
195 }, 196 },
196 }) 197 })
@@ -483,4 +483,9 @@ export default { @@ -483,4 +483,9 @@ export default {
483 'App.Customer.GetUserCard':{ 483 'App.Customer.GetUserCard':{
484 openid:'openid', 484 openid:'openid',
485 }, 485 },
  486 + //根据账单ID,改变用户自主选择的卡券类型
  487 + 'App.Customer.ChangeDiscountCombination':{
  488 + openid:'openid',
  489 + silence: false,
  490 + },
486 } 491 }