调整应付配置和应付列表订单的费用重算

This commit is contained in:
liuminghui
2026-11-17 17:47:01 +08:00
parent 9483bb4899
commit 6b2b205083
45 changed files with 1448 additions and 2131 deletions
+23 -70
View File
@@ -14,6 +14,9 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="Link" :disabled="selection.length !== 1" @click="openBind(selection)" v-hasPermi="['price:pay:bind']">绑定渠道</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="createRef.open()" v-hasPermi="['price:pay:add']">新增价卡</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="Upload" @click="importRef.open()" v-hasPermi="['price:pay:import']">导入价卡</el-button>
</el-col>
@@ -26,9 +29,10 @@
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExportDetail" v-hasPermi="['price:pay:export']">导出明细</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="Setting" @click="openRule(selection)" v-hasPermi="['price:pay:edit']">附加费配置</el-button>
</el-col>
</template>
<template #col-chargeType="{ row }">
<span>{{ chargeTypeText(row.chargeType) }}</span>
</template>
<template #col-sourceFile="{ row }">
@@ -67,6 +71,7 @@
</basic-table>
<pay-import-dialog ref="importRef" @saved="tableRef.refresh()" />
<pay-create-dialog ref="createRef" @saved="tableRef.refresh()" />
<el-dialog v-model="bindVisible" title="绑定渠道" width="640px" append-to-body @closed="resetBind">
<el-form label-width="70px">
<el-form-item label="产品">
@@ -93,8 +98,6 @@
<el-button type="primary" :loading="bindSaving" @click="submitBind">确认</el-button>
</template>
</el-dialog>
<pay-surcharge-rule-dialog ref="ruleRef" />
<el-drawer v-model="historyVisible" :title="historyTitle" size="980px" append-to-body destroy-on-close>
<div class="history-bar">
<el-button type="primary" plain :disabled="historyPicked.length !== 2" @click="openCompare">比对所选版本</el-button>
@@ -120,31 +123,12 @@
<el-table-column label="操作" width="220" align="center">
<template #default="{ row }">
<el-button link type="primary" @click="downloadSource(row)" v-hasPermi="['price:pay:query']">下载</el-button>
<el-button link type="primary" @click="openRuleLog(row)" v-hasPermi="['price:pay:query']">附加费记录</el-button>
<el-button link type="primary" @click="openDetail(row)" v-hasPermi="['price:pay:query']">查看</el-button>
</template>
</el-table-column>
</el-table>
</el-drawer>
<el-dialog v-model="ruleLogVisible" :title="ruleLogTitle" width="860px" append-to-body>
<el-table v-loading="ruleLogLoading" :data="ruleLogRows" border size="small" empty-text="这一版还没有附加费配置记录">
<el-table-column label="操作" width="70" align="center">
<template #default="{ row }">{{ ruleLogAction(row.operationType) }}</template>
</el-table-column>
<el-table-column label="更改前" min-width="220" show-overflow-tooltip>
<template #default="{ row }">{{ ruleLogSide(row, 'before') }}</template>
</el-table-column>
<el-table-column label="更改后" min-width="220" show-overflow-tooltip>
<template #default="{ row }">{{ ruleLogSide(row, 'after') }}</template>
</el-table-column>
<el-table-column prop="createBy" label="操作人" width="100" align="center" />
<el-table-column label="操作时间" width="160" align="center">
<template #default="{ row }">{{ row.createTime || '-' }}</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog v-model="termVisible" title="修改有效期" width="460px" append-to-body>
<el-form label-width="90px">
<el-form-item label="生效开始" required>
@@ -221,16 +205,18 @@
</template>
<script setup name="PricePay">
import { listPay, getPay, delPay, updatePay, listPayTerm, updatePayTerm, changePayTermStatus, comparePay, listPaySurchargeRuleLog, batchBindChannelPay } from '@/api/price/pay'
import { listPay, getPay, delPay, updatePay, listPayTerm, updatePayTerm, changePayTermStatus, comparePay, batchBindChannelPay } from '@/api/price/pay'
import { listChannelOptions } from '@/api/masterdata/serviceChannel'
import { useDict } from '@/utils/dict'
import PayImportDialog from './components/PayImportDialog.vue'
import PayCreateDialog from './components/PayCreateDialog.vue'
import PayConfigDetail from './components/PayConfigDetail.vue'
import PaySurchargeRuleDialog from './components/PaySurchargeRuleDialog.vue'
const { proxy } = getCurrentInstance()
const { order_charge_type } = useDict('order_charge_type')
const tableRef = ref()
const importRef = ref()
const ruleRef = ref()
const createRef = ref()
const detailVisible = ref(false)
const detailLoading = ref(false)
const savingRowKey = ref('')
@@ -241,10 +227,6 @@ const historyRows = ref([])
const historyTitle = ref('价格版本')
const historyProductId = ref(null)
const historyPicked = ref([])
const ruleLogVisible = ref(false)
const ruleLogLoading = ref(false)
const ruleLogRows = ref([])
const ruleLogTitle = ref('附加费配置记录')
const compareVisible = ref(false)
const compareLoading = ref(false)
const compareTitle = ref('版本比对')
@@ -275,7 +257,7 @@ const statusOptions = [
]
const columns = [
{ label: '服务商渠道名称', prop: 'productName', align: 'center', minWidth: 180, showOverflowTooltip: true, fixed: 'left' },
{ label: '应付价卡名称', prop: 'productName', align: 'center', minWidth: 180, showOverflowTooltip: true, fixed: 'left' },
{ label: '价卡归属', prop: 'supplierName', align: 'center', width: 100 },
{ label: '国家/口岸', prop: 'countryScope', align: 'center', minWidth: 120, showOverflowTooltip: true },
{ label: '费用类型', prop: 'chargeType', align: 'center', width: 110 },
@@ -295,7 +277,7 @@ const columns = [
]
const searchColumns = [
{ label: '服务商渠道名称', prop: 'productName', component: 'input', placeholder: '产品名称', width: '180px' },
{ label: '应付价卡名称', prop: 'productName', component: 'input', placeholder: '产品名称', width: '180px' },
{ label: '价卡归属', prop: 'supplierName', component: 'input', placeholder: '威狮、易德、GWE', width: '160px' },
{ label: '来源文件', prop: 'sourceFile', component: 'input', placeholder: '文件名', width: '180px' },
{ label: '报价工作表', prop: 'sheetName', component: 'input', placeholder: '工作表', width: '160px' },
@@ -361,8 +343,13 @@ function handleDelete(ids) {
}).catch(() => {})
}
function openRule(selection) {
ruleRef.value?.open(selection || [])
function chargeTypeText(value) {
const hit = (order_charge_type.value || []).find(item => item.value === value)
if (hit) return hit.label
if (value === 'PER_KG') return '常规计费'
if (value === 'FLAT') return '一口价'
if (value === 'EXTRA') return '续重价'
return value || '-'
}
function channelLabel(item) {
@@ -397,7 +384,7 @@ function resetBind() {
function submitBind() {
if (!bindForm.productId) {
proxy.$modal.msgWarning('请选择一个产品')
proxy.$modal.msgWarning('请选择一个应付价卡')
return
}
if (!bindForm.channelIds.length) {
@@ -476,40 +463,6 @@ function termText(row) {
return `${start || '不限'} 至 ${end || '不限'}`
}
function openRuleLog(row) {
ruleLogTitle.value = `${row.productName || '产品'} 第 ${row.versionNo || '-'} 版的附加费配置记录`
ruleLogRows.value = []
ruleLogVisible.value = true
ruleLogLoading.value = true
listPaySurchargeRuleLog(row.productId, row.termId).then(res => {
ruleLogRows.value = res.data || []
}).finally(() => {
ruleLogLoading.value = false
})
}
function ruleLogAction(type) {
if (type === '1') return '新增'
if (type === '2') return '修改'
if (type === '3') return '删除'
return '-'
}
function ruleLogSide(row, side) {
let content = row.changeContent
if (typeof content === 'string') {
try {
content = JSON.parse(content)
} catch (error) {
return side === 'after' ? content : '-'
}
}
const values = content?.[side]
if (!values || typeof values !== 'object') return '-'
const text = Object.entries(values).map(([label, value]) => `${label}:${value}`).join(';')
return text || '-'
}
function openHistory(row) {
historyProductId.value = row.productId
historyTitle.value = `${row.productName || '产品'}的价格版本`