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' ? '是' : '否' }} + + +