Jelajahi Sumber

优化付费和保存付费信息的流程。

lighter 4 tahun lalu
induk
melakukan
5e856ff099

+ 0 - 8
src/api/appointment.js

@@ -55,14 +55,6 @@ export function hasValidCovidAssessment(patientId) {
   })
 }
 
-export function saveAppointment(data) {
-  return request({
-    url: '/appointment/saveAppointment',
-    method: 'post',
-    data,
-  })
-}
-
 export function confirmAppointment(data) {
   return request({
     url: '/appointment/confirmAppointment',

+ 0 - 8
src/api/inpatient-service.js

@@ -23,11 +23,3 @@ export function getPrepaidHistory(patientId) {
     params: { patientId },
   })
 }
-
-export function payYjjSuccessful(data) {
-  return request({
-    url: '/inpatient/payYjjSuccessful',
-    method: 'post',
-    data,
-  })
-}

+ 0 - 8
src/api/pay-mz-fee.js

@@ -16,14 +16,6 @@ export function getUnPaidDetail(patientId, hisOrdNum) {
   })
 }
 
-export function saveMzChargeInfo(tradeNo) {
-  return request({
-    url: '/payMzFee/saveMzChargeInfo',
-    method: 'get',
-    params: { tradeNo },
-  })
-}
-
 export function getMzPaidList(patientId) {
   return request({
     url: '/payMzFee/getMzPaidList',

+ 9 - 3
src/utils/wx-pay.js

@@ -1,6 +1,8 @@
-import { createPayOrder } from '../api/wx-jsapi'
+import { Toast } from 'vant'
+import { createPayOrder, queryOrderState } from '../api/wx-jsapi'
+import router from '../router'
 
-export function wxPay(param, wxPayCallback) {
+export function wxPay(param) {
   createPayOrder(param).then((res) => {
     WeixinJSBridge.invoke(
       'getBrandWCPayRequest',
@@ -14,7 +16,11 @@ export function wxPay(param, wxPayCallback) {
         totalFee: res.totalFee,
       },
       function (res2) {
-        wxPayCallback(res)
+        console.log(res2)
+        queryOrderState(res.tradeNo).then((res3) => {
+          Toast.success(res3)
+          router.push('/hospitalService')
+        })
       }
     )
   })

+ 1 - 27
src/views/hospital-service/appointment/PayAppointmentFee.vue

@@ -46,11 +46,7 @@
 import store from '../../../store'
 import { reactive } from 'vue'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
-import { saveAppointment } from '../../../api/appointment'
 import { wxPay } from '../../../utils/wx-pay'
-import { Toast } from 'vant'
-import router from '../../../router'
-import { queryOrderState } from '../../../api/wx-jsapi'
 export default {
   name: 'PayAppointmentFee',
   setup() {
@@ -61,28 +57,6 @@ export default {
     const countDownFinish = () => {
       data.disablePayButton = true
     }
-    const wxPayCallback = (res) => {
-      queryOrderState(res.tradeNo).then((tradeState) => {
-        if (tradeState === 'SUCCESS') {
-          const param = {
-            mzyReqrec: {
-              patientId: data.appointment.patientId,
-              paymode: 'WX',
-              psordnum: res.tradeNo,
-              agtordnum: res.serialNo,
-            },
-            mzyRequestId: data.appointment.mzyRequestId,
-            totalFee: data.appointment.fee,
-          }
-          saveAppointment(param).then((res2) => {
-            Toast.success(res2)
-            router.push('/hospitalService')
-          })
-        } else {
-          Toast.fail('支付失败')
-        }
-      })
-    }
     const pay = () => {
       const param = {
         body: '挂号费',
@@ -92,7 +66,7 @@ export default {
         patientId: data.appointment.patientId,
         mzyRequestId: data.appointment.mzyRequestId,
       }
-      wxPay(param, wxPayCallback)
+      wxPay(param)
     }
     return {
       data,

+ 2 - 18
src/views/hospital-service/inpatient-service/DisplayPrepaid.vue

@@ -73,9 +73,7 @@ import { ref } from 'vue'
 import { useRouter } from 'vue-router'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
 import { wxPay } from '../../../utils/wx-pay'
-import { Dialog, Toast } from 'vant'
-import { payYjjSuccessful } from '../../../api/inpatient-service'
-import { queryOrderState } from '../../../api/wx-jsapi'
+import { Dialog } from 'vant'
 export default {
   setup() {
     const router = useRouter()
@@ -89,20 +87,6 @@ export default {
       otherAmount.value = null
       prepaidAmount.value = val
     }
-    const wxPayCallback = (res) => {
-      queryOrderState(res.tradeNo).then((tradeState) => {
-        if (tradeState === 'SUCCESS') {
-          res.inpatientNo = params.inpatientNo
-          res.admissTimes = params.admissTimes
-          payYjjSuccessful(res).then((res2) => {
-            Toast.success(res2)
-            router.go(-1)
-          })
-        } else {
-          Toast.fail('支付失败')
-        }
-      })
-    }
 
     const beforePay = () => {
       if (otherAmount.value) {
@@ -130,7 +114,7 @@ export default {
         inpatientNo: params.inpatientNo,
         admissTimes: params.admissTimes,
       }
-      wxPay(param, wxPayCallback)
+      wxPay(param)
     }
     return {
       params,

+ 2 - 16
src/views/hospital-service/pay-mz-fee/UnPaidDetail.vue

@@ -42,30 +42,16 @@
 
 <script>
 import { useRouter } from 'vue-router'
-import { getUnPaidDetail, saveMzChargeInfo } from '../../../api/pay-mz-fee'
+import { getUnPaidDetail } from '../../../api/pay-mz-fee'
 import { onMounted, ref } from 'vue'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
 import { wxPay } from '../../../utils/wx-pay'
-import { Toast } from 'vant'
-import { queryOrderState } from '../../../api/wx-jsapi'
 export default {
   name: 'UnPaidDetail',
   setup() {
     const router = useRouter()
     const params = router.currentRoute.value.params
     const fees = ref([])
-    const wxPayCallback = (res) => {
-      queryOrderState(res.tradeNo).then((tradeState) => {
-        if (tradeState === 'SUCCESS') {
-          saveMzChargeInfo(res.tradeNo).then((res2) => {
-            Toast.success(res2)
-            router.go(-1)
-          })
-        } else {
-          Toast.fail('支付失败')
-        }
-      })
-    }
     const wechatPay = () => {
       let bodyText = '门诊缴费'
       if (fees.value.length === 1) {
@@ -79,7 +65,7 @@ export default {
         patientId: params.patientId,
         hisOrdNum: params.hisOrdNum,
       }
-      wxPay(param, wxPayCallback)
+      wxPay(param)
     }
     onMounted(() => {
       getUnPaidDetail(params.patientId, params.hisOrdNum).then((res) => {