Commit 9b2fe1b0 authored by mengwenhao's avatar mengwenhao

fix:商品-更改原价可以为空

parent acdba7f3
......@@ -1144,7 +1144,9 @@ export default {
// 更改售价
salePrice () {
if (!this.goodsObj.price) {
this.goodsObj.price = "";
this.$nextTick(() => {
this.goodsObj.price = "";
})
}
const parseFloatValue = Number(this.goodsObj.price).toFixed(2);
this.goodsObj.price = Number(parseFloatValue);
......@@ -1152,7 +1154,7 @@ export default {
typeof this.goodsObj.price === "number" &&
isNaN(this.goodsObj.price)
) {
this.goodsObj.price = 0;
this.goodsObj.price = "";
return this.$message.error("售价价格必须为数字");
}
},
......@@ -1160,7 +1162,9 @@ export default {
// 更改原价
perPrice () {
if (!this.goodsObj.original_price) {
this.goodsObj.original_price = "";
this.$nextTick(() => {
this.goodsObj.original_price = "";
})
}
const parseOriginalPrice = Number(this.goodsObj.original_price).toFixed(
2
......@@ -1170,7 +1174,7 @@ export default {
typeof this.goodsObj.original_price === "number" &&
isNaN(this.goodsObj.original_price)
) {
this.goodsObj.original_price = 0;
this.goodsObj.original_price = "";
return this.$message.error("原价价格必为数字");
}
},
......@@ -1266,10 +1270,7 @@ export default {
if (!query.rule_refund) {
return this.$message.error("请填写退款规则");
}
if (query.original_price.length === 0) {
return this.$message.error("请填写原价(保留两位小数)");
}
if (query.original_price == 0) {
if (query.original_price === "0") {
return this.$message.error("原价价格不得为0");
}
if (query.price.length === 0) {
......@@ -1278,7 +1279,7 @@ export default {
if (query.price == 0) {
return this.$message.error("售价价格不得为0");
}
if (typeof query.original_price !== "number") {
if (query.original_price && typeof query.original_price !== "number") {
return this.$message.error("原价价格必须为数字");
}
if (typeof query.price !== "number") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment