优惠卷更改

This commit is contained in:
余同学 2024-11-26 18:03:52 +08:00
parent 99b9851d55
commit 6b95aed059
3 changed files with 85 additions and 29 deletions

View File

@ -9,4 +9,8 @@ export const coupon = {
params: data,
});
},
//添加优惠卷
addCoupon: (data) => {
return $http.post(`/merchant-api/coupon/save`, data);
},
};

View File

@ -147,9 +147,7 @@ export default {
});
},
addProduct(row) {
this.$refs.addOrUpdate
.toggle()
.add({
this.$refs.addOrUpdate.toggle().add({
...row,
marketId: this.formInline.marketId,
shopId: this.formInline.shopId,
@ -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 <span>店铺</span>;
} else if (row.publisher == "PLATFORM") {
return <span>平台</span>;
}
},
},
{
title: "类别",
align: "center",
field: "name",
field: "category",
type: "jsx",
render: ({ row }) => {
if (row.category == "NO_THRESHOLD") {
return <span>无门槛优惠券</span>;
} else if (row.category == "MAX_OUT") {
return <span>满减优惠券</span>;
} else if (row.category == "FIRST_ATTENTION") {
return <span>首次关注优惠券</span>;
} else if (row.category == "BIRTHDAY") {
return <span>生日券</span>;
} else if (row.category == "PLATFORM") {
return <span>平台优惠券</span>;
}
},
{
title: "领取类型",
align: "center",
field: "receiveType",
},
{
title: "优惠券类型",
align: "center",
field: "name",
field: "couponType",
type: "jsx",
render: ({ row }) => {
if (row.couponType == "MONEY") {
return <span>满减券</span>;
} else if (row.couponType == "DISCOUNT") {
return <span>折扣券</span>;
}
},
},
{
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 <span>关闭</span>;
} else if (row.status == 2) {
} else if (row.status == 1) {
return <span>开启</span>;
}
},

View File

@ -29,7 +29,7 @@
>
</el-date-picker>
</el-form-item>
<el-form-item label-width="150px" label="开领取日期" prop="name">
<el-form-item label-width="150px" label="开领取日期" prop="name">
<el-date-picker
@change="collectionDateChange"
v-model="collectionDate"
@ -92,7 +92,7 @@
<el-option
v-for="item in [
{
label: '',
label: '限',
value: 0,
},
{
@ -134,6 +134,7 @@
import commodity from "./commodity.vue";
import { debounce, cloneDeep } from "lodash";
import { Divider } from "element-ui";
import loginVue from "../../../common/login.vue";
export default {
components: { commodity },
data() {
@ -175,7 +176,20 @@ export default {
this.modalConfig.title = `添加${row.label}`;
this.$nextTick(() => {
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,7 +245,12 @@ export default {
type: "primary",
handle: () => {
console.log(this.modalData);
this.$api.mer_admin.bankCardAdd(this.modalData).then((res) => {
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();