额度审批

This commit is contained in:
luojiaquan
2026-09-17 09:00:26 +08:00
parent 6487146117
commit 324da1baa1
14 changed files with 974 additions and 439 deletions
@@ -35,19 +35,3 @@ export function cancelBalanceWriteoff(writeoffId, cancelRemark) {
})
}
/** 账单查看:账单列表(只读) */
export function listCustomerBill(query) {
return request({
url: '/customersupplier/customerbill/list',
method: 'get',
params: query
})
}
/** 账单查看:账单详情(含明细) */
export function getCustomerBill(arBillId) {
return request({
url: '/customersupplier/customerbill/' + arBillId,
method: 'get'
})
}
@@ -68,11 +68,47 @@ export function listCreditFlow(query) {
})
}
/** 调整客户额度(信用额度/临时额度),调整过程留额度流水 */
export function adjustCredit(data) {
/** 提交额度调整申请(信用额度/临时额度),审批通过后才调整额度 */
export function applyCreditAdjust(data) {
return request({
url: '/customersupplier/customermoney/credit/adjust',
url: '/customersupplier/customermoney/credit/apply',
method: 'post',
data: data
})
}
/** 查询额度调整申请列表 */
export function listCreditApply(query) {
return request({
url: '/customersupplier/customermoney/credit/apply/list',
method: 'get',
params: query
})
}
/** 审批通过额度调整申请 */
export function approveCreditApply(applyId, approveRemark) {
return request({
url: '/customersupplier/customermoney/credit/apply/approve/' + applyId,
method: 'put',
data: { approveRemark }
})
}
/** 驳回额度调整申请 */
export function rejectCreditApply(applyId, approveRemark) {
return request({
url: '/customersupplier/customermoney/credit/apply/reject/' + applyId,
method: 'put',
data: { approveRemark }
})
}
/** 撤销待审批的额度调整申请 */
export function cancelCreditApply(applyId) {
return request({
url: '/customersupplier/customermoney/credit/apply/cancel/' + applyId,
method: 'put'
})
}
+6 -1
View File
@@ -1,6 +1,6 @@
<template>
<div class="app-container ar-bill-page">
<basic-table ref="tableRef" :columns="columns" :search-columns="searchColumns" :search-label-width="82" :query="queryList" row-key="arBillId" :selection="false">
<basic-table ref="tableRef" :columns="columns" :search-columns="searchColumns" :search-label-width="82" :query="queryList" :default-params="defaultSearchParams" row-key="arBillId" :selection="false">
<template #toolbar>
<el-col :span="1.5"><el-button type="primary" plain icon="Plus" v-hasPermi="['ar:bill:generate']" @click="generateOpen = true">生成账单</el-button></el-col>
</template>
@@ -32,7 +32,12 @@ import GenerateBillDialog from './components/GenerateBillDialog.vue'
import { AR_BILL_STATUS, AR_BILL_STATUS_OPTIONS, AR_BILL_STATUS_TYPES } from '@/constants/ar/bill'
const { proxy } = getCurrentInstance()
const route = useRoute()
const tableRef = ref()
// 从客户余额页“查看账单”跳入时,按当前客户预筛选(重置后仍保留该条件)
const defaultSearchParams = computed(() => ({
customerId: route.query.customerId ? Number(route.query.customerId) : undefined
}))
const detailOpen = ref(false)
const detailLoading = ref(false)
const detail = ref(null)
@@ -1,301 +0,0 @@
<template>
<div class="app-container">
<!-- 查询条件 -->
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
<el-form-item label="账单号" prop="billNo">
<el-input v-model="queryParams.billNo" placeholder="请输入账单号" clearable style="width: 180px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="账单名称" prop="billName">
<el-input v-model="queryParams.billName" placeholder="请输入账单名称" clearable style="width: 180px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="queryParams.customerName" placeholder="请输入客户名称" clearable style="width: 180px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="全部状态" clearable style="width: 140px">
<el-option v-for="opt in statusOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
<el-form-item label="币种" prop="currency">
<el-select v-model="queryParams.currency" placeholder="全部币种" clearable style="width: 120px">
<el-option v-for="c in currencyOptions" :key="c" :label="c" :value="c" />
</el-select>
</el-form-item>
<el-form-item label="账期">
<el-date-picker
v-model="dateRange"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始"
end-placeholder="结束"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button icon="Search" @click="toggleSearch">{{ showSearch ? '收起' : '展开' }}</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" />
</el-row>
<el-table v-loading="loading" :data="billList" border>
<el-table-column label="账单号" align="center" prop="billNo" min-width="170" show-overflow-tooltip />
<el-table-column label="账单名称" align="center" prop="billName" min-width="150" show-overflow-tooltip />
<el-table-column label="客户" align="center" prop="customerName" min-width="150" show-overflow-tooltip />
<el-table-column label="账期开始" align="center" prop="billPeriodStart" width="110">
<template #default="scope">{{ fmtDate(scope.row.billPeriodStart) }}</template>
</el-table-column>
<el-table-column label="账期结束" align="center" prop="billPeriodEnd" width="110">
<template #default="scope">{{ fmtDate(scope.row.billPeriodEnd) }}</template>
</el-table-column>
<el-table-column label="账单日期" align="center" prop="billDate" width="110">
<template #default="scope">{{ fmtDate(scope.row.billDate) }}</template>
</el-table-column>
<el-table-column label="订单数" align="center" prop="orderCount" width="80" />
<el-table-column label="应收金额" align="right" width="130">
<template #default="scope">
<span class="amount">{{ scope.row.currency }} {{ fmtMoney(scope.row.totalAmount) }}</span>
</template>
</el-table-column>
<el-table-column label="已核销" align="right" width="120">
<template #default="scope"><span class="written">{{ fmtMoney(scope.row.writtenOffAmount) }}</span></template>
</el-table-column>
<el-table-column label="未核销" align="right" width="120">
<template #default="scope"><span class="unwritten">{{ fmtMoney(scope.row.unwrittenAmount) }}</span></template>
</el-table-column>
<el-table-column label="状态" align="center" width="100">
<template #default="scope">
<el-tag :type="statusTag(scope.row.status)">{{ statusLabel(scope.row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="80" fixed="right">
<template #default="scope">
<el-button link type="primary" icon="View" @click="handleView(scope.row)"
v-hasPermi="['customer:bill:query']">详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 账单详情抽屉(只读) -->
<el-drawer v-model="detailOpen" size="72%" :title="drawerTitle" destroy-on-close>
<div v-loading="detailLoading" class="bill-detail">
<template v-if="detail">
<el-descriptions :column="3" border size="small">
<el-descriptions-item label="账单号">{{ detail.billNo }}</el-descriptions-item>
<el-descriptions-item label="账单名称" :span="2">{{ detail.billName || '-' }}</el-descriptions-item>
<el-descriptions-item label="客户">{{ detail.customerName }}</el-descriptions-item>
<el-descriptions-item label="客户编码">{{ detail.customerCode || '-' }}</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag :type="statusTag(detail.status)">{{ statusLabel(detail.status) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="账期开始">{{ fmtDate(detail.billPeriodStart) }}</el-descriptions-item>
<el-descriptions-item label="账期结束">{{ fmtDate(detail.billPeriodEnd) }}</el-descriptions-item>
<el-descriptions-item label="账单日期">{{ fmtDate(detail.billDate) }}</el-descriptions-item>
<el-descriptions-item label="币种">{{ detail.currency }}</el-descriptions-item>
<el-descriptions-item label="订单数">{{ detail.orderCount }}</el-descriptions-item>
<el-descriptions-item label="应收金额">
<span class="amount">{{ fmtMoney(detail.totalAmount) }}</span>
</el-descriptions-item>
<el-descriptions-item label="已核销金额">
<span class="written">{{ fmtMoney(detail.writtenOffAmount) }}</span>
</el-descriptions-item>
<el-descriptions-item label="未核销金额">
<span class="unwritten">{{ fmtMoney(detail.unwrittenAmount) }}</span>
</el-descriptions-item>
<el-descriptions-item label="确认人">{{ detail.confirmedBy || '-' }}</el-descriptions-item>
<el-descriptions-item label="确认时间">{{ fmtDateTime(detail.confirmedTime) }}</el-descriptions-item>
<el-descriptions-item label="收款银行">
{{ [detail.bankName, detail.bankAccountName].filter(Boolean).join(' / ') || '-' }}
</el-descriptions-item>
<el-descriptions-item label="备注" :span="3">{{ detail.remark || '-' }}</el-descriptions-item>
</el-descriptions>
<div class="detail-title">订单明细({{ detail.details?.length || 0 }} 单)</div>
<el-table :data="detail.details || []" border size="small" row-key="detailId">
<el-table-column type="expand">
<template #default="props">
<div class="fee-wrap">
<div class="fee-title">费用明细</div>
<el-table :data="props.row.fees || []" border size="small">
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column label="费用名称" prop="feeName" min-width="120" show-overflow-tooltip />
<el-table-column label="数量" prop="quantity" width="90" align="right" />
<el-table-column label="单位" prop="unit" width="70" align="center" />
<el-table-column label="单价" prop="unitPrice" width="100" align="right" />
<el-table-column label="金额" prop="amount" width="110" align="right">
<template #default="f">{{ f.row.currency }} {{ fmtMoney(f.row.amount) }}</template>
</el-table-column>
<el-table-column label="备注" prop="remark" min-width="120" show-overflow-tooltip />
<template #empty><span class="empty-tip">无费用明细</span></template>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column label="序号" prop="detailNo" width="60" align="center" />
<el-table-column label="订单号" prop="orderNo" min-width="140" show-overflow-tooltip />
<el-table-column label="跟踪号" prop="trackingNo" min-width="140" show-overflow-tooltip />
<el-table-column label="产品" prop="productName" min-width="120" show-overflow-tooltip />
<el-table-column label="目的国" prop="countryName" width="100" align="center" />
<el-table-column label="实重" prop="actualWeight" width="80" align="right" />
<el-table-column label="体积重" prop="volumeWeight" width="80" align="right" />
<el-table-column label="计费重" prop="chargeWeight" width="80" align="right" />
<el-table-column label="金额" prop="totalAmount" width="120" align="right">
<template #default="scope">{{ scope.row.currency }} {{ fmtMoney(scope.row.totalAmount) }}</template>
</el-table-column>
</el-table>
</template>
</div>
</el-drawer>
</div>
</template>
<script setup name="CustomerBill">
import { listCustomerBill, getCustomerBill } from '@/api/customersuppliermanagement/customermoney/customerbill'
const { proxy } = getCurrentInstance()
const route = useRoute()
const statusOptions = [
{ value: 'DRAFT', label: '草稿' },
{ value: 'CONFIRMED', label: '已确认' },
{ value: 'PARTIAL_WRITTEN_OFF', label: '部分核销' },
{ value: 'WRITTEN_OFF', label: '已核销' },
{ value: 'VOID', label: '已作废' }
]
const statusTagMap = { DRAFT: 'info', CONFIRMED: 'warning', PARTIAL_WRITTEN_OFF: 'primary', WRITTEN_OFF: 'success', VOID: 'danger' }
const currencyOptions = ['CNY', 'USD', 'EUR', 'GBP', 'HKD', 'JPY']
const billList = ref([])
const loading = ref(false)
const total = ref(0)
const showSearch = ref(true)
const dateRange = ref([])
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
billNo: '',
billName: '',
customerName: '',
customerId: route.query.customerId || undefined,
status: '',
currency: ''
})
const detailOpen = ref(false)
const detailLoading = ref(false)
const detail = ref(null)
const drawerTitle = computed(() => detail.value ? `账单详情 - ${detail.value.billNo}` : '账单详情')
function statusLabel(v) {
return statusOptions.find(o => o.value === v)?.label || v || '-'
}
function statusTag(v) {
return statusTagMap[v] || 'info'
}
function fmtMoney(v) {
const n = Number(v)
return isNaN(n) ? '0.00' : n.toFixed(2)
}
function fmtDate(v) {
return v ? String(v).substring(0, 10) : '-'
}
function fmtDateTime(v) {
return v ? String(v).substring(0, 16) : '-'
}
function getList() {
loading.value = true
const params = proxy.addDateRange({ ...queryParams }, dateRange.value)
listCustomerBill(params).then(res => {
billList.value = res.rows || []
total.value = res.total || 0
}).finally(() => {
loading.value = false
})
}
function handleQuery() {
queryParams.pageNum = 1
getList()
}
function resetQuery() {
dateRange.value = []
proxy.resetForm('queryRef')
// 从客户余额页跳入时保留客户过滤
queryParams.customerId = route.query.customerId || undefined
handleQuery()
}
function toggleSearch() {
showSearch.value = !showSearch.value
}
function handleView(row) {
detail.value = null
detailOpen.value = true
detailLoading.value = true
getCustomerBill(row.arBillId).then(res => {
detail.value = res.data || null
}).finally(() => {
detailLoading.value = false
})
}
getList()
</script>
<style scoped>
.amount {
color: var(--el-color-danger);
font-weight: 600;
}
.written {
color: var(--el-color-success);
font-weight: 600;
}
.unwritten {
color: var(--el-color-warning);
font-weight: 600;
}
.bill-detail {
padding: 0 16px 16px;
}
.detail-title {
font-weight: 600;
font-size: 14px;
margin: 16px 0 8px;
padding-left: 8px;
border-left: 3px solid var(--el-color-primary);
}
.fee-wrap {
padding: 8px 16px;
background: var(--el-fill-color-light);
}
.fee-title {
font-weight: 600;
margin-bottom: 8px;
font-size: 13px;
}
.empty-tip {
color: var(--el-text-color-secondary);
font-size: 12px;
}
.mb8 {
margin-bottom: 8px;
}
</style>
@@ -14,14 +14,14 @@
<el-button
icon="Document"
@click="goBillView"
v-hasPermi="['customer:bill:list']"
v-hasPermi="['ar:bill:list']"
>查看账单</el-button>
<el-button
type="primary"
icon="Money"
@click="openAdjustDialog()"
v-hasPermi="['customer:credit:adjust']"
>额度调整</el-button>
>额度调整申请</el-button>
</div>
</div>
</el-card>
@@ -339,6 +339,97 @@
@pagination="getCreditFlowList"
/>
</el-tab-pane>
<!-- ====== 额度审批(信用/额外额度调整申请) ====== -->
<el-tab-pane label="额度审批" name="creditApply">
<el-alert type="warning" :closable="false" class="credit-apply-tip">
信用额度 / 额外额度调整需先提交申请,审批通过后额度才会调整并写入额度流水。
</el-alert>
<el-form :model="applyQuery" :inline="true" class="search-form">
<el-form-item label="额度类型" prop="creditType">
<el-select v-model="applyQuery.creditType" placeholder="全部" clearable style="width: 130px;">
<el-option v-for="opt in creditTypeOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="applyQuery.status" placeholder="全部" clearable style="width: 130px;">
<el-option v-for="opt in applyStatusOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="getApplyList">搜索</el-button>
<el-button icon="Refresh" @click="resetApplyQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="applyList" border v-loading="applyLoading">
<el-table-column label="申请单号" align="center" prop="applyNo" width="180" />
<el-table-column label="额度类型" align="center" prop="creditType" width="100">
<template #default="scope">
<el-tag :type="scope.row.creditType === 'TEMP' ? 'warning' : ''">
{{ formatOption(creditTypeOptions, scope.row.creditType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="调整方式" align="center" prop="adjustMode" width="90">
<template #default="scope">{{ formatOption(adjustModeOptions, scope.row.adjustMode) }}</template>
</el-table-column>
<el-table-column label="调整金额" align="center" prop="changeAmount" width="110">
<template #default="scope">{{ formatMoney(scope.row.changeAmount) }}</template>
</el-table-column>
<el-table-column label="生效日期" align="center" prop="effectiveDate" width="100">
<template #default="scope">{{ scope.row.effectiveDate || '-' }}</template>
</el-table-column>
<el-table-column label="失效日期" align="center" prop="expireDate" width="100">
<template #default="scope">{{ scope.row.expireDate || '长期' }}</template>
</el-table-column>
<el-table-column label="调整原因" align="center" prop="reason" min-width="150" show-overflow-tooltip />
<el-table-column label="状态" align="center" prop="status" width="90">
<template #default="scope">
<el-tag :type="applyStatusTag(scope.row.status)" size="small">
{{ formatOption(applyStatusOptions, scope.row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="申请人" align="center" prop="applyBy" width="100" />
<el-table-column label="申请时间" align="center" prop="applyTime" width="150">
<template #default="scope">{{ formatDateTime(scope.row.applyTime) }}</template>
</el-table-column>
<el-table-column label="审批人" align="center" prop="approveBy" width="100">
<template #default="scope">{{ scope.row.approveBy || '-' }}</template>
</el-table-column>
<el-table-column label="审批时间" align="center" prop="approveTime" width="150">
<template #default="scope">{{ scope.row.approveTime ? formatDateTime(scope.row.approveTime) : '-' }}</template>
</el-table-column>
<el-table-column label="审批意见" align="center" prop="approveRemark" min-width="140" show-overflow-tooltip>
<template #default="scope">{{ scope.row.approveRemark || '-' }}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150" fixed="right">
<template #default="scope">
<template v-if="scope.row.status === 'PENDING'">
<el-button link type="success" size="small"
@click="handleApproveApply(scope.row)"
v-hasPermi="['customer:credit:approve']">通过</el-button>
<el-button link type="danger" size="small"
@click="handleRejectApply(scope.row)"
v-hasPermi="['customer:credit:approve']">驳回</el-button>
<el-button link type="warning" size="small"
@click="handleCancelApply(scope.row)"
v-hasPermi="['customer:credit:adjust']">撤销</el-button>
</template>
<span v-else>-</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="applyTotal > 0"
:total="applyTotal"
v-model:page="applyQuery.pageNum"
v-model:limit="applyQuery.pageSize"
@pagination="getApplyList"
/>
</el-tab-pane>
<!-- ====== 账单核销(用账户余额核销应收账单) ====== -->
<el-tab-pane label="账单核销" name="billWriteoff">
<el-alert type="info" :closable="false" class="writeoff-summary">
@@ -348,7 +439,7 @@
<span>账户余额:<b class="money-in">CNY {{ formatMoney(currentAccount.balance) }}</b></span>
<el-button type="primary" link size="small" icon="Refresh" @click="loadBillWriteoffData">刷新</el-button>
<el-button type="primary" plain size="small" @click="goBillView"
v-hasPermi="['customer:bill:list']">查看全部账单</el-button>
v-hasPermi="['ar:bill:list']">查看全部账单</el-button>
</div>
</el-alert>
@@ -621,9 +712,9 @@
</template>
</el-dialog>
<!-- ====== 额度调整弹窗 ====== -->
<!-- ====== 额度调整申请弹窗 ====== -->
<el-dialog
:title="creditDialog.form.creditType === 'TEMP' ? '临时额度调整' : '信用额度调整'"
:title="(creditDialog.form.creditType === 'TEMP' ? '额外额度调整申请' : '信用额度调整申请') + '(提交后需审批)'"
v-model="creditDialog.visible"
width="600px"
append-to-body
@@ -724,7 +815,7 @@
</div>
<template #footer>
<el-button type="primary" :loading="creditSubmitLoading" @click="submitAdjustCredit">确 定</el-button>
<el-button type="primary" :loading="creditSubmitLoading" @click="submitAdjustCredit">提交申请</el-button>
<el-button @click="creditDialog.visible = false">取 消</el-button>
</template>
</el-dialog>
@@ -804,7 +895,7 @@
import axios from 'axios'
import { saveAs } from 'file-saver'
import { getCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
import { listAccount, listReceipt, getReceipt, addReceipt, confirmReceipt, cancelReceipt, listFlow, listCreditFlow, adjustCredit } from "@/api/customersuppliermanagement/customermoney/customermoney.js"
import { listAccount, listReceipt, getReceipt, addReceipt, confirmReceipt, cancelReceipt, listFlow, listCreditFlow, applyCreditAdjust, listCreditApply, approveCreditApply, rejectCreditApply, cancelCreditApply } from "@/api/customersuppliermanagement/customermoney/customermoney.js"
import { listUnsettledBill, listBalanceWriteoff, balanceWriteoff, cancelBalanceWriteoff } from "@/api/customersuppliermanagement/customermoney/customerbill.js"
import { convertToBase } from "@/api/data/exchangeRate"
import { getToken } from "@/utils/auth"
@@ -1056,12 +1147,12 @@ function submitAdjustCredit() {
payload.expireDate = f.expireDate || null
}
creditSubmitLoading.value = true
adjustCredit(payload).then(() => {
proxy.$modal.msgSuccess('额度调整成功')
applyCreditAdjust(payload).then(() => {
proxy.$modal.msgSuccess('申请已提交,等待审批')
creditDialog.visible = false
loadCustomer()
loadAccounts()
getCreditFlowList()
if (creditApplyLoaded) {
getApplyList()
}
}).finally(() => {
creditSubmitLoading.value = false
})
@@ -1346,6 +1437,88 @@ function resetCreditFlowQuery() {
getCreditFlowList()
}
/* ================= 额度调整申请/审批 ================= */
const applyStatusOptions = [
{ value: 'PENDING', label: '待审批' },
{ value: 'APPROVED', label: '已通过' },
{ value: 'REJECTED', label: '已驳回' },
{ value: 'CANCELLED', label: '已撤销' }
]
const applyStatusTagMap = { PENDING: 'warning', APPROVED: 'success', REJECTED: 'danger', CANCELLED: 'info' }
function applyStatusTag(v) {
return applyStatusTagMap[v] || 'info'
}
const applyList = ref([])
const applyTotal = ref(0)
const applyLoading = ref(false)
const applyQuery = reactive({
pageNum: 1,
pageSize: 10,
customerId: route.query.customerId,
creditType: '',
status: ''
})
let creditApplyLoaded = false
function getApplyList() {
const customerId = route.query.customerId
if (!customerId) return
applyLoading.value = true
applyQuery.customerId = customerId
listCreditApply({ ...applyQuery }).then(res => {
applyList.value = res.rows || []
applyTotal.value = res.total || 0
}).finally(() => {
applyLoading.value = false
})
}
function resetApplyQuery() {
applyQuery.creditType = ''
applyQuery.status = ''
applyQuery.pageNum = 1
getApplyList()
}
/** 审批通过后刷新账户卡片与额度流水 */
function afterApplyHandled() {
getApplyList()
loadAccounts()
getCreditFlowList()
}
function handleApproveApply(row) {
proxy.$modal.confirm(`确认通过额度调整申请「${row.applyNo}」?通过后将立即调整客户额度并写入额度流水。`)
.then(() => approveCreditApply(row.applyId, '审批通过'))
.then(() => {
proxy.$modal.msgSuccess('已审批通过')
afterApplyHandled()
}).catch(() => {})
}
function handleRejectApply(row) {
proxy.$prompt('请输入驳回原因', '驳回额度调整申请', {
confirmButtonText: '确认驳回',
cancelButtonText: '取消',
inputType: 'textarea',
inputPattern: /\S+/,
inputErrorMessage: '驳回原因不能为空'
}).then(({ value }) => rejectCreditApply(row.applyId, value)).then(() => {
proxy.$modal.msgSuccess('已驳回')
getApplyList()
}).catch(() => {})
}
function handleCancelApply(row) {
proxy.$modal.confirm(`确认撤销待审批申请「${row.applyNo}」?`)
.then(() => cancelCreditApply(row.applyId))
.then(() => {
proxy.$modal.msgSuccess('已撤销')
getApplyList()
}).catch(() => {})
}
/* ================= 账单核销 ================= */
const billStatusMap = {
DRAFT: { label: '草稿', type: 'info' },
@@ -1366,7 +1539,7 @@ function formatDate(val) {
}
function goBillView() {
router.push({
path: '/customersuppliermanagement/customerbill',
path: '/ar/bill',
query: { customerId: route.query.customerId || '' }
})
}
@@ -1510,6 +1683,10 @@ function submitCancelWriteoff() {
}
watch(activeTab, (tab) => {
if (tab === 'creditApply' && !creditApplyLoaded) {
creditApplyLoaded = true
getApplyList()
}
if (tab === 'billWriteoff' && !billWriteoffLoaded) {
billWriteoffLoaded = true
loadBillWriteoffData()
@@ -1632,6 +1809,13 @@ function initPage() {
flowTotal.value = 0
creditFlowList.value = []
creditFlowTotal.value = 0
applyList.value = []
applyTotal.value = 0
applyQuery.customerId = customerId
applyQuery.creditType = ''
applyQuery.status = ''
applyQuery.pageNum = 1
creditApplyLoaded = false
unsettledList.value = []
writeoffList.value = []
writeoffTotal.value = 0
@@ -1716,6 +1900,9 @@ watch(() => route.query.customerId, (newId, oldId) => {
.credit-tip {
margin-bottom: 12px;
}
.credit-apply-tip {
margin-bottom: 12px;
}
.credit-preview {
margin-top: 4px;
padding: 10px 14px;
@@ -124,7 +124,11 @@
<el-table-column label="客户名称" align="center" prop="customerName" />
<el-table-column label="对外代码" align="center" prop="customerCodeDw" />
<el-table-column label="统一社会信用代码" align="center" prop="creditCode" />
<el-table-column label="业务类型" align="center" prop="customerType" />
<el-table-column label="业务类型" align="center" prop="customerType">
<template #default="scope">
<dict-tag :options="customer_type" :value="scope.row.customerType" />
</template>
</el-table-column>
<el-table-column label="启用状态" align="center" prop="isEnable">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.isEnable" />
@@ -154,7 +158,14 @@
<el-table-column label="重量阈值" align="center" prop="weightThreshold" />
<el-table-column label="抛比" align="center" prop="throwRatio" />
<el-table-column label="信用额度" align="center" prop="creditEd" />
<el-table-column label="绑定产品ID" align="center" prop="productIds" />
<el-table-column label="绑定产品" align="center" prop="productIds" min-width="180">
<template #default="scope">
<span v-if="productNames(scope.row.productIds)" :title="productNames(scope.row.productIds)">
{{ productNames(scope.row.productIds) }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="备注说明" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240">
<template #default="scope">
@@ -178,6 +189,7 @@
<script setup name="Customer">
import { listCustomer, delCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
import { useProducts, parseProductIds } from '@/components/ProductSelect/useProducts'
const { proxy } = getCurrentInstance()
@@ -189,7 +201,14 @@ const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const { sys_normal_disable, settlement_type } = useDict("sys_normal_disable", "settlement_type")
const { sys_normal_disable, settlement_type, customer_type } = useDict("sys_normal_disable", "settlement_type", "customer_type")
/** 绑定产品ID串 -> 产品名称展示(产品代码+名称;查不到的产品回显原ID) */
const { ensureProducts, getProductLabel } = useProducts()
function productNames(productIds) {
return parseProductIds(productIds).map(id => getProductLabel(id)).join(',')
}
ensureProducts()
/** 格式化余额(数据源 customer_account 余额表) */
function formatBalance(val) {