账单bug修复,以及加入转单号功能
This commit is contained in:
@@ -365,6 +365,10 @@ async function getList() {
|
||||
total.value = res?.total || 0
|
||||
} catch (e) {
|
||||
console.error('BasicTable 加载失败', e)
|
||||
// 查询失败时清空旧结果,避免用户误以为旧列表是本次查询结果。
|
||||
tableData.value = []
|
||||
total.value = 0
|
||||
selectionList.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
@@ -200,6 +200,21 @@ export const dynamicRoutes = [
|
||||
meta: { title: '供应商编辑', activeMenu: '/customersuppliermanagement/supplierinfo' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
// 兼容旧入口 /ar/bill/log;正式菜单路由由数据库菜单生成,当前菜单路径为 /ar/log。
|
||||
path: '/ar/bill/log',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['ar:log:list'],
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/ar/bill/log.vue'),
|
||||
name: 'ArBillLogCompat',
|
||||
meta: { title: '应收日志', activeMenu: '/ar/log' }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-drawer :model-value="modelValue" :title="detail?.billNo || '应收账单详情'" size="1000px" append-to-body destroy-on-close @update:model-value="$emit('update:modelValue', $event)">
|
||||
<el-drawer class="bill-detail-drawer" :model-value="modelValue" :title="detail?.billNo || '应收账单详情'" size="min(1000px, 100vw)" append-to-body destroy-on-close @update:model-value="$emit('update:modelValue', $event)">
|
||||
<div v-loading="loading">
|
||||
<el-empty v-if="!detail" description="暂无详情" />
|
||||
<template v-else>
|
||||
@@ -37,6 +37,7 @@
|
||||
<el-table-column prop="detailNo" label="#" width="55" align="center" />
|
||||
<el-table-column prop="orderNo" label="订单号" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="trackingNo" label="运单号" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="transferNo" label="转单号" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="产品" min-width="150"><template #default="{ row }">{{ row.productName || row.productCode || '-' }}</template></el-table-column>
|
||||
<el-table-column label="目的地" min-width="120"><template #default="{ row }">{{ row.countryName || row.countryCode || '-' }}</template></el-table-column>
|
||||
<el-table-column label="重量/尺寸" min-width="170"><template #default="{ row }">{{ row.chargeWeight || '-' }} kg / {{ dimensions(row) }}</template></el-table-column>
|
||||
@@ -139,6 +140,7 @@ function mask(value) { if (!value) return '-'; return value.length <= 4 ? '****'
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
:deep(.bill-detail-drawer) { max-width: 100vw; }
|
||||
.summary { margin-bottom: 18px; }
|
||||
.total { color: #f56c6c; font-size: 16px; font-weight: 600; }
|
||||
.section-title { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; font-weight: 600; }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<el-col :span="8"><el-form-item label="客户" prop="customerId"><customer-select v-model="generateForm.customerId" placeholder="请选择客户" @change="handleCustomerChange" /></el-form-item></el-col>
|
||||
<el-col :span="8"><el-form-item label="币种" prop="currency"><el-select v-model="generateForm.currency" placeholder="请选择币种" style="width: 100%;" @change="handleCurrencyChange"><el-option label="人民币 CNY" value="CNY" /><el-option label="美元 USD" value="USD" /></el-select></el-form-item></el-col>
|
||||
<el-col :span="8"><el-form-item label="账单截止日" prop="cutoffDate"><el-date-picker v-model="generateForm.cutoffDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择账单截止日" style="width: 100%;" @change="resetPreview" /></el-form-item></el-col>
|
||||
<el-col :span="8"><el-form-item label="订单/运单号"><el-input v-model="generateForm.orderOrTrackingNo" placeholder="请输入订单号或运单号" clearable /></el-form-item></el-col>
|
||||
<el-col :span="8"><el-form-item label="单号"><el-input v-model="generateForm.orderOrTrackingNo" placeholder="请输入订单号、运单号或转单号" clearable /></el-form-item></el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="payee-card" v-loading="bankAccountLoading">
|
||||
@@ -60,6 +60,7 @@
|
||||
<el-table-column type="selection" width="50" fixed="left" :selectable="isMainRowSelectable" />
|
||||
<el-table-column prop="orderNo" label="订单号" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="trackingNo" label="运单号" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="transferNo" label="转单号" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="customerName" label="客户" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="bizDate" label="业务日期" width="105" :formatter="formatDateColumn" />
|
||||
<el-table-column prop="productName" label="产品" min-width="140" show-overflow-tooltip />
|
||||
@@ -87,13 +88,14 @@
|
||||
|
||||
<el-dialog v-model="excludeDialogOpen" title="选择排除订单" width="1100px" append-to-body destroy-on-close @close="handleExcludeDialogClose">
|
||||
<div class="exclude-toolbar">
|
||||
<el-input v-model="excludeKeyword" clearable placeholder="请输入订单号或运单号" class="exclude-search-input" />
|
||||
<el-input v-model="excludeKeyword" clearable placeholder="请输入订单号、运单号或转单号" class="exclude-search-input" />
|
||||
<el-button type="primary" :loading="excludeLoading" @click="queryExcludeRows">查询</el-button>
|
||||
</div>
|
||||
<el-table ref="excludeTableRef" v-loading="excludeLoading" :data="excludeRowsPage" row-key="billId" border stripe max-height="420" empty-text="暂无符合条件的订单" @selection-change="handleExcludeSelectionChange">
|
||||
<el-table-column type="selection" width="50" fixed="left" />
|
||||
<el-table-column prop="orderNo" label="订单号" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column prop="trackingNo" label="运单号" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="transferNo" label="转单号" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="customerName" label="客户" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="bizDate" label="业务日期" width="120" :formatter="formatDateColumn" />
|
||||
<el-table-column prop="incomeTotal" label="应收金额" width="130" align="right" :formatter="formatNumberColumn" />
|
||||
|
||||
+42
-16
@@ -924,7 +924,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- ====== 余额核销账单弹窗 ====== -->
|
||||
<el-dialog title="余额核销账单" v-model="woDialog.visible" width="560px" append-to-body>
|
||||
<el-dialog title="余额核销账单" v-model="woDialog.visible" width="560px" append-to-body v-loading="woDialog.accountLoading">
|
||||
<el-descriptions :column="1" border size="small" v-if="woDialog.bill">
|
||||
<el-descriptions-item label="账单号">{{ woDialog.bill.billNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="账单名称">{{ woDialog.bill.billName || '-' }}</el-descriptions-item>
|
||||
@@ -937,13 +937,12 @@
|
||||
</el-descriptions>
|
||||
<el-form :model="woDialog.form" label-width="110px" class="wo-form">
|
||||
<el-form-item label="本次核销金额" required>
|
||||
<el-input-number
|
||||
<el-input
|
||||
v-model="woDialog.form.writeoffAmount"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0.01"
|
||||
controls-position="right"
|
||||
inputmode="decimal"
|
||||
clearable
|
||||
style="width: 220px;"
|
||||
placeholder="请输入核销金额"
|
||||
/>
|
||||
<span class="wo-form-unit">CNY</span>
|
||||
</el-form-item>
|
||||
@@ -1851,7 +1850,8 @@ function loadBillWriteoffData() {
|
||||
|
||||
/* ---- 核销弹窗 ---- */
|
||||
const woSubmitLoading = ref(false)
|
||||
const woDialog = reactive({ visible: false, bill: null, form: {} })
|
||||
const woDialog = reactive({ visible: false, bill: null, form: {}, accountLoading: false })
|
||||
let writeoffAccountRequestSerial = 0
|
||||
/** 核销后余额预览(不为负则可提交) */
|
||||
const woAfterBalance = computed(() => {
|
||||
const balance = Number(currentAccount.value.balance) || 0
|
||||
@@ -1859,27 +1859,53 @@ const woAfterBalance = computed(() => {
|
||||
return formatMoney(balance - amount)
|
||||
})
|
||||
|
||||
function openWriteoffDialog(row) {
|
||||
// 先刷新账户余额,避免用过期余额核销
|
||||
listAccount(route.query.customerId).then(res => {
|
||||
accountList.value = res.data || []
|
||||
})
|
||||
async function openWriteoffDialog(row) {
|
||||
const customerId = Number(route.query.customerId)
|
||||
if (!customerId) {
|
||||
proxy.$modal.msgError('缺少客户ID,无法发起核销')
|
||||
return
|
||||
}
|
||||
|
||||
woDialog.bill = row
|
||||
const balance = Number(currentAccount.value.balance) || 0
|
||||
const unwritten = Number(row.unwrittenAmount) || 0
|
||||
woDialog.form = {
|
||||
arBillId: row.arBillId,
|
||||
customerId: Number(route.query.customerId),
|
||||
writeoffAmount: Math.min(unwritten, balance > 0 ? balance : unwritten),
|
||||
customerId,
|
||||
// 余额接口返回前先显示 0,避免使用旧余额或在余额为 0 时错误带出整笔未核销金额。
|
||||
writeoffAmount: 0,
|
||||
writeoffDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
|
||||
remark: ''
|
||||
}
|
||||
woDialog.visible = true
|
||||
|
||||
// 必须等待余额刷新完成后再计算默认金额,避免异步请求尚未返回就读取旧余额。
|
||||
const requestSerial = ++writeoffAccountRequestSerial
|
||||
woDialog.accountLoading = true
|
||||
try {
|
||||
const res = await listAccount(customerId)
|
||||
if (requestSerial !== writeoffAccountRequestSerial) return
|
||||
accountList.value = res.data || []
|
||||
const balance = Math.max(0, Number(currentAccount.value.balance) || 0)
|
||||
woDialog.form.writeoffAmount = Math.min(unwritten, balance)
|
||||
} catch (e) {
|
||||
if (requestSerial !== writeoffAccountRequestSerial) return
|
||||
woDialog.form.writeoffAmount = 0
|
||||
proxy.$modal.msgError('账户余额刷新失败,请稍后重试')
|
||||
} finally {
|
||||
if (requestSerial === writeoffAccountRequestSerial) woDialog.accountLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
function submitWriteoff() {
|
||||
if (woDialog.accountLoading) {
|
||||
proxy.$modal.msgWarning('正在刷新账户余额,请稍候')
|
||||
return
|
||||
}
|
||||
const bill = woDialog.bill
|
||||
const amount = Number(woDialog.form.writeoffAmount)
|
||||
const rawAmount = typeof woDialog.form.writeoffAmount === 'string'
|
||||
? woDialog.form.writeoffAmount.trim()
|
||||
: woDialog.form.writeoffAmount
|
||||
const amount = Number(rawAmount)
|
||||
if (!(amount > 0)) {
|
||||
proxy.$modal.msgError('核销金额必须大于0')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user