diff --git a/src/api/product/category.js b/src/api/product/category.js index e99314b..03e09df 100644 --- a/src/api/product/category.js +++ b/src/api/product/category.js @@ -17,10 +17,11 @@ export function getCategory(id) { }) } -export function getTemplateAttribute(id) { +export function getTemplateAttribute(data) { return request({ - url: '/product/category/getTemplateAttribute/' + id, - method: 'get' + url: '/product/category/getTemplateAttribute/', + method: 'post', + data }) } diff --git a/src/api/product/info.js b/src/api/product/info.js index 6b80d5c..dfefb45 100644 --- a/src/api/product/info.js +++ b/src/api/product/info.js @@ -17,7 +17,12 @@ export function getInfo(id) { }) } - +export function getPro(id) { + return request({ + url: '/product/info/getProductDetail?id=' + id, + method: 'get' + }) +} // 新增商品信息 diff --git a/src/layouttest/index.vue b/src/layouttest/index.vue index e756531..f877f13 100644 --- a/src/layouttest/index.vue +++ b/src/layouttest/index.vue @@ -1,19 +1,97 @@ diff --git a/src/router/index.js b/src/router/index.js index 1c8da96..dff0f18 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,7 +3,7 @@ import Router from 'vue-router' /* Layout */ import Layout from '@/layout' import Layouttest from "@/layouttest"; - +import DetailsComponent from '@/views/a/detailsComponent.vue'; Vue.use(Router) /** @@ -80,10 +80,10 @@ export const constantRoutes = [ redirect: 'test', children: [ { - path: 'test', + path: '/test/:id', component: () => import('@/views/a/index'), name: 'Test', - meta: {title: "测试", icon: 'dashboard', affix: true} + meta: {title: "商品商城", icon: 'dashboard', affix: true} } ] }, @@ -100,6 +100,11 @@ export const constantRoutes = [ meta: {title: '个人中心', icon: 'user'} } ] + }, + { + path:'/details', + name:'/details', + component: DetailsComponent } ] @@ -192,5 +197,5 @@ Router.prototype.replace = function push(location) { export default new Router({ mode: 'history', // 去掉url中的# scrollBehavior: () => ({y: 0}), - routes: constantRoutes + routes: constantRoutes, }) diff --git a/src/views/a/detailsComponent.vue b/src/views/a/detailsComponent.vue new file mode 100644 index 0000000..4092440 --- /dev/null +++ b/src/views/a/detailsComponent.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/views/a/index.vue b/src/views/a/index.vue index f8fa94a..39bd5a5 100644 --- a/src/views/a/index.vue +++ b/src/views/a/index.vue @@ -1,23 +1,289 @@ diff --git a/src/views/product/productInfo/index.vue b/src/views/product/productInfo/index.vue index 9a312ea..cc4eefa 100644 --- a/src/views/product/productInfo/index.vue +++ b/src/views/product/productInfo/index.vue @@ -108,6 +108,12 @@ v-hasPermi="['product:info:remove']" >删除 + 详细 + @@ -278,7 +284,7 @@
- {{e}} + @@ -286,12 +292,10 @@
属性组名称【{{ templateAttributeGroup.groupName }}】
-
- - +
+ -
@@ -299,7 +303,7 @@ - 商品属性{{e}} + 商品属性 @@ -313,7 +317,7 @@ - 自有属性{{e}} + 自有属性 @@ -388,7 +392,7 @@ import {listInfo, getInfo, delInfo, addInfo, updateInfo} from "@/api/product/info"; import {listBrand} from "@/api/product/brand"; import {listRule} from "@/api/product/rule"; -import {getTemplateAttribute, listCategory} from "@/api/product/category"; +import {getTemplateAttribute, listCategory} from "@/api/product/category"; import {addAttribute} from "@/api/product/attribute"; export default { @@ -524,6 +528,11 @@ export default { "value":"" } ], + test:{ + id:0, + value:0, + }, + check:[] }; }, watch: { @@ -540,11 +549,16 @@ export default { } } }, + "form.id":{ + handler(val){ + this.test.id=val + } + }, "form.type": { handler(value) { if (value != null) { - getTemplateAttribute(value).then(response => { - console.log(response) + this.test.value=value + getTemplateAttribute(this.test).then(response => { const {data} = response; const {templateAttributeGroupList, templateAttributeList, attributeList} = data; this.categoryCommonElement.templateAttributeGroupList = templateAttributeGroupList; @@ -554,6 +568,7 @@ export default { } } }, + }, created() { this.getList(); @@ -561,6 +576,10 @@ export default { this.CategoryTree(); }, methods: { + detail(id){ + console.log(id) + this.$router.push('/test/'+id) + }, onSubmit() { this.skuList.forEach(skuInfo => { skuInfo.image = this.oneSettingValue.image; @@ -761,19 +780,10 @@ export default { this.reset(); const id = row.id || this.ids getInfo(id).then(response => { - console.log(response) - + console.log(this.categoryCommonElement) + this.test.id=id this.form = response.data; this.oneSettingValue=response.data.specification - - this.e=[] - this.e1=[] - this.e2=[] - this.e3=[] - this.e = response.data.asProductAttributeInfo.map(item => { - return { attributeId: item.attributeId, value: item.value }; - }); - console.log(this.e) this.changeRule(response.data.ruleId) this.onSubmit() this.form.type=parseInt(response.data.type) @@ -791,7 +801,6 @@ export default { if (valid) { if (this.form.id != null) { this.selectAttribute() - console.log(this.form) updateInfo(this.form).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false;