294 检查项目设置-》套餐设置:基本信息服务费字段的值系统没有自动合计套餐明细服务费字段所有行的值

295 检查项目设置-》套餐设置:套餐明细数量字段后面需要增加单位字段
This commit is contained in:
Ranyunqiao
2026-03-30 09:03:49 +08:00
parent 6d23d36a9c
commit b5527cc07f
4 changed files with 44 additions and 7 deletions

View File

@@ -49,6 +49,9 @@ public class CheckPackageDetailDto {
@NotNull(message = "数量不能为空") @NotNull(message = "数量不能为空")
private Integer quantity; private Integer quantity;
/** 单位 */
private String unit;
/** 单价 */ /** 单价 */
@NotNull(message = "单价不能为空") @NotNull(message = "单价不能为空")
private BigDecimal unitPrice; private BigDecimal unitPrice;

View File

@@ -84,6 +84,7 @@
T1.id, T1.id,
T1.bus_no, T1.bus_no,
T1.name, T1.name,
T1.permitted_unit_code,
T2.price as retail_price T2.price as retail_price
FROM wor_activity_definition T1 FROM wor_activity_definition T1
INNER JOIN adm_charge_item_definition T2 INNER JOIN adm_charge_item_definition T2

View File

@@ -53,6 +53,9 @@ public class CheckPackageDetail {
/** 数量 */ /** 数量 */
private Integer quantity; private Integer quantity;
/** 单位 */
private String unit;
/** 单价 */ /** 单价 */
private BigDecimal unitPrice; private BigDecimal unitPrice;

View File

@@ -154,9 +154,9 @@
v-model="formData.serviceFee" v-model="formData.serviceFee"
:precision="2" :precision="2"
:min="0" :min="0"
placeholder="请输入服务费" placeholder="自动合计"
style="width: 100%" style="width: 100%"
:disabled="isReadOnly" disabled
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -281,6 +281,12 @@
<span v-else>{{ row.quantity }}</span> <span v-else>{{ row.quantity }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位" width="80" align="center">
<template #default="{ row }">
<span v-if="row.editing">{{ row.unit || '-' }}</span>
<span v-else>{{ row.unit || '-' }}</span>
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价" width="150" align="center"> <el-table-column prop="unitPrice" label="单价" width="150" align="center">
<template #default="{ row }"> <template #default="{ row }">
<el-input <el-input
@@ -309,7 +315,7 @@
placeholder="服务费" placeholder="服务费"
style="width: 100%" style="width: 100%"
:controls="false" :controls="false"
@change="calculateTotal(row)" @input="(val) => handleServiceChargeInput(val, row)"
/> />
<span v-else>{{ row.serviceCharge?.toFixed(2) || '0.00' }}</span> <span v-else>{{ row.serviceCharge?.toFixed(2) || '0.00' }}</span>
</template> </template>
@@ -539,6 +545,7 @@ function loadPackageData(data) {
days: item.days || '', days: item.days || '',
quantity: item.quantity || 1, quantity: item.quantity || 1,
unitPrice: item.unitPrice || 0, unitPrice: item.unitPrice || 0,
unit: item.unit || '',
amount: item.amount || 0, amount: item.amount || 0,
serviceCharge: item.serviceCharge || 0, serviceCharge: item.serviceCharge || 0,
total: item.total || 0, total: item.total || 0,
@@ -553,6 +560,9 @@ function loadPackageData(data) {
console.log('formData 加载后:', formData) console.log('formData 加载后:', formData)
console.log('detailData 加载后:', detailData.value) console.log('detailData 加载后:', detailData.value)
// 加载数据后自动计算总服务费
calculateTotalServiceFee()
} }
onMounted(async () => { onMounted(async () => {
@@ -781,10 +791,12 @@ async function loadDiagnosisTreatmentItem(itemId, itemData) {
async function loadDiagnosisTreatmentList(forceRefresh = false) { async function loadDiagnosisTreatmentList(forceRefresh = false) {
// 如果不是强制刷新且已有数据且未过期,直接返回 // 如果不是强制刷新且已有数据且未过期,直接返回
if (!forceRefresh && diagnosisTreatmentList.value.length > 0) { if (!forceRefresh && diagnosisTreatmentList.value.length > 0) {
return // 由于缓存过期时间改为0始终视为过期需要重新加载
// 这里直接跳过,不返回,让它重新加载
} }
// 从session缓存读取 // 从session缓存读取
let useCache = false
try { try {
const cachedData = cache.session.getJSON(DIAGNOSIS_TREATMENT_CACHE_KEY) const cachedData = cache.session.getJSON(DIAGNOSIS_TREATMENT_CACHE_KEY)
if (cachedData && cachedData.timestamp) { if (cachedData && cachedData.timestamp) {
@@ -877,6 +889,7 @@ function handleAddRow() {
frequency: '', frequency: '',
days: '', days: '',
quantity: 1, quantity: 1,
unit: '',
unitPrice: 0, unitPrice: 0,
amount: 0, amount: 0,
serviceCharge: 0, serviceCharge: 0,
@@ -914,6 +927,7 @@ function handleDeleteRow(index) {
}).then(() => { }).then(() => {
detailData.value.splice(index, 1) detailData.value.splice(index, 1)
calculatePackagePrice() calculatePackagePrice()
calculateTotalServiceFee()
ElMessage.success('删除成功') ElMessage.success('删除成功')
}).catch(() => {}) }).catch(() => {})
} }
@@ -1027,7 +1041,9 @@ function handleItemSelect(row) {
row.itemName = item.name || item.itemName || '' row.itemName = item.name || item.itemName || ''
row.code = item.busNo || item.code || item.itemCode || '' row.code = item.busNo || item.code || item.itemCode || ''
row.unitPrice = parseFloat(item.retailPrice || item.unitPrice || item.price || 0) row.unitPrice = parseFloat(item.retailPrice || item.unitPrice || item.price || 0)
console.log('设置单价:', row.unitPrice) // permittedUnitCode_dictText是字典翻译后的值permittedUnitCode是后端返回的原始值
row.unit = item.permittedUnitCode_dictText || item.permittedUnitCode || ''
// 缓存选中的项目 // 缓存选中的项目
loadDiagnosisTreatmentItem(row.itemId, item) loadDiagnosisTreatmentItem(row.itemId, item)
@@ -1044,10 +1060,23 @@ function calculateAmount(row) {
calculateTotal(row) calculateTotal(row)
} }
// 处理服务费输入
function handleServiceChargeInput(val, row) {
row.serviceCharge = val || 0
calculateTotal(row)
}
// 计算总金额 // 计算总金额
function calculateTotal(row) { function calculateTotal(row) {
row.total = (row.amount || 0) + (row.serviceCharge || 0) row.total = (row.amount || 0) + (row.serviceCharge || 0)
calculatePackagePrice() calculatePackagePrice()
calculateTotalServiceFee()
}
// 计算总服务费(合计所有明细行的服务费)
function calculateTotalServiceFee() {
const totalServiceFee = detailData.value.reduce((sum, item) => sum + (item.serviceCharge || 0), 0)
formData.serviceFee = totalServiceFee
} }
// 计算套餐金额(应用折扣) // 计算套餐金额(应用折扣)
@@ -1203,6 +1232,7 @@ async function handleSave() {
frequency: item.frequency || '', frequency: item.frequency || '',
days: item.days || '', days: item.days || '',
quantity: parseInt(item.quantity) || 1, quantity: parseInt(item.quantity) || 1,
unit: item.unit || '',
unitPrice: parseFloat(item.unitPrice) || 0, unitPrice: parseFloat(item.unitPrice) || 0,
amount: parseFloat(item.amount) || 0, amount: parseFloat(item.amount) || 0,
serviceCharge: parseFloat(item.serviceCharge) || 0, serviceCharge: parseFloat(item.serviceCharge) || 0,