费用明细可以增加费用

This commit is contained in:
wuweihua
2026-09-22 15:30:25 +08:00
parent 77b95f9450
commit 226db7799b
20 changed files with 797 additions and 14 deletions
@@ -90,6 +90,9 @@
<div class="sec-title">费用明细</div>
<el-tabs v-model="feeTab" class="fee-tabs">
<el-tab-pane label="应收" name="income">
<div class="fee-toolbar">
<el-button type="primary" plain size="small" icon="Plus" v-hasPermi="['price:billing:feeAdd']" @click="openAddFee">增加费用</el-button>
</div>
<el-table v-if="incomeFees.length" :data="incomeFees" border size="small" class="fee-table">
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
<template #default="{ row }">{{ displayFeeName(row) }}</template>
@@ -114,6 +117,15 @@
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
<template #default="{ row }">{{ row.remark || '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="120" align="center" fixed="right">
<template #default="{ row }">
<template v-if="canEditManualFee(row)">
<el-button link type="primary" v-hasPermi="['price:billing:feeEdit']" @click="openEditFee(row)">编辑</el-button>
<el-button link type="danger" v-hasPermi="['price:billing:feeRemove']" @click="handleDeleteFee(row)">删除</el-button>
</template>
<span v-else>-</span>
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无应收明细" :image-size="64" />
</el-tab-pane>
@@ -149,10 +161,23 @@
</section>
</div>
</div>
<add-income-fee-dialog
v-model="addFeeOpen"
:bill-id="detail?.billId || ''"
:charge-weight="detail?.chargeWeight ?? detail?.weight"
:freight-amount="detail?.freightAmount"
:edit-row="editFeeRow"
@success="onFeeAdded"
/>
</el-drawer>
</template>
<script setup>
import AddIncomeFeeDialog from './AddIncomeFeeDialog.vue'
import { deleteIncomeBillFee } from '@/api/price/billing'
const { proxy } = getCurrentInstance()
const props = defineProps({
modelValue: { type: Boolean, default: false },
title: { type: String, default: '计费详情' },
@@ -160,9 +185,11 @@ const props = defineProps({
detail: { type: Object, default: null }
})
defineEmits(['update:modelValue'])
const emit = defineEmits(['update:modelValue', 'updated'])
const feeTab = ref('income')
const addFeeOpen = ref(false)
const editFeeRow = ref(null)
const { bms_fee_type, bms_currency } = useDict('bms_fee_type', 'bms_currency')
const incomeFees = computed(() => {
@@ -181,6 +208,37 @@ watch(() => props.detail, () => {
feeTab.value = 'income'
})
function canEditManualFee(row) {
return row && String(row.manualFlag) === '1' && row.arBillStatus !== 'BILLED'
}
function openAddFee() {
if (!props.detail?.billId) return
editFeeRow.value = null
addFeeOpen.value = true
}
function openEditFee(row) {
editFeeRow.value = row
addFeeOpen.value = true
}
function handleDeleteFee(row) {
if (!canEditManualFee(row)) return
proxy.$modal.confirm('确认删除该费用吗?').then(() => {
return deleteIncomeBillFee(row.feeId)
}).then(res => {
proxy.$modal.msgSuccess('删除成功')
emit('updated', res.data || null)
}).catch(() => {})
}
function onFeeAdded(data) {
editFeeRow.value = null
if (data) emit('updated', data)
}
function customerActiveLabel(status) {
const map = { ACTIVE: '正常', MISSING: '不存在', DISABLED: '停用' }
return map[status] || status || '-'
@@ -378,6 +436,11 @@ function sourceTagType(source) {
font-variant-numeric: tabular-nums;
font-weight: 500;
}
.fee-toolbar {
display: flex;
/* justify-content: flex-end; */
margin-bottom: 10px;
}
.fee-tabs {
margin-top: 0;
}