提交优惠券,积分修改(领券部分没做)
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 })
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user