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
@@ -497,9 +497,7 @@ layout("/layouts/platform_h5.html"){
placeholder="请填写报销事由"
type="textarea"
rows="2"
autosize
:rules="[{ required: true, message: '请填写报销事由' }]"
required></van-field>
autosize></van-field>
<van-field label="备注"
v-model="formData.notes"
placeholder="需要填写:发票编号、开具方、金额"
@@ -546,19 +544,6 @@ layout("/layouts/platform_h5.html"){
</van-popup>
</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
label="附件" :rules="[{ required: true, message: '请上传附件' }]">
<template #input>
@@ -574,8 +559,7 @@ layout("/layouts/platform_h5.html"){
</template>
</van-field>
</van-cell-group>
<van-cell-group title="电子发票" class="form-section"
v-if="formData.reimburseProject && formData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<van-cell-group title="电子发票" class="form-section" v-if="formData.reimburseProject">
<van-field label="报销金额"
v-model="formData.money"
placeholder="自动汇总发票金额"
@@ -584,6 +568,13 @@ layout("/layouts/platform_h5.html"){
v-model="formData.invoiceNumber"
placeholder="自动统计发票数量"
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-toolbar">
<span>发票明细列表</span>
@@ -1023,9 +1014,8 @@ layout("/layouts/platform_h5.html"){
},
handleReimburseProjectChange(value) {
if (value === "UNION_REIMBURSE_PROJECT_1") {
this.$set(this.formData, "invoiceDetails", [])
this.$set(this.formData, "invoiceNumber", "")
this.$set(this.formData, "money", "")
this.rebuildInvoiceSummary()
} else {
this.rebuildInvoiceSummary()
}
@@ -1259,9 +1249,6 @@ layout("/layouts/platform_h5.html"){
})
},
rebuildInvoiceSummary() {
if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
return
}
let totalMoney = 0
let fileCount = 0
const invoiceDetails = this.formData.invoiceDetails || []
@@ -1273,15 +1260,19 @@ layout("/layouts/platform_h5.html"){
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))
},
validateInvoiceDetailsBeforeSubmit() {
if (!this.formData.reimburseProject || this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") {
return true
}
const invoiceDetails = this.formData.invoiceDetails || []
if (!invoiceDetails.length) {
// 慰问类允许不填发票;如果填写了发票明细,则每条明细仍需完整。
if (!invoiceDetails.length && this.formData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1") {
this.$toast.fail("请至少维护一条发票明细")
return false
}
@@ -1442,13 +1433,13 @@ layout("/layouts/platform_h5.html"){
async onSubmit() {
this.normalizeContactFields()
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
this.$refs.formRef.validate().then(() => {
// if (!this.formData.userSign) {
// this.$toast.fail("请签名")
// return
// }
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
if (!this.validateInvoiceDetailsBeforeSubmit()) {
return
}
@@ -1477,13 +1468,13 @@ layout("/layouts/platform_h5.html"){
async onSubmitAgain() {
this.normalizeContactFields()
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
this.$refs.formRef.validate().then(() => {
if (!this.formData.userSign) {
this.$toast.fail("请签名")
return
}
this.normalizeCondolenceDateFields()
this.rebuildInvoiceSummary()
if (!this.validateInvoiceDetailsBeforeSubmit()) {
return
}
@@ -1578,6 +1569,7 @@ layout("/layouts/platform_h5.html"){
this.$set(this.formData, "way", selectedType.way)
this.$set(this.formData, "condolenceMoney", parseFloat(selectedType.money || 0).toFixed(2))
this.$set(this.formData, "condolenceFilesNotes", selectedType.uploadFileDesc)
this.rebuildInvoiceSummary()
}
},
onCondolenceWayConfirm(o) {
@@ -92,7 +92,7 @@ const UNION_REIMBURSE_INFO = {
</van-cell>
</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="发票张数">{{ viewData.invoiceNumber }}</van-cell>
<van-cell title="发票明细列表">