拉取DEV代码

This commit is contained in:
duan
2024-08-01 15:50:15 +08:00
14 changed files with 954 additions and 139 deletions

View File

@@ -16,6 +16,9 @@
<el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入商品名称" style="width: 500px;"></el-input>
</el-form-item>
<el-form-item label="商品介绍" prop="shortTitle">
<el-input v-model="form.shortTitle" type="textarea" placeholder="请输入商品介绍" style="width: 500px;"></el-input>
</el-form-item>
<el-form-item label="单位" prop="unitId">
<el-select v-model="form.unitId" placeholder="请选择单位" style="width: 500px;" @change="selectUnitt">
<el-option :label="item.name" :value="item.id" v-for="item in units" :key="item.id"></el-option>
@@ -89,38 +92,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="商品条码">
@@ -201,7 +214,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">
@@ -210,7 +224,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">
@@ -219,7 +235,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">
@@ -228,7 +245,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">
@@ -237,7 +256,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">
@@ -246,7 +266,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>
@@ -256,7 +277,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="商品条码">
@@ -304,13 +327,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">
@@ -324,8 +349,9 @@
<el-dialog title="批量修改" width="400px" :visible.sync="showBatchModal">
<el-form :model="batchNumberForm">
<el-form-item>
<el-input-number v-model="batchNumberForm.batchNumber" :min="0" 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">
@@ -396,6 +422,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,
@@ -406,6 +435,7 @@ export default {
id: "",
typeEnum: "normal",
name: "",
shortTitle: "",//商品介绍
unitId: "",
unitName: "",
categoryId: "", // 商品分类id
@@ -535,15 +565,15 @@ export default {
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
}
})
},
@@ -572,8 +602,14 @@ export default {
},
// 确认批量修改规格
batchNumberFormConfirm() {
this.form.skuList.map(item => {
item[this.batchNumberKey] = this.batchNumberForm.batchNumber;
console.log(this.form.skuList)
this.form.skuList.map((item, index) => {
//解决vue2列表数据更新视图未变化问题
let newitem = { ...item }
newitem[this.batchNumberKey] = this.batchNumberForm.batchNumber;
this.$set(this.form.skuList, index, { ...newitem })
// item[this.batchNumberKey] = this.batchNumberForm.batchNumber;
});
this.showBatchModal = false;
this.batchNumberForm.batchNumber = 0;
@@ -605,11 +641,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);