From 0834c1ccc77ae26764cdfaa52432f19de38f505c Mon Sep 17 00:00:00 2001 From: fanfan Date: Fri, 6 Sep 2024 20:09:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modal/GoodsModal/GoodsModal.vue | 10 ++++++ src/views/goods/Index.vue | 12 +++++++ src/views/goods/modules/MultiSpec.vue | 34 +++++++++++++++---- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/src/components/Modal/GoodsModal/GoodsModal.vue b/src/components/Modal/GoodsModal/GoodsModal.vue index 7d40d47..4473fdf 100644 --- a/src/components/Modal/GoodsModal/GoodsModal.vue +++ b/src/components/Modal/GoodsModal/GoodsModal.vue @@ -52,6 +52,11 @@ /> + +

+ {{ text == 10 ? '单规格' : '多规格' }} +

+
{{ text == 10 ? '上架' : '下架' }} @@ -76,6 +81,11 @@ const columns = [ title: '商品信息', width: '335px', scopedSlots: { customRender: 'item' }, + }, + { + title: '规格类型', + dataIndex: 'spec_type', + scopedSlots: { customRender: 'spec_type' }, }, { title: '商品价格', diff --git a/src/views/goods/Index.vue b/src/views/goods/Index.vue index 6d63505..9998a3c 100644 --- a/src/views/goods/Index.vue +++ b/src/views/goods/Index.vue @@ -156,6 +156,11 @@ {{ text == 10 ? '上架' : '下架' }} + +

+ {{ text == 10 ? '单规格' : '多规格' }} +

+

{{ text == 0 ? '待处理' : '已归类' }} @@ -225,6 +230,13 @@ const columns = [ dataIndex: 'goods_name', width: '260px', scopedSlots: { customRender: 'goods_name' }, + }, + { + title: '规格类型', + width: '90px', + dataIndex: 'spec_type', + scopedSlots: { customRender: 'spec_type' }, + sorter: true, }, { title: '商品价格', diff --git a/src/views/goods/modules/MultiSpec.vue b/src/views/goods/modules/MultiSpec.vue index c46bac2..3c5c5a8 100644 --- a/src/views/goods/modules/MultiSpec.vue +++ b/src/views/goods/modules/MultiSpec.vue @@ -120,10 +120,12 @@ {{ item.goods_sku_no }} - @@ -150,7 +152,7 @@ export default { // 商品规格是否锁定(锁定状态下不允许编辑规格) isSpecLocked: PropTypes.bool.def(false), checkList: PropTypes.array.def([]), - source: PropTypes.any.def(0) + source: PropTypes.any.def(0), }, data() { return { @@ -183,6 +185,25 @@ export default { this.getData() }, methods: { + handleEdit(item) { + const routeData = this.$router.resolve({ + path: '/goods/update', + query: { + goodsId: item.goods_id, + }, + }) + window.open(routeData.href, '_blank') + }, + handleCancel(index, item) { + for (let key in this.multiSpecData.skuList[index]) { + if (this.multiSpecData.skuList[index].hasOwnProperty(key)) { + this.multiSpecData.skuList[index][key] = '' + } + } + this.multiSpecData.skuList[index].spec_value_0 = item.spec_value_0 + this.multiSpecData.skuList[index].tempId = item.tempId + this.multiSpecData.skuList[index].skuKeys = item.skuKeys + }, // 获取规格及SKU信息(展示) getData() { const { defaultSpecList, defaultSkuList } = this @@ -282,14 +303,13 @@ export default { const skuItem = skuList.find((sku) => sku.goods_id === goodsId) if (skuItem) { this.$message.error('一个商品只能选择一次', 2) - return false + return } - this.getGoodsDetail(goodsId).then((res) => { const queryGoodsId = this.$route.query.goodsId if (res.spec_type === 20 && queryGoodsId !== goodsId) { this.$message.error('您选择的商品是多规格商品', 2) - return false + return } const sku = res.skuList[0] From 91171ecce6528fcdb23bb2aee7aa2efea0485347 Mon Sep 17 00:00:00 2001 From: fanfan Date: Sun, 8 Sep 2024 20:32:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/model/goods/MultiSpec.js | 26 ++++---- src/components/SelectGoods/SelectGoods.vue | 9 ++- src/views/goods/modules/MultiSpec.vue | 69 ++++++++++++++-------- 3 files changed, 60 insertions(+), 44 deletions(-) diff --git a/src/common/model/goods/MultiSpec.js b/src/common/model/goods/MultiSpec.js index 059e05c..e385d70 100644 --- a/src/common/model/goods/MultiSpec.js +++ b/src/common/model/goods/MultiSpec.js @@ -5,24 +5,22 @@ import { log } from '@/api/market/presale' // 默认的sku字段属性 const defaultColumns = [ - /* { - title: '预览图', - dataIndex: 'image', - width: 90, - scopedSlots: { customRender: 'image' } - }, */ { title: '选择商品', dataIndex: 'select_goods', width: 120, scopedSlots: { customRender: 'select_goods' } }, -/* { - title: '商品名称', - dataIndex: 'goods_name', - width: 120, - scopedSlots: { customRender: 'goods_name' } - }, */ + { + title: '商品ID', + dataIndex: 'goods_id', + width: 90, + }, + { + title: '商品信息', + scopedSlots: { customRender: 'item' }, + width: 180, + }, { title: '商品价格', dataIndex: 'goods_price', @@ -79,7 +77,9 @@ const defaultSkuItemData = { cost_price: '', stock_num: '', goods_weight: '', - goods_sku_no: '' + goods_sku_no: '', + goods_image :'', +goods_name :'' } // const demoSpecList = [ diff --git a/src/components/SelectGoods/SelectGoods.vue b/src/components/SelectGoods/SelectGoods.vue index 3d4c0da..df0feb8 100644 --- a/src/components/SelectGoods/SelectGoods.vue +++ b/src/components/SelectGoods/SelectGoods.vue @@ -1,7 +1,7 @@