Commit 20255594 by 高淑倩

add: 积分兑换优惠券

parent d1b65078
// component/exchange-coupon-modal/exchange-coupon-modal.js // component/exchange-coupon-modal/exchange-coupon-modal.js
var app = getApp()
const wxService = require('../../utils/wxService')
const envInfo = require('../../config/index').envInfo
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
isExchange:Boolean isExchange:{
type: Boolean,
value: false
},
exchangePoint:{
type: Number,
value: 0
},
exchangeId: {
type: String,
value: ''
},
}, },
/** /**
...@@ -46,15 +61,28 @@ Component({ ...@@ -46,15 +61,28 @@ Component({
}) })
} }
}, },
//再想想 // 再想想
cancel(){ cancel(){
this.setData({ this.setData({
isExchange: false isExchange: false
}) })
}, },
//立即兑换 // 立即兑换
query(){ handelRedeemNow(){
wx.showLoading({
title: '加载中'
})
const params = {
activateId: this.data.exchangeId
}
wxService.post(`/coupon/pointsRedemptionCouponSetting/exchange`, params).then(res=>{
const {result,data} = res.data
console.log('res.data',res.data)
if(result == 0){
wx.hideLoading()
}
})
} }
} }
}) })
...@@ -7,16 +7,16 @@ ...@@ -7,16 +7,16 @@
</view> </view>
<view class="modal-content"> <view class="modal-content">
<view class='modal-desc'> <view class='modal-desc'>
<text><text class="num">500</text>积分</text> <view><text class="num">{{exchangePoint}}</text>积分</view>
<view class='coupon-number'> <!-- <view class='coupon-number'>
<view class="redus" catchtap="minusNum">-</view> <view class="redus" catchtap="minusNum">-</view>
<input type="number" catchtap bindblur="blurNum" bindinput="inputNum" value="{{couponNum}}"></input> <input type="number" catchtap bindblur="blurNum" bindinput="inputNum" value="{{couponNum}}"></input>
<view class="add" catchtap="addNum">+</view> <view class="add" catchtap="addNum">+</view>
</view> </view>-->
</view> </view>
<view> <view>
<button type='default' class='cancel' bindtap='cancel'>再想想</button> <button type='default' class='cancel' bindtap='cancel'>再想想</button>
<button type='primary' class='query' bindtap='query'>立即兑换</button> <button type='primary' class='query' bindtap='handelRedeemNow'>立即兑换</button>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -60,6 +60,8 @@ ...@@ -60,6 +60,8 @@
font-size: 28rpx; font-size: 28rpx;
margin-top: 38rpx; margin-top: 38rpx;
margin-bottom: 100rpx; margin-bottom: 100rpx;
display: flex;
justify-content:center;
} }
.cancel,.query{ .cancel,.query{
display: inline-block; display: inline-block;
......
...@@ -15,7 +15,9 @@ wxService.page({ ...@@ -15,7 +15,9 @@ wxService.page({
totalPages: 0, totalPages: 0,
integralCouponList: [], // 积分兑换优惠券列表 integralCouponList: [], // 积分兑换优惠券列表
noMore: false, noMore: false,
isExchange: false isExchange: false,
exchangeId: '',
exchangePoint: 0,
}, },
/** /**
...@@ -50,9 +52,12 @@ wxService.page({ ...@@ -50,9 +52,12 @@ wxService.page({
}) })
}, },
//立即兑换 //立即兑换
exchange(){ exchange(e){
const {id, point} = e.currentTarget.dataset
this.setData({ this.setData({
isExchange :true isExchange :true,
exchangeId: id,
exchangePoint: point
}) })
}, },
// 点击跳转至会员规则页 // 点击跳转至会员规则页
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<view class='coupon-time fs-24'>{{item.startTime}}</view> <view class='coupon-time fs-24'>{{item.startTime}}</view>
<view class='coupon-desc fs-24' data-id="{{item.id}}" bindtap="goCouponDetail">查看详情</view> <view class='coupon-desc fs-24' data-id="{{item.id}}" bindtap="goCouponDetail">查看详情</view>
</view> </view>
<view class='coupon-code fs-24' bindtap='exchange'>立即兑换</view> <view class='coupon-code fs-24' data-id="{{item.id}}" data-point="{{item.point}}" bindtap='exchange'>立即兑换</view>
</view> </view>
</view> </view>
<view class='empty-wrap' wx:if="{{!integralCouponList.length}}"> <view class='empty-wrap' wx:if="{{!integralCouponList.length}}">
...@@ -21,6 +21,6 @@ ...@@ -21,6 +21,6 @@
<view class='empty-text'>没有任何卡劵</view> <view class='empty-text'>没有任何卡劵</view>
</view> </view>
</view> </view>
<exchange-coupon-modal isExchange='{{isExchange}}'/> <exchange-coupon-modal exchangeId="{{exchangeId}}" exchangePoint="{{exchangePoint}}" isExchange='{{isExchange}}'/>
<no-more wx:if="{{noMore}}"/> <no-more wx:if="{{noMore}}"/>
</view> </view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment