优化商品编辑
This commit is contained in:
@@ -91,38 +91,48 @@
|
|||||||
<el-table :data="form.skuList" border>
|
<el-table :data="form.skuList" border>
|
||||||
<el-table-column label="售价" prop="salePrice">
|
<el-table-column label="售价" prop="salePrice">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'salePrice')" @blur="priceFormat(scope.row,'salePrice')" v-model="scope.row.salePrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'salePrice')" @blur="priceFormat(scope.row, 'salePrice')"
|
||||||
|
v-model="scope.row.salePrice" controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="会员价" prop="memberPrice">
|
<el-table-column label="会员价" prop="memberPrice">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'memberPrice')" @blur="priceFormat(scope.row,'memberPrice')" v-model="scope.row.memberPrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'memberPrice')"
|
||||||
|
@blur="priceFormat(scope.row, 'memberPrice')" v-model="scope.row.memberPrice"
|
||||||
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="成本价" prop="costPrice">
|
<el-table-column label="成本价" prop="costPrice">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'costPrice')" @blur="priceFormat(scope.row,'costPrice')" v-model="scope.row.costPrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'costPrice')" @blur="priceFormat(scope.row, 'costPrice')"
|
||||||
|
v-model="scope.row.costPrice" controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="原价" prop="originPrice">
|
<el-table-column label="原价" prop="originPrice">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'originPrice')" @blur="priceFormat(scope.row,'originPrice')" v-model="scope.row.originPrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'originPrice')"
|
||||||
|
@blur="priceFormat(scope.row, 'originPrice')" v-model="scope.row.originPrice"
|
||||||
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="起售数量" prop="suit">
|
<el-table-column label="起售数量" prop="suit">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'suit')" @blur="priceFormat(scope.row,'suit')" v-model="scope.row.suit" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'suit')" @blur="priceFormat(scope.row, 'suit')"
|
||||||
|
v-model="scope.row.suit" controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="库存数量" prop="stockNumber">
|
<el-table-column label="库存数量" prop="stockNumber">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'stockNumber')" @blur="priceFormat(scope.row,'stockNumber')" v-model="scope.row.stockNumber" :disabled="!!form.id"
|
<el-input-number @change="priceFormat(scope.row, 'stockNumber')"
|
||||||
|
@blur="priceFormat(scope.row, 'stockNumber')" v-model="scope.row.stockNumber" :disabled="!!form.id"
|
||||||
controls-position="right"></el-input-number>
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="分销金额" prop="firstShared">
|
<el-table-column label="分销金额" prop="firstShared">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'firstShared')" @blur="priceFormat(scope.row,'firstShared')" v-model="scope.row.firstShared" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'firstShared')"
|
||||||
|
@blur="priceFormat(scope.row, 'firstShared')" v-model="scope.row.firstShared"
|
||||||
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品条码">
|
<el-table-column label="商品条码">
|
||||||
@@ -203,7 +213,8 @@
|
|||||||
<i class="icon el-icon-edit" @click="batchNumber('salePrice')"></i>
|
<i class="icon el-icon-edit" @click="batchNumber('salePrice')"></i>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'salePrice')" @blur="priceFormat(scope.row,'salePrice')" v-model="scope.row.salePrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'salePrice')" @blur="priceFormat(scope.row, 'salePrice')"
|
||||||
|
v-model="scope.row.salePrice" controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="会员价" prop="memberPrice">
|
<el-table-column label="会员价" prop="memberPrice">
|
||||||
@@ -212,7 +223,9 @@
|
|||||||
<i class="icon el-icon-edit" @click="batchNumber('memberPrice')"></i>
|
<i class="icon el-icon-edit" @click="batchNumber('memberPrice')"></i>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'memberPrice')" @blur="priceFormat(scope.row,'memberPrice')" v-model="scope.row.memberPrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'memberPrice')"
|
||||||
|
@blur="priceFormat(scope.row, 'memberPrice')" v-model="scope.row.memberPrice"
|
||||||
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="成本价" prop="costPrice">
|
<el-table-column label="成本价" prop="costPrice">
|
||||||
@@ -221,7 +234,8 @@
|
|||||||
<i class="icon el-icon-edit" @click="batchNumber('costPrice')"></i>
|
<i class="icon el-icon-edit" @click="batchNumber('costPrice')"></i>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'costPrice')" @blur="priceFormat(scope.row,'costPrice')" v-model="scope.row.costPrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'costPrice')" @blur="priceFormat(scope.row, 'costPrice')"
|
||||||
|
v-model="scope.row.costPrice" controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="原价" prop="originPrice">
|
<el-table-column label="原价" prop="originPrice">
|
||||||
@@ -230,7 +244,9 @@
|
|||||||
<i class="icon el-icon-edit" @click="batchNumber('originPrice')"></i>
|
<i class="icon el-icon-edit" @click="batchNumber('originPrice')"></i>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'originPrice')" @blur="priceFormat(scope.row,'originPrice')" v-model="scope.row.originPrice" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'originPrice')"
|
||||||
|
@blur="priceFormat(scope.row, 'originPrice')" v-model="scope.row.originPrice"
|
||||||
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="起售数量" prop="suit">
|
<el-table-column label="起售数量" prop="suit">
|
||||||
@@ -239,7 +255,8 @@
|
|||||||
<i class="icon el-icon-edit" @click="batchNumber('suit')"></i>
|
<i class="icon el-icon-edit" @click="batchNumber('suit')"></i>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'originsuitrice')" @blur="priceFormat(scope.row,'suit')" v-model="scope.row.suit" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'originsuitrice')" @blur="priceFormat(scope.row, 'suit')"
|
||||||
|
v-model="scope.row.suit" controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="库存数量" prop="stockNumber">
|
<el-table-column label="库存数量" prop="stockNumber">
|
||||||
@@ -248,7 +265,8 @@
|
|||||||
<i class="icon el-icon-edit" @click="batchNumber('stockNumber')" v-if="!form.id"></i>
|
<i class="icon el-icon-edit" @click="batchNumber('stockNumber')" v-if="!form.id"></i>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'stockNumber')" @blur="priceFormat(scope.row,'stockNumber')" v-model="scope.row.stockNumber" :disabled="!!scope.row.id"
|
<el-input-number @change="priceFormat(scope.row, 'stockNumber')"
|
||||||
|
@blur="priceFormat(scope.row, 'stockNumber')" v-model="scope.row.stockNumber" :disabled="!!scope.row.id"
|
||||||
controls-position="right"></el-input-number>
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -258,7 +276,9 @@
|
|||||||
<i class="icon el-icon-edit" @click="batchNumber('firstShared')"></i>
|
<i class="icon el-icon-edit" @click="batchNumber('firstShared')"></i>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number @change="priceFormat(scope.row,'firstShared')" @blur="priceFormat(scope.row,'firstShared')" v-model="scope.row.firstShared" controls-position="right"></el-input-number>
|
<el-input-number @change="priceFormat(scope.row, 'firstShared')"
|
||||||
|
@blur="priceFormat(scope.row, 'firstShared')" v-model="scope.row.firstShared"
|
||||||
|
controls-position="right"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品条码">
|
<el-table-column label="商品条码">
|
||||||
@@ -306,13 +326,15 @@
|
|||||||
<div class="tips">开启后: 收银完成后会自动打印对应数量的标签数</div>
|
<div class="tips">开启后: 收银完成后会自动打印对应数量的标签数</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="打包费">
|
<el-form-item label="打包费">
|
||||||
<el-input-number @change="priceFormat(form,'packFee')" @blur="priceFormat(form,'packFee')" v-model="form.packFee" controls-position="right" ></el-input-number>
|
<el-input-number @change="priceFormat(form, 'packFee')" @blur="priceFormat(form, 'packFee')"
|
||||||
|
v-model="form.packFee" controls-position="right"></el-input-number>
|
||||||
<div class="tips">
|
<div class="tips">
|
||||||
单份商品打包费。注:店铺开启外卖模式下该数据才生效
|
单份商品打包费。注:店铺开启外卖模式下该数据才生效
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="虚拟销量">
|
<el-form-item label="虚拟销量">
|
||||||
<el-input-number @change="priceFormat(form,'baseSalesNumber')" @blur="priceFormat(form,'baseSalesNumber')" v-model="form.baseSalesNumber" controls-position="right" ></el-input-number>
|
<el-input-number @change="priceFormat(form, 'baseSalesNumber')" @blur="priceFormat(form, 'baseSalesNumber')"
|
||||||
|
v-model="form.baseSalesNumber" controls-position="right"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<el-form-item label="排序" v-if="form.id">
|
<el-form-item label="排序" v-if="form.id">
|
||||||
@@ -326,8 +348,9 @@
|
|||||||
<el-dialog title="批量修改" width="400px" :visible.sync="showBatchModal">
|
<el-dialog title="批量修改" width="400px" :visible.sync="showBatchModal">
|
||||||
<el-form :model="batchNumberForm">
|
<el-form :model="batchNumberForm">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input-number @change="priceFormat(batchNumberForm,'batchNumber')" @blur="priceFormat(batchNumberForm,'batchNumber')" v-model="batchNumberForm.batchNumber" controls-position="right"
|
<el-input-number @change="priceFormat(batchNumberForm, 'batchNumber')"
|
||||||
style="width: 100%;"></el-input-number>
|
@blur="priceFormat(batchNumberForm, 'batchNumber')" v-model="batchNumberForm.batchNumber"
|
||||||
|
controls-position="right" style="width: 100%;"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
@@ -395,6 +418,9 @@ export default {
|
|||||||
stockNumber: 0,
|
stockNumber: 0,
|
||||||
firstShared: 0,
|
firstShared: 0,
|
||||||
barCode: `${localStorage.getItem("shopId")}${dayjs().valueOf()}`,
|
barCode: `${localStorage.getItem("shopId")}${dayjs().valueOf()}`,
|
||||||
|
isGrounding: 1,
|
||||||
|
productId: this.$route.query.goods_id,
|
||||||
|
shopId: localStorage.getItem("shopId")
|
||||||
// suit: 1
|
// suit: 1
|
||||||
},
|
},
|
||||||
tableAddShopIndex: null,
|
tableAddShopIndex: null,
|
||||||
@@ -405,7 +431,7 @@ export default {
|
|||||||
id: "",
|
id: "",
|
||||||
typeEnum: "normal",
|
typeEnum: "normal",
|
||||||
name: "",
|
name: "",
|
||||||
shortTitle:"",//商品介绍
|
shortTitle: "",//商品介绍
|
||||||
unitId: "",
|
unitId: "",
|
||||||
unitName: "",
|
unitName: "",
|
||||||
categoryId: "", // 商品分类id
|
categoryId: "", // 商品分类id
|
||||||
@@ -521,24 +547,23 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
priceFormat(item, key) {
|
||||||
priceFormat(item,key){
|
const messageheight = 48;
|
||||||
const messageheight=48;
|
const offset = window.innerHeight / 2 - (messageheight / 2) - 100
|
||||||
const offset=window.innerHeight/2-(messageheight/2) -100
|
this.$nextTick(() => {
|
||||||
this.$nextTick(()=>{
|
const min = 0;
|
||||||
const min=0;
|
const max = 100000000;
|
||||||
const max=100000000;
|
const newval = formatPrice(item[key], min, max, true)
|
||||||
const newval=formatPrice(item[key],min,max,true)
|
|
||||||
console.log(newval)
|
console.log(newval)
|
||||||
if(typeof newval!=='number'){
|
if (typeof newval !== 'number') {
|
||||||
item[key]=newval.value
|
item[key] = newval.value
|
||||||
this.$message({
|
this.$message({
|
||||||
offset,
|
offset,
|
||||||
message: `请输入${min}到${max}范围内的数字`,
|
message: `请输入${min}到${max}范围内的数字`,
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
item[key]=newval
|
item[key] = newval
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -568,12 +593,12 @@ export default {
|
|||||||
// 确认批量修改规格
|
// 确认批量修改规格
|
||||||
batchNumberFormConfirm() {
|
batchNumberFormConfirm() {
|
||||||
console.log(this.form.skuList)
|
console.log(this.form.skuList)
|
||||||
this.form.skuList.map((item,index) => {
|
this.form.skuList.map((item, index) => {
|
||||||
//解决vue2列表数据更新视图未变化问题
|
//解决vue2列表数据更新视图未变化问题
|
||||||
let newitem = {...item}
|
let newitem = { ...item }
|
||||||
newitem[this.batchNumberKey] = this.batchNumberForm.batchNumber;
|
newitem[this.batchNumberKey] = this.batchNumberForm.batchNumber;
|
||||||
|
|
||||||
this.$set( this.form.skuList, index, {...newitem})
|
this.$set(this.form.skuList, index, { ...newitem })
|
||||||
// item[this.batchNumberKey] = this.batchNumberForm.batchNumber;
|
// item[this.batchNumberKey] = this.batchNumberForm.batchNumber;
|
||||||
});
|
});
|
||||||
this.showBatchModal = false;
|
this.showBatchModal = false;
|
||||||
@@ -606,11 +631,12 @@ export default {
|
|||||||
this.form.skuList = skuList.map((item, index) => {
|
this.form.skuList = skuList.map((item, index) => {
|
||||||
specInfo[index].id = item.id;
|
specInfo[index].id = item.id;
|
||||||
specInfo[index].productId = item.productId;
|
specInfo[index].productId = item.productId;
|
||||||
specInfo[index].realSalesNumber = item.productId;
|
specInfo[index].realSalesNumber = item.realSalesNumber;
|
||||||
specInfo[index].shopId = item.shopId;
|
specInfo[index].shopId = item.shopId;
|
||||||
specInfo[index].warnLine = item.warnLine;
|
specInfo[index].warnLine = item.warnLine;
|
||||||
specInfo[index].suit = item.suit;
|
specInfo[index].suit = item.suit;
|
||||||
specInfo[index].stockNumber = item.stockNumber;
|
specInfo[index].stockNumber = item.stockNumber;
|
||||||
|
specInfo[index].isGrounding = item.isGrounding;
|
||||||
return specInfo[index];
|
return specInfo[index];
|
||||||
});
|
});
|
||||||
console.log(this.form.skuList);
|
console.log(this.form.skuList);
|
||||||
|
|||||||
Reference in New Issue
Block a user