udate:新增店铺数据库配置字段,列表属性展示

fix:修复删除,新增商品规格提交后不刷新数据的bug
This commit is contained in:
lihaoyuan 2025-07-29 18:14:14 +08:00
parent b81ff8d290
commit 03335b2319
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({
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,
}
})
}

View File

@ -6,10 +6,19 @@
@close="$emit('update:visible', false)"
>
<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 @click="handleSyncShopImages">图库匹配并上架商品</el-button>
<el-button
@click="handleSyncShopImages"
:disabled="!filter.storeId"
>
图库匹配并上架商品
</el-button>
<el-select
v-model="filter.storeId"
clearable
@ -23,6 +32,11 @@
:value="item.store_id"
/>
</el-select>
<el-checkbox
v-model="isPublishValue"
label="是否上架商品"
:indeterminate="false"
></el-checkbox>
</div>
</el-dialog>
</template>
@ -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,20 +87,33 @@
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
}
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('操作成功')
} else{
this.$message.error(res.msg)
}
})
},
async handleSyncShopImages() {
this.withStoreValidation(async () => {
this.$confirm('确定要匹配当前选择店铺的商品图库?', '友情提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -85,15 +122,18 @@
const res = await GoodsToolApi.syncShopImages({
storeId: this.filter.storeId,
})
if (res.status == 200) {
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

View File

@ -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()
}
})
},

View File

@ -60,6 +60,10 @@
<el-input v-model="innerFormData.cronExpression" />
</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-date-picker
v-model="innerFormData.refreshTime"
@ -104,6 +108,12 @@
<el-radio :label="'2'">自动</el-radio>
</el-radio-group>
</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-input v-model="innerFormData.remark" type="textarea" />
</el-form-item>
@ -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',
}
},

View File

@ -70,6 +70,7 @@
</template>
</el-table-column>
<el-table-column label="同步表达式" prop="cronExpression" />
<el-table-column label="同步间隔时间" prop="shopGapTime" />
<el-table-column label="备注信息" prop="remark" />
<el-table-column label="刷新时间" prop="refreshTime" />
<el-table-column label="是否双向同步" prop="isTowSync">
@ -78,6 +79,13 @@
{{ scope.row.isTowSync === '1' ? '是' : '否' }}
</el-tag>
</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 label="操作" width="250">
<template slot-scope="scope">