Commit d2d11b53 authored by liwenhong's avatar liwenhong

Merge branch 'release-activity'

# Conflicts:
#	src/pages/Activity/releaseProduc/components/addProduc.vue
parents ad03eeb0 68962cf3
...@@ -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 <el-table
...@@ -138,7 +138,11 @@ ...@@ -138,7 +138,11 @@
></el-input-number> ></el-input-number>
</el-form-item> </el-form-item>
<br /> <br />
<el-form-item label="新增库存:" prop="inventory_total"> <el-form-item
label="库存:"
prop="inventory_total"
:rules="[{ required: true, message: '请输入库存' }]"
>
<el-input <el-input
v-model="commodityForm.inventory_total" v-model="commodityForm.inventory_total"
placeholder="" placeholder=""
...@@ -150,7 +154,7 @@ ...@@ -150,7 +154,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>
<el-form-item <el-form-item
prop="checkedRadio" prop="checkedRadio"
...@@ -376,7 +380,8 @@ var addProduct = { ...@@ -376,7 +380,8 @@ var addProduct = {
goodsSkuID: "", goodsSkuID: "",
inventoryTotal: 0, // 总库存 inventoryTotal: 0, // 总库存
inventoryRest: 0 // 剩余库存 inventoryRest: 0, // 剩余库存
inventory: 0, // 添加库存
}; };
}, },
methods: { methods: {
...@@ -410,6 +415,7 @@ var addProduct = { ...@@ -410,6 +415,7 @@ var addProduct = {
// 库存计算 // 库存计算
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 = "";
...@@ -468,6 +474,7 @@ var addProduct = { ...@@ -468,6 +474,7 @@ var addProduct = {
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.num_limit = this.commodityForm.num_limit =
res.result.goods_info.rule_limit === 0 res.result.goods_info.rule_limit === 0
...@@ -503,7 +510,7 @@ var addProduct = { ...@@ -503,7 +510,7 @@ var addProduct = {
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,
...@@ -584,7 +591,7 @@ var addProduct = { ...@@ -584,7 +591,7 @@ var addProduct = {
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