From 4fca0538255573b2acca22d0dbdf0552ee52546d Mon Sep 17 00:00:00 2001 From: 2812875475 <2812875475@qq.com> Date: Thu, 14 Mar 2024 15:22:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E4=BF=A1=E6=81=AF=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product/info.js | 5 ++++- src/components/Attribute/index.vue | 7 ++++-- src/components/AttributeGroup/index.vue | 7 ++++-- src/components/Brand/index.vue | 7 ++++-- src/views/product/category/index.vue | 3 ++- src/views/product/productInfo/index.vue | 30 ++++++++++++++++++------- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/api/product/info.js b/src/api/product/info.js index 80b02c2..6b80d5c 100644 --- a/src/api/product/info.js +++ b/src/api/product/info.js @@ -12,11 +12,14 @@ export function listInfo(query) { // 查询商品信息详细 export function getInfo(id) { return request({ - url: '/product/info/' + id, + url: '/product/info/product/' + id, method: 'get' }) } + + + // 新增商品信息 export function addInfo(data) { return request({ diff --git a/src/components/Attribute/index.vue b/src/components/Attribute/index.vue index 1f6435a..2f520c9 100644 --- a/src/components/Attribute/index.vue +++ b/src/components/Attribute/index.vue @@ -67,9 +67,11 @@ import {listAttribute} from "@/api/product/attribute"; export default { name: "CheckAttribute", props: { - value: { + items: { type: Array, - default: [] + default: function() { + return ['item1', 'item2', 'item3']; + } }, checkedList: { type: Array, @@ -109,6 +111,7 @@ export default { attributeTotal: 0, attributeList: [], total: 0, + value: [] } }, created() { diff --git a/src/components/AttributeGroup/index.vue b/src/components/AttributeGroup/index.vue index 8c95e66..03d59b2 100644 --- a/src/components/AttributeGroup/index.vue +++ b/src/components/AttributeGroup/index.vue @@ -67,9 +67,11 @@ import {listAttributeGroup} from "@/api/product/attributeGroup"; export default { name: "CheckAttributeGroup", props: { - value: { + items: { type: Array, - default: [] + default: function() { + return ['item1', 'item2', 'item3']; + } }, checkedList: { type: Array, @@ -109,6 +111,7 @@ export default { attributeGroupTotal: 0, attributeGroupList: [], total: 0, + value:[] } }, created() { diff --git a/src/components/Brand/index.vue b/src/components/Brand/index.vue index 0968579..9196198 100644 --- a/src/components/Brand/index.vue +++ b/src/components/Brand/index.vue @@ -67,9 +67,11 @@ import {listBrand} from "@/api/product/brand"; export default { nam: "CheckBrand", props: { - value: { + items: { type: Array, - default: [] + default: function() { + return ['item1', 'item2', 'item3']; + } }, checkedList: { type: Array, @@ -109,6 +111,7 @@ export default { brandTotal: 0, brandList: [], total: 0, + value:[] } }, created() { diff --git a/src/views/product/category/index.vue b/src/views/product/category/index.vue index 9598dcd..d5360af 100644 --- a/src/views/product/category/index.vue +++ b/src/views/product/category/index.vue @@ -148,7 +148,7 @@ - + @@ -184,6 +184,7 @@ import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; export default { + name: "Category", dicts: ['sys_yes_no'], components: { diff --git a/src/views/product/productInfo/index.vue b/src/views/product/productInfo/index.vue index f11a393..2b60cde 100644 --- a/src/views/product/productInfo/index.vue +++ b/src/views/product/productInfo/index.vue @@ -97,7 +97,7 @@ type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" - v-hasPermi="['product:info:edit']" + v-hasPermi="['product:info:query']" >修改 - @@ -438,6 +437,7 @@ export default { templateAttributeGroupList: [], templateAttributeList: [], attributeList: [] + }, ruleAddFormStatus: false, addRulePropertyValue: null, @@ -476,7 +476,13 @@ export default { brandId: null, }, // 表单参数 - form: {}, + form: { + ruleId:[], + skuList:[], + templateAttributeGroupList:[], + attributeCheckedList:[], + templateAttributeList:[], + }, // 表单校验 rules: { name: [ @@ -525,7 +531,6 @@ export default { }, "form.type": { handler(value) { - console.log(value) if (value != null) { getTemplateAttribute(value).then(response => { console.log(response) @@ -547,7 +552,6 @@ export default { methods: { onSubmit() { this.skuList.forEach(skuInfo => { - console.log(this.oneSettingValue) skuInfo.image = this.oneSettingValue.image; skuInfo.stock = this.oneSettingValue.stock; skuInfo.price = this.oneSettingValue.price; @@ -557,9 +561,11 @@ export default { this.skuList=[] }, changeRule(ruleId) { + this.titleList = [] let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === ruleId); const {ruleAttrList} = ruleInfo; + let skuTotal = 1; for (let ruleAttrListKey in ruleAttrList) { let ruleAttrInfo = ruleAttrList[ruleAttrListKey]; @@ -597,8 +603,6 @@ export default { let counter = 0; for (let forIndex = 0; forIndex < forSize; forIndex++) { const {ruleList} = ruleAttrInfo; - console.log(ruleList) - ruleList.forEach(value => { for (let continuousIndex = 0; continuousIndex < continuousSize; continuousIndex++) { this.skuList[counter++]["prop" + currentIndex] = value; @@ -657,7 +661,6 @@ export default { listCategory().then(response => { this.categoryOptions = [] this.categoryOptions = this.handleTree(response.data, "id", "parentId"); - console.log(this.categoryOptions); }) }, next() { @@ -728,7 +731,13 @@ export default { this.reset(); const id = row.id || this.ids getInfo(id).then(response => { + console.log(response) this.form = response.data; + this.changeRule(response.data.ruleId) + this.form.type=parseInt(response.data.type) + this.form.mianType=parseInt(response.data.mianType) + this.form.parentType=parseInt(response.data.parentType) + this.CategoryTree() this.open = true; this.title = "修改商品信息"; }); @@ -744,6 +753,11 @@ export default { this.getList(); }); } else { + this.form.templateAttributeGroupList=this.categoryCommonElement.templateAttributeGroupList + this.form.attributeCheckedList=this.attributeCheckedList + this.form.skuList=this.skuList + this.form.templateAttributeList=this.categoryCommonElement.templateAttributeList + addInfo(this.form).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false;