diff --git a/src/components/ElUploadImage.vue b/src/components/ElUploadImage.vue
index 0b7ce47..8fae89e 100644
--- a/src/components/ElUploadImage.vue
+++ b/src/components/ElUploadImage.vue
@@ -4,6 +4,7 @@
v-bind="props"
action=""
:before-upload="handleBeforeUpload"
+ :class="{ max: imgList.length === props.limit }"
:file-list="imgList"
:http-request="handleUpload"
list-type="picture-card"
@@ -136,4 +137,10 @@
return res + units[unit];
});
-
+
diff --git a/src/views/sales/product/form/step1.vue b/src/views/sales/product/form/step1.vue
index fcac0e8..6fe2fbd 100644
--- a/src/views/sales/product/form/step1.vue
+++ b/src/views/sales/product/form/step1.vue
@@ -103,6 +103,7 @@
const id = route.params.id;
if (id && id !== state.form.id) {
let res = await store.dispatch('product/detail', id);
+ res.pictureList = res.pictureList || [res.mainPicture];
Object.assign(state.form, res);
}
};
@@ -111,7 +112,9 @@
state.loading = true;
try {
await state.refsForm.validate();
- await store.dispatch('product/save', state.form);
+ let data = _.cloneDeep(state.form);
+ data.mainPicture = data.pictureList[0];
+ state.form.id = await store.dispatch('product/save', state.form);
router.push({
name: 'UpdateProduct',
params: {
diff --git a/src/views/sales/product/index.vue b/src/views/sales/product/index.vue
index a356cd6..a06864f 100644
--- a/src/views/sales/product/index.vue
+++ b/src/views/sales/product/index.vue
@@ -133,7 +133,7 @@
/* 删除 */
const handleRemove = (row) => {
- store.dispatch('product/remove', row.id);
+ store.dispatch('product/remove', [row.id]);
};
/* 查看详情 */
@@ -158,8 +158,10 @@
};
/* 上下架 */
- const handleEnabled = (row) => {
- console.info(row);
+ const handleEnabled = async (row) => {
+ loading.value = true;
+ await store.dispatch('product/save', row);
+ loading.value = false;
};
/* 列表配置 */