|
@@ -115,6 +115,8 @@ export default {
|
|
|
async filtereEdit (e) {
|
|
|
this.formdata = e;
|
|
|
this.title = '修改商品';
|
|
|
+ const item = this.typeList.find(i => i.name == e.type)?.code;
|
|
|
+ this.typeChange(Number(item));
|
|
|
this.visibleSync = true;
|
|
|
},
|
|
|
// 删除
|
|
@@ -135,13 +137,16 @@ export default {
|
|
|
// 商品改变
|
|
|
async goodChange(e) {
|
|
|
const res = await this.goodFetch({ code: this.typeCode, id: e });
|
|
|
- const { name, thumbnail } = res;
|
|
|
- this.$refs.formData.setForm('name', name);
|
|
|
- this.$refs.formData.setForm('thumbnail', thumbnail);
|
|
|
+ if (res.name) {
|
|
|
+ this.$refs.formData.setForm('name', res.name);
|
|
|
+ } else {
|
|
|
+ this.$refs.formData.setForm('name', res.title);
|
|
|
+ }
|
|
|
+ this.$refs.formData.setForm('thumbnail', res.thumbnail);
|
|
|
},
|
|
|
// 表单保存
|
|
|
async formSave (e) {
|
|
|
- console.log(e);
|
|
|
+ const item = this.typeList.find(i => i.name == e.type)?.code;
|
|
|
if (e.isRevise && e?.isRevise == false) {
|
|
|
this.$message.warning('未作修改');
|
|
|
return;
|
|
@@ -150,6 +155,7 @@ export default {
|
|
|
let res, msg;
|
|
|
// 修改
|
|
|
if (e._id) {
|
|
|
+ e.type = item;
|
|
|
res = await this.marketUpdate(e);
|
|
|
msg = '商品修改成功';
|
|
|
} else {
|