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