Commit 0eb0c93d6c2e550627b89460fa5e08fad3aa666c

Authored by yvan.ni
1 parent c5041549

积分兑换券的功能

pages/user/coupons/exchange/exchange.js
@@ -61,8 +61,13 @@ Page({ @@ -61,8 +61,13 @@ Page({
61 */ 61 */
62 async click(e) { 62 async click(e) {
63 var th=this; 63 var th=this;
64 - this.data.monye=e.currentTarget.dataset.monye;  
65 - this.data.integr=e.currentTarget.dataset.integr; 64 +
  65 + var index=e.currentTarget.dataset.index;
  66 + var item=this.data.result[index];
  67 + this.data.monye=item.ToSum;
  68 + this.data.integr=item.Integral;
  69 + this.data.number=item.Number;
  70 +
66 var my_con = this.selectComponent("#my_con"); //组件的id 71 var my_con = this.selectComponent("#my_con"); //组件的id
67 var title="是否使用"+th.data.integr+"积分兑换代金券面值"+th.data.monye+"元"; 72 var title="是否使用"+th.data.integr+"积分兑换代金券面值"+th.data.monye+"元";
68 my_con.open(title, "确定", "取消", th.sure_pay, null) 73 my_con.open(title, "确定", "取消", th.sure_pay, null)
@@ -71,6 +76,7 @@ Page({ @@ -71,6 +76,7 @@ Page({
71 sure_pay:function(){ 76 sure_pay:function(){
72 var monye=this.data.monye; 77 var monye=this.data.monye;
73 var integr=this.data.integr; 78 var integr=this.data.integr;
  79 + var number=this.data.number;
74 80
75 var user_id = getApp().globalData.user_id; 81 var user_id = getApp().globalData.user_id;
76 console.log(integr,"是什么微卷",typeof integr,monye); 82 console.log(integr,"是什么微卷",typeof integr,monye);
@@ -81,6 +87,7 @@ Page({ @@ -81,6 +87,7 @@ Page({
81 store_id: store_id, 87 store_id: store_id,
82 money:monye, 88 money:monye,
83 integ:integr, 89 integ:integr,
  90 + number:number,
84 }, 91 },
85 success: function (su) { 92 success: function (su) {
86 if (su.data.data!=null) { 93 if (su.data.data!=null) {
pages/user/coupons/exchange/exchange.wxml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <view><text class='f-big'>{{filter.getNum(result.ToSum)}}</text></view> 6 <view><text class='f-big'>{{filter.getNum(result.ToSum)}}</text></view>
7 </view> 7 </view>
8 <view class='mb20'>{{result.Integral}}积分兑换{{filter.getNum(result.ToSum)}}元微券</view> 8 <view class='mb20'>{{result.Integral}}积分兑换{{filter.getNum(result.ToSum)}}元微券</view>
9 - <view class='jf-btn' bindtap='click' data-monye='{{result.ToSum}}' data-integr="{{result.Integral}}">立即兑换</view> 9 + <view class='jf-btn' bindtap='click' data-index="{{idx}}">立即兑换</view>
10 </view> 10 </view>
11 </block> 11 </block>
12 <my_confirm id="my_con"></my_confirm> 12 <my_confirm id="my_con"></my_confirm>
13 \ No newline at end of file 13 \ No newline at end of file