Commit acb0f866 authored by mengwenhao's avatar mengwenhao

fix:修改商品剩余库存字段信息

parent ae14574e
......@@ -390,12 +390,12 @@
v-if="$route.params.operation === 'EDIT'"
v-model="inventoryAdd"
@change="hasNumberChange"
@blur="hasNumberChange"
:precision="0"
></el-input-number>
<span v-else>{{ goodsObj.inventory_rest }}</span>
</el-form-item>
<el-form-item label="已下单量:">
<span>{{ goodsObj.total_amount_sold }}</span>
<span>{{ goodsObj.total_amount_order }}</span>
</el-form-item>
<el-form-item label="已卖出总数:">
<span>{{ goodsObj.total_amount_sold }}</span>
......@@ -647,7 +647,7 @@ export default {
}
},
mounted () {
created () {
this.getOptions();
this.getGoodsDetailList(this.$route.params.spuId);
},
......@@ -686,7 +686,7 @@ export default {
if (!val) {
this.rejectReason.reason = "";
}
}
},
},
data () {
......@@ -723,6 +723,7 @@ export default {
introduceUploadList: [], // 上传详情图片列表
inventoryNumber: 0, // 库存数量
isAllowStockChange: true, // 是否允许更改库存
// 使用规则表单
rulesForm: {
......@@ -1059,13 +1060,14 @@ export default {
this.inventoryAdd = 0;
});
}
if (this.inventoryAdd + this.goodsObj.inventory_rest < 0) {
if (this.inventoryAdd + this.goodsObj.inventory_rest < 1) {
this.$nextTick(() => {
this.inventoryAdd = 0;
this.isAllowStockChange = false;
});
this.$message.error("库存增减不得超出剩余库存范围");
return this.$message.error("剩余库存量不得小于1");
} else {
this.isAllowStockChange = true;
}
console.log(this.inventoryAdd);
},
// 单人可购买上限的修改
......@@ -1242,6 +1244,12 @@ export default {
if (!this.isGoodsNameRepeat) {
return this.$message.error("商品名称被占用,请重新更换商品名称");
}
console.log(this.isAllowStockChange);
if (!this.isAllowStockChange) {
return this.$message.error("剩余库存量不得小于1");
}
if (!query.expiration_time) {
return this.$message.error("过期时间未填写,请填写后再提交");
}
......
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