修改更新欠费状态功能

This commit is contained in:
wuweihua
2026-09-23 15:53:12 +08:00
parent 8522201248
commit c62433c09e
9 changed files with 253 additions and 18 deletions
+55 -13
View File
@@ -6,6 +6,7 @@
:search-columns="searchColumns"
:query="queryList"
search-action-align="center"
:search-per-row="4"
row-key="billId"
>
<template #search-orderNos="{ model }">
@@ -66,6 +67,18 @@
<template #col-payTotal="{ row }">
<span class="payable">{{ formatMoney(row.payTotal) }}</span>
</template>
<template #toolbar="{ selection, ids }">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Refresh"
:disabled="!selection.length"
v-hasPermi="['price:billing:arrearsUpdate']"
@click="handleUpdateArrears(ids, selection)"
>更新欠费状态</el-button>
</el-col>
</template>
<template #col-action="{ row }">
<el-button link type="primary" icon="View" @click="handleView(row)">查看</el-button>
</template>
@@ -76,7 +89,8 @@
</template>
<script setup name="BillingBill">
import { listBill, getBill, listOrderNoOptions, listTrackingNoOptions, listTransferNoOptions } from '@/api/price/billing'
import { listBill, getBill, listOrderNoOptions, listTrackingNoOptions, listTransferNoOptions, updateCreditArrears } from '@/api/price/billing'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useProducts } from '@/components/ProductSelect/useProducts'
import BillDetail from './components/BillDetail.vue'
@@ -132,18 +146,53 @@ const columns = [
{ label: '操作', prop: 'action', align: 'center', width: 90, fixed: 'right', slot: 'action', showInToolbar: false }
]
const arrearsStatusOptions = [
{ label: '正常', value: 'NORMAL' },
{ label: '欠费', value: 'ARREARS' }
]
const searchColumns = [
{ label: '订单号', prop: 'orderNos', placeholder: '订单号' },
{ label: '运单号', prop: 'trackingNos', placeholder: '运单号' },
{ label: '转单号', prop: 'transferNos', placeholder: '转单号' },
{ label: '客户', prop: 'customerCodes', placeholder: '客户代码' },
{ label: '产品代码', prop: 'productCodes', placeholder: '产品代码' }
{ label: '产品代码', prop: 'productCodes', placeholder: '产品代码' },
{
label: '额度欠费',
prop: 'creditArrearsStatus',
component: 'select',
options: arrearsStatusOptions,
placeholder: '请选择',
props: { clearable: true }
}
]
function queryList(params) {
return listBill(params)
}
function handleUpdateArrears(ids, selection) {
const billIds = (ids && ids.length)
? ids
: (selection || []).map(row => row.billId).filter(Boolean)
if (!billIds.length) {
ElMessage.warning('请勾选要更新的订单')
return
}
const arrearsCount = (selection || []).filter(row => row.creditArrearsStatus === 'ARREARS').length
ElMessageBox.confirm(
'确认将勾选的 ' + billIds.length + ' 条订单更新欠费状态为正常?将逐单校验可用额度,校验不通过的不会更新' +
(arrearsCount < billIds.length ? '(当前勾选中欠费 ' + arrearsCount + ' 条)' : '') + '。',
'更新欠费状态',
{ type: 'warning' }
).then(() => {
return updateCreditArrears(billIds)
}).then(res => {
ElMessage.success(res.msg || '更新完成')
tableRef.value?.refresh?.()
}).catch(() => {})
}
function handleView(row) {
title.value = '计费详情'
open.value = true
@@ -217,17 +266,10 @@ function creditArrearsTagType(status) {
font-variant-numeric: tabular-nums;
}
/* 搜索栏铺满整行:搜索项 flex 等分拉伸,控件占满所在项 */
.billing-bill :deep(.basic-form.el-form--inline) {
display: flex;
flex-wrap: wrap;
}
.billing-bill :deep(.basic-form.el-form--inline > .el-form-item:not(.basic-form-action--center)) {
flex: 1 1 0;
margin-right: 12px;
}
.billing-bill :deep(.basic-form.el-form--inline .el-form-item .el-select),
.billing-bill :deep(.basic-form.el-form--inline .el-form-item .el-input) {
/* 搜索栏走 BasicTable search-per-row=4 的栅格布局(固定 4 项一行,多余换行),
这里只补齐插槽渲染的控件宽度,不再覆盖 BasicForm 的布局 */
.billing-bill :deep(.basic-form .el-form-item .el-select),
.billing-bill :deep(.basic-form .el-form-item .el-input) {
width: 100%;
}
</style>