From 03335b231906a91d33716471823688e3c2ae3aa3 Mon Sep 17 00:00:00 2001 From: lihaoyuan <18278596806@163.com> Date: Tue, 29 Jul 2025 18:14:14 +0800 Subject: [PATCH] =?UTF-8?q?udate:=E6=96=B0=E5=A2=9E=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=85=8D=E7=BD=AE=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8C=E5=88=97=E8=A1=A8=E5=B1=9E=E6=80=A7=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=20fix:=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E5=88=B7=E6=96=B0=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/goodsTool.js | 5 +- .../goodsTool/BatchProductOperation.vue | 99 +++++++++++++------ src/views/product/goodsTool/index.vue | 8 +- src/views/store/storeConf/DbConfigForm.vue | 21 +++- src/views/store/storeConf/index.vue | 8 ++ 5 files changed, 105 insertions(+), 36 deletions(-) diff --git a/src/api/goodsTool.js b/src/api/goodsTool.js index b96a987..b146b66 100644 --- a/src/api/goodsTool.js +++ b/src/api/goodsTool.js @@ -94,7 +94,7 @@ export async function downloadErrorReport(data) { }) } -export async function syncProductMaping(storeId) { +export async function syncProductMaping(storeId,isPublish) { return request({ url: `/admin/shop/shop-sync-productMapper/syncProductMaping`, method: 'put', @@ -102,7 +102,8 @@ export async function syncProductMaping(storeId) { 'Content-Type': 'application/json', }, params:{ - storeId + storeId, + isPublish, } }) } diff --git a/src/views/product/goodsTool/BatchProductOperation.vue b/src/views/product/goodsTool/BatchProductOperation.vue index 62ed6ad..f3b38ec 100644 --- a/src/views/product/goodsTool/BatchProductOperation.vue +++ b/src/views/product/goodsTool/BatchProductOperation.vue @@ -6,10 +6,19 @@ @close="$emit('update:visible', false)" >
- + 自动匹配规格 - 图库匹配并上架商品 + + 图库匹配并上架商品 + +
@@ -36,6 +50,7 @@ filter: { productName: '', storeId: '', + isPublish: '0', }, tableData: [], pagination: { @@ -45,9 +60,18 @@ }, selectedRowKeys: [], shopList: [], - tableData: [], } }, + computed: { + isPublishValue: { + get() { + return this.filter.isPublish === '1' + }, + set(value) { + this.filter.isPublish = value ? '1' : '0' + }, + }, + }, props: { visible: { type: Boolean, @@ -63,37 +87,53 @@ this.$emit('update:visible', false) }, open() { - console.log('123456456456') this.$emit('update:visible', true) }, - async handleSyncProductMaping() { - const res = await GoodsToolApi.syncProductMaping(this.filter.storeId) - if (res.status == 200) { - this.$message.success('操作成功') - } - }, - handleSyncShopImages() { + // 校验店铺选择的高阶函数 + withStoreValidation(callback) { if (!this.filter.storeId) { - this.$message.error('请选择店铺') - return + this.$message.error('请先选择店铺') + return false } - this.$confirm('确定要匹配当前选择店铺的商品图库?', '友情提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'danger', - }).then(async () => { - const res = await GoodsToolApi.syncShopImages({ - storeId: this.filter.storeId, - }) - if (res.status == 200) { + return callback() + }, + + async handleSyncProductMaping() { + this.withStoreValidation(async () => { + const res = await GoodsToolApi.syncProductMaping( + this.filter.storeId, + this.filter.isPublish + ) + if (res.status === 200) { this.$message.success('操作成功') - this.getProductMapperList() + } else{ + this.$message.error(res.msg) } }) }, + + async handleSyncShopImages() { + this.withStoreValidation(async () => { + this.$confirm('确定要匹配当前选择店铺的商品图库?', '友情提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'danger', + }).then(async () => { + const res = await GoodsToolApi.syncShopImages({ + storeId: this.filter.storeId, + }) + if (res.status === 200) { + this.$message.success('操作成功') + this.getProductMapperList() + } + }) + }) + }, + handleSelectionChange(selection) { this.selectedRowKeys = selection.map((item) => item.id) }, + async getGoodsList() { let res = await GoodsToolApi.getProductMapperList({ ...this.filter, @@ -103,6 +143,7 @@ this.tableData = res.data.items this.pagination.total = res.data.records }, + async getShopList() { let res = await GoodsToolApi.getShopList() this.shopList = res.data.items @@ -111,9 +152,9 @@ } + .operation-container { + display: flex; + align-items: center; + gap: 12px; + } + \ No newline at end of file diff --git a/src/views/product/goodsTool/index.vue b/src/views/product/goodsTool/index.vue index 94e13d1..dc142fa 100644 --- a/src/views/product/goodsTool/index.vue +++ b/src/views/product/goodsTool/index.vue @@ -250,7 +250,7 @@ const res = await GoodsToolApi.getProductMapping({ id: data.id }) if (res.status == 200) { this.$message.success('操作成功') - this.getProductMapperList() + this.getGoodsList() } }) }, @@ -277,7 +277,7 @@ const res = await GoodsToolApi.deleteGoods({ id: data.id }) if (res.status == 200) { this.$message.success('已删除') - this.getProductMapperList() + this.getGoodsList() } }) }, @@ -291,7 +291,7 @@ const res = await GoodsToolApi.getSyncBaseMapingProducts() if (res.status == 200) { this.$message.success('操作成功') - this.getProductMapperList() + this.getGoodsList() } }) }, @@ -311,7 +311,7 @@ }) if (res.status == 200) { this.$message.success('操作成功') - this.getProductMapperList() + this.getGoodsList() } }) }, diff --git a/src/views/store/storeConf/DbConfigForm.vue b/src/views/store/storeConf/DbConfigForm.vue index 3093b80..9e46655 100644 --- a/src/views/store/storeConf/DbConfigForm.vue +++ b/src/views/store/storeConf/DbConfigForm.vue @@ -60,6 +60,10 @@ + + + + 自动 + + + + + + @@ -200,6 +210,13 @@ trigger: 'change', }, ], + isNegativeAllowed: [ + { + required: true, + message: '请选择是否允许负库存售卖', + trigger: 'change', + }, + ], cronExpression: [ { required: true, @@ -245,10 +262,12 @@ syncMode: '1', hasStart: '1', cronExpression: '', + shopGapTime:'', remark: '', refreshTime: '', isTowSync: '0', - priorityMode: '1' + priorityMode: '1', + isNegativeAllowed:'0', } }, diff --git a/src/views/store/storeConf/index.vue b/src/views/store/storeConf/index.vue index 5ffe231..335bd5d 100644 --- a/src/views/store/storeConf/index.vue +++ b/src/views/store/storeConf/index.vue @@ -70,6 +70,7 @@ + @@ -78,6 +79,13 @@ {{ scope.row.isTowSync === '1' ? '是' : '否' }} + + +