|
|
@@ -98,6 +98,75 @@
|
|
|
label-width="100px"
|
|
|
class="demo-form"
|
|
|
>
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="replaceForm.name"
|
|
|
+ placeholder="请输入名称"
|
|
|
+ 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" :success="uploadSuccess"></cl-upload>
|
|
|
+ <p style="font-size: 14px; color: #cccccc">建议上传图片比例 400X400</p>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="分类" prop="classId">
|
|
|
+ <el-select
|
|
|
+ v-model="replaceForm.className"
|
|
|
+ size="small"
|
|
|
+ placeholder="请选择分类"
|
|
|
+ @change="selClassFn"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in itemClassList"
|
|
|
+ :key="index"
|
|
|
+ :value="item.name"
|
|
|
+ >{{ item.name }}</el-option
|
|
|
+ >
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="库存预警" prop="stockWarning">
|
|
|
+ <el-input
|
|
|
+ v-model="replaceForm.stockWarning"
|
|
|
+ placeholder="请输入数值"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="每扎重量" prop="weight">
|
|
|
+ <el-input
|
|
|
+ v-model="replaceForm.weight"
|
|
|
+ placeholder="请输入斤数"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="每扎成本价" prop="cost">
|
|
|
+ <el-input
|
|
|
+ v-model="replaceForm.cost"
|
|
|
+ placeholder="请输入成本价"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="每扎加价" prop="addPrice">
|
|
|
+ <el-input
|
|
|
+ v-model="replaceForm.addPrice"
|
|
|
+ placeholder="请输入加价"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
@@ -151,15 +220,12 @@ export default {
|
|
|
classId: '',
|
|
|
className: '',
|
|
|
cover: '',
|
|
|
- bigUnitId: '',
|
|
|
- bigUnit: '',
|
|
|
smallUnitId: '',
|
|
|
smallUnit: '',
|
|
|
stockWarning:'',
|
|
|
cost:'',
|
|
|
addPrice:'',
|
|
|
weight:'',
|
|
|
- ratio:''
|
|
|
},
|
|
|
replaceFormRules: {
|
|
|
name: {
|
|
|
@@ -174,18 +240,6 @@ export default {
|
|
|
required: true,
|
|
|
message: '请选择分类',
|
|
|
},
|
|
|
- bigUnitId: {
|
|
|
- required: true,
|
|
|
- message: '请选择大单位',
|
|
|
- },
|
|
|
- smallUnitId: {
|
|
|
- required: true,
|
|
|
- message: '请选择小单位',
|
|
|
- },
|
|
|
- ratio: {
|
|
|
- required: true,
|
|
|
- message: '比例不能为空',
|
|
|
- },
|
|
|
stockWarning: {
|
|
|
required: true,
|
|
|
message: '最低库存不能为空',
|
|
|
@@ -203,9 +257,13 @@ export default {
|
|
|
message: '重量不能为空',
|
|
|
}
|
|
|
},
|
|
|
+ itemClassList: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
showCost() {
|
|
|
@@ -238,15 +296,35 @@ export default {
|
|
|
this.$router.go(0)
|
|
|
}).catch(err => { console.log(err) })
|
|
|
},
|
|
|
+ getAllClass() {
|
|
|
+ if (!this.$util.isEmpty(this.itemClassList)) {
|
|
|
+ return this.itemClassList;
|
|
|
+ }
|
|
|
+ this.$service.itemClass.list().then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ this.itemClassList = res.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
addFn () {
|
|
|
this.showItemModal = true
|
|
|
},
|
|
|
+ uploadSuccess() {},
|
|
|
+ selClassFn(val) {
|
|
|
+ let index = this.itemClassList.findIndex((e) => e.name == val);
|
|
|
+ this.replaceForm.classId = this.itemClassList[index].id;
|
|
|
+ },
|
|
|
resetForm() {
|
|
|
this.goodsData = {};
|
|
|
this.$refs['replaceForm'].resetFields();
|
|
|
this.addDialog = false;
|
|
|
},
|
|
|
- replaceConfirmFn() {},
|
|
|
+ replaceConfirmFn() {
|
|
|
+ this.$refs.replaceForm.validate((valid) => {
|
|
|
+ if(valid) {
|
|
|
+ console.log(this.replaceForm)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
tabClick (tab, e) {
|
|
|
this.app.refresh({ classId: this.classId });
|
|
|
},
|
|
|
@@ -378,7 +456,9 @@ export default {
|
|
|
.done();
|
|
|
app.refresh({ classId: this.classId });
|
|
|
},
|
|
|
-
|
|
|
+ uploadSuccess() {
|
|
|
+ console.log(this.$refs['replaceForm'].validateField('cover'))
|
|
|
+ },
|
|
|
refresh (params) {
|
|
|
this.app.refresh(params);
|
|
|
},
|
|
|
@@ -403,6 +483,7 @@ export default {
|
|
|
},
|
|
|
replaceBtnFn() {
|
|
|
this.addDialog = true
|
|
|
+ this.getAllClass()
|
|
|
},
|
|
|
changeSort (d, type) {
|
|
|
this.dataList.form.type = type
|