|
|
@@ -82,7 +82,7 @@
|
|
|
</template>
|
|
|
|
|
|
<template #slot-modify="{ scope }">
|
|
|
- <el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id,1)" >修改</el-button>
|
|
|
+ <el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id)" >修改</el-button>
|
|
|
<el-button type="text" v-if="scope.row.delStatus==1" @click.native.stop="setStatusFun(scope.row.id,0)" >上架</el-button>
|
|
|
<el-button type="text" v-if="scope.row.delStatus==0" @click.native.stop="setStatusFun(scope.row.id,1)" >下架</el-button>
|
|
|
</template>
|
|
|
@@ -165,6 +165,7 @@
|
|
|
<el-input
|
|
|
v-model="replaceForm.name"
|
|
|
placeholder="请输入名称"
|
|
|
+ @input="fillName($event)"
|
|
|
size="small"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
@@ -175,13 +176,6 @@
|
|
|
size="small"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="别名" prop="alias">
|
|
|
- <el-input
|
|
|
- v-model="replaceForm.alias"
|
|
|
- placeholder="请输入别名"
|
|
|
- size="small"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
|
|
|
<el-form-item label="图片" prop="cover">
|
|
|
<cl-upload v-model="replaceForm.cover" :successFun="uploadSuccess"></cl-upload>
|
|
|
@@ -315,7 +309,6 @@ export default {
|
|
|
replaceForm: {
|
|
|
name: '',
|
|
|
py: '',
|
|
|
- alias: '',
|
|
|
classId: '',
|
|
|
className: '',
|
|
|
cover: '',
|
|
|
@@ -376,9 +369,21 @@ export default {
|
|
|
computed: {
|
|
|
},
|
|
|
mounted() {
|
|
|
-
|
|
|
+ this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
+ //自动填写拼音
|
|
|
+ fillName(event){
|
|
|
+ this.$service.product.py({ name: event }).then(res => {
|
|
|
+ if(res.py){
|
|
|
+ this.replaceForm.py = res.py
|
|
|
+ }
|
|
|
+ }).catch(err => { console.log(err) })
|
|
|
+ },
|
|
|
+ init(){
|
|
|
+ this.getAllClass()
|
|
|
+ this.getAllUnit()
|
|
|
+ },
|
|
|
selectItemFn (currentItem) {
|
|
|
|
|
|
let item = currentItem.list
|
|
|
@@ -747,7 +752,6 @@ export default {
|
|
|
|
|
|
this.dataList.form.data = JSON.stringify(this.initData)
|
|
|
this.$service.product.productBatchUpdate(this.dataList.form).then(res => {
|
|
|
-
|
|
|
|
|
|
if(type == 'price'){
|
|
|
//修改原价需要刷新
|
|
|
@@ -764,26 +768,34 @@ export default {
|
|
|
|
|
|
},
|
|
|
replaceBtnFn(id) {
|
|
|
- this.getAllClass()
|
|
|
- this.getAllUnit()
|
|
|
this.addDialog = true
|
|
|
this.currentItemId = id;
|
|
|
+
|
|
|
if(id==0){
|
|
|
this.replaceFormRules = {};
|
|
|
this.replaceForm = {
|
|
|
name: '',
|
|
|
py: '',
|
|
|
- alias: '',
|
|
|
classId: '',
|
|
|
className: '',
|
|
|
cover: '',
|
|
|
bigUnit: '',
|
|
|
smallUnit: '',
|
|
|
+ bigUnitId: '',
|
|
|
+ smallUnitId: '',
|
|
|
stockWarning:'',
|
|
|
cost:'',
|
|
|
addPrice:'',
|
|
|
weight:'',
|
|
|
};
|
|
|
+
|
|
|
+ //大小单位默认给设置为扎和支
|
|
|
+ this.replaceForm.bigUnitId = this.unitList[0].id;
|
|
|
+ this.replaceForm.bigUnit = this.unitList[0].name;
|
|
|
+ this.replaceForm.smallUnitId = this.unitList[1].id;
|
|
|
+ this.replaceForm.smallUnit = this.unitList[1].name;
|
|
|
+ this.$forceUpdate();
|
|
|
+
|
|
|
}else{
|
|
|
this.replaceFormRules = {
|
|
|
name: {
|
|
|
@@ -843,7 +855,6 @@ export default {
|
|
|
}
|
|
|
let data = this.$refs['xCrud'].table.data;
|
|
|
data.forEach((ele)=>{
|
|
|
-
|
|
|
if(this.dataList.form.type == 'addPrice'){
|
|
|
let batchAddNum = (Number(this.batchAddNum) + Number(ele.addPrice)).toFixed(2)
|
|
|
ele.addPrice = batchAddNum
|
|
|
@@ -859,7 +870,6 @@ export default {
|
|
|
}else{
|
|
|
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
this.dialogFormVisible = false;
|
|
|
},
|
|
|
@@ -870,7 +880,6 @@ export default {
|
|
|
}
|
|
|
let data = this.$refs['xCrud'].table.data;
|
|
|
data.forEach((ele)=>{
|
|
|
-
|
|
|
if(this.dataList.form.type == 'addPrice'){
|
|
|
ele.addPrice = this.batchAlterNum
|
|
|
this.initData.push({id:ele.id,addPrice:this.batchAlterNum})
|
|
|
@@ -883,7 +892,6 @@ export default {
|
|
|
}else{
|
|
|
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
this.dialogFormVisible = false
|
|
|
},
|