diff --git a/src/api/modules/coupon.js b/src/api/modules/coupon.js index a473bc9..a6dd50a 100644 --- a/src/api/modules/coupon.js +++ b/src/api/modules/coupon.js @@ -9,4 +9,8 @@ export const coupon = { params: data, }); }, + //添加优惠卷 + addCoupon: (data) => { + return $http.post(`/merchant-api/coupon/save`, data); + }, }; diff --git a/src/views/modules/coupon/index.vue b/src/views/modules/coupon/index.vue index abb003f..4ac5f09 100644 --- a/src/views/modules/coupon/index.vue +++ b/src/views/modules/coupon/index.vue @@ -147,13 +147,11 @@ export default { }); }, addProduct(row) { - this.$refs.addOrUpdate - .toggle() - .add({ - ...row, - marketId: this.formInline.marketId, - shopId: this.formInline.shopId, - }); + this.$refs.addOrUpdate.toggle().add({ + ...row, + marketId: this.formInline.marketId, + shopId: this.formInline.shopId, + }); }, deleteProduct() { console.log(this.selectList); @@ -202,35 +200,55 @@ export default { return [ { type: "checkbox", width: "60px", fixed: "left" }, // { type: "seq", width: "60px", align: "center", title: "序号" }, - { - title: "店铺", - align: "center", - field: "cardName", - }, { title: "优惠券名称", align: "center", - field: "cardNo", + field: "name", }, { title: "发行方", align: "center", - field: "telNo", + field: "publisher", + type: "jsx", + render: ({ row }) => { + if (row.publisher === "MERCHANT") { + return 店铺; + } else if (row.publisher == "PLATFORM") { + return 平台; + } + }, }, { title: "类别", align: "center", - field: "name", - }, - { - title: "领取类型", - align: "center", - field: "receiveType", + field: "category", + type: "jsx", + render: ({ row }) => { + if (row.category == "NO_THRESHOLD") { + return 无门槛优惠券; + } else if (row.category == "MAX_OUT") { + return 满减优惠券; + } else if (row.category == "FIRST_ATTENTION") { + return 首次关注优惠券; + } else if (row.category == "BIRTHDAY") { + return 生日券; + } else if (row.category == "PLATFORM") { + return 平台优惠券; + } + }, }, { title: "优惠券类型", align: "center", - field: "name", + field: "couponType", + type: "jsx", + render: ({ row }) => { + if (row.couponType == "MONEY") { + return 满减券; + } else if (row.couponType == "DISCOUNT") { + return 折扣券; + } + }, }, { title: "优惠金额", @@ -247,6 +265,21 @@ export default { align: "center", field: "minPrice", }, + { + title: "限量", + align: "center", + field: "limitedNum", + }, + { + title: "发放总数", + align: "center", + field: "total", + }, + { + title: "剩余数量", + align: "center", + field: "lastTotal", + }, { title: "状态", align: "center", @@ -255,7 +288,7 @@ export default { render: ({ row }) => { if (row.status == 0) { return 关闭; - } else if (row.status == 2) { + } else if (row.status == 1) { return 开启; } }, diff --git a/src/views/modules/coupon/popup/add-or-update.vue b/src/views/modules/coupon/popup/add-or-update.vue index 257f200..48e83f2 100644 --- a/src/views/modules/coupon/popup/add-or-update.vue +++ b/src/views/modules/coupon/popup/add-or-update.vue @@ -29,7 +29,7 @@ > - + { this.modalData = { + category: "NO_THRESHOLD", + receiveType: "MANUAL", + couponType: "MONEY", + isTimeReceive: 1, //0-不限时,1-限时 + name: "", + useStartTime: "", + useEndTime: "", + receiveStartTime: "", + receiveEndTime: "", + money: "", total: 10000, + limitedNum: 0, + minPrice: 0, + usableRange: "PARTIAL_GOODS", //部分商品-PARTIAL_GOODS 所有商品-ALL_GOODS 部分摊位-PARTIAL_SHOP }; this.$refs.modal.resetFields(); }); @@ -231,11 +245,16 @@ export default { type: "primary", handle: () => { console.log(this.modalData); - this.$api.mer_admin.bankCardAdd(this.modalData).then((res) => { - console.log(res); - this.$emit("queryList"); - this.toggle(); - }); + let data = { ...this.modalData }; + data.targetIds = [data.targetIds]; + console.log(this.modalData, data); + this.$api.coupon + .addCoupon({ ...data, ...this.formInline }) + .then((res) => { + console.log(res); + this.$emit("queryList"); + this.toggle(); + }); }, }, ];