|
@@ -22,6 +22,11 @@ interface ISelection {
|
|
hidden?: boolean
|
|
hidden?: boolean
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+interface ICategoryProdRelation {
|
|
|
|
+ goodsId: number
|
|
|
|
+ goodsTypeId: number
|
|
|
|
+}
|
|
|
|
+
|
|
export default Vue.extend({
|
|
export default Vue.extend({
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -61,7 +66,13 @@ export default Vue.extend({
|
|
this.new = false
|
|
this.new = false
|
|
this.id = id
|
|
this.id = id
|
|
this.form.title = '修改商品'
|
|
this.form.title = '修改商品'
|
|
- httpx.post(
|
|
|
|
|
|
+ this.getProductInfo(id)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ methods: {
|
|
|
|
+ getProductInfo(id: number) {
|
|
|
|
+ return httpx.post(
|
|
httpx.makeurl("/goods/editGood"),
|
|
httpx.makeurl("/goods/editGood"),
|
|
id
|
|
id
|
|
).then(({ data }) => {
|
|
).then(({ data }) => {
|
|
@@ -69,7 +80,8 @@ export default Vue.extend({
|
|
this.notFound()
|
|
this.notFound()
|
|
}
|
|
}
|
|
const item = data.goodList[0]
|
|
const item = data.goodList[0]
|
|
- const categories = data?.goodsGoodsTypesEntityList || []
|
|
|
|
|
|
+ const categories_raw: ICategoryProdRelation[] = data?.goodsGoodsTypesEntityList || []
|
|
|
|
+ const categories = categories_raw.map(v => v.goodsTypeId)
|
|
this.form = {
|
|
this.form = {
|
|
name: item.name,
|
|
name: item.name,
|
|
desc: item.desc,
|
|
desc: item.desc,
|
|
@@ -87,10 +99,7 @@ export default Vue.extend({
|
|
title: `修改商品 ${item.name}`,
|
|
title: `修改商品 ${item.name}`,
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- methods: {
|
|
|
|
|
|
+ },
|
|
getCategoryList(name: string = "") {
|
|
getCategoryList(name: string = "") {
|
|
return httpx.post(httpx.makeurl("/goodsTypes/queryGoodsTypeList"), {
|
|
return httpx.post(httpx.makeurl("/goodsTypes/queryGoodsTypeList"), {
|
|
name: name, limit: 1000, page: 1
|
|
name: name, limit: 1000, page: 1
|
|
@@ -107,6 +116,8 @@ export default Vue.extend({
|
|
data.deliverPrice = real2database(data.deliverPrice)
|
|
data.deliverPrice = real2database(data.deliverPrice)
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
data.cover = data.cover[0] || ""
|
|
data.cover = data.cover[0] || ""
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ delete data.title;
|
|
|
|
|
|
console.log(data)
|
|
console.log(data)
|
|
|
|
|