提交merge1.3

This commit is contained in:
2025-12-27 15:30:25 +08:00
parent 8c607c8749
commit 088861f66e
1245 changed files with 220442 additions and 77616 deletions

View File

@@ -1,5 +1,12 @@
<template>
<el-dialog title="确认收费" v-model="props.open" width="700px" append-to-body destroy-on-close>
<el-dialog
title="确认收费"
v-model="props.open"
@close="close"
width="700px"
append-to-body
destroy-on-close
>
<div v-loading="dialogLoading">
<el-text size="large" style="display: block; margin-bottom: 15px">
收费日期{{ currentDate }}
@@ -27,7 +34,7 @@
:key="payEnum.value"
:label="payEnum.label"
:value="payEnum.value"
:disabled="isMethodDisabled(payEnum.value)"
:disabled="isMethodDisabled(payEnum)"
/>
</el-select>
<span>支付金额</span>
@@ -66,6 +73,17 @@
</el-text>
</div>
</div>
<div class="payment-item">
<span>{{ payTypeText }}支付</span>
<el-input
ref="txtCodeRef"
v-model="txtCode"
style="width: 300px"
:placeholder="payTypePlaceholder"
/>
<el-button link type="primary" @click="handleWxPay()">扫码支付</el-button>
<el-button link type="primary" @click="getWxPayResult()">查看结果</el-button>
</div>
<!-- 金额汇总 -->
<div class="summary">
<el-space :size="30">
@@ -90,12 +108,13 @@
</template>
</el-dialog>
</template>
<script setup>
import { savePayment } from './outpatientregistration';
import { savePayment, wxPay, WxPayResult } from './outpatientregistration';
import { computed, watch, reactive, ref, getCurrentInstance, nextTick } from 'vue';
import { Delete } from '@element-plus/icons-vue';
import { debounce } from 'lodash-es';
import printUtils, { PRINT_TEMPLATE } from '@/utils/printUtils';
// 获取费用性质文本
const getFeeTypeText = computed(() => {
@@ -147,6 +166,7 @@ const props = defineProps({
type: Object,
default: undefined,
},
<<<<<<< HEAD
medfee_paymtd_code: {
type: Array,
default: () => [],
@@ -155,10 +175,21 @@ const props = defineProps({
type: String,
default: '',
}
=======
orgId: {
type: String,
default: '',
},
orgName: {
type: String,
default: '',
},
>>>>>>> v1.3
});
const { proxy } = getCurrentInstance();
const dialogLoading = ref(false);
const txtCode = ref('');
const throttledGetList = debounce(submit, 300);
const formData = reactive({
totalAmount: 0,
@@ -182,114 +213,231 @@ watch(
const emit = defineEmits(['close']);
// 根据printUtils实现的打印方法
async function printReceipt(param) {
console.log(param, 'param');
console.log(props.patientInfo, 'props.patientInfo');
console.log('打印收费小票数据:', param);
console.log('患者信息:', props.patientInfo);
// 构造一个新的对象,添加头 "data"
const result = {
data: [
{
...param,
// 基础支付类型
YB_FUND_PAY: param.detail.find((t) => t.payEnum === 100000)?.amount ?? 0, // 基支付总额
SELF_PAY: param.detail.find((t) => t.payEnum === 200000)?.amount ?? 0, // 个人负担总金
OTHER_PAY: param.detail.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额
try {
// 构造打印数据
const printData = {
data: [
{
...param,
// 基支付类型
YB_FUND_PAY: param.detail.find((t) => t.payEnum === 100000)?.amount ?? 0, // 基金支付总
SELF_PAY: param.detail.find((t) => t.payEnum === 200000)?.amount ?? 0, // 个人负担金额
OTHER_PAY: param.detail.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额)
// 基本医保统筹基金支出
YB_TC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 110000)?.amount ?? 0, // 基本医保统筹基金支出
YB_BC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 120000)?.amount ?? 0, // 补充医疗保险基金支出
YB_JZ_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 130000)?.amount ?? 0, // 医疗救助基金支出
YB_OTHER_AMOUNT: param.detail.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出
// 基本医保统筹基金支出
YB_TC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 110000)?.amount ?? 0, // 基本医保统筹基金支出
YB_BC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 120000)?.amount ?? 0, // 补充医疗保险基金支出
YB_JZ_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 130000)?.amount ?? 0, // 医疗救助基金支出
YB_OTHER_AMOUNT: param.detail.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出
// 职工基本医疗保险
YB_TC_ZG_FUND_VALUE: param.detail.find((t) => t.payEnum === 110100)?.amount ?? 0, // 职工基本医疗保险
YB_TC_JM_FUND_VALUE: param.detail.find((t) => t.payEnum === 110200)?.amount ?? 0, // 居民基本医疗保险(修正原错误注释)
// 职工基本医疗保险
YB_TC_ZG_FUND_VALUE: param.detail.find((t) => t.payEnum === 110100)?.amount ?? 0, // 职工基本医疗保险
YB_TC_JM_FUND_VALUE: param.detail.find((t) => t.payEnum === 110200)?.amount ?? 0, // 居民基本医疗保险
// 补充医疗保险基金支出细分
YB_BC_JM_DB_VALUE: param.detail.find((t) => t.payEnum === 120100)?.amount ?? 0, // 全体参保人的居民大病保险
YB_BC_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120200)?.amount ?? 0, // 大额医疗费用补助
YB_BC_ZG_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120300)?.amount ?? 0, // 企业职工大额医疗费用补助
YB_BC_GWY_BZ_VALUE: param.detail.find((t) => t.payEnum === 120400)?.amount ?? 0, // 公务员医疗补助
// 补充医疗保险基金支出细分
YB_BC_JM_DB_VALUE: param.detail.find((t) => t.payEnum === 120100)?.amount ?? 0, // 全体参保人的居民大病保险
YB_BC_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120200)?.amount ?? 0, // 大额医疗费用补助
YB_BC_ZG_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120300)?.amount ?? 0, // 企业职工大额医疗费用补助
YB_BC_GWY_BZ_VALUE: param.detail.find((t) => t.payEnum === 120400)?.amount ?? 0, // 公务员医疗补助
// 其他支出细分
OTHER_PAY_DD_FUND_VALUE: param.detail.find((t) => t.payEnum === 300001)?.amount ?? 0, // 兜底基金支出
OTHER_PAY_YW_SH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300002)?.amount ?? 0, // 意外伤害基金支出
OTHER_PAY_LX_YL_FUND_VALUE: param.detail.find((t) => t.payEnum === 300003)?.amount ?? 0, // 离休人员医疗保障金支出
OTHER_PAY_LX_YH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300004)?.amount ?? 0, // 离休人员优惠金支出
OTHER_PAY_CZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300005)?.amount ?? 0, // 财政基金支出
OTHER_PAY_CZ_YZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300006)?.amount ?? 0, // 财政预支支出
OTHER_PAY_ZG_DB_FUND_VALUE: param.detail.find((t) => t.payEnum === 300007)?.amount ?? 0, // 职工大病基金支出
OTHER_PAY_EY_FUND_VALUE: param.detail.find((t) => t.payEnum === 300008)?.amount ?? 0, // 二乙基金支出
OTHER_PAY_QX_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300009)?.amount ?? 0, // 倾斜救助支出
OTHER_PAY_YL_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300010)?.amount ?? 0, // 医疗救助再救助基金
HOSP_PART_AMT: param.detail.find((t) => t.payEnum === 300011)?.amount ?? 0, // 医院负担金额
// 其他支出细分
OTHER_PAY_DD_FUND_VALUE: param.detail.find((t) => t.payEnum === 300001)?.amount ?? 0, // 兜底基金支出
OTHER_PAY_YW_SH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300002)?.amount ?? 0, // 意外伤害基金支出
OTHER_PAY_LX_YL_FUND_VALUE: param.detail.find((t) => t.payEnum === 300003)?.amount ?? 0, // 离休人员医疗保障金支出
OTHER_PAY_LX_YH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300004)?.amount ?? 0, // 离休人员优惠金支出
OTHER_PAY_CZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300005)?.amount ?? 0, // 财政基金支出
OTHER_PAY_CZ_YZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300006)?.amount ?? 0, // 财政预支支出
OTHER_PAY_ZG_DB_FUND_VALUE: param.detail.find((t) => t.payEnum === 300007)?.amount ?? 0, // 职工大病基金支出
OTHER_PAY_EY_FUND_VALUE: param.detail.find((t) => t.payEnum === 300008)?.amount ?? 0, // 二乙基金支出
OTHER_PAY_QX_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300009)?.amount ?? 0, // 倾斜救助支出
OTHER_PAY_YL_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300010)?.amount ?? 0, // 医疗救助再救助基金
HOSP_PART_AMT: param.detail.find((t) => t.payEnum === 300011)?.amount ?? 0, // 医院负担金额
// 医保结算返回值
FULAMT_OWNPAY_AMT: param.detail.find((t) => t.payEnum === 1)?.amount ?? 0, // 全自费金额
OVERLMT_SELFPAY: param.detail.find((t) => t.payEnum === 3)?.amount ?? 0, // 超限价自费费用
PRESELFPAY_AMT: param.detail.find((t) => t.payEnum === 4)?.amount ?? 0, // 先行自付金额
INSCP_SCP_AMT: param.detail.find((t) => t.payEnum === 5)?.amount ?? 0, // 符合政策范围金额
ACT_PAY_DEDC: param.detail.find((t) => t.payEnum === 6)?.amount ?? 0, // 实际支付起付线
POOL_PROP_SELFPAY: param.detail.find((t) => t.payEnum === 7)?.amount ?? 0, // 基本医疗保险统筹基金支付比例
BALC: param.detail.find((t) => t.payEnum === 8)?.amount ?? 0, // 余额
// 医保结算返回值 - 修复运算符优先级问题,添加括号确保正确拼接'元'
FULAMT_OWNPAY_AMT: (param.detail?.find((t) => t.payEnum === 1)?.amount ?? 0) + '元', // 全自费金额
OVERLMT_SELFPAY: (param.detail?.find((t) => t.payEnum === 3)?.amount ?? 0) + '元', // 超限价自费费用
PRESELFPAY_AMT: (param.detail?.find((t) => t.payEnum === 4)?.amount ?? 0) + '元', // 先行自付金额
INSCP_SCP_AMT: (param.detail?.find((t) => t.payEnum === 5)?.amount ?? 0) + '元', // 符合政策范围金额
ACT_PAY_DEDC: (param.detail?.find((t) => t.payEnum === 6)?.amount ?? 0) + '元', // 实际支付起付线
POOL_PROP_SELFPAY: (param.detail?.find((t) => t.payEnum === 7)?.amount ?? 0) + '元', // 基本医疗保险统筹基金支付比例
BALC: (param.detail?.find((t) => t.payEnum === 8)?.amount ?? 0) + '元', // 余额
// 特殊支付方式
SELF_YB_ZH_PAY: param.detail.find((t) => t.payEnum === 210000)?.amount ?? 0, // 个人医保账户支付
SELF_YB_ZH_GJ_VALUE: param.detail.find((t) => t.payEnum === 210100)?.amount ?? 0, // 账户共济支付金额
SELF_CASH_PAY: param.detail.find((t) => t.payEnum === 220000)?.amount ?? 0, // 个人现金支付金额
SELF_VX_PAY: param.detail.find((t) => t.payEnum === 230000)?.amount ?? 0, // 微信支付金额
SELF_ALI_PAY: param.detail.find((t) => t.payEnum === 240000)?.amount ?? 0, // 阿里支付金额
// 特殊支付方式
SELF_YB_ZH_PAY:
(param.detail?.find((t) => t.payEnum === 210000)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 210000)?.amount ?? 0) + '元'
: '', // 个人医保账户支付
SELF_YB_ZH_GJ_VALUE:
(param.detail?.find((t) => t.payEnum === 210100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 210100)?.amount ?? 0) + '元'
: '', // 账户共济支付金额
SELF_CASH_PAY:
(param.detail?.find((t) => t.payEnum === 220000)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 220000)?.amount ?? 0) + '元'
: '', // 个人现金支付金额
SELF_VX_PAY:
(param.detail?.find((t) => t.payEnum === 230000)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 230000)?.amount ?? 0) + '元'
: '', // 微信支付金额
SELF_ALI_PAY:
(param.detail?.find((t) => t.payEnum === 240000)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 240000)?.amount ?? 0) + '元'
: '', // 阿里支付金额
// 现金支付细分
SELF_CASH_VALUE: param.detail.find((t) => t.payEnum === 220400)?.amount ?? 0, // 个人现金支付金额(现金)
SELF_CASH_VX_VALUE: param.detail.find((t) => t.payEnum === 220100)?.amount ?? 0, // 个人现金支付金额(微信)
SELF_CASH_ALI_VALUE: param.detail.find((t) => t.payEnum === 220200)?.amount ?? 0, // 个人现金支付金额(支付宝)
SELF_CASH_UNION_VALUE: param.detail.find((t) => t.payEnum === 220300)?.amount ?? 0, // 个人现金支付金额(银联)
// 现金支付细分
SELF_CASH_VALUE:
(param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0) + '元'
: '', // 个人现金支付金额(现金)
SELF_CASH_VX_VALUE:
(param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0) + '元'
: '', // 个人现金支付金额(微信)
SELF_CASH_ALI_VALUE:
(param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0) + '元'
: '', // 个人现金支付金额(支付宝)
SELF_CASH_UNION_VALUE:
(param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0) + '元'
: '', // 个人现金支付金额(银联)
// 基金类型(扩展)
BIRTH_FUND: param.detail.find((t) => t.payEnum === 510100)?.amount ?? 0, // 生育基金
RETIREE_MEDICAL: param.detail.find((t) => t.payEnum === 340100)?.amount ?? 0, // 离休人员医疗保障基金
URBAN_BASIC_MEDICAL: param.detail.find((t) => t.payEnum === 390100)?.amount ?? 0, // 城乡居民基本医疗保险基金
URBAN_SERIOUS_ILLNESS: param.detail.find((t) => t.payEnum === 390200)?.amount ?? 0, // 城乡居民大病医疗保险基金
MEDICAL_ASSISTANCE: param.detail.find((t) => t.payEnum === 610100)?.amount ?? 0, // 医疗救助基金
GOVERNMENT_SUBSIDY: param.detail.find((t) => t.payEnum === 640100)?.amount ?? 0, // 政府兜底基金
ACCIDENT_INSURANCE: param.detail.find((t) => t.payEnum === 390400)?.amount ?? 0, // 意外伤害基金
CARE_INSURANCE: param.detail.find((t) => t.payEnum === 620100)?.amount ?? 0, // 照护保险基金
FINANCIAL_FUND: param.detail.find((t) => t.payEnum === 360100)?.amount ?? 0, // 财政基金
HOSPITAL_ADVANCE: param.detail.find((t) => t.payEnum === 999900)?.amount ?? 0, // 医院垫付
SUPPLEMENTARY_INSURANCE: param.detail.find((t) => t.payEnum === 390300)?.amount ?? 0, // 城乡居民大病补充保险基金
HEALTHCARE_PREPAYMENT: param.detail.find((t) => t.payEnum === 360300)?.amount ?? 0, // 保健预支基金
Mr_QR_Code: param.regNo,
sex: props.patientInfo.genderEnum_enumText,
age: props.patientInfo.age,
personType: '职工医保',
fixmedinsName: param.fixmedinsName + '门诊收费明细',
},
],
// feeDetial: param.detail, //收费项目,后端还未返回
};
// 将对象转换为 JSON 字符串
let jsonString = JSON.stringify(result, null, 2);
console.log(jsonString, 'jsonString');
await CefSharp.BindObjectAsync('boundAsync');
await boundAsync.printReport(
'门诊收费明细单.grf',
jsonString
)
// 基金类型(扩展)
BIRTH_FUND:
(param.detail?.find((t) => t.payEnum === 510100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 510100)?.amount ?? 0) + '元'
: '', // 生育基金
RETIREE_MEDICAL:
(param.detail?.find((t) => t.payEnum === 340100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 340100)?.amount ?? 0) + '元'
: '', // 离休人员医疗保障基金
URBAN_BASIC_MEDICAL:
(param.detail?.find((t) => t.payEnum === 390100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 390100)?.amount ?? 0) + '元'
: '', // 城乡居民基本医疗保险基金
URBAN_SERIOUS_ILLNESS:
(param.detail?.find((t) => t.payEnum === 390200)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 390200)?.amount ?? 0) + '元'
: '', // 城乡居民大病医疗保险基金
MEDICAL_ASSISTANCE:
(param.detail?.find((t) => t.payEnum === 610100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 610100)?.amount ?? 0) + '元'
: '', // 医疗救助基金
GOVERNMENT_SUBSIDY:
(param.detail?.find((t) => t.payEnum === 640100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 640100)?.amount ?? 0) + '元'
: '', // 政府兜底基金
ACCIDENT_INSURANCE:
(param.detail?.find((t) => t.payEnum === 390400)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 390400)?.amount ?? 0) + '元'
: '', // 意外伤害基金
CARE_INSURANCE:
(param.detail?.find((t) => t.payEnum === 620100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 620100)?.amount ?? 0) + '元'
: '', // 照护保险基金
FINANCIAL_FUND:
(param.detail?.find((t) => t.payEnum === 360100)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 360100)?.amount ?? 0) + '元'
: '', // 财政基金
HOSPITAL_ADVANCE:
(param.detail?.find((t) => t.payEnum === 999900)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 999900)?.amount ?? 0) + '元'
: '', // 医院垫付
SUPPLEMENTARY_INSURANCE:
(param.detail?.find((t) => t.payEnum === 390300)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 390300)?.amount ?? 0) + '元'
: '', // 城乡居民大病补充保险基金
HEALTHCARE_PREPAYMENT:
(param.detail?.find((t) => t.payEnum === 360300)?.amount ?? 0) > 0
? (param.detail?.find((t) => t.payEnum === 360300)?.amount ?? 0) + '元'
: '', // 保健预支基金
//微信刷卡支付
SELF_CASH_VX_VALUE: (() => {
// const cashValue = param.detail.find((t) => t.payEnum === 220400)?.amount ?? 0;
const vxValue = param.detail.find((t) => t.payEnum === 220100)?.amount ?? 0;
const unionValue = param.detail.find((t) => t.payEnum === 220300)?.amount ?? 0;
const aliValue = param.detail.find((t) => t.payEnum === 220200)?.amount ?? 0;
return vxValue + unionValue + aliValue + '元';
})(),
// 患者信息
patientName: param.patientName || '',
sex: param.sex === 1 ? '女' : param.sex === 0 ? '男' : param.sex || '',
age: param.age ? param.age + '岁' : '',
personType: param.contractName, //病人类型
// 挂号和就诊信息
encounterId: props.patientInfo?.encounterId || '',
busNo: props.patientInfo?.busNo || '',
Mr_QR_Code: param.regNo || props.registerBusNo,
// 科室和医生信息
organizationName: props.orgName || props.patientInfo?.organizationName || '',
practitionerName: props.patientInfo?.practitionerName || '',
healthcareName: props.patientInfo?.healthcareName || '',
// 费用信息
fixmedinsName: param.fixmedinsName
? param.fixmedinsName + '门诊收费明细'
: '门诊收费明细',
// 收费员
cashier: param.paymentEmployee,
// 收费时间
chargeTime: new Date().toLocaleString(),
//电子收据二维码
pictureUrl: param.pictureUrl || 'https://chinaebill.com/img/xiaochengxu.png',
},
],
};
// 选择门诊挂号打印模板
console.log('printDataprintDataprintDataprintDataprintData', printData.data[0]);
await printUtils.print(PRINT_TEMPLATE.OUTPATIENT_REGISTRATION, printData.data[0]);
console.log('打印成功');
} catch (error) {
console.error('打印失败:', error);
proxy.$modal.msgError('打印失败: ' + error.message);
}
}
function handleWxPay() {
console.log('开始微信支付,当前支付详情:', formData.selfPay);
console.log(
'支付金额详情:',
formData.selfPay.map((item) => ({ payEnum: item.payEnum, amount: item.amount }))
);
wxPay({
txtCode: txtCode.value,
//chargeItemIds: props.chargeItemIds,
//encounterId: props.patientInfo.encounterId,
id: props.paymentId,
paymentDetails: formData.selfPay,
// ybMdtrtCertType: props.userCardInfo.psnCertType,
// busiCardInfo: props.userCardInfo.busiCardInfo,
})
.then((response) => {
//返回结果是jsonString可判断其调用是否成功
console.log(response, 'response');
var res = JSON.parse(response);
if (!res.IsSuccess) {
proxy.$modal.msgError('调用打印插件失败:' + res.ErrorMessage);
}
console.log('微信支付请求成功:', response);
})
.catch((error) => {
proxy.$modal.msgError('调用打印插件失败:' + error);
console.error('微信支付请求失败:', error);
});
}
function getWxPayResult() {
WxPayResult({
txtCode: txtCode.value,
chargeItemIds: props.chargeItemIds,
encounterId: props.patientInfo.encounterId,
id: props.paymentId,
paymentDetails: formData.selfPay,
ybMdtrtCertType: props.userCardInfo.psnCertType,
busiCardInfo: props.userCardInfo.busiCardInfo,
});
}
function submit() {
if (parseFloat(displayAmount.value) < formData.totalAmount) {
proxy.$modal.msgError('请输入正确的结算金额');
@@ -311,8 +459,8 @@ function submit() {
.then((res) => {
if (res.code == 200) {
printReceipt(res.data);
(formData.selfPay = [{ payEnum: 220100, amount: 0.0, payLevelEnum: 2 }]),
emit('close', 'success');
formData.selfPay = [{ payEnum: 220100, amount: 0.0, payLevelEnum: 2 }];
emit('close', 'success');
}
})
.finally(() => {
@@ -323,10 +471,10 @@ function submit() {
const currentDate = ref(new Date().toLocaleString());
const selfPayMethods = [
{ label: '现金', value: 220400 },
{ label: '微信', value: 220100 },
{ label: '支付宝', value: 220200 },
{ label: '银联', value: 220300 },
{ label: '现金', value: 220400, isWebPay: false },
{ label: '微信', value: 220100, isWebPay: true },
{ label: '支付宝', value: 220200, isWebPay: true },
{ label: '银联', value: 220300, isWebPay: true },
];
// 计算剩余可输入金额
@@ -349,10 +497,27 @@ const getMax = (index) => {
};
// 检查支付方式是否已使用
const isMethodDisabled = (payEnum) => {
return formData.selfPay.some((item) => item.payEnum === payEnum);
const isMethodDisabled = (option) => {
if (formData.selfPay.length > 1) {
// 禁用已被选择的相同方式,避免重复选择
const selectedEnums = formData.selfPay.map((item) => item.payEnum);
debugger;
if (selectedEnums.includes(option.value)) {
return true;
}
// 若已经选择了任一线上支付方式,则其他线上方式不可再选,仅允许现金等线下方式
const hasSelectedWebPay = selectedEnums.some((val) => {
const found = selfPayMethods.find((m) => m.value === val);
return found ? found.isWebPay === true : false;
});
if (hasSelectedWebPay && option.isWebPay) {
return true;
}
return false;
} else {
return false;
}
};
const handleAmountChange = () => {
// 不需要在这里直接设置 returnedAmount依赖 computed 属性
};
@@ -367,9 +532,21 @@ const addPayment = () => {
const removePayment = (index) => {
formData.selfPay.splice(index, 1);
};
const payTypeText = ref('微信');
const payTypePlaceholder = computed(() => {
if (payTypeText.value === '现金') {
return '请输入现金金额';
}
return payTypeText.value + '支付二维码';
});
const clearAmount = (index) => {
// formData.selfPay[index].amount = 0;
const selectedOption = selfPayMethods.find(
(item) => item.value === formData.selfPay[index].payEnum
);
if (selectedOption) {
payTypeText.value = selectedOption.label;
}
};
// 计算属性
@@ -387,6 +564,8 @@ const returnedAmount = computed(() => {
});
function close() {
//清空表单数据
txtCode.value = '';
emit('close', 'cancel');
}
</script>
@@ -486,4 +665,4 @@ function close() {
color: #999;
pointer-events: none; /* 避免点击干扰 */
}
</style>
</style>