Przeglądaj źródła

fix: 缴费列表和缴费详情新增字段

carver 2 lat temu
rodzic
commit
30f9685004

+ 1 - 1
antbuilder/industry/hospitalV2/components/hospital-payment/index.axml

@@ -41,7 +41,7 @@
       </view>
       <view class="payment-flex-r" a:if="{{ props.item.status === 0 }}">
         <view class="payment-flex-b" a:if="{{ props.item.type === 3 && props.item.medicareBinded }}" catchTap="onPayment" data-item="{{ props.item }}" data-medicareBinded="{{ true }}">刷医保</view>
-        <view class="payment-flex-b" catchTap="onPayment" data-item="{{ props.item }}">付款</view>
+        <view class="payment-flex-b" a:if="{{ props.item.total !== 0 }}" catchTap="onPayment" data-item="{{ props.item }}">付款</view>
       </view>
     </view>
   </scroll-fetch>

+ 17 - 2
antbuilder/industry/hospitalV2/components/hospital-payment/index.js

@@ -92,6 +92,13 @@ Component({
 					name,
 					age,
 					sex,
+					prescribeDate,
+					hisOrderNo,
+					doctorName,
+					doctorCode,
+					total,
+					hisClinicCode,
+					deptName,
 				},
 			} = e.target.dataset;
 			history.push({
@@ -109,6 +116,13 @@ Component({
 					name,
 					age,
 					sex,
+					prescribeDate,
+					hisOrderNo,
+					doctorName,
+					doctorCode,
+					total,
+					hisClinicCode,
+					deptName,
 				},
 				pageType: "hospital-payment-detail",
 			});
@@ -118,7 +132,6 @@ Component({
 		async onPayment(e) {
 			const { medicareBinded = false, item } = e.target.dataset; // 同意订阅消息后发起支付
 			// 挂号
-
 			if (item.type === 1) {
 				await tradePay(
 					{
@@ -149,6 +162,7 @@ Component({
 						useBalance: !medicareBinded,
 						useMedicare: medicareBinded,
 						outTradeNo: item.outTradeNo,
+						...item,
 					},
 					{
 						tradeType: "Outpatient",
@@ -161,11 +175,12 @@ Component({
 					dataset: {
 						outTradeNo: item.outTradeNo,
 						type: item.type,
+						...item,
 					},
 				},
 			}); // 发起消息订阅
 
-			this.subscribe.subscribeMessage();
+			// this.subscribe.subscribeMessage();
 		},
 	},
 });

+ 146 - 104
antbuilder/industry/hospitalV2/utils/tradePay.js

@@ -1,125 +1,167 @@
-import { tradeNoForOrder, tradeResult, tradeNoQuery } from '../service/common';
+import { tradeNoForOrder, tradeResult, tradeNoQuery } from "../service/common";
 
 const tradePay = function (params, option = {}) {
-  // eslint-disable-next-line no-param-reassign
-  option = Object.assign({
-    useBalance: false,
-    useMedicare: false,
-    tradeType: 'Appointment' // Outpatient: 门诊缴费; Appointment: 挂号、充值
-
-  }, option);
-  console.log(params, option);
-
-  if (option.tradeType === 'Appointment') {
-    /**
-     * params 挂号 : { type: 1, idNum: '', depName: '' }
-     * params 充值 : { type: 2, idNum: '', amount: 0 }
-     */
-    return appointment(params);
-  } else {
-    /**
-     * params : { outTradeNo }
-     */
-    return outpatient(params);
-  }
+	// eslint-disable-next-line no-param-reassign
+	option = Object.assign(
+		{
+			useBalance: false,
+			useMedicare: false,
+			tradeType: "Appointment", // Outpatient: 门诊缴费; Appointment: 挂号、充值
+		},
+		option
+	);
+	console.log(params, option);
+
+	if (option.tradeType === "Appointment") {
+		/**
+		 * params 挂号 : { type: 1, idNum: '', depName: '' }
+		 * params 充值 : { type: 2, idNum: '', amount: 0 }
+		 */
+		return appointment(params);
+	} else {
+		/**
+		 * params : { outTradeNo }
+		 */
+		return outpatient(params);
+	}
 }; // 挂号,充值类订单
 
-
 function appointment(params) {
-  return tradeNoQuery(params).then(_tradePay);
+	return tradeNoQuery(params).then(_tradePay);
 } // 门诊类订单
 
-
 function outpatient(params) {
-  return tradeNoForOrder({
-    useBalance: params.useBalance,
-    // 是否使用就诊卡余额
-    useMedicare: params.useMedicare,
-    // 是否使用医保卡余额
-    outTradeNo: params.outTradeNo // 商家订单号
-
-  }).then(tradeData => {
-    if (tradeData.tradeNo) {
-      // 发起支付
-      return _tradePay(tradeData);
-    } else {
-      return Promise.resolve(compareResult({
-        success: true
-      }));
-    }
-  });
+	const {
+		hisPatientId,
+		age,
+		sex,
+		orderId,
+		hisOrderNo,
+		amount,
+		deptName,
+		doctorName,
+		doctorCode,
+		total,
+		hisClinicCode,
+		name,
+		prescribeDate,
+	} = params;
+	return tradeNoForOrder({
+		useBalance: params.useBalance,
+		// 是否使用就诊卡余额
+		useMedicare: params.useMedicare,
+		// 是否使用医保卡余额
+		outTradeNo: params.outTradeNo, // 商家订单号
+		// 新增参数
+		hisPatientId,
+		age,
+		sex,
+		orderId,
+		hisOrderNo,
+		amount,
+		deptName,
+		doctorName,
+		doctorCode,
+		total,
+		hisClinicCode,
+		name,
+		prescribeDate,
+	}).then((tradeData) => {
+		if (tradeData.tradeNo) {
+			// 发起支付
+			return _tradePay(tradeData);
+		} else {
+			return Promise.resolve(
+				compareResult({
+					success: true,
+				})
+			);
+		}
+	});
 } // 处理支付结果
 
-
 function compareResult(param) {
-  console.log(param);
+	console.log(param);
 
-  if (!param.success) {
-    my.showToast({
-      type: 'fail',
-      content: param.payRes.memo || '订单支付失败'
-    });
-  }
+	if (!param.success) {
+		my.showToast({
+			type: "fail",
+			content: param.payRes.memo || "订单支付失败",
+		});
+	}
 
-  return param.success;
+	return param.success;
 }
 
-function _tradePay(tradeData = {
-  tradeNo: '',
-  outTradeNo: ''
-}) {
-  return new Promise((resolve, reject) => {
-    my.tradePay({
-      tradeNO: tradeData.tradeNo,
-
-      success(payRes) {
-        // 4000 订单处理失败
-        // 6001 用途中途取消支付
-        // 6002 网络链接出错
-        if (payRes.resultCode === '4000' || payRes.resultCode === '6002' || payRes.resultCode === '6001') {
-          // 支付失败
-          reject(compareResult({
-            success: false,
-            payRes
-          }));
-        } else {
-          // 其他情况调用接口确认
-          triggerPay({
-            tradeNo: tradeData.tradeNo,
-            outTradeNo: tradeData.outTradeNo,
-            resultCode: payRes.resultCode
-          }).then(r => {
-            if (r.status === 'TRADE_SUCCESS') {
-              resolve(compareResult({
-                success: true,
-                payRes
-              }));
-            } else {
-              reject(compareResult({
-                success: false,
-                payRes
-              }));
-            }
-          });
-        }
-      },
-
-      fail: payRes => {
-        // 订单支付异常
-        reject(compareResult({
-          success: false,
-          payRes
-        }));
-      }
-    });
-  });
+function _tradePay(
+	tradeData = {
+		tradeNo: "",
+		outTradeNo: "",
+	}
+) {
+	return new Promise((resolve, reject) => {
+		my.tradePay({
+			tradeNO: tradeData.tradeNo,
+
+			success(payRes) {
+				// 4000 订单处理失败
+				// 6001 用途中途取消支付
+				// 6002 网络链接出错
+				if (
+					payRes.resultCode === "4000" ||
+					payRes.resultCode === "6002" ||
+					payRes.resultCode === "6001"
+				) {
+					// 支付失败
+					reject(
+						compareResult({
+							success: false,
+							payRes,
+						})
+					);
+				} else {
+					// 其他情况调用接口确认
+					triggerPay({
+						tradeNo: tradeData.tradeNo,
+						outTradeNo: tradeData.outTradeNo,
+						resultCode: payRes.resultCode,
+					}).then((r) => {
+						if (r.status === "TRADE_SUCCESS") {
+							resolve(
+								compareResult({
+									success: true,
+									payRes,
+								})
+							);
+						} else {
+							reject(
+								compareResult({
+									success: false,
+									payRes,
+								})
+							);
+						}
+					});
+				}
+			},
+
+			fail: (payRes) => {
+				// 订单支付异常
+				reject(
+					compareResult({
+						success: false,
+						payRes,
+					})
+				);
+			},
+		});
+	});
 } // 验证支付结果
 
-
 function triggerPay(param) {
-  return tradeResult(param);
+	return tradeResult(param);
 }
 
 export default {
-  tradePay
-};
+	tradePay,
+};