This commit is contained in:
=
2026-05-09 15:33:13 +08:00
parent 943c15a7f4
commit 9e014daddf
7 changed files with 106 additions and 61 deletions
@@ -189,7 +189,7 @@ public class UnionReimburseMineController {
@SaCheckPermission(value = {"unionReimburse.mine", "h5.unionReimburse.mine"}, mode = SaMode.OR) @SaCheckPermission(value = {"unionReimburse.mine", "h5.unionReimburse.mine"}, mode = SaMode.OR)
@SLog( tag = "删除工会报销", msg = "删除工会报销") @SLog( tag = "删除工会报销", msg = "删除工会报销")
public Result delete(@Param("id") String id) { public Result delete(@Param("id") String id) {
unionReimburseService.delete(id); unionReimburseService.deleteApply(id);
return Result.success(); return Result.success();
} }
@@ -24,6 +24,11 @@ public interface UnionReimburseService extends BaseService<UnionReimburse> {
*/ */
UnionReimburse getApplyForm(String id); UnionReimburse getApplyForm(String id);
/**
* 删除报销申请,并同步删除关联发票明细。
*/
void deleteApply(String id);
/** /**
* 查询付款人的历史收款信息。 * 查询付款人的历史收款信息。
*/ */
@@ -123,6 +123,8 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
normalizeInvoiceDetails(unionReimburse); normalizeInvoiceDetails(unionReimburse);
if (needInvoiceDetails(unionReimburse)) { if (needInvoiceDetails(unionReimburse)) {
fillInvoiceSummary(unionReimburse); fillInvoiceSummary(unionReimburse);
} else {
fillCondolenceInvoiceSummary(unionReimburse);
} }
fillDefaultRealMoney(unionReimburse); fillDefaultRealMoney(unionReimburse);
if (stateId == 2) { if (stateId == 2) {
@@ -178,6 +180,16 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
return unionReimburse; return unionReimburse;
} }
@Override
public void deleteApply(String id) {
if (StrUtil.isBlank(id)) {
return;
}
// 删除申请主记录时同步清理发票明细,避免遗留无归属的发票关联数据。
this.dao().clear(UnionReimburseInvoiceDetail.class, Cnd.where("reimburseId", "=", id));
this.delete(id);
}
@Override @Override
public List<UnionReimburseBankHistoryVO> getUserBankHistory(String payer) { public List<UnionReimburseBankHistoryVO> getUserBankHistory(String payer) {
if (StrUtil.isBlank(payer)) { if (StrUtil.isBlank(payer)) {
@@ -470,6 +482,29 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
unionReimburse.setInvoiceNumber(String.valueOf(invoiceFileCount)); unionReimburse.setInvoiceNumber(String.valueOf(invoiceFileCount));
} }
/**
* 慰问类报销允许不填发票;有发票时按发票汇总金额申请,没有发票时按慰问金额申请。
*/
private void fillCondolenceInvoiceSummary(UnionReimburse unionReimburse) {
double totalMoney = 0D;
int invoiceFileCount = 0;
for (UnionReimburseInvoiceDetail detail : unionReimburse.getInvoiceDetails()) {
if (detail.getInvoiceAmount() != null) {
totalMoney = BigDecimal.valueOf(totalMoney)
.add(BigDecimal.valueOf(detail.getInvoiceAmount()))
.doubleValue();
}
if (Lang.isNotEmpty(detail.getInvoiceFiles())) {
invoiceFileCount++;
}
}
Double applyMoney = invoiceFileCount > 0
? BigDecimal.valueOf(totalMoney).setScale(2, RoundingMode.HALF_UP).doubleValue()
: unionReimburse.getCondolenceMoney();
unionReimburse.setMoney(applyMoney);
unionReimburse.setInvoiceNumber(String.valueOf(invoiceFileCount));
}
/** /**
* 默认实际金额跟随申请金额,后续管理员可在汇总页按最终报销金额调整。 * 默认实际金额跟随申请金额,后续管理员可在汇总页按最终报销金额调整。
*/ */
@@ -496,11 +531,8 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
// if (StrUtil.isBlank(unionReimburse.getBankOfDeposit())) { // if (StrUtil.isBlank(unionReimburse.getBankOfDeposit())) {
// return Result.error("请填写开户行"); // return Result.error("请填写开户行");
// } // }
if (StrUtil.isBlank(unionReimburse.getPaymentNotes())) {
return Result.error("请填写支付内容");
}
if (!needInvoiceDetails(unionReimburse)) { if (!needInvoiceDetails(unionReimburse)) {
return null; return validateInvoiceDetails(unionReimburse, false);
} }
if (StrUtil.isBlank(unionReimburse.getActivityName())) { if (StrUtil.isBlank(unionReimburse.getActivityName())) {
return Result.error("请填写活动名称"); return Result.error("请填写活动名称");
@@ -514,7 +546,17 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
if (Lang.isEmpty(unionReimburse.getFiles())) { if (Lang.isEmpty(unionReimburse.getFiles())) {
return Result.error("请上传附件"); return Result.error("请上传附件");
} }
return validateInvoiceDetails(unionReimburse, true);
}
/**
* 发票明细提交校验:活动类必须至少一条,慰问类允许为空但填写后必须完整。
*/
private Result validateInvoiceDetails(UnionReimburse unionReimburse, boolean required) {
if (Lang.isEmpty(unionReimburse.getInvoiceDetails())) { if (Lang.isEmpty(unionReimburse.getInvoiceDetails())) {
if (!required) {
return null;
}
return Result.error("请至少维护一条发票明细"); return Result.error("请至少维护一条发票明细");
} }
for (int i = 0; i < unionReimburse.getInvoiceDetails().size(); i++) { for (int i = 0; i < unionReimburse.getInvoiceDetails().size(); i++) {
@@ -751,8 +793,10 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
} }
private BigDecimal getDeclaredApplyMoney(UnionReimburse unionReimburse) { private BigDecimal getDeclaredApplyMoney(UnionReimburse unionReimburse) {
Double money = "UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject()) Double money = unionReimburse.getMoney();
? unionReimburse.getCondolenceMoney() : unionReimburse.getMoney(); if (money == null && "UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject())) {
money = unionReimburse.getCondolenceMoney();
}
return BigDecimal.valueOf(money == null ? 0D : money).setScale(2, RoundingMode.HALF_UP); return BigDecimal.valueOf(money == null ? 0D : money).setScale(2, RoundingMode.HALF_UP);
} }
@@ -1097,7 +1141,7 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
} }
/** /**
* 当前仅活动类报销维护发票明细,慰问类仍按原有逻辑处理金额 * 非慰问类报销必须维护发票明细,慰问类发票明细为可选
*/ */
private boolean needInvoiceDetails(UnionReimburse unionReimburse) { private boolean needInvoiceDetails(UnionReimburse unionReimburse) {
return unionReimburse != null && !"UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject()); return unionReimburse != null && !"UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject());
@@ -36,6 +36,13 @@ layout("/layouts/platform.html"){
.invoice-file-name:hover { .invoice-file-name:hover {
text-decoration: underline; text-decoration: underline;
} }
.invoice-field-title {
color: #606266;
font-size: 14px;
line-height: 22px;
margin-bottom: 6px;
}
</style> </style>
<div id="app" v-cloak> <div id="app" v-cloak>
@@ -509,26 +516,23 @@ layout("/layouts/platform.html"){
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="报销金额" prop="money"> <el-form-item label="报销金额" prop="money">
<div class="invoice-field-title">报销金额</div>
<el-input v-model="formData.money" placeholder="自动汇总发票金额" readonly></el-input> <el-input v-model="formData.money" placeholder="自动汇总发票金额" readonly></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="发票张数" prop="invoiceNumber"> <el-form-item label="发票张数" prop="invoiceNumber">
<div class="invoice-field-title">发票张数</div>
<el-input v-model="formData.invoiceNumber" placeholder="自动统计发票数量" readonly></el-input> <el-input v-model="formData.invoiceNumber" placeholder="自动统计发票数量" readonly></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="paymentNotes" label="支付内容"> <el-form-item prop="paymentNotes" label="支付内容">
<div class="invoice-field-title">支付内容</div>
<el-input maxlength="500" v-model="formData.paymentNotes" placeholder="请填写支付内容" <el-input maxlength="500" v-model="formData.paymentNotes" placeholder="请填写支付内容"
type="textarea" :autosize="{ minRows: 4, maxRows: 8}"></el-input> type="textarea" :autosize="{ minRows: 4, maxRows: 8}"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item prop="notes" label="备注">
<el-input maxlength="500" v-model="formData.notes" placeholder="补充说明"
type="textarea" :autosize="{ minRows: 3, maxRows: 6}"></el-input>
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<div class="invoice-toolbar"> <div class="invoice-toolbar">
<div> <div>
@@ -714,7 +718,6 @@ layout("/layouts/platform.html"){
condolenceTime: [{required: true, message: "请选择慰问时间", trigger: ["change", "blur"]}], condolenceTime: [{required: true, message: "请选择慰问时间", trigger: ["change", "blur"]}],
// invoiceNumber: [{required: true, message: "请填写发票张数", trigger: ["change", "blur"]}], // invoiceNumber: [{required: true, message: "请填写发票张数", trigger: ["change", "blur"]}],
// invoice: [{required: true, message: "请填写发票号码", trigger: ["change", "blur"]}], // invoice: [{required: true, message: "请填写发票号码", trigger: ["change", "blur"]}],
paymentNotes: [{required: true, message: "请填写支付内容", trigger: ["change", "blur"]}],
activityName: [{required: true, message: "请填写活动名称", trigger: ["change", "blur"]}], activityName: [{required: true, message: "请填写活动名称", trigger: ["change", "blur"]}],
money: [{required: true, message: "请填写报销金额", trigger: ["change", "blur"]}], money: [{required: true, message: "请填写报销金额", trigger: ["change", "blur"]}],
mobile: [ mobile: [
@@ -756,7 +759,7 @@ layout("/layouts/platform.html"){
}, },
computed: { computed: {
showInvoiceTab() { showInvoiceTab() {
return this.formData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1" return !!this.formData.reimburseProject
}, },
bankHistoryUserNames() { bankHistoryUserNames() {
const userNameMap = {} const userNameMap = {}
@@ -999,14 +1002,14 @@ layout("/layouts/platform.html"){
this.$set(this.formData, "condolenceMoney", parseFloat(money).toFixed(2)) this.$set(this.formData, "condolenceMoney", parseFloat(money).toFixed(2))
this.$set(this.formData, "condolenceFilesNotes", uploadFileDesc) this.$set(this.formData, "condolenceFilesNotes", uploadFileDesc)
this.$set(this.formData, "typeName", name) this.$set(this.formData, "typeName", name)
this.rebuildInvoiceSummary()
} }
}, },
handleReimburseProjectChange(value) { handleReimburseProjectChange(value) {
if (value === "UNION_REIMBURSE_PROJECT_1") { if (value === "UNION_REIMBURSE_PROJECT_1") {
this.$set(this, "activeTabName", "basic") this.$set(this, "activeTabName", "basic")
this.$set(this.formData, "invoiceDetails", [])
this.$set(this.formData, "invoiceNumber", "")
this.$set(this.formData, "money", null) this.$set(this.formData, "money", null)
this.rebuildInvoiceSummary()
} else { } else {
this.rebuildInvoiceSummary() this.rebuildInvoiceSummary()
this.normalizeFundBalance() this.normalizeFundBalance()
@@ -1201,9 +1204,6 @@ layout("/layouts/platform.html"){
}) })
}, },
rebuildInvoiceSummary() { rebuildInvoiceSummary() {
if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
return
}
let totalMoney = 0 let totalMoney = 0
let fileCount = 0 let fileCount = 0
const invoiceDetails = this.formData.invoiceDetails || [] const invoiceDetails = this.formData.invoiceDetails || []
@@ -1215,15 +1215,19 @@ layout("/layouts/platform.html"){
fileCount = fileCount + 1 fileCount = fileCount + 1
} }
} }
this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00") // 慰问类发票为可选附件;有发票按发票汇总金额,没有发票按慰问金额。
if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
const condolenceMoney = this.formData.condolenceMoney
this.$set(this.formData, "money", fileCount > 0 ? (totalMoney ? totalMoney.toFixed(2) : "0.00") : condolenceMoney)
} else {
this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00")
}
this.$set(this.formData, "invoiceNumber", String(fileCount)) this.$set(this.formData, "invoiceNumber", String(fileCount))
}, },
validateInvoiceDetailsBeforeSubmit() { validateInvoiceDetailsBeforeSubmit() {
if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
return true
}
const invoiceDetails = this.formData.invoiceDetails || [] const invoiceDetails = this.formData.invoiceDetails || []
if (!invoiceDetails.length) { // 慰问类允许不填发票;如果填写了发票明细,则每条明细仍需完整。
if (!invoiceDetails.length && this.formData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1") {
this.$message.warning("请至少维护一条发票明细") this.$message.warning("请至少维护一条发票明细")
return false return false
} }
@@ -1284,6 +1288,7 @@ layout("/layouts/platform.html"){
// 提交验证 // 提交验证
validateBeforeSubmit() { validateBeforeSubmit() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.rebuildInvoiceSummary()
this.$refs.formRef.validate((valid) => { this.$refs.formRef.validate((valid) => {
if (valid) { if (valid) {
if (this.formData.reimburseFundSource === "UNION_REIMBURSE_FUND_SOURCE_3" && !this.formData.clubId) { if (this.formData.reimburseFundSource === "UNION_REIMBURSE_FUND_SOURCE_3" && !this.formData.clubId) {
@@ -1297,7 +1302,6 @@ layout("/layouts/platform.html"){
return return
} }
this.normalizeFundBalance() this.normalizeFundBalance()
this.rebuildInvoiceSummary()
resolve(true) resolve(true)
} else { } else {
this.$message.warning("请完善必填信息") this.$message.warning("请完善必填信息")
@@ -293,7 +293,7 @@ const unionReimburseInfo = {
}, },
computed: { computed: {
showInvoiceTab() { showInvoiceTab() {
return this.viewData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1" return !!this.viewData.reimburseProject
} }
}, },
methods: { methods: {
@@ -497,9 +497,7 @@ layout("/layouts/platform_h5.html"){
placeholder="请填写报销事由" placeholder="请填写报销事由"
type="textarea" type="textarea"
rows="2" rows="2"
autosize autosize></van-field>
:rules="[{ required: true, message: '请填写报销事由' }]"
required></van-field>
<van-field label="备注" <van-field label="备注"
v-model="formData.notes" v-model="formData.notes"
placeholder="需要填写:发票编号、开具方、金额" placeholder="需要填写:发票编号、开具方、金额"
@@ -546,19 +544,6 @@ layout("/layouts/platform_h5.html"){
</van-popup> </van-popup>
</template> </template>
<!-- 支付内容 -->
<van-field
v-if="formData.reimburseProject && formData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'"
label="支付内容"
v-model="formData.paymentNotes"
placeholder="请填写支付内容"
type="textarea"
rows="2"
autosize
required
:rules="[{ required: true, message: '请填写支付内容' }]"
></van-field>
<van-field class="more-text" name="files" required <van-field class="more-text" name="files" required
label="附件" :rules="[{ required: true, message: '请上传附件' }]"> label="附件" :rules="[{ required: true, message: '请上传附件' }]">
<template #input> <template #input>
@@ -574,8 +559,7 @@ layout("/layouts/platform_h5.html"){
</template> </template>
</van-field> </van-field>
</van-cell-group> </van-cell-group>
<van-cell-group title="电子发票" class="form-section" <van-cell-group title="电子发票" class="form-section" v-if="formData.reimburseProject">
v-if="formData.reimburseProject && formData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<van-field label="报销金额" <van-field label="报销金额"
v-model="formData.money" v-model="formData.money"
placeholder="自动汇总发票金额" placeholder="自动汇总发票金额"
@@ -584,6 +568,13 @@ layout("/layouts/platform_h5.html"){
v-model="formData.invoiceNumber" v-model="formData.invoiceNumber"
placeholder="自动统计发票数量" placeholder="自动统计发票数量"
readonly></van-field> readonly></van-field>
<!-- 支付内容 -->
<van-field label="支付内容"
v-model="formData.paymentNotes"
placeholder="请填写支付内容"
type="textarea"
rows="2"
autosize></van-field>
<div class="invoice-section"> <div class="invoice-section">
<div class="invoice-toolbar"> <div class="invoice-toolbar">
<span>发票明细列表</span> <span>发票明细列表</span>
@@ -1023,9 +1014,8 @@ layout("/layouts/platform_h5.html"){
}, },
handleReimburseProjectChange(value) { handleReimburseProjectChange(value) {
if (value === "UNION_REIMBURSE_PROJECT_1") { if (value === "UNION_REIMBURSE_PROJECT_1") {
this.$set(this.formData, "invoiceDetails", [])
this.$set(this.formData, "invoiceNumber", "")
this.$set(this.formData, "money", "") this.$set(this.formData, "money", "")
this.rebuildInvoiceSummary()
} else { } else {
this.rebuildInvoiceSummary() this.rebuildInvoiceSummary()
} }
@@ -1259,9 +1249,6 @@ layout("/layouts/platform_h5.html"){
}) })
}, },
rebuildInvoiceSummary() { rebuildInvoiceSummary() {
if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
return
}
let totalMoney = 0 let totalMoney = 0
let fileCount = 0 let fileCount = 0
const invoiceDetails = this.formData.invoiceDetails || [] const invoiceDetails = this.formData.invoiceDetails || []
@@ -1273,15 +1260,19 @@ layout("/layouts/platform_h5.html"){
fileCount = fileCount + 1 fileCount = fileCount + 1
} }
} }
this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00") // 慰问类发票为可选附件;有发票按发票汇总金额,没有发票按慰问金额。
if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
const condolenceMoney = this.formData.condolenceMoney
this.$set(this.formData, "money", fileCount > 0 ? (totalMoney ? totalMoney.toFixed(2) : "0.00") : condolenceMoney)
} else {
this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00")
}
this.$set(this.formData, "invoiceNumber", String(fileCount)) this.$set(this.formData, "invoiceNumber", String(fileCount))
}, },
validateInvoiceDetailsBeforeSubmit() { validateInvoiceDetailsBeforeSubmit() {
if (!this.formData.reimburseProject || this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
return true
}
const invoiceDetails = this.formData.invoiceDetails || [] const invoiceDetails = this.formData.invoiceDetails || []
if (!invoiceDetails.length) { // 慰问类允许不填发票;如果填写了发票明细,则每条明细仍需完整。
if (!invoiceDetails.length && this.formData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1") {
this.$toast.fail("请至少维护一条发票明细") this.$toast.fail("请至少维护一条发票明细")
return false return false
} }
@@ -1442,13 +1433,13 @@ layout("/layouts/platform_h5.html"){
async onSubmit() { async onSubmit() {
this.normalizeContactFields() this.normalizeContactFields()
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
this.$refs.formRef.validate().then(() => { this.$refs.formRef.validate().then(() => {
// if (!this.formData.userSign) { // if (!this.formData.userSign) {
// this.$toast.fail("请签名") // this.$toast.fail("请签名")
// return // return
// } // }
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
if (!this.validateInvoiceDetailsBeforeSubmit()) { if (!this.validateInvoiceDetailsBeforeSubmit()) {
return return
} }
@@ -1477,13 +1468,13 @@ layout("/layouts/platform_h5.html"){
async onSubmitAgain() { async onSubmitAgain() {
this.normalizeContactFields() this.normalizeContactFields()
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
this.$refs.formRef.validate().then(() => { this.$refs.formRef.validate().then(() => {
if (!this.formData.userSign) { if (!this.formData.userSign) {
this.$toast.fail("请签名") this.$toast.fail("请签名")
return return
} }
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
if (!this.validateInvoiceDetailsBeforeSubmit()) { if (!this.validateInvoiceDetailsBeforeSubmit()) {
return return
} }
@@ -1578,6 +1569,7 @@ layout("/layouts/platform_h5.html"){
this.$set(this.formData, "way", selectedType.way) this.$set(this.formData, "way", selectedType.way)
this.$set(this.formData, "condolenceMoney", parseFloat(selectedType.money || 0).toFixed(2)) this.$set(this.formData, "condolenceMoney", parseFloat(selectedType.money || 0).toFixed(2))
this.$set(this.formData, "condolenceFilesNotes", selectedType.uploadFileDesc) this.$set(this.formData, "condolenceFilesNotes", selectedType.uploadFileDesc)
this.rebuildInvoiceSummary()
} }
}, },
onCondolenceWayConfirm(o) { onCondolenceWayConfirm(o) {
@@ -92,7 +92,7 @@ const UNION_REIMBURSE_INFO = {
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
<van-cell-group title="电子发票" v-if="viewData.reimburseProject && viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'"> <van-cell-group title="电子发票" v-if="viewData.reimburseProject">
<van-cell title="报销金额">{{ formatMoney(viewData.money) }}</van-cell> <van-cell title="报销金额">{{ formatMoney(viewData.money) }}</van-cell>
<van-cell title="发票张数">{{ viewData.invoiceNumber }}</van-cell> <van-cell title="发票张数">{{ viewData.invoiceNumber }}</van-cell>
<van-cell title="发票明细列表"> <van-cell title="发票明细列表">