瀏覽代碼

添加诊间挂号支付

lighter 2 年之前
父節點
當前提交
f92005801f
共有 4 個文件被更改,包括 131 次插入1 次删除
  1. 16 0
      src/api/appointment.js
  2. 5 0
      src/router/index.js
  3. 3 1
      src/views/Home.vue
  4. 107 0
      src/views/hospital-service/appointment/PayClinicAppointmentOrder.vue

+ 16 - 0
src/api/appointment.js

@@ -78,3 +78,19 @@ export function getPaidMzGhList(patientId) {
     params: { patientId },
   })
 }
+
+export function listMzyReqrecUnPay(data) {
+  return request({
+    url: '/appointment/listMzyReqrecUnPay',
+    method: 'post',
+    data,
+  })
+}
+
+export function getMzyReqrecInfo(data) {
+  return request({
+    url: '/appointment/getMzyReqrecInfo',
+    method: 'post',
+    data,
+  })
+}

+ 5 - 0
src/router/index.js

@@ -77,6 +77,11 @@ export const constantRoutes = [
     component: () => import('../views/hospital-service/appointment/PayAppointmentFee.vue'),
     meta: { title: '收银台' },
   },
+  {
+    path: '/payClinicAppointmentOrder/:patientId/:times',
+    component: () => import('../views/hospital-service/appointment/PayClinicAppointmentOrder.vue'),
+    meta: { title: '诊间挂号支付' },
+  },
   {
     path: '/selectPayPatient',
     component: () => import('../views/hospital-service/pay-mz-fee/SelectPayPatient.vue'),

+ 3 - 1
src/views/Home.vue

@@ -30,8 +30,10 @@ export default {
         let pathInfo = to.split('_')
         if (pathInfo.length === 1) {
           router.push('/' + to)
-        } else {
+        } else if (pathInfo.length === 2) {
           router.push('/' + pathInfo[0] + '/' + pathInfo[1])
+        } else {
+          router.push('/' + pathInfo[0] + '/' + pathInfo[1] + '/' + pathInfo[2])
         }
       }
     }

+ 107 - 0
src/views/hospital-service/appointment/PayClinicAppointmentOrder.vue

@@ -0,0 +1,107 @@
+<template>
+  <window-size>
+    <van-empty :image="empty" description="您没有待缴费记录" v-if="showEmpty"></van-empty>
+    <div v-else>
+      <van-notice-bar left-icon="warning-o">
+        <template #default>
+          <div v-if="disablePayButton">
+            <span>有效支付时间已过期</span>
+          </div>
+          <div v-else>
+            <div style="display: inline-block">请在&nbsp;&nbsp;</div>
+            <div style="display: inline-block">
+              <van-count-down
+                  style="color: orangered"
+                  :time="60 * 15 * 1000"
+                  format="mm分ss秒"
+                  @finish="countDownFinish"
+              />
+            </div>
+            <div style="display: inline-block">&nbsp;&nbsp;内完成支付</div>
+          </div>
+        </template>
+      </van-notice-bar>
+      <van-grid :column-num="1">
+        <van-grid-item>
+          <template #default>
+            <div style="font-size: 12px">支付金额(元)</div>
+            <div style="color: orangered; font-size: 30px; font-weight: bold; margin-top: 5px">
+              {{ appointment.totalAmount }}
+            </div>
+          </template>
+        </van-grid-item>
+      </van-grid>
+      <div style="height: 5px"></div>
+      <van-cell title="费用类型" value="诊间挂号"></van-cell>
+      <van-cell title="就诊科室" :value="appointment.unitCode"></van-cell>
+      <van-cell title="医生姓名" :value="appointment.doctorCode"></van-cell>
+      <van-cell title="就诊日期" :value="appointment.requestDayStr"></van-cell>
+      <van-cell title="就诊时段" :value="appointment.ampm"></van-cell>
+      <van-cell title="就诊人" :value="appointment.name"></van-cell>
+      <van-cell title="就诊卡号" :value="appointment.patientId"></van-cell>
+      <div style="height: 10px"></div>
+      <van-button type="primary" block :disabled="disablePayButton" @click="pay">微信支付</van-button>
+    </div>
+  </window-size>
+</template>
+
+<script>
+import empty from '../../../assets/empty.png'
+import {onMounted, ref} from 'vue'
+import { getLocalOpenId } from '../../../utils/check-patient-id'
+import { wxPay } from '../../../utils/wx-pay'
+import { getMzyReqrecInfo } from '../../../api/appointment.js'
+import { Toast } from 'vant'
+import {useRouter} from "vue-router";
+export default {
+  name: 'PayClinicAppointmentOrder',
+  setup() {
+    const router = useRouter()
+    const patientId = router.currentRoute.value.params.patientId
+    const times = router.currentRoute.value.params.times
+
+    const disablePayButton = ref(false)
+    const countDownFinish = () => {
+      disablePayButton.value = true
+    }
+    const appointment = ref({})
+    const showEmpty = ref(true)
+    const pay = () => {
+      const param = {
+        body: '诊间挂号',
+        orderType: 0,
+        totalFee: appointment.totalAmount,
+        openId: getLocalOpenId(),
+        patientId: appointment.patientId,
+        mzyRequestId: appointment.times
+      }
+      wxPay(param).then((result) => {
+        Toast.success(result)
+        router.push('/hospitalService')
+      }).catch((result) => {
+        Toast.success(result)
+        router.push('/hospitalService')
+      })
+    }
+
+    onMounted(() => {
+      const params = { patientId, times }
+      getMzyReqrecInfo(params).then(res => {
+        appointment.value = res
+        showEmpty.value = false
+      }).catch(() => {
+        showEmpty.value = true
+      })
+    })
+
+    return {
+      empty,
+      showEmpty,
+      disablePayButton,
+      countDownFinish,
+      appointment,
+      pay,
+    }
+  },
+}
+</script>