提交 f78391b2 authored 作者: 刘旭's avatar 刘旭

优化

上级 16d5dcb4
...@@ -72,7 +72,9 @@ ...@@ -72,7 +72,9 @@
<el-form-item label="商品配件"> <el-form-item label="商品配件">
<el-select v-model="goodsParts" multiple collapse-tags collapse-tags-tooltip <el-select v-model="goodsParts" multiple collapse-tags collapse-tags-tooltip
style="width: 240px"> style="width: 240px">
<el-option v-for="item in partsList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in partsList" :key="item.id"
:label="item.partGoodsName ? item.partGoodsName : item.name"
:value="item.partGoodsId ? item.partGoodsId : item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -244,7 +246,7 @@ let goods = ref({ ...@@ -244,7 +246,7 @@ let goods = ref({
categoryId: undefined, categoryId: undefined,
keywords: undefined keywords: undefined
} as any); } as any);
let goodsParts = ref() let goodsParts = ref([] as any)
let specVisiable = ref(false); let specVisiable = ref(false);
let specForm = ref({ specification: "", value: "", picUrl: "" } as any); let specForm = ref({ specification: "", value: "", picUrl: "" } as any);
let multipleSpec = ref(true); let multipleSpec = ref(true);
...@@ -282,6 +284,7 @@ let initList = () => { ...@@ -282,6 +284,7 @@ let initList = () => {
}).then((res: any) => { }).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
partsList.value = res.data.list; partsList.value = res.data.list;
console.log(partsList.value, '....');
} }
}) })
} }
...@@ -290,8 +293,13 @@ initList() ...@@ -290,8 +293,13 @@ initList()
let init = (id: number) => { let init = (id: number) => {
detailGoods(id).then((res) => { detailGoods(id).then((res) => {
goods.value = res.data.goods; goods.value = res.data.goods;
partsList.value = res.data.parts for (let s in res.data.parts) {
console.log(goods.value); console.log(s, '////');
goodsParts.value.push(res.data.parts[s].partGoodsId)
}
// partsList.value = res.data.parts
console.log(res.data);
// 稍微调整一下前后端不一致 // 稍微调整一下前后端不一致
if (goods.value?.brandId === 0) { if (goods.value?.brandId === 0) {
...@@ -361,16 +369,18 @@ let handleEdit = () => { ...@@ -361,16 +369,18 @@ let handleEdit = () => {
}; };
editGoods(finalGoods) editGoods(finalGoods)
.then((res: any) => { .then((res: any) => {
ElNotification({ if (res.code === 200) {
type: 'success', ElNotification({
title: "成功", type: 'success',
message: "编辑成功", title: "成功",
}); message: "编辑成功",
emits('initShelves') });
handleCancel() emits('initShelves')
handleCancel()
}
}) })
.catch((res: any) => { .catch((res: any) => {
ElMessageBox.alert("业务错误:" + res.data.errmsg, "警告", { ElMessageBox.alert("业务错误:" + res.msg, "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
type: "error", type: "error",
}); });
......
...@@ -331,16 +331,18 @@ let handlePublish = () => { ...@@ -331,16 +331,18 @@ let handlePublish = () => {
}; };
publishGoods(finalGoods) publishGoods(finalGoods)
.then((res: any) => { .then((res: any) => {
ElNotification({ if (res.code === 200) {
type: 'success', ElNotification({
title: "成功", type: 'success',
message: "创建成功", title: "成功",
}); message: "创建成功",
emits('initShelves') });
handleCancel() emits('initShelves')
handleCancel()
}
}) })
.catch((res) => { .catch((res) => {
ElMessageBox.alert("业务错误:" + res.data.errmsg, "警告", { ElMessageBox.alert("业务错误:" + res.msg, "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
type: "error", type: "error",
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论