Browse Source

feature: 添加就诊指南静态页面

liweimin 2 years ago
parent
commit
4e328f113f

+ 10 - 0
antbuilder/core/utils/ywtService.js

@@ -19,3 +19,13 @@ export async function doctorSchedule(data) {
 	if (err || !res) return [err, null];
 	return [null, res];
 }
+
+export async function getRegisteredAnnouncement(data) {
+	const [err, res] = await ywtRequest({
+		url: "/register/getRegisteredAnnouncement",
+		method: "post",
+		data,
+	});
+	if (err || !res) return [err, null];
+	return [null, res];
+}

+ 5 - 0
antbuilder/industry/hospitalV2/components/follow-up-notice/index.acss

@@ -1,3 +1,8 @@
+.hospital-new-component .follow-up-notice{
+  padding: 20rpx;
+  margin-bottom: 300rpx
+}
+
 .hospital-new-component .follow-up-notice .title {
   color: #333;
   font-weight: 550;

+ 1 - 117
antbuilder/industry/hospitalV2/components/follow-up-notice/index.axml

@@ -1,122 +1,6 @@
 <wrapper>
   <view class="follow-up-notice">
-    <view a:if="{{ type === 'normal' }}" class="rich-container">
-      <view class="title">网络挂号须知</view>
-      <view class="rich-content">
-        <view class="warm-text">
-          浙大一院总部一起暂未开放发热门诊,有发热症状或者体温超过37.5℃的病友,请到庆春、之江院区发热门诊就诊。
-        </view>
-        <view class="text-item">
-          <view class="sub-title">
-            1.实名制预约
-          </view>
-          <view class="sub-text">
-            我院门诊已经全面施行实名制预约模式
-          </view>
-        </view>
-        <view class="text-item">
-          <view class="sub-title">
-            2.预约制
-          </view>
-          <view class="sub-text">
-            我院门诊已经全面施行“非急诊预约挂号服务”模式,所有号源都实行预约制,不为现场预留号,当日挂号均为预约剩余号。请患者朋友们提前预约挂号。
-          </view>
-        </view>
-        <view class="text-item">
-          <view class="sub-title">
-            3.预约时间
-          </view>
-          <view class="sub-text">
-            预约周期已调整为7天(每日08:00-20:00循环放号)
-          </view>
-        </view>
-        <view class="text-item">
-          <view class="sub-title">
-            4.挂号规则
-          </view>
-          <view class="sub-text">
-            挂号时间上午号08:00-11:00,下午号08:00-15:00当日挂号不可退号
-            支付成功后无需取号,请直接持就诊卡(电子就诊卡均可)报道候诊
-            心里咨询门诊请严格按照提示时段就诊,过时作废
-          </view>
-        </view>
-      </view>
-    </view>
-    <view a:if="{{ type === 'huangshi' }}" class="rich-container">
-      <view class="title">南方医院白云分院疫情期间就诊温馨告知</view>
-      <view class="rich-content">
-        <view class="text-item">
-          <view class="sub-text">
-            南方医院白云分院疫情期间就诊温馨提示
-          </view>
-          <view class="sub-text">
-            尊敬的市民朋友∶
-          </view>
-          <view class="sub-text">
-            为贯彻落实国家新冠疫情防控工作与维持日常诊疗服务相关部署,切实保障您及家人的健康,现就我院近期就诊相关事宜温馨告知如下,请您仔细阅读。
-          </view>
-        </view>
-        <view class="text-item">
-          <view class="sub-title">
-            一、进入医院须知
-          </view>
-          <view class="sub-text">
-            1.所有人员须监测体温,佩戴口罩,出示穗康码/粤康码(<text class="green">绿码</text>),须扫描我院的"<text class="red">通行健康码</text>"登记。
-          </view>
-          <view class="sub-text">
-            2.进入诊区均须经过<text class="red">预检分诊<text>。
-          </view>
-          <view class="sub-text">
-            3.国内低风险区域即中、高风险区所有县(市、区、镇)的其他地区(不含广州低风险区域),须持来穗后<text class="red">24小时</text>核酸<text class="red">阴性</text>结果就诊。
-          </view>
-          <view class="sub-text">
-            4.<text class="red">住院患者</text>及<text class="red">陪护</text>需持有<text class="red">48小时内</text>核酸<text class="red">阴性</text>结果。
-          </view>
-        </view>
-        <view class="text-item">
-          <view class="sub-title">
-            二、门诊就诊须知
-          </view>
-          <view class="sub-text">
-            1.普通门诊开诊时间∶周一至周日上午<text class="red">:08∶00-12∶00,下午:13∶00-16∶00,夜诊:16∶00-21∶00</text>。节假日另行通知。
-          </view>
-          <view class="sub-text">
-            2.除急诊外,消化内镜、门诊手术、口腔治疗、咽喉镜、雾化、碳13、肺功能检查、透析等高风险操作应有<text class="red">72小时内</text>核酸<text class="red">阴性</text>结果。
-          </view>
-          <view class="sub-text">
-            3.候诊时请您尽量保持<text class="red">1米以上</text>距离排队,避免人群拥挤。
-          </view>
-          <view class="sub-text">
-            4.严格执行"<text class="red">一人一诊一室</text>",老年体弱、行动不便患者及儿童仅允许一人陪同。
-          </view>
-          <view class="sub-text">
-            5.我院新冠疫苗接种时间为:<text class="red">周一~周日:上午8:00-11:30,下午13:30-15:30</text>。
-          </view>
-        </view>
-        <view class="text-item">
-          <view class="sub-title">
-            特殊人群<text class="red">禁止</text>进入院内:
-          </view>
-          <view class="sub-text">
-            1.我院发热门诊<text class="red">暂停对外开放</text>,请至就近开设发热门诊的医疗机构就诊。
-          </view>
-          <view class="sub-text">
-            2.<text class="red">红码</text>人员∶一律上报社区三人小组,等待转运。
-          </view>
-          <view class="sub-text">
-            3.<text class="yellow">黄码</text>人员∶有新冠“十大症状”者,请至就近开设发热门诊的医疗机构就诊。
-          </view>
-        </view>
-        <view class="text-item">
-          <view class="sub-text">
-            所有人员不得隐瞒与疫情相关的病史、疫情中高风险地区旅居史、或与疑似患者接触史等,故意隐瞒相关信息,造成疫情扩散者,将被依法追究刑事责任。
-          </view>
-          <view class="sub-text">
-            2022年8月8日
-          </view>
-        </view>
-      </view>
-    </view>
+    <mas-adc-rich-pro content="{{ content }}"/>
     <view class="fixed-footer">
       <view class="agree-container">
         <text>同意</text>

+ 13 - 1
antbuilder/industry/hospitalV2/components/follow-up-notice/index.js

@@ -1,14 +1,18 @@
 import history from "../../utils/history";
+import { getRegisteredAnnouncement } from "../../../../core/utils/ywtService";
 Component({
 	props: {
 		componentData: {},
 	},
 	data: {
 		type: "",
+		content: "",
 	},
 	didMount() {
 		const { query = {} } = this.$page.data;
-		const { name } = query;
+		const { name, hospitalDistrictId } = query;
+		console.log("query ===>", query);
+		this.getAgreement(hospitalDistrictId);
 		const nameMap = {
 			黄石总院: "huangshi",
 		};
@@ -17,6 +21,14 @@ Component({
 		});
 	},
 	methods: {
+		async getAgreement(hospitalId) {
+			const [err, result] = await getRegisteredAnnouncement({
+				hospitalId: Number(hospitalId),
+			});
+			if (!err && result && result.id > 0) {
+				this.setData({ content: result.content });
+			}
+		},
 		toNextPage() {
 			const { componentData } = this.props;
 			const { query = {} } = this.$page.data;

+ 7 - 6
antbuilder/industry/hospitalV2/components/follow-up-notice/index.json

@@ -1,7 +1,8 @@
 {
-  "component": true,
-  "usingComponents": {
-    "wrapper": "../components/wrapper/index",
-    "rich-pro": "@mas.io/adc-rich-pro/es/index"
-  }
-}
+	"component": true,
+	"usingComponents": {
+		"wrapper": "../components/wrapper/index",
+		"rich-pro": "@mas.io/adc-rich-pro/es/index",
+		"mas-adc-rich-pro": "@mas.io/adc-rich-pro/es/index"
+	}
+}

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

@@ -36,7 +36,7 @@
         </view>
         <view class="payment-medicare-flex">
           <view>自费支付金额</view>
-          <view>¥{{ medicare.own }}</view>
+          <view>¥{{ order.amount }}</view>
         </view>
       </view>
     </view>
@@ -52,13 +52,13 @@
           <block a:if="{{ order.age }}">,{{ order.age }}岁</block>
         </view>
 
-        <view class="payment-form-val" a:else>{{ order[item.key] }}</view>
+        <view class="payment-form-val" a:else>{{ order[item.key] || '暂无' }}</view>
       </view>
 
       <block a:if="{{ expand }}">
         <view class="payment-form" hidden="{{ order.status === 0 && item.key === 'payTime' }}" a:for="{{ fromItem.slice(5) }}" key="{{ index }}">
           <view class="payment-form-label">{{ item.label }}</view>
-          <view class="payment-form-val">{{ order[item.key] }}</view>
+          <view class="payment-form-val">{{ order[item.key] || '暂无' }}</view>
         </view>
       </block>
 
@@ -73,7 +73,7 @@
       </view>
     </view>
 
-    <block a:if="{{ order.status === 1 }}">
+    <block a:if="{{ order.status === 99 }}">
       <view class="payment-block" a:for="{{ checkRemind }}">
         <view class="payment-block-title">
           <view>{{ index }}</view>
@@ -131,7 +131,7 @@
       </view>
     </block>
 
-    <block a:if="{{ order.status === 0 }}">
+    <block a:if="{{ order.status === 0 && order.amount > 0 }}">
       <view class="payment-fixed" a:if="{{ prder.type === 3 && order.medicareBinded }}">
         <view class="patient-fixed-bottom">
           <view class="patient-fixed-btn white" onTap="onPay">自费支付</view>

+ 32 - 3
antbuilder/industry/hospitalV2/components/hospital-payment-detail/index.js

@@ -47,7 +47,7 @@ Component({
 			},
 			{
 				label: "就诊卡号",
-				key: "cardNum",
+				key: "hisPatientId",
 			},
 			{
 				label: "就诊科室",
@@ -114,11 +114,12 @@ Component({
 					order: Object.assign({}, this.data.order, data),
 					medicare: {
 						total: numFix(total),
-						own: numFix(payDetails["自费支付金额"]),
+						own: numFix(payDetails["自费支付金额"]) || "0.00",
 						detail,
 					},
 					checkRemind: JSON.parse(data.checkRemind || "{}"),
 				});
+				console.log("1111111111 ===>", this.data);
 			});
 		},
 
@@ -165,11 +166,39 @@ Component({
 				);
 			} else {
 				// 门诊订单
+				const {
+					hisPatientId,
+					age,
+					sex,
+					orderId,
+					hisOrderNo,
+					amount,
+					deptName,
+					doctorName,
+					doctorCode,
+					total,
+					hisClinicCode,
+					name,
+					prescribeDate,
+				} = oreder;
 				await tradePay(
 					{
 						useBalance: !medicareBinded,
 						useMedicare: medicareBinded,
 						outTradeNo: oreder.outTradeNo,
+						hisPatientId,
+						age,
+						sex,
+						orderId,
+						hisOrderNo,
+						amount,
+						deptName,
+						doctorName,
+						doctorCode,
+						total,
+						hisClinicCode,
+						name,
+						prescribeDate,
 					},
 					{
 						tradeType: "Outpatient",
@@ -179,7 +208,7 @@ Component({
 
 			this.payDetail(this.$page.data.query); // 支付成功以后,发起消息订阅
 
-			this.subscribe.subscribeMessage();
+			// this.subscribe.subscribeMessage();
 		},
 
 		hrefTo() {

+ 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>

+ 19 - 4
antbuilder/industry/hospitalV2/components/hospital-payment/index.js

@@ -92,12 +92,19 @@ Component({
 					name,
 					age,
 					sex,
+					prescribeDate,
+					hisOrderNo,
+					doctorName,
+					doctorCode,
+					total,
+					hisClinicCode,
+					deptName,
 				},
 			} = e.target.dataset;
 			history.push({
 				title: "缴费详情",
 				query: {
-					type,
+					type: type || 0,
 					outTradeNo,
 					status,
 					tradeNo,
@@ -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",
@@ -160,12 +174,13 @@ Component({
 				target: {
 					dataset: {
 						outTradeNo: item.outTradeNo,
-						type: item.type,
+						type: item.type ? item.type : 0,
+						...item,
 					},
 				},
 			}); // 发起消息订阅
 
-			this.subscribe.subscribeMessage();
+			// this.subscribe.subscribeMessage();
 		},
 	},
 });

+ 2 - 1
antbuilder/industry/hospitalV2/components/hospital-project/index.js

@@ -11,7 +11,7 @@ import { tradePay } from "../../utils/tradePay";
 import { reportCmPV_YL } from "../../utils/cloudMonitorHelper";
 const deptCodeMap = {
 	黄石总院: 500,
-	沙河分院: 500,
+	沙河分院: 667,
 };
 Component(
 	createSubscribe({
@@ -106,6 +106,7 @@ Component(
 				const { questionList: formList } = await getQuestionnaire({
 					hospitalDistrictId,
 				});
+				console.log("query", query);
 				const projects = await getItemList({
 					hospitalDistrictId,
 					deptCode: deptCodeMap[query.hospitalName],

+ 1 - 1
antbuilder/industry/hospitalV2/components/select-department/index.acss

@@ -1,5 +1,5 @@
 .hospital-new-component .select-department-container {
-  padding-top: 116rpx;
+  // padding-top: 116rpx;
   position: relative;
   background-color: #fff;
 }

+ 13 - 11
antbuilder/industry/hospitalV2/components/select-department/index.js

@@ -41,17 +41,19 @@ Component({
 			const code = "hospital_service_code";
 			const { link, uuid, title, linkType, accessMode, serviceDesc } =
 				await queryServiceByCode(code);
-			const serviceItem = {
-				url: link,
-				accessMode,
-				name: title,
-				serviceDesc,
-				urlType: linkType,
-				serviceUUID: uuid,
-			};
-			await this.updateData({
-				serviceItem,
-			});
+			if (uuid) {
+				const serviceItem = {
+					url: link,
+					accessMode,
+					name: title,
+					serviceDesc,
+					urlType: linkType,
+					serviceUUID: uuid,
+				};
+				await this.updateData({
+					serviceItem,
+				});
+			}
 		},
 
 		getQuery() {

+ 69 - 60
antbuilder/industry/hospitalV2/components/select-hospital-area/index.js

@@ -1,68 +1,77 @@
-import history from '../../utils/history';
-import { getHospitalDistrictList } from './service';
+import history from "../../utils/history";
+import { getHospitalDistrictList } from "./service";
+import { getRegisteredAnnouncement } from "../../../../core/utils/ywtService";
 Component({
-  props: {
-    height: '100vh',
-    componentData: {}
-  },
-  methods: {
-    getExtInfo() {
-      const {
-        componentData
-      } = this.props;
-      const {
-        componentExtInfo
-      } = componentData;
-      return componentExtInfo || {};
-    },
+	props: {
+		height: "100vh",
+		componentData: {},
+	},
+	methods: {
+		getExtInfo() {
+			const { componentData } = this.props;
+			const { componentExtInfo } = componentData;
+			return componentExtInfo || {};
+		},
 
-    async onService() {
-      const list = await getHospitalDistrictList();
-      /* 如果只有一个院区直接跳转到挂号须知 */
+		async onService() {
+			const list = await getHospitalDistrictList();
+			/* 如果只有一个院区直接跳转到挂号须知 */
 
-      if (list.length === 1) {
-        this.toNextPage(list[0], true);
-      }
+			if (list.length === 1) {
+				this.toNextPage(list[0], true);
+			}
 
-      return {
-        list,
-        pagination: {
-          total: list.length
-        }
-      };
-    },
+			return {
+				list,
+				pagination: {
+					total: list.length,
+				},
+			};
+		},
 
-    onItemTap({
-      target: {
-        dataset
-      }
-    }) {
-      this.toNextPage(dataset.item);
-    },
+		onItemTap({ target: { dataset } }) {
+			this.toNextPage(dataset.item);
+		},
 
-    toNextPage(item, replace) {
-      const {
-        name,
-        hospitalDistrictId
-      } = item;
-      const {
-        isNotice = 'Y'
-      } = this.getExtInfo();
-      /* 如果没有就诊须知跳转选择科室页面 */
+		async toNextPage(item, replace) {
+			const { name, hospitalDistrictId } = item;
+			const { isNotice = "Y" } = this.getExtInfo();
+			/* 如果没有就诊须知跳转选择科室页面 */
 
-      const pageType = isNotice === 'N' ? 'select-department' : 'follow-up-notice';
-      history[replace ? 'replace' : 'push']({
-        pageType,
-        title: '挂号须知',
-        componentData: {
-          area: item
-        },
-        query: {
-          name,
-          hospitalDistrictId
-        }
-      });
-    }
+			const pageType =
+				isNotice === "N" ? "select-department" : "follow-up-notice";
 
-  }
-});
+			const [err, result] = await getRegisteredAnnouncement({
+				hospitalId: Number(hospitalDistrictId),
+			});
+
+			if (!err && result && result.id > 0) {
+				history[replace ? "replace" : "push"]({
+					pageType,
+					title: "挂号须知",
+					componentData: {
+						area: item,
+					},
+					query: {
+						name,
+						hospitalDistrictId,
+					},
+				});
+			} else {
+				const { componentData } = this.props;
+				const { query = {} } = this.$page.data;
+				history[replace ? "replace" : "push"]({
+					query: {
+						...query,
+						name,
+						hospitalDistrictId,
+					},
+					componentData,
+					title: "选择科室",
+					pageType: "select-department",
+				});
+			}
+			return;
+		},
+	},
+});

+ 5 - 4
antbuilder/industry/hospitalV2/components/select-hospital-area/service.js

@@ -1,8 +1,9 @@
-import request from './../../service/request';
+import request from "./../../service/request";
+
 /* 获取院区列表 */
 // eslint-disable-next-line
 
 export const getHospitalDistrictList = () => {
-  const url = '/isvRequest.order.queryHospitalDistrictList';
-  return request.post(url);
-};
+	const url = "/isvRequest.order.queryHospitalDistrictList";
+	return request.post(url);
+};

+ 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,
+};