From 8135d4616bc6c7a324c6a8a27c9e0a94bca011e8 Mon Sep 17 00:00:00 2001 From: gyq <875626088@qq.com> Date: Thu, 16 May 2024 10:09:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0=E5=95=86?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/groupTypeList/index.vue | 47 +++++++--- src/components/shopList/index.vue | 4 +- src/views/product/add_shop.vue | 114 +++++++++++++++++-------- 3 files changed, 117 insertions(+), 48 deletions(-) diff --git a/src/components/groupTypeList/index.vue b/src/components/groupTypeList/index.vue index cbb1da9..6dba1bd 100644 --- a/src/components/groupTypeList/index.vue +++ b/src/components/groupTypeList/index.vue @@ -1,8 +1,8 @@ @@ -46,13 +46,15 @@ export default { total: 0, loading: false, list: [] - } + }, + goods: [] } }, methods: { // 确定选商品 confirmHandle(row) { - this.$emit('success', row) + let res = this.$refs.table.selection + this.$emit('success', res) this.close() }, // 重置查询 @@ -83,19 +85,42 @@ export default { name: this.searhForm.name, sort: 'id', }) - this.tableData.loading = false this.tableData.list = res.content this.tableData.total = res.totalElements + + if (this.goods.length) { + this.$nextTick(() => { + this.selection() + }) + } + setTimeout(() => { + this.tableData.loading = false + }, 500); } catch (error) { console.log(error) } }, - show() { + show(goods) { this.dialogVisible = true + if (goods && goods.length) { + this.goods = [...goods] + } else { + this.goods = [] + } this.resetHandle() + this.getTableData() }, close() { this.dialogVisible = false + }, + selection() { + this.goods.forEach(row => { + this.tableData.list.forEach((item, index) => { + if (row.id == item.id) { + this.$refs.table.toggleRowSelection(this.tableData.list[index]); + } + }) + }); } } } diff --git a/src/components/shopList/index.vue b/src/components/shopList/index.vue index 25382cf..232270e 100644 --- a/src/components/shopList/index.vue +++ b/src/components/shopList/index.vue @@ -112,7 +112,6 @@ export default { shopId: localStorage.getItem('shopId'), sort: 'id', }) - this.tableData.loading = false this.tableData.list = res.content this.tableData.total = res.totalElements @@ -121,6 +120,9 @@ export default { this.selection() }) } + setTimeout(() => { + this.tableData.loading = false + }, 500); } catch (error) { console.log(error) } diff --git a/src/views/product/add_shop.vue b/src/views/product/add_shop.vue index 632e56f..bd7f61e 100644 --- a/src/views/product/add_shop.vue +++ b/src/views/product/add_shop.vue @@ -23,7 +23,18 @@ 添加单位 - + + + + + + + + 添加团购券分类 + + @@ -33,7 +44,7 @@ -
注:第一张图为商品封面图,图片尺寸为750×750(可拖动图片排序)
+
注:第一张图为商品封面图,图片尺寸为750×750
@@ -49,6 +60,9 @@
{{ item.name }}
+
x{{ item.groupNum }}
+
@@ -212,37 +226,40 @@
注:小程序商城必须设置库存数量大于0
- -
-
-
收银台
-
- + @@ -263,6 +280,8 @@ 确 定 + +
@@ -271,6 +290,7 @@ import { tbShopUnit, tbShopCategoryGet, tbProductPost, tbProductSpecGet, tbProdu import addUnit from './components/addUnit' import addClassify from './components/addClassify' import shopList from '@/components/shopList' +import groupTypeList from '@/components/groupTypeList' import uploadImg from '@/components/uploadImg' import settings from '@/settings' import dayjs from 'dayjs' @@ -281,7 +301,8 @@ export default { addUnit, addClassify, uploadImg, - shopList + shopList, + groupTypeList }, data() { return { @@ -328,7 +349,8 @@ export default { specInfo: [], selectSpec: [], specTableHeaders: [], - skuSnap: '' + skuSnap: '', + groupCategoryId: [] }, rules: { typeEnum: [ @@ -349,6 +371,13 @@ export default { trigger: 'change', message: '请选择商品分类' } + ], + groupCategoryId: [ + { + required: true, + trigger: 'change', + message: '请选择团购券分类' + } ] }, units: [], @@ -464,16 +493,22 @@ export default { }, // 分组选择商品 selectShopRes(res) { + let arr = res.map(item => { + item.groupNum = 1 + return item + }) if (this.tableAddShopIndex != null) { - this.form.groupSnap[this.tableAddShopIndex].goods = res; + this.form.groupSnap[this.tableAddShopIndex].goods = [...arr]; this.tableAddShopIndex = null } else { this.form.groupSnap.push({ title: '', - goods: res, + goods: [...arr], number: 1 }) } + + console.log(this.form.groupSnap); }, // 切换类型 changeTypeEnum(index) { @@ -671,6 +706,10 @@ export default { display: flex; align-items: center; + &:not(:first-child) { + margin-top: 6px; + } + .dot { $size: 6px; width: $size; @@ -681,15 +720,18 @@ export default { .name { flex: 1; + display: flex; margin-left: 10px; + align-items: center; .t { color: #333; font-size: 14px; - max-width: 100px; + width: 100px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; + margin-right: 10px; } }