提交优惠券,积分修改(领券部分没做)
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index"
|
||||
import { redeemCoupons } from "../../service/system";
|
||||
import request from "../../utils/request"
|
||||
const { OK } = request;
|
||||
|
||||
// components/discountCoupon/index.js
|
||||
Component({
|
||||
|
||||
@@ -5,7 +10,8 @@ Component({
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
type: Number,
|
||||
data: Object
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -20,7 +26,22 @@ Component({
|
||||
*/
|
||||
methods: {
|
||||
handleUse() {
|
||||
|
||||
alertInfo("敬请期待")
|
||||
},
|
||||
handleChange() {
|
||||
const { data } = this.data;
|
||||
const that = this;
|
||||
loadingFunc(async () => {
|
||||
console.log("--------------========", data)
|
||||
const { code, message } = await redeemCoupons({ id: data.id, type: 2 })
|
||||
console.log("code", code, 'message', message)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("兑换成功")
|
||||
this.triggerEvent("change", { id, type: 2 })
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
@@ -5,28 +5,33 @@
|
||||
<view class="top">
|
||||
<view class="left">
|
||||
<view class="typeText">
|
||||
通用优惠券
|
||||
<text wx:if="{{data.type === 0}}"> 通用优惠券 </text>
|
||||
<text wx:if="{{data.type === 1}}"> 无门槛优惠券 </text>
|
||||
<text wx:if="{{data.type === 2}}"> 满减券 </text>
|
||||
</view>
|
||||
<view class="time">
|
||||
有效期至2024.12.01
|
||||
有效期至 {{ data.endTime }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="price">
|
||||
<text style="font-size: 26rpx;line-height: 26rpx;"> ¥ </text>
|
||||
<view class="number"> 30 </view>
|
||||
<view class="number" wx:if="{{data.discount > 0}}"> {{ data.discount }} 折 </view>
|
||||
<view class="number" wx:elif="{{data.discountMoney > 0}}"> {{ data.discountMoney }} 元 </view>
|
||||
<view wx:else> - </view>
|
||||
</view>
|
||||
<view class="limit">
|
||||
满30可用
|
||||
满 {{ data.useMin }} 可用
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view class="left">
|
||||
仅限商城使用
|
||||
|
||||
</view>
|
||||
<view class="right">
|
||||
<van-button type="info" size="small" bind:tap="handleUse">去使用</van-button>
|
||||
<van-button wx:if="{{type === 1}}" type="info" size="small" bind:tap="handleUse">去领取</van-button>
|
||||
<van-button wx:if="{{type === 2}}" type="info" size="small" bind:tap="handleChange">去兑换</van-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
Reference in New Issue
Block a user