Commit ba3a0cf5 authored by liwenhong's avatar liwenhong

add:库存+去掉图片素材入口

parent 22738111
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
<el-button class="addCommodityBtn" @click="commodity('add', '')" <el-button class="addCommodityBtn" @click="commodity('add', '')"
>添加商品</el-button >添加商品</el-button
> >
<el-button class="commodLibraryAdd" @click="commodLibraryAdd" <!-- <el-button class="commodLibraryAdd" @click="commodLibraryAdd"
>从商品库添加</el-button >从商品库添加</el-button
> > -->
</div> </div>
<!-- Tab --> <!-- Tab -->
<el-table :data="comTableData" border style="width: 100%"> <el-table :data="comTableData" border style="width: 100%">
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
></el-input-number> ></el-input-number>
</el-form-item> </el-form-item>
<br /> <br />
<el-form-item label="新增库存:"> <el-form-item label="库存:">
<el-input <el-input
v-model="commodityForm.inventory_total" v-model="commodityForm.inventory_total"
placeholder="" placeholder=""
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
已售:<span style="margin-right: 10px">{{ 已售:<span style="margin-right: 10px">{{
commodityForm.total_amount_sold commodityForm.total_amount_sold
}}</span> }}</span>
剩余库存:<span>{{ inventoryRest }}</span> 剩余库存:<span>{{ commodityForm.inventory_total }}</span>
</div> </div>
<br /> <br />
<el-form-item <el-form-item
...@@ -297,6 +297,7 @@ export default { ...@@ -297,6 +297,7 @@ export default {
inventoryTotal: 0, // 总库存 inventoryTotal: 0, // 总库存
inventoryRest: 0, // 剩余库存 inventoryRest: 0, // 剩余库存
inventory: 0, // 添加库存
}; };
}, },
// computed: { // computed: {
...@@ -337,6 +338,7 @@ export default { ...@@ -337,6 +338,7 @@ export default {
// 库存计算 // 库存计算
inventoryIpt(val) { inventoryIpt(val) {
if(val < 0) return this.commodityForm.inventory_total = 0;
var pattern = /^-?[1-9]\d*$|^0$/g; var pattern = /^-?[1-9]\d*$|^0$/g;
if (!pattern.test(this.commodityForm.inventory_total)) { if (!pattern.test(this.commodityForm.inventory_total)) {
this.commodityForm.inventory_total = ""; this.commodityForm.inventory_total = "";
...@@ -395,6 +397,7 @@ export default { ...@@ -395,6 +397,7 @@ export default {
const res = await markGoodsInfo(params); const res = await markGoodsInfo(params);
this.inventoryRest = res.result.goods_info.inventory_rest; this.inventoryRest = res.result.goods_info.inventory_rest;
this.inventoryTotal = res.result.goods_info.inventory_total; this.inventoryTotal = res.result.goods_info.inventory_total;
this.inventory = res.result.goods_info.inventory_total;
this.commodityForm = res.result.goods_info; this.commodityForm = res.result.goods_info;
this.commodityForm.business1 = res.result.goods_info.ota_id; this.commodityForm.business1 = res.result.goods_info.ota_id;
this.picUrlList = []; this.picUrlList = [];
...@@ -421,7 +424,7 @@ export default { ...@@ -421,7 +424,7 @@ export default {
goods_name: this.commodityForm.goods_name, goods_name: this.commodityForm.goods_name,
desc_pic_url: this.picStr, desc_pic_url: this.picStr,
desc: "", desc: "",
inventory_add: this.commodityForm.inventory_total, inventory_add: this.commodityForm.inventory_total - this.inventory,
original_price: this.commodityForm.original_price, original_price: this.commodityForm.original_price,
price: this.commodityForm.price, price: this.commodityForm.price,
marketing_name: this.editInfo.marketing_name, marketing_name: this.editInfo.marketing_name,
...@@ -489,7 +492,7 @@ export default { ...@@ -489,7 +492,7 @@ export default {
goods_name: this.commodityForm.goods_name, goods_name: this.commodityForm.goods_name,
desc_pic_url: this.picStr, desc_pic_url: this.picStr,
desc: "", desc: "",
inventory: this.commodityForm.inventory_total, inventory: this.commodityForm.inventory_total - this.inventory,
original_price: this.commodityForm.original_price, original_price: this.commodityForm.original_price,
marketing_type: "4", marketing_type: "4",
price: this.commodityForm.price, price: this.commodityForm.price,
......
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