浏览代码

完成保存挂号信息功能。

lighter 4 年之前
父节点
当前提交
35a2c22e6a

+ 74 - 12
package-lock.json

@@ -431,17 +431,17 @@
       }
     },
     "@vue/compiler-sfc": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npm.taobao.org/@vue/compiler-sfc/download/@vue/compiler-sfc-3.0.4.tgz",
-      "integrity": "sha1-IRn+HmjSwmiq+iBGHILBOamt+OA=",
+      "version": "3.0.5",
+      "resolved": "https://registry.npm.taobao.org/@vue/compiler-sfc/download/@vue/compiler-sfc-3.0.5.tgz",
+      "integrity": "sha1-OuCOYCRKcvr5WYNhh0+3vbWx03w=",
       "dev": true,
       "requires": {
         "@babel/parser": "^7.12.0",
         "@babel/types": "^7.12.0",
-        "@vue/compiler-core": "3.0.4",
-        "@vue/compiler-dom": "3.0.4",
-        "@vue/compiler-ssr": "3.0.4",
-        "@vue/shared": "3.0.4",
+        "@vue/compiler-core": "3.0.5",
+        "@vue/compiler-dom": "3.0.5",
+        "@vue/compiler-ssr": "3.0.5",
+        "@vue/shared": "3.0.5",
         "consolidate": "^0.16.0",
         "estree-walker": "^2.0.1",
         "hash-sum": "^2.0.0",
@@ -452,16 +452,78 @@
         "postcss-modules": "^3.2.2",
         "postcss-selector-parser": "^6.0.4",
         "source-map": "^0.6.1"
+      },
+      "dependencies": {
+        "@vue/compiler-core": {
+          "version": "3.0.5",
+          "resolved": "https://registry.npm.taobao.org/@vue/compiler-core/download/@vue/compiler-core-3.0.5.tgz",
+          "integrity": "sha1-puVMq+lTbnTGUTrNJknzEa8dQ6w=",
+          "dev": true,
+          "requires": {
+            "@babel/parser": "^7.12.0",
+            "@babel/types": "^7.12.0",
+            "@vue/shared": "3.0.5",
+            "estree-walker": "^2.0.1",
+            "source-map": "^0.6.1"
+          }
+        },
+        "@vue/compiler-dom": {
+          "version": "3.0.5",
+          "resolved": "https://registry.npm.taobao.org/@vue/compiler-dom/download/@vue/compiler-dom-3.0.5.tgz",
+          "integrity": "sha1-eIWhPm0Y9k3ejrzuwFLtLBAmlsI=",
+          "dev": true,
+          "requires": {
+            "@vue/compiler-core": "3.0.5",
+            "@vue/shared": "3.0.5"
+          }
+        },
+        "@vue/shared": {
+          "version": "3.0.5",
+          "resolved": "https://registry.npm.taobao.org/@vue/shared/download/@vue/shared-3.0.5.tgz",
+          "integrity": "sha1-wTHYi9ZxPMTZOzuxNy7bGYMiX/A=",
+          "dev": true
+        }
       }
     },
     "@vue/compiler-ssr": {
-      "version": "3.0.4",
-      "resolved": "https://registry.npm.taobao.org/@vue/compiler-ssr/download/@vue/compiler-ssr-3.0.4.tgz",
-      "integrity": "sha1-zL0fVXNNUdFAL62CWsECACp6B8c=",
+      "version": "3.0.5",
+      "resolved": "https://registry.npm.taobao.org/@vue/compiler-ssr/download/@vue/compiler-ssr-3.0.5.tgz",
+      "integrity": "sha1-dmGtiRoL6UhybH960eQlJTxYe4M=",
       "dev": true,
       "requires": {
-        "@vue/compiler-dom": "3.0.4",
-        "@vue/shared": "3.0.4"
+        "@vue/compiler-dom": "3.0.5",
+        "@vue/shared": "3.0.5"
+      },
+      "dependencies": {
+        "@vue/compiler-core": {
+          "version": "3.0.5",
+          "resolved": "https://registry.npm.taobao.org/@vue/compiler-core/download/@vue/compiler-core-3.0.5.tgz",
+          "integrity": "sha1-puVMq+lTbnTGUTrNJknzEa8dQ6w=",
+          "dev": true,
+          "requires": {
+            "@babel/parser": "^7.12.0",
+            "@babel/types": "^7.12.0",
+            "@vue/shared": "3.0.5",
+            "estree-walker": "^2.0.1",
+            "source-map": "^0.6.1"
+          }
+        },
+        "@vue/compiler-dom": {
+          "version": "3.0.5",
+          "resolved": "https://registry.npm.taobao.org/@vue/compiler-dom/download/@vue/compiler-dom-3.0.5.tgz",
+          "integrity": "sha1-eIWhPm0Y9k3ejrzuwFLtLBAmlsI=",
+          "dev": true,
+          "requires": {
+            "@vue/compiler-core": "3.0.5",
+            "@vue/shared": "3.0.5"
+          }
+        },
+        "@vue/shared": {
+          "version": "3.0.5",
+          "resolved": "https://registry.npm.taobao.org/@vue/shared/download/@vue/shared-3.0.5.tgz",
+          "integrity": "sha1-wTHYi9ZxPMTZOzuxNy7bGYMiX/A=",
+          "dev": true
+        }
       }
     },
     "@vue/reactivity": {

+ 2 - 2
package.json

@@ -14,7 +14,7 @@
     "vuex": "^4.0.0-rc.2"
   },
   "devDependencies": {
-    "vite": "^1.0.0-rc.13",
-    "@vue/compiler-sfc": "^3.0.4"
+    "@vue/compiler-sfc": "^3.0.5",
+    "vite": "^1.0.0-rc.13"
   }
 }

+ 21 - 21
src/api/appointment.js

@@ -2,14 +2,14 @@ import request from '../utils/request'
 
 export function getAllDepartments() {
   return request({
-    url: '/wechat/getAllDepartments',
+    url: '/appointment/getAllDepartments',
     method: 'get',
   })
 }
 
 export function getSourcesByDate(data) {
   return request({
-    url: '/wechat/getSourcesByDate',
+    url: '/appointment/getSourcesByDate',
     method: 'post',
     data,
   })
@@ -17,7 +17,7 @@ export function getSourcesByDate(data) {
 
 export function getDoctorSources(data) {
   return request({
-    url: '/wechat/getDoctorSources',
+    url: '/appointment/getDoctorSources',
     method: 'post',
     data,
   })
@@ -25,7 +25,15 @@ export function getDoctorSources(data) {
 
 export function getDoctorArrangement(data) {
   return request({
-    url: '/wechat/getDoctorArrangement',
+    url: '/appointment/getDoctorArrangement',
+    method: 'post',
+    data,
+  })
+}
+
+export function getGhFee(data) {
+  return request({
+    url: '/appointment/getGhFee',
     method: 'post',
     data,
   })
@@ -33,7 +41,7 @@ export function getDoctorArrangement(data) {
 
 export function getDoctorInfo(doctorCode, openId) {
   return request({
-    url: '/wechat/getDoctorInfo',
+    url: '/appointment/getDoctorInfo',
     method: 'get',
     params: { doctorCode, openId },
   })
@@ -41,31 +49,23 @@ export function getDoctorInfo(doctorCode, openId) {
 
 export function hasDoneCovidAssessment(patientId) {
   return request({
-    url: '/wechat/hasDoneCovidAssessment',
+    url: '/appointment/hasDoneCovidAssessment',
     method: 'get',
     params: { patientId },
   })
 }
 
-export function confirmAppointment(data) {
-  return request({
-    url: '/wechat/confirmAppointment',
-    method: 'post',
-    data,
-  })
-}
-
-export function collectDoctor(data) {
+export function saveAppointment(data) {
   return request({
-    url: '/wechat/collectDoctor',
+    url: '/appointment/saveAppointment',
     method: 'post',
     data,
   })
 }
 
-export function disCollectDoctor(data) {
+export function confirmAppointment(data) {
   return request({
-    url: '/wechat/disCollectDoctor',
+    url: '/appointment/confirmAppointment',
     method: 'post',
     data,
   })
@@ -73,7 +73,7 @@ export function disCollectDoctor(data) {
 
 export function getSourcesByDateAndDoctor(data) {
   return request({
-    url: '/wechat/getSourcesByDateAndDoctor',
+    url: '/appointment/getSourcesByDateAndDoctor',
     method: 'post',
     data,
   })
@@ -81,7 +81,7 @@ export function getSourcesByDateAndDoctor(data) {
 
 export function getDoctorQrCode(doctorCode) {
   return request({
-    url: '/wechat/getDoctorQrCode',
+    url: '/appointment/getDoctorQrCode',
     method: 'get',
     params: { doctorCode },
   })
@@ -89,7 +89,7 @@ export function getDoctorQrCode(doctorCode) {
 
 export function createPayOrder(data) {
   return request({
-    url: '/wechat/createPayOrder',
+    url: '/appointment/createPayOrder',
     method: 'post',
     data,
   })

+ 2 - 2
src/api/check-exam.js

@@ -2,7 +2,7 @@ import request from '../utils/request'
 
 export function checkExamIndex(data) {
   return request({
-    url: '/wechat/checkExamIndex',
+    url: '/inspections/checkExamIndex',
     method: 'post',
     data,
   })
@@ -10,7 +10,7 @@ export function checkExamIndex(data) {
 
 export function checkExamDetail(orderId) {
   return request({
-    url: '/wechat/checkExamDetail',
+    url: '/inspections/checkExamDetail',
     method: 'get',
     params: { orderId },
   })

+ 3 - 3
src/api/inpatient-service.js

@@ -2,7 +2,7 @@ import request from '../utils/request'
 
 export function getInpatientInfo(patientId) {
   return request({
-    url: '/wechat/getInpatientInfo',
+    url: '/inpatient/getInpatientInfo',
     method: 'get',
     params: { patientId },
   })
@@ -10,7 +10,7 @@ export function getInpatientInfo(patientId) {
 
 export function getZyFees(data) {
   return request({
-    url: '/wechat/getZyFees',
+    url: '/inpatient/getZyFees',
     method: 'post',
     data,
   })
@@ -18,7 +18,7 @@ export function getZyFees(data) {
 
 export function getPrepaidHistory(patientId) {
   return request({
-    url: '/wechat/getPrepaidHistory',
+    url: '/inpatient/getPrepaidHistory',
     method: 'get',
     params: { patientId },
   })

+ 17 - 1
src/api/my-collection.js

@@ -1,8 +1,24 @@
 import request from '../utils/request'
 
+export function collectDoctor(data) {
+  return request({
+    url: '/collections/collectDoctor',
+    method: 'post',
+    data,
+  })
+}
+
+export function disCollectDoctor(data) {
+  return request({
+    url: '/collections/disCollectDoctor',
+    method: 'post',
+    data,
+  })
+}
+
 export function getMyCollections(openId) {
   return request({
-    url: '/wechat/getMyCollections',
+    url: '/collections/getMyCollections',
     method: 'get',
     params: { openId },
   })

+ 6 - 6
src/api/patient-id-cards.js

@@ -2,7 +2,7 @@ import request from '../utils/request'
 
 export function getOpenId(code) {
   return request({
-    url: '/wechat/getOpenId',
+    url: '/patientCards/getOpenId',
     method: 'get',
     params: { code },
   })
@@ -10,7 +10,7 @@ export function getOpenId(code) {
 
 export function getPatientIdByOpenId(openId) {
   return request({
-    url: '/wechat/getPatientIdByOpenId',
+    url: '/patientCards/getPatientIdByOpenId',
     method: 'get',
     params: { openId },
   })
@@ -18,7 +18,7 @@ export function getPatientIdByOpenId(openId) {
 
 export function bindPatientId(data) {
   return request({
-    url: '/wechat/bindPatientId',
+    url: '/patientCards/bindPatientId',
     method: 'post',
     data,
   })
@@ -26,7 +26,7 @@ export function bindPatientId(data) {
 
 export function setDefaultCard(patientId, openId) {
   return request({
-    url: '/wechat/setDefaultCard',
+    url: '/patientCards/setDefaultCard',
     method: 'get',
     params: { patientId, openId },
   })
@@ -34,7 +34,7 @@ export function setDefaultCard(patientId, openId) {
 
 export function relieveBindCard(data) {
   return request({
-    url: '/wechat/relieveBindCard',
+    url: '/patientCards/relieveBindCard',
     method: 'post',
     data,
   })
@@ -42,7 +42,7 @@ export function relieveBindCard(data) {
 
 export function relieveBindCardButCanceled(data) {
   return request({
-    url: '/wechat/relieveBindCardButCanceled',
+    url: '/patientCards/relieveBindCardButCanceled',
     method: 'post',
     data,
   })

+ 2 - 2
src/api/pay-mz-fee.js

@@ -2,7 +2,7 @@ import request from '../utils/request'
 
 export function getUnPaidFee(patientId) {
   return request({
-    url: '/wechat/getUnPaidFee',
+    url: '/payMzFee/getUnPaidFee',
     method: 'get',
     params: { patientId },
   })
@@ -10,7 +10,7 @@ export function getUnPaidFee(patientId) {
 
 export function getUnPaidDetail(patientId, hisOrdNum) {
   return request({
-    url: '/wechat/getUnPaidDetail',
+    url: '/payMzFee/getUnPaidDetail',
     method: 'get',
     params: { patientId, hisOrdNum },
   })

+ 5 - 0
src/router/index.js

@@ -151,6 +151,11 @@ export const constantRoutes = [
     component: () => import('../views/hospital-service/health-cart/Vaccine.vue'),
     meta: { title: '疫苗' },
   },
+  {
+    path: '/covidExam/:patientId',
+    component: () => import('../views/hospital-service/health-cart/CovidExam.vue'),
+    meta: { title: '新冠肺炎核酸检测' },
+  },
   {
     path: '/selectAppointmentRecordPatient',
     component: () => import('../views/mine/appointment-record/SelectPatientCard.vue'),

+ 4 - 1
src/utils/request.js

@@ -23,9 +23,12 @@ service.interceptors.request.use(
 service.interceptors.response.use(
   (response) => {
     store.commit('SET_LOADING', false)
-    if (response.data.code === 200 || response.data.code === 0) {
+    if (response.data.code === 200) {
       return response.data.data
     }
+    if (response.data.code === 0) {
+      return response.data
+    }
     if (response.data.code > 1000 && response.data.code < 2000) {
       Toast({
         message: response.data.message,

+ 25 - 0
src/utils/wx-pay.js

@@ -0,0 +1,25 @@
+import { createPayOrder } from '../api/appointment'
+
+export function wxPay(param, callback) {
+  createPayOrder(param).then((res) => {
+    WeixinJSBridge.invoke(
+      'getBrandWCPayRequest',
+      {
+        appId: res.appId,
+        timeStamp: res.timeStamp,
+        nonceStr: res.nonceStr,
+        package: res.package,
+        signType: res.signType,
+        paySign: res.paySign,
+        totalFee: res.totalFee,
+      },
+      function (res2) {
+        if (res2.err_msg === 'get_brand_wcpay_request:ok') {
+          // 使用以上方式判断前端返回,微信团队郑重提示:
+          //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
+          callback(res)
+        }
+      }
+    )
+  })
+}

+ 14 - 3
src/views/hospital-service/appointment/AppointmentConfirm.vue

@@ -54,10 +54,11 @@
 
 <script>
 import store from '../../../store'
-import { computed, reactive, watchEffect } from 'vue'
+import { computed, onMounted, reactive, watchEffect } from 'vue'
 import Cookies from 'js-cookie'
-import { hasDoneCovidAssessment } from '../../../api/appointment'
+import { getGhFee, hasDoneCovidAssessment } from '../../../api/appointment'
 import router from '../../../router'
+import { Dialog } from 'vant'
 export default {
   name: 'AppointConfirm',
   setup() {
@@ -66,7 +67,6 @@ export default {
       week: week ? week : localStorage.week,
       appointment: store.state.appointmentInfo,
     })
-
     const patientCards = computed(() => {
       return store.state.patientCards
     })
@@ -99,6 +99,17 @@ export default {
         }
       })
     }
+    onMounted(() => {
+      getGhFee(data.appointment).then((res) => {
+        data.appointment.fee = res.data
+        if (res.message) {
+          Dialog.alert({
+            title: '提示',
+            message: response.data.message,
+          })
+        }
+      })
+    })
     return {
       data,
       patientCards,

+ 7 - 8
src/views/hospital-service/appointment/DoctorArrangement.vue

@@ -21,9 +21,9 @@
           </div>
           <div>
             <div style="height: 5px"></div>
-            <van-button type="primary" plain size="small" :icon="collected.icon" @click="collectAction">{{
-              collected.text
-            }}</van-button>
+            <van-button type="primary" plain size="small" :icon="collected.icon" @click="collectAction">
+              {{ collected.text }}
+            </van-button>
             <div style="height: 5px"></div>
             <van-button type="primary" plain size="small" icon="qr" @click="showDoctorQrCode">二维码</van-button>
           </div>
@@ -90,10 +90,9 @@ import {
   getDoctorInfo,
   getSourcesByDateAndDoctor,
   getDoctorArrangement,
-  collectDoctor,
-  disCollectDoctor,
   getDoctorQrCode,
 } from '../../../api/appointment'
+import { collectDoctor, disCollectDoctor } from '../../../api/my-collection'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
 import { genTextPortrait } from '../../../utils/portrait'
 import { getOneWeekText, getNextSevenDate } from '../../../utils/date'
@@ -122,8 +121,8 @@ export default {
       router.push('/appointmentConfirm')
     }
     const collected = computed(() => {
-      const icon = data.doctorInfo.collected === 0 ? 'star-o' : 'star'
-      const text = data.doctorInfo.collected === 0 ? '未收藏' : '已收藏'
+      const icon = data.doctorInfo.collected > 0 ? 'star' : 'star-o'
+      const text = data.doctorInfo.collected > 0 ? '已收藏' : '未收藏'
       return { icon, text }
     })
     const deptCode = router.currentRoute.value.params.dept
@@ -205,7 +204,7 @@ export default {
       getSourcesByDateAndDoctor(param).then((res) => {
         data.nextSevenDaySources = res
         for (let i = 0; i < 7; i++) {
-          if (res[i] === 0) {
+          if (res[i] === 200) {
             handleClickDate(i)
             break
           }

+ 23 - 21
src/views/hospital-service/appointment/PayAppointmentFee.vue

@@ -46,7 +46,9 @@
 import store from '../../../store'
 import { reactive } from 'vue'
 import { getLocalOpenId } from '../../../utils/check-patient-id'
-import { createPayOrder } from '../../../api/appointment'
+import { createPayOrder, saveAppointment } from '../../../api/appointment'
+import { wxPay } from '../../../utils/wx-pay'
+import { Toast } from 'vant'
 export default {
   name: 'PayAppointmentFee',
   setup() {
@@ -57,33 +59,33 @@ export default {
     const countDownFinish = () => {
       data.disablePayButton = true
     }
+
+    const callback = (lres) => {
+      const param = {
+        mzyReqrec: {
+          patientId: data.appointment.patientId,
+          paymode: 'WX',
+          psordnum: lres.tradeNo,
+          agtordnum: lres.timeStamp,
+        },
+        mzyRequestId: data.appointment.mzyRequestId,
+        totalFee: data.appointment.fee,
+      }
+      saveAppointment(param).then((res) => {
+        Toast.success(res)
+      })
+    }
+
     const pay = () => {
       const param = {
         body: '挂号费',
         totalFee: data.appointment.fee,
         openId: getLocalOpenId(),
       }
+      // wxPay(param, callback)
+
       createPayOrder(param).then((res) => {
-        // eslint-disable-next-line no-undef
-        WeixinJSBridge.invoke(
-          'getBrandWCPayRequest',
-          {
-            appId: res.appId,
-            timeStamp: res.timeStamp,
-            nonceStr: res.nonceStr,
-            package: res.package,
-            signType: res.signType,
-            paySign: res.paySign,
-            totalFee: res.totalFee,
-          },
-          function (res) {
-            alert(JSON.stringify(res))
-            if (res.err_msg == 'get_brand_wcpay_request:ok') {
-              // 使用以上方式判断前端返回,微信团队郑重提示:
-              //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-            }
-          }
-        )
+        callback(res)
       })
     }
     return {

+ 33 - 0
src/views/hospital-service/health-cart/CovidExam.vue

@@ -0,0 +1,33 @@
+<template>
+  <window-size>
+    <div style="height: 10px"></div>
+    <van-cell title="名称" value="新冠肺炎核酸检测"></van-cell>
+    <van-cell title="价格" value="¥1"></van-cell>
+    <div style="height: 10px"></div>
+    <van-button type="primary" block @click="pay">微信支付</van-button>
+  </window-size>
+</template>
+<script>
+import { wxPay } from '../../../utils/wx-pay'
+import { getLocalOpenId } from '../../../utils/check-patient-id'
+import { Toast } from 'vant'
+export default {
+  setup() {
+    const callback = () => {
+      Toast.success('您已成功支付!')
+    }
+
+    const pay = () => {
+      const param = {
+        body: '新冠肺炎核酸检测',
+        totalFee: 1,
+        openId: getLocalOpenId(),
+      }
+      wxPay(param, callback)
+    }
+    return {
+      pay,
+    }
+  },
+}
+</script>

+ 1 - 0
src/views/hospital-service/health-cart/HealthCartCategory.vue

@@ -3,6 +3,7 @@
     <div style="height: 10px"></div>
     <van-cell title="体检套餐" is-link :to="'/physicalExaminationPackage/' + patientId"></van-cell>
     <van-cell title="疫苗" is-link :to="'/vaccine/' + patientId"></van-cell>
+    <van-cell title="新冠肺炎核酸检测" is-link :to="'/covidExam/' + patientId"></van-cell>
   </window-size>
 </template>
 

+ 1 - 1
vite.config.js

@@ -1,5 +1,5 @@
 module.exports = {
   open: true,
   https: false,
-  port: 8081,
+  port: 81,
 }