✨ 客户余额页增加只读账单弹窗
This commit is contained in:
+25
-1
@@ -11,8 +11,11 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.bms.ar.domain.ArBill;
|
||||||
import com.bms.ar.domain.ArBalanceWriteoff;
|
import com.bms.ar.domain.ArBalanceWriteoff;
|
||||||
|
import com.bms.ar.domain.vo.ArBillQuery;
|
||||||
import com.bms.ar.service.IArBalanceWriteoffService;
|
import com.bms.ar.service.IArBalanceWriteoffService;
|
||||||
|
import com.bms.ar.service.IArBillService;
|
||||||
import com.bms.common.annotation.Log;
|
import com.bms.common.annotation.Log;
|
||||||
import com.bms.common.core.controller.BaseController;
|
import com.bms.common.core.controller.BaseController;
|
||||||
import com.bms.common.core.domain.AjaxResult;
|
import com.bms.common.core.domain.AjaxResult;
|
||||||
@@ -20,7 +23,7 @@ import com.bms.common.core.page.TableDataInfo;
|
|||||||
import com.bms.common.enums.BusinessType;
|
import com.bms.common.enums.BusinessType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户余额核销应收账单 Controller(账单查看统一走应收管理-应收账单页面)
|
* 客户余额账单查询与核销 Controller
|
||||||
*
|
*
|
||||||
* @author bms
|
* @author bms
|
||||||
* @date 2026-09-16
|
* @date 2026-09-16
|
||||||
@@ -32,6 +35,27 @@ public class CustomerBillController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IArBalanceWriteoffService balanceWriteoffService;
|
private IArBalanceWriteoffService balanceWriteoffService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IArBillService billService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定客户的应收账单(分页)。客户ID来自路径并覆盖查询对象中的同名参数。
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
|
||||||
|
@GetMapping("/list/{customerId}")
|
||||||
|
public TableDataInfo billList(@PathVariable("customerId") Long customerId, ArBillQuery query)
|
||||||
|
{
|
||||||
|
if (customerId == null || customerId <= 0L)
|
||||||
|
{
|
||||||
|
return getDataTable(Collections.emptyList());
|
||||||
|
}
|
||||||
|
ArBillQuery billQuery = query == null ? new ArBillQuery() : query;
|
||||||
|
billQuery.setCustomerId(customerId);
|
||||||
|
startPage();
|
||||||
|
List<ArBill> list = billService.selectArBillList(billQuery);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询客户可核销账单(已确认/部分核销,未核销额大于0)
|
* 查询客户可核销账单(已确认/部分核销,未核销额大于0)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/** 分页查询指定客户的应收账单(客户ID由路径固定) */
|
||||||
|
export function listCustomerBills(customerId, query) {
|
||||||
|
return request({
|
||||||
|
url: '/customersupplier/customerbill/list/' + customerId,
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** 查询客户可核销账单(已确认/部分核销) */
|
/** 查询客户可核销账单(已确认/部分核销) */
|
||||||
export function listUnsettledBill(customerId) {
|
export function listUnsettledBill(customerId) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="visible"
|
||||||
|
:title="dialogTitle"
|
||||||
|
width="min(1500px, 96vw)"
|
||||||
|
append-to-body
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<basic-table
|
||||||
|
:columns="columns"
|
||||||
|
:search-columns="searchColumns"
|
||||||
|
:query="queryBills"
|
||||||
|
:extra-params="fixedParams"
|
||||||
|
:selection="false"
|
||||||
|
:show-toolbar="false"
|
||||||
|
:border="true"
|
||||||
|
:max-height="560"
|
||||||
|
:page-size="10"
|
||||||
|
row-key="arBillId"
|
||||||
|
>
|
||||||
|
<template #col-status="{ row }">
|
||||||
|
<el-tag :type="statusType(row.status)">{{ statusText(row.status) }}</el-tag>
|
||||||
|
</template>
|
||||||
|
<template #col-totalAmount="{ row }">
|
||||||
|
<span class="amount">{{ money(row.totalAmount) }}</span>
|
||||||
|
</template>
|
||||||
|
<template #col-writtenOffAmount="{ row }">
|
||||||
|
<span class="written">{{ money(row.writtenOffAmount) }}</span>
|
||||||
|
</template>
|
||||||
|
<template #col-unwrittenAmount="{ row }">
|
||||||
|
<span class="unwritten">{{ money(row.unwrittenAmount) }}</span>
|
||||||
|
</template>
|
||||||
|
</basic-table>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="visible = false">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { listCustomerBills } from '@/api/customersuppliermanagement/customermoney/customerbill'
|
||||||
|
import { AR_BILL_STATUS_OPTIONS, AR_BILL_STATUS_TYPES } from '@/constants/ar/bill'
|
||||||
|
import { arEnumLabel } from '@/constants/ar/enums'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: { type: Boolean, default: false },
|
||||||
|
customerId: { type: [String, Number], required: true },
|
||||||
|
customerName: { type: String, default: '' }
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
const visible = computed({
|
||||||
|
get: () => props.modelValue,
|
||||||
|
set: value => emit('update:modelValue', value)
|
||||||
|
})
|
||||||
|
const dialogTitle = computed(() => props.customerName ? `客户账单 - ${props.customerName}` : '客户账单')
|
||||||
|
|
||||||
|
// BasicTable merges these fixed parameters after search and pagination state.
|
||||||
|
const fixedParams = computed(() => ({ customerId: Number(props.customerId) }))
|
||||||
|
const statusOptions = AR_BILL_STATUS_OPTIONS
|
||||||
|
const columns = [
|
||||||
|
{ label: '账单号', prop: 'billNo', minWidth: 180, showOverflowTooltip: true },
|
||||||
|
{ label: '账单名称', prop: 'billName', minWidth: 180, showOverflowTooltip: true },
|
||||||
|
{ label: '客户名称', prop: 'customerName', minWidth: 130, showOverflowTooltip: true },
|
||||||
|
{ label: '客户编码', prop: 'customerCode', minWidth: 120, showOverflowTooltip: true },
|
||||||
|
{ label: '账单截止日', prop: 'billPeriodEnd', minWidth: 120, formatter: row => `截至 ${date(row.billPeriodEnd)}` },
|
||||||
|
{ label: '订单数', prop: 'orderCount', width: 80 },
|
||||||
|
{ label: '应收总额', prop: 'totalAmount', width: 120, align: 'right', slot: 'totalAmount' },
|
||||||
|
{ label: '已核销', prop: 'writtenOffAmount', width: 110, align: 'right', slot: 'writtenOffAmount' },
|
||||||
|
{ label: '未核销', prop: 'unwrittenAmount', width: 110, align: 'right', slot: 'unwrittenAmount' },
|
||||||
|
{ label: '状态', prop: 'status', width: 110, slot: 'status' },
|
||||||
|
{ label: '账单日期', prop: 'billDate', width: 120, formatter: row => date(row.billDate) }
|
||||||
|
]
|
||||||
|
const searchColumns = [
|
||||||
|
{ label: '账单号', prop: 'billNo', component: 'input', placeholder: '账单号', width: '180px' },
|
||||||
|
{ label: '账单名称', prop: 'billName', component: 'input', placeholder: '账单名称', width: '180px' },
|
||||||
|
{ label: '状态', prop: 'status', component: 'select', options: statusOptions, placeholder: '全部状态', width: '150px' },
|
||||||
|
{ label: '账单日期', prop: 'billDateRange', component: 'daterange', width: '300px' },
|
||||||
|
{ label: '账单截止日', prop: 'billPeriodEnd', component: 'date', width: '160px' }
|
||||||
|
]
|
||||||
|
|
||||||
|
function queryBills(params) {
|
||||||
|
const query = { ...params }
|
||||||
|
const range = query.billDateRange
|
||||||
|
if (Array.isArray(range) && range.length === 2) {
|
||||||
|
query.billDateStart = range[0]
|
||||||
|
query.billDateEnd = range[1]
|
||||||
|
}
|
||||||
|
delete query.billDateRange
|
||||||
|
// The route parameter is authoritative; the customer ID cannot be changed by search/reset.
|
||||||
|
delete query.customerId
|
||||||
|
return listCustomerBills(props.customerId, query)
|
||||||
|
}
|
||||||
|
|
||||||
|
function date(value) { return value ? String(value).slice(0, 10) : '-' }
|
||||||
|
function money(value) {
|
||||||
|
const amount = Number(value)
|
||||||
|
return Number.isNaN(amount) ? '-' : amount.toFixed(2)
|
||||||
|
}
|
||||||
|
function statusText(value) { return arEnumLabel(AR_BILL_STATUS_OPTIONS, value) }
|
||||||
|
function statusType(value) { return AR_BILL_STATUS_TYPES[value] || 'info' }
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.amount { color: #f56c6c; font-weight: 600; }
|
||||||
|
.written { color: var(--el-color-success); }
|
||||||
|
.unwritten { color: var(--el-color-warning); }
|
||||||
|
</style>
|
||||||
+23
-9
@@ -13,8 +13,8 @@
|
|||||||
<el-tag type="success" size="small">本位币账户 CNY</el-tag>
|
<el-tag type="success" size="small">本位币账户 CNY</el-tag>
|
||||||
<el-button
|
<el-button
|
||||||
icon="Document"
|
icon="Document"
|
||||||
@click="goBillView"
|
@click="openBillDialog"
|
||||||
v-hasPermi="['ar:bill:list']"
|
v-hasPermi="['customersupplier:customerinfo:list']"
|
||||||
>查看账单</el-button>
|
>查看账单</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -26,6 +26,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<customer-bill-list-dialog
|
||||||
|
v-if="billDialogVisible"
|
||||||
|
:key="currentCustomerId"
|
||||||
|
v-model="billDialogVisible"
|
||||||
|
:customer-id="currentCustomerId"
|
||||||
|
:customer-name="customer.customerName || route.query.customerName || ''"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 余额概览(数据来源 customer_account) -->
|
<!-- 余额概览(数据来源 customer_account) -->
|
||||||
<el-row :gutter="12" class="balance-row">
|
<el-row :gutter="12" class="balance-row">
|
||||||
<el-col :xs="12" :sm="8" :md="4">
|
<el-col :xs="12" :sm="8" :md="4">
|
||||||
@@ -478,8 +486,6 @@
|
|||||||
<span>未核销总额:<b class="money-out">CNY {{ unsettledTotal }}</b></span>
|
<span>未核销总额:<b class="money-out">CNY {{ unsettledTotal }}</b></span>
|
||||||
<span>账户余额:<b class="money-in">CNY {{ formatMoney(currentAccount.balance) }}</b></span>
|
<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" link size="small" icon="Refresh" @click="loadBillWriteoffData">刷新</el-button>
|
||||||
<el-button type="primary" plain size="small" @click="goBillView"
|
|
||||||
v-hasPermi="['ar:bill:list']">查看全部账单</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</el-alert>
|
</el-alert>
|
||||||
|
|
||||||
@@ -1110,6 +1116,7 @@
|
|||||||
<script setup name="CustomerMoney">
|
<script setup name="CustomerMoney">
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
|
import CustomerBillListDialog from './CustomerBillListDialog.vue'
|
||||||
import { getCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
|
import { getCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
|
||||||
import { listAccount, listReceipt, getReceipt, addReceipt, confirmReceipt, cancelReceipt, listFlow, listCreditFlow, applyCreditAdjust, listCreditApply, approveCreditApply, rejectCreditApply, cancelCreditApply, listMyCreditPools } from "@/api/customersuppliermanagement/customermoney/customermoney.js"
|
import { listAccount, listReceipt, getReceipt, addReceipt, confirmReceipt, cancelReceipt, listFlow, listCreditFlow, applyCreditAdjust, listCreditApply, approveCreditApply, rejectCreditApply, cancelCreditApply, listMyCreditPools } from "@/api/customersuppliermanagement/customermoney/customermoney.js"
|
||||||
import { listUnsettledBill, listBalanceWriteoff, balanceWriteoff, cancelBalanceWriteoff } from "@/api/customersuppliermanagement/customermoney/customerbill.js"
|
import { listUnsettledBill, listBalanceWriteoff, balanceWriteoff, cancelBalanceWriteoff } from "@/api/customersuppliermanagement/customermoney/customerbill.js"
|
||||||
@@ -2028,11 +2035,18 @@ function formatDate(val) {
|
|||||||
if (!val) return '-'
|
if (!val) return '-'
|
||||||
return String(val).substring(0, 10)
|
return String(val).substring(0, 10)
|
||||||
}
|
}
|
||||||
function goBillView() {
|
const billDialogVisible = ref(false)
|
||||||
router.push({
|
const currentCustomerId = computed(() => {
|
||||||
path: '/ar/bill',
|
const id = Number(route.query.customerId)
|
||||||
query: { customerId: route.query.customerId || '' }
|
return Number.isSafeInteger(id) && id > 0 ? id : null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function openBillDialog() {
|
||||||
|
if (!currentCustomerId.value) {
|
||||||
|
proxy.$modal.msgWarning('缺少客户ID,请从客户列表进入客户余额页')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
billDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsettledList = ref([])
|
const unsettledList = ref([])
|
||||||
|
|||||||
Reference in New Issue
Block a user