|
|
@ -103,6 +103,7 @@
|
|
|
|
const id = route.params.id;
|
|
|
|
const id = route.params.id;
|
|
|
|
if (id && id !== state.form.id) {
|
|
|
|
if (id && id !== state.form.id) {
|
|
|
|
let res = await store.dispatch('product/detail', id);
|
|
|
|
let res = await store.dispatch('product/detail', id);
|
|
|
|
|
|
|
|
res.pictureList = res.pictureList || [res.mainPicture];
|
|
|
|
Object.assign(state.form, res);
|
|
|
|
Object.assign(state.form, res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -111,7 +112,9 @@
|
|
|
|
state.loading = true;
|
|
|
|
state.loading = true;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await state.refsForm.validate();
|
|
|
|
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({
|
|
|
|
router.push({
|
|
|
|
name: 'UpdateProduct',
|
|
|
|
name: 'UpdateProduct',
|
|
|
|
params: {
|
|
|
|
params: {
|
|
|
|