|
|
@@ -48,10 +48,13 @@ export default {
|
|
|
rechargePurpose: {}, // 充值用途
|
|
|
medicalRecords: {}, // 就诊记录
|
|
|
rechargeAmount: "",
|
|
|
+ rechargeAmountMax: "", // 充值金额上限(订单总额),从 URL 带入后锁定不变,不和 rechargeAmount 同步
|
|
|
admObj: {},
|
|
|
purPoseObj: {},
|
|
|
platform: app.globalData.platform,
|
|
|
- provider: app.globalData.provider
|
|
|
+ provider: app.globalData.provider,
|
|
|
+ prePayAmt: '', // 最小充值金额(下限),由上游 advancePayment 透传
|
|
|
+ prePayIDInfo: '', // 押金账户信息,从 order.vue turnTrans 透传,传给 99070016
|
|
|
}
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
@@ -60,16 +63,51 @@ export default {
|
|
|
eventChannel.on('selectAVisit', function (data) {
|
|
|
_tihs.setData({
|
|
|
admObj: data.admObj,
|
|
|
- purPoseObj: data.purPoseObj
|
|
|
+ purPoseObj: data.purPoseObj,
|
|
|
+ rechargeAmount: data.rechargeAmount || '',
|
|
|
+ prePayAmt: data.prePayAmt || '',
|
|
|
}, () => {
|
|
|
console.log("admObj", _tihs.purPoseObj)
|
|
|
});
|
|
|
})
|
|
|
+ // 从账单页直接 URL 参数带入(跳过 advancePayment 中转的新流程)
|
|
|
+ if (options && (options.purPoseCode || options.rechargeAmount || options.prePayAmt || options.admID)) {
|
|
|
+ _tihs.setData({
|
|
|
+ purPoseObj: {
|
|
|
+ accpurPoseCode: options.purPoseCode || '',
|
|
|
+ accpurPoseDesc: options.purPoseDesc || options.purPoseCode || '',
|
|
|
+ },
|
|
|
+ admObj: { admID: options.admID || '' },
|
|
|
+ rechargeAmount: options.rechargeAmount || '',
|
|
|
+ rechargeAmountMax: options.rechargeAmount || '', // 上限锁定,不和输入同步
|
|
|
+ prePayAmt: options.prePayAmt || '',
|
|
|
+ prePayIDInfo: options.prePayIDInfo || '',
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
onChange(event) {
|
|
|
+ const val = event.detail.value;
|
|
|
+ const upper = +this.rechargeAmountMax; // 用锁定上限,不用当前输入值
|
|
|
+ const lower = +this.prePayAmt;
|
|
|
+ // 上限校验(订单金额,锁定不变)
|
|
|
+ if (upper && +val > upper) {
|
|
|
+ uni.showToast({
|
|
|
+ title: `金额不能超过 ${upper} 元`,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 下限校验(后端返回的最小充值金额),仅当 prePayAmt 有值时校验
|
|
|
+ if (this.prePayAmt && +val < lower) {
|
|
|
+ uni.showToast({
|
|
|
+ title: `金额不能小于 ${lower} 元`,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- rechargeAmount: event.detail.value
|
|
|
+ rechargeAmount: val
|
|
|
})
|
|
|
},
|
|
|
|
|
|
@@ -80,10 +118,31 @@ export default {
|
|
|
let userData = this.$cache.get('userData');
|
|
|
let {
|
|
|
rechargeAmount,
|
|
|
+ rechargeAmountMax,
|
|
|
+ prePayAmt,
|
|
|
+ prePayIDInfo,
|
|
|
admObj,
|
|
|
purPoseObj,
|
|
|
platform
|
|
|
} = this
|
|
|
+ // 上下限二次校验(防止 onChange 被绕过:粘贴、长按等场景)
|
|
|
+ const val = +rechargeAmount;
|
|
|
+ const upper = +rechargeAmountMax;
|
|
|
+ const lower = +prePayAmt;
|
|
|
+ if (upper && val > upper) {
|
|
|
+ uni.showToast({
|
|
|
+ title: `金额不能超过 ${upper} 元`,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (prePayAmt && val < lower) {
|
|
|
+ uni.showToast({
|
|
|
+ title: `金额不能小于 ${lower} 元`,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
const userCode = platform == "alipay" ? "alisf" : "wxsf"
|
|
|
const payWayCode = platform == "alipay" ? "ALIPAY" : "WECHAT"
|
|
|
let data1 = {
|
|
|
@@ -99,6 +158,7 @@ export default {
|
|
|
payWayCode,
|
|
|
payWayAmt: rechargeAmount || "",
|
|
|
purPoseCode: purPoseObj.accpurPoseCode || "",
|
|
|
+ prePayIDInfo: prePayIDInfo || "",
|
|
|
}]
|
|
|
}
|
|
|
let data = {
|
|
|
@@ -109,7 +169,7 @@ export default {
|
|
|
payReasonID: "",
|
|
|
insuType: "",
|
|
|
body: "",
|
|
|
- businessType: "DEPAliPAY", // "OPPAY",
|
|
|
+ businessType: "DEPPAY", // "OPPAY",
|
|
|
patNo: userData.hisPatNo ? userData.hisPatNo : '',
|
|
|
patName: userData.patDesc ? userData.patDesc : '',
|
|
|
idCardNo: userData.idCardNo,
|