feat: 商品修改

feature/task1.0.0__0514__ch
向文可 2 years ago
parent ba983e3feb
commit e7e43c3c03

@ -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];
});
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
.max {
:deep(.el-upload) {
display: none;
}
}
</style>

@ -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: {

@ -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;
};
/* 列表配置 */

Loading…
Cancel
Save