提交优惠券,积分修改(领券部分没做)

This commit is contained in:
2024-12-06 17:41:26 +08:00
parent 34c2cb76e7
commit 9bc3cb5584
20 changed files with 198 additions and 105 deletions

View File

@@ -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 })
})
}
}
})