diff --git a/src/api/product/info.js b/src/api/product/info.js index 80b02c2..5288172 100644 --- a/src/api/product/info.js +++ b/src/api/product/info.js @@ -9,6 +9,13 @@ export function listInfo(query) { }) } +// 查询商品信息详细 +export function getDetailInfo(id) { + return request({ + url: '/product/info/detail/' + id, + method: 'get' + }) +} // 查询商品信息详细 export function getInfo(id) { return request({ @@ -29,7 +36,7 @@ export function addInfo(data) { // 修改商品信息 export function updateInfo(data) { return request({ - url: '/product/info/'+data.id, + url: '/product/info/'+data.projectAddModel.id, method: 'put', data: data }) diff --git a/src/components/CheckAttribute/index.vue b/src/components/CheckAttribute/index.vue index 81fb799..5b20ab3 100644 --- a/src/components/CheckAttribute/index.vue +++ b/src/components/CheckAttribute/index.vue @@ -70,16 +70,29 @@ export default { value: { type: Array, default: [] + }, + checkedList: { + type: Array, + default: null } }, watch: { value: { handler(val) { if (val.toString() !== this.attributeIdList.toString()){ - this.attributeIdList = val + this.attributeIdList = val; this.checkedAttributeList = [] } }, + immediate: true, + }, + checkedList: { + handler(val){ + if (val !== undefined && val.length > 0){ + this.checkedAttributeList = val; + this.attributeIdList = this.checkedAttributeList.map(checked => checked.id); + } + }, immediate: true } }, diff --git a/src/components/CheckAttributeGroup/index.vue b/src/components/CheckAttributeGroup/index.vue index a047454..d857d81 100644 --- a/src/components/CheckAttributeGroup/index.vue +++ b/src/components/CheckAttributeGroup/index.vue @@ -67,17 +67,10 @@ export default { value: { type: Array, default: [] - } - }, - watch: { - value: { - handler(val) { - if (val.toString() !== this.attributeGroupIdList.toString()){ - this.attributeGroupIdList = val - this.checkedAttributeGroupList = [] - } - }, - immediate: true + }, + checkedList: { + type: Array, + default: null } }, data() { @@ -93,6 +86,26 @@ export default { attributeGroupList: [] } }, + watch: { + value: { + handler(val) { + if (val.toString() !== this.attributeGroupIdList.toString()){ + this.attributeGroupIdList = val; + this.checkedAttributeGroupList = [] + } + }, + immediate: true, + }, + checkedList: { + handler(val){ + if (val !== undefined && val.length > 0){ + this.checkedAttributeGroupList = val; + this.attributeGroupIdList = this.checkedAttributeGroupList.map(checked => checked.id); + } + }, + immediate: true + } + }, created() { this.queryAttributeGroup(); }, diff --git a/src/components/CheckBrand/index.vue b/src/components/CheckBrand/index.vue index 9f680b0..f0bfaa2 100644 --- a/src/components/CheckBrand/index.vue +++ b/src/components/CheckBrand/index.vue @@ -12,9 +12,9 @@ - {{ brand.name }} + {{ brand.nam }} @@ -27,7 +27,7 @@ - + 查询 @@ -42,7 +42,7 @@ :value="brand.id" :label="brand.id" @change="checkedBrand(brand)" - border>{{ brand.name }} + border>{{ brand.nam }} @@ -67,17 +67,10 @@ export default { value: { type: Array, default: [] - } - }, - watch: { - vlue: { - handler(val) { - if (val.toString() !== this.brandIdList.toString()){ - this.brandIdList = val - this.checkedBrandList = [] - } - }, - immediate: true + }, + checkedList: { + type: Array, + default: null } }, data() { @@ -93,6 +86,26 @@ export default { brandList: [] } }, + watch: { + value: { + handler(val) { + if (val.toString() !== this.brandIdList.toString()){ + this.brandIdList = val; + this.checkedBrandList = [] + } + }, + immediate: true, + }, + checkedList: { + handler(val){ + if (val !== undefined && val.length > 0){ + this.checkedBrandList = val; + this.brandIdList = this.checkedBrandList.map(checked => checked.id); + } + }, + immediate: true + } + }, created() { this.queryBrand(); }, diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 4d10bd8..7eb6e9f 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -124,6 +124,9 @@ export default { methods: { init() { const editor = this.$refs.editor; + if (this.readOnly){ + this.options.modules.toolbar= {} + } this.Quill = new Quill(editor, this.options); // 如果设置了上传地址则自定义图片上传事件 if (this.type == 'url') { diff --git a/src/layout-shop/index.vue b/src/layout-shop/index.vue new file mode 100644 index 0000000..91adb0f --- /dev/null +++ b/src/layout-shop/index.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/main.js b/src/main.js index ec9f715..8513d52 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,9 @@ -import Vue from 'vue' + +import Vue from 'vue'; +import ElementUI from 'element-ui'; +import 'element-ui/lib/theme-chalk/index.css'; + +Vue.use(ElementUI); import Cookies from 'js-cookie' diff --git a/src/router/index.js b/src/router/index.js index 2afac71..a35c89a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,8 @@ import Vue from 'vue' import Router from 'vue-router' /* Layout */ import Layout from '@/layout' - +import LayoutShop from "@/layout-shop/index.vue"; +import detail from "@/views/product/info/detail/index.vue"; Vue.use(Router) /** @@ -73,6 +74,23 @@ export const constantRoutes = [ } ] }, + { + path: '', + component: LayoutShop, + redirect: 'product-detail', + children: [ + { + path: 'product-detail/:detailId(\\d+)', + component: () => import('@/views/product/info/detail/index'), + name: 'ShopProduct', + meta: {title: '商品详情', icon: 'dashboard', affix: true} + } + ] + }, + // { + // path: '/gb', + // component: detail + // }, { path: '/user', component: Layout, diff --git a/src/views/product/info/detail/index.vue b/src/views/product/info/detail/index.vue new file mode 100644 index 0000000..4bae317 --- /dev/null +++ b/src/views/product/info/detail/index.vue @@ -0,0 +1,304 @@ + + + + + + diff --git a/src/views/product/info/index.vue b/src/views/product/info/index.vue index 57b5940..59d13f9 100644 --- a/src/views/product/info/index.vue +++ b/src/views/product/info/index.vue @@ -115,6 +115,9 @@