增加一个渠道绑定

This commit is contained in:
wuweihua
2026-11-10 16:21:07 +08:00
parent e6a9fcf0a2
commit 1a0483c7fe
20 changed files with 940 additions and 147 deletions
+35 -26
View File
@@ -76,12 +76,12 @@
/>
<el-drawer v-model="detailVisible" :title="detailTitle" size="78%" destroy-on-close append-to-body @closed="onDetailClosed">
<pay-config-detail :product="detailProduct" :editable="detailEditing" />
<template #footer>
<el-button v-if="!detailEditing" type="primary" icon="Edit" @click="startEdit">修改</el-button>
<el-button v-else type="primary" @click="applyDetail">保存</el-button>
<el-button @click="detailVisible = false">关闭</el-button>
</template>
<pay-config-detail
:product="detailProduct"
:editable="true"
:saving-row-key="savingRowKey"
@save-row="saveDetailRow"
/>
</el-drawer>
</div>
</template>
@@ -111,9 +111,9 @@ const importMeta = reactive({
overwrite: false
})
const detailVisible = ref(false)
const detailEditing = ref(false)
const detailProduct = ref(null)
const detailRowKey = ref('')
const savingRowKey = ref('')
const detailTitle = computed(() => detailProduct.value?.productName || detailProduct.value?.sheetName || '产品明细')
const priceSetId = computed(() => {
@@ -135,13 +135,13 @@ const cardTitle = computed(() => {
const pageBanner = computed(() => {
const name = form.basic.priceSetName || ''
const code = form.basic.priceSetCode || ''
if (editVersionMode.value) return `编辑待生效版本 V${versionNo.value}:${name}(${code})`
if (editVersionMode.value) return `编辑版本 V${versionNo.value}:${name}(${code})`
return `新建版本:${name}(${code})`
})
const headerTip = computed(() => {
if (editVersionMode.value) return '可重新导入或修改明细;完成后覆盖本待生效版本,不新增版本号'
if (editVersionMode.value) return '可重新导入或修改明细;完成后覆盖本版本,不新增版本号'
if (newVersionMode.value) return '导入后生成待生效新版本;生效时间请回详情页设置'
return '打单价卡与应付独立;解析后回填到此表,查看后点修改可改明细'
return '打单价卡与应付独立;解析后回填到此表,查看明细后可在行内保存修改'
})
function goBack() {
@@ -219,28 +219,21 @@ function onImportConfirm(payload) {
function openDetail(row) {
if (!row) return
detailEditing.value = false
savingRowKey.value = ''
detailRowKey.value = row.rowKey || `${row.sheetName || ''}-${row.productName || ''}`
detailProduct.value = JSON.parse(JSON.stringify(row))
detailVisible.value = true
}
function startEdit() {
detailEditing.value = true
}
function onDetailClosed() {
detailEditing.value = false
detailProduct.value = null
detailRowKey.value = ''
savingRowKey.value = ''
}
function applyDetail() {
function applyEditedProduct() {
const edited = detailProduct.value
if (!edited) {
detailVisible.value = false
return
}
if (!edited) return false
const key = detailRowKey.value
const idx = productRows.value.findIndex(item => {
const itemKey = item.rowKey || `${item.sheetName || ''}-${item.productName || ''}`
@@ -248,7 +241,7 @@ function applyDetail() {
})
if (idx < 0) {
proxy.$modal.msgError('未找到对应产品行')
return
return false
}
const bands = edited.weightBands || []
const fees = edited.surcharges || []
@@ -261,9 +254,25 @@ function applyDetail() {
extraCount: extras.length,
parseStatus: bands.length + fees.length + extras.length === 0 ? 'EMPTY' : (edited.parseStatus || 'OK')
})
detailEditing.value = false
detailVisible.value = false
proxy.$modal.msgSuccess('已更新该产品明细')
return true
}
function saveDetailRow(payload) {
if (savingRowKey.value) {
payload?.done?.(false)
return
}
savingRowKey.value = payload?.rowKey || 'row'
let ok = false
try {
ok = !!applyEditedProduct()
if (ok) proxy.$modal.msgSuccess('该行已保存')
} catch (e) {
ok = false
} finally {
savingRowKey.value = ''
payload?.done?.(ok)
}
}
function statusType(status) {
@@ -295,7 +304,7 @@ async function finish() {
return
}
const tip = editVersionMode.value
? `将覆盖待生效版本 V${versionNo.value} 的 ${productRows.value.length} 个产品,确认继续?`
? `将覆盖版本 V${versionNo.value} 的 ${productRows.value.length} 个产品,确认继续?`
: newVersionMode.value
? `将为套餐「${form.basic.priceSetName || ''}」新建待生效版本并保存 ${productRows.value.length} 个产品,确认继续?`
: `将创建打单套餐并保存 ${productRows.value.length} 个应收产品,确认继续?`