This commit is contained in:
mixtan 2025-07-29 18:23:03 +08:00
commit 16fcf86b0a
5 changed files with 105 additions and 36 deletions

View File

@ -94,7 +94,7 @@ export async function downloadErrorReport(data) {
}) })
} }
export async function syncProductMaping(storeId) { export async function syncProductMaping(storeId,isPublish) {
return request({ return request({
url: `/admin/shop/shop-sync-productMapper/syncProductMaping`, url: `/admin/shop/shop-sync-productMapper/syncProductMaping`,
method: 'put', method: 'put',
@ -102,7 +102,8 @@ export async function syncProductMaping(storeId) {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
params:{ params:{
storeId storeId,
isPublish,
} }
}) })
} }

View File

@ -6,10 +6,19 @@
@close="$emit('update:visible', false)" @close="$emit('update:visible', false)"
> >
<div class="operation-container"> <div class="operation-container">
<el-button plain type="info" @click="handleSyncProductMaping"> <el-button
plain
type="info"
@click="handleSyncProductMaping"
:disabled="!filter.storeId">
自动匹配规格 自动匹配规格
</el-button> </el-button>
<el-button @click="handleSyncShopImages">图库匹配并上架商品</el-button> <el-button
@click="handleSyncShopImages"
:disabled="!filter.storeId"
>
图库匹配并上架商品
</el-button>
<el-select <el-select
v-model="filter.storeId" v-model="filter.storeId"
clearable clearable
@ -23,6 +32,11 @@
:value="item.store_id" :value="item.store_id"
/> />
</el-select> </el-select>
<el-checkbox
v-model="isPublishValue"
label="是否上架商品"
:indeterminate="false"
></el-checkbox>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
@ -36,6 +50,7 @@
filter: { filter: {
productName: '', productName: '',
storeId: '', storeId: '',
isPublish: '0',
}, },
tableData: [], tableData: [],
pagination: { pagination: {
@ -45,9 +60,18 @@
}, },
selectedRowKeys: [], selectedRowKeys: [],
shopList: [], shopList: [],
tableData: [],
} }
}, },
computed: {
isPublishValue: {
get() {
return this.filter.isPublish === '1'
},
set(value) {
this.filter.isPublish = value ? '1' : '0'
},
},
},
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
@ -63,37 +87,53 @@
this.$emit('update:visible', false) this.$emit('update:visible', false)
}, },
open() { open() {
console.log('123456456456')
this.$emit('update:visible', true) this.$emit('update:visible', true)
}, },
async handleSyncProductMaping() { //
const res = await GoodsToolApi.syncProductMaping(this.filter.storeId) withStoreValidation(callback) {
if (res.status == 200) {
this.$message.success('操作成功')
}
},
handleSyncShopImages() {
if (!this.filter.storeId) { if (!this.filter.storeId) {
this.$message.error('请选择店铺') this.$message.error('请先选择店铺')
return return false
} }
this.$confirm('确定要匹配当前选择店铺的商品图库?', '友情提示', { return callback()
confirmButtonText: '确定', },
cancelButtonText: '取消',
type: 'danger', async handleSyncProductMaping() {
}).then(async () => { this.withStoreValidation(async () => {
const res = await GoodsToolApi.syncShopImages({ const res = await GoodsToolApi.syncProductMaping(
storeId: this.filter.storeId, this.filter.storeId,
}) this.filter.isPublish
if (res.status == 200) { )
if (res.status === 200) {
this.$message.success('操作成功') 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) { handleSelectionChange(selection) {
this.selectedRowKeys = selection.map((item) => item.id) this.selectedRowKeys = selection.map((item) => item.id)
}, },
async getGoodsList() { async getGoodsList() {
let res = await GoodsToolApi.getProductMapperList({ let res = await GoodsToolApi.getProductMapperList({
...this.filter, ...this.filter,
@ -103,6 +143,7 @@
this.tableData = res.data.items this.tableData = res.data.items
this.pagination.total = res.data.records this.pagination.total = res.data.records
}, },
async getShopList() { async getShopList() {
let res = await GoodsToolApi.getShopList() let res = await GoodsToolApi.getShopList()
this.shopList = res.data.items this.shopList = res.data.items
@ -111,9 +152,9 @@
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.operation-container { .operation-container {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12px; gap: 12px;
} }
</style> </style>

View File

@ -250,7 +250,7 @@
const res = await GoodsToolApi.getProductMapping({ id: data.id }) const res = await GoodsToolApi.getProductMapping({ id: data.id })
if (res.status == 200) { if (res.status == 200) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.getProductMapperList() this.getGoodsList()
} }
}) })
}, },
@ -277,7 +277,7 @@
const res = await GoodsToolApi.deleteGoods({ id: data.id }) const res = await GoodsToolApi.deleteGoods({ id: data.id })
if (res.status == 200) { if (res.status == 200) {
this.$message.success('已删除') this.$message.success('已删除')
this.getProductMapperList() this.getGoodsList()
} }
}) })
}, },
@ -291,7 +291,7 @@
const res = await GoodsToolApi.getSyncBaseMapingProducts() const res = await GoodsToolApi.getSyncBaseMapingProducts()
if (res.status == 200) { if (res.status == 200) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.getProductMapperList() this.getGoodsList()
} }
}) })
}, },
@ -311,7 +311,7 @@
}) })
if (res.status == 200) { if (res.status == 200) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.getProductMapperList() this.getGoodsList()
} }
}) })
}, },

View File

@ -60,6 +60,10 @@
<el-input v-model="innerFormData.cronExpression" /> <el-input v-model="innerFormData.cronExpression" />
</el-form-item> </el-form-item>
<el-form-item label="同步间隔时间" prop="shopGapTime">
<el-input v-model="innerFormData.shopGapTime" />
</el-form-item>
<el-form-item label="刷新时间" prop="refreshTime"> <el-form-item label="刷新时间" prop="refreshTime">
<el-date-picker <el-date-picker
v-model="innerFormData.refreshTime" v-model="innerFormData.refreshTime"
@ -104,6 +108,12 @@
<el-radio :label="'2'">自动</el-radio> <el-radio :label="'2'">自动</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="允许负库存售卖" prop="isNegativeAllowed">
<el-radio-group v-model="innerFormData.isNegativeAllowed">
<el-radio :label="'1'"></el-radio>
<el-radio :label="'0'"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注信息" prop="remark"> <el-form-item label="备注信息" prop="remark">
<el-input v-model="innerFormData.remark" type="textarea" /> <el-input v-model="innerFormData.remark" type="textarea" />
</el-form-item> </el-form-item>
@ -200,6 +210,13 @@
trigger: 'change', trigger: 'change',
}, },
], ],
isNegativeAllowed: [
{
required: true,
message: '请选择是否允许负库存售卖',
trigger: 'change',
},
],
cronExpression: [ cronExpression: [
{ {
required: true, required: true,
@ -245,10 +262,12 @@
syncMode: '1', syncMode: '1',
hasStart: '1', hasStart: '1',
cronExpression: '', cronExpression: '',
shopGapTime:'',
remark: '', remark: '',
refreshTime: '', refreshTime: '',
isTowSync: '0', isTowSync: '0',
priorityMode: '1' priorityMode: '1',
isNegativeAllowed:'0',
} }
}, },

View File

@ -70,6 +70,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="同步表达式" prop="cronExpression" /> <el-table-column label="同步表达式" prop="cronExpression" />
<el-table-column label="同步间隔时间" prop="shopGapTime" />
<el-table-column label="备注信息" prop="remark" /> <el-table-column label="备注信息" prop="remark" />
<el-table-column label="刷新时间" prop="refreshTime" /> <el-table-column label="刷新时间" prop="refreshTime" />
<el-table-column label="是否双向同步" prop="isTowSync"> <el-table-column label="是否双向同步" prop="isTowSync">
@ -78,6 +79,13 @@
{{ scope.row.isTowSync === '1' ? '是' : '否' }} {{ scope.row.isTowSync === '1' ? '是' : '否' }}
</el-tag> </el-tag>
</template> </template>
</el-table-column>
<el-table-column label="是否允许负库存售卖" prop="isNegativeAllowed">
<template slot-scope="scope">
<el-tag :type="scope.row.isNegativeAllowed === '1' ? 'success' : 'info'">
{{ scope.row.isNegativeAllowed === '1' ? '是' : '否' }}
</el-tag>
</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="250"> <el-table-column label="操作" width="250">
<template slot-scope="scope"> <template slot-scope="scope">