优化砍价逻辑,以及修改劵活动Bug

master
lemon橪 2021-10-12 18:06:52 +08:00
parent e80316d43d
commit 6fa3fa7822
3 changed files with 11 additions and 38 deletions

View File

@ -221,6 +221,7 @@ export default {
if (res.success) { if (res.success) {
this.$Message.success("优惠券活动已停止"); this.$Message.success("优惠券活动已停止");
this.getDataList(); this.getDataList();
this.$Modal.remove()
} }
}).catch(() => {}); }).catch(() => {});
}, },

View File

@ -19,22 +19,18 @@
</template> </template>
<template slot-scope="{ index }" slot="settlementPrice"> <template slot-scope="{ index }" slot="settlementPrice">
<Input type="number" v-model="form.promotionGoodsList[index].settlementPrice" /> <InputNumber :min="0" v-model="form.promotionGoodsList[index].settlementPrice" />
</template> </template>
<template slot-scope="{ index }" slot="lowestPrice"> <template slot-scope="{ index }" slot="lowestPrice">
<Input type="number" v-model="form.promotionGoodsList[index].lowestPrice" /> <InputNumber :min="0" v-model="form.promotionGoodsList[index].lowestPrice" />
</template> </template>
<template slot-scope="{ index }" slot="highestPrice"> <template slot-scope="{ index }" slot="highestPrice">
<Input type="number" v-model="form.promotionGoodsList[index].highestPrice" /> <InputNumber :min="0" v-model="form.promotionGoodsList[index].highestPrice" />
</template> </template>
<template slot-scope="{ index }" slot="purchasePrice">
<Input type="number" v-model="form.promotionGoodsList[index].purchasePrice" />
</template>
<template slot-scope="{ index }" slot="stock"> <template slot-scope="{ index }" slot="stock">
<Input type="number" v-model="form.promotionGoodsList[index].stock" /> <InputNumber :min="0" v-model="form.promotionGoodsList[index].stock" />
</template> </template>
</Table> </Table>
</FormItem> </FormItem>
@ -122,12 +118,6 @@ export default {
slot: "highestPrice", slot: "highestPrice",
width: 110, width: 110,
}, },
{
title: "最低购买金额",
slot: "purchasePrice",
width: 110,
},
{ {
title: "活动库存", title: "活动库存",
slot: "stock", slot: "stock",
@ -209,11 +199,7 @@ export default {
this.$Message.error("活动库存不能为0且不能超过商品库存"); this.$Message.error("活动库存不能为0且不能超过商品库存");
return; return;
} }
//
if (!regular.money.test(res.purchasePrice)) {
checkResult = false;
this.$Message.error("最低购买金额格式不正确");
}
// //
if (!regular.money.test(res.settlementPrice)) { if (!regular.money.test(res.settlementPrice)) {
checkResult = false; checkResult = false;
@ -324,7 +310,7 @@ export default {
item.forEach((e) => { item.forEach((e) => {
list.push({ list.push({
settlementPrice: e.settlementPrice || 0, settlementPrice: e.settlementPrice || 0,
purchasePrice: e.purchasePrice || 0, purchasePrice: 0,
lowestPrice: e.lowestPrice || 0, lowestPrice: e.lowestPrice || 0,
highestPrice: e.highestPrice || 0, highestPrice: e.highestPrice || 0,
stock: e.stock || 0, stock: e.stock || 0,

View File

@ -30,16 +30,7 @@
style="width: 260px" style="width: 260px"
/> />
</FormItem> </FormItem>
<FormItem label="最低购买金额" prop="purchasePrice">
<Input
:disabled="onlyView"
type="number"
v-model="form.purchasePrice"
placeholder="请填写最低购买金额"
clearable
style="width: 260px"
/>
</FormItem>
<FormItem label="最低可砍" prop="lowestPrice"> <FormItem label="最低可砍" prop="lowestPrice">
<Input <Input
:disabled="onlyView" :disabled="onlyView"
@ -156,6 +147,7 @@
return { return {
modalType: 0, // modalType: 0, //
form: { form: {
purchasePrice:0,
goodsSku: {}, goodsSku: {},
}, },
id: this.$route.query.id, // id id: this.$route.query.id, // id
@ -166,10 +158,7 @@
{required: true, message: "请输入结算金额"}, {required: true, message: "请输入结算金额"},
{validator: checkSettlementPrice}, {validator: checkSettlementPrice},
], ],
purchasePrice: [
{required: true, message: "请输入最低购买金额"},
{validator: checkPurchasePrice},
],
lowestPrice: [ lowestPrice: [
{required: true, message: "请输入最低可砍金额"}, {required: true, message: "请输入最低可砍金额"},
{validator: checkLowestPrice}, {validator: checkLowestPrice},
@ -227,10 +216,7 @@
this.$Message.error("活动库存不能为0且不能超过商品库存"); this.$Message.error("活动库存不能为0且不能超过商品库存");
return return
} }
//
if (!regular.money.test(params.purchasePrice)) {
this.$Message.error("最低购买金额格式不正确");
}
// //
if (!regular.money.test(params.settlementPrice)) { if (!regular.money.test(params.settlementPrice)) {
this.$Message.error("结算价格金额格式不正确"); this.$Message.error("结算价格金额格式不正确");