AppointmentConfirm.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <window-size>
  3. <van-cell title="医生姓名" :value="appointment.doctorName"/>
  4. <van-cell title="医生号别" :value="appointment.doctorTitle"/>
  5. <van-cell title="就诊科室" :value="appointment.deptName"/>
  6. <van-cell title="预约日期">
  7. <template #default>
  8. <div style="color: orangered">
  9. {{ appointment.week }}&nbsp;&nbsp;{{ appointment.date }}
  10. </div>
  11. </template>
  12. </van-cell>
  13. <van-cell title="预约时段">
  14. <template #default>
  15. <div style="color: orangered">
  16. {{ appointment.ampm }}&nbsp;&nbsp;{{ appointment.apValue || '' }}
  17. </div>
  18. </template>
  19. </van-cell>
  20. <div style="height: 5px"></div>
  21. <van-cell title="挂号金额">
  22. <template #default>
  23. <div style="color: orangered">¥{{ appointment.fee }}</div>
  24. </template>
  25. </van-cell>
  26. <div style="height: 5px"></div>
  27. <van-radio-group v-model="appointment.patientId">
  28. <van-cell-group>
  29. <div v-for="item in patientCards" :key="item.patientId">
  30. <van-cell center icon="user-o" :label="item.patientId" clickable
  31. @click="changePatient(item.patientId)">
  32. <template #title>
  33. <span class="custom-title">{{ item.name }}</span>
  34. &nbsp;
  35. <van-tag type="primary" plain v-if="item.isDefault === 1">默认</van-tag>
  36. </template>
  37. <template #right-icon>
  38. <van-radio :name="item.patientId"/>
  39. </template>
  40. </van-cell>
  41. </div>
  42. </van-cell-group>
  43. </van-radio-group>
  44. <van-cell
  45. icon="add-o"
  46. title="添加就诊人"
  47. is-link
  48. to="/createOrBind"
  49. ></van-cell>
  50. <div style="height: 10px"></div>
  51. <van-button type="primary" block @click="confirmAppointment" :disabled="disableGhBtn">确认挂号</van-button>
  52. </window-size>
  53. </template>
  54. <script setup>
  55. import store from '@/store'
  56. import {computed, onMounted, ref} from 'vue'
  57. import {checkAppointmentRequirements, getGhFee} from '@/api/appointment'
  58. import router from '@/router'
  59. import {showConfirmDialog, showToast} from 'vant'
  60. import Cookies from 'js-cookie'
  61. const disableGhBtn = ref(true)
  62. const appointment = store.state.appointmentInfo
  63. const patientCards = computed(() => {
  64. return store.state.patientCards
  65. })
  66. const changePatient = (patientId) => {
  67. appointment.patientId = patientId
  68. queryAppointmentCost()
  69. }
  70. const queryAppointmentCost = () => {
  71. getGhFee(appointment).then((res) => {
  72. appointment.fee = res.fee
  73. disableGhBtn.value = false
  74. if (res.message) {
  75. showToast({
  76. message: res.message,
  77. position: 'top',
  78. duration: 3000,
  79. })
  80. }
  81. }).catch(() => {
  82. appointment.fee = '获取失败'
  83. disableGhBtn.value = true
  84. })
  85. }
  86. const confirmAppointment = () => {
  87. const message = appointment.ampm === '夜间门诊'
  88. ? '夜间门诊就诊时间为17:30-21:00,如您疼痛难忍或病情紧急,请至一楼急诊科就诊。'
  89. : '实际看诊序号以至分诊台到诊登记为准。当天未就诊,不予退号、换号、转科,敬请谅解。'
  90. checkAppointmentRequirements(appointment.patientId, appointment.deptCode).then(() => {
  91. showConfirmDialog({
  92. title: '温馨提示',
  93. message,
  94. confirmButtonText: '确认挂号',
  95. cancelButtonText: '取消挂号'
  96. }).then(() => {
  97. fetchPatientName()
  98. }).catch(() => {
  99. })
  100. })
  101. }
  102. function fetchPatientName() {
  103. patientCards.value.forEach((item) => {
  104. if (item.patientId === appointment.patientId) {
  105. appointment.patientName = item.name
  106. toCashier()
  107. }
  108. })
  109. }
  110. function toCashier() {
  111. const createOrderRequest = {...appointment}
  112. createOrderRequest.body = '挂号费'
  113. createOrderRequest.orderType = 1
  114. createOrderRequest.totalFee = appointment.fee
  115. createOrderRequest.fundpayAmt = 0
  116. createOrderRequest.acctpayAmt = 0
  117. createOrderRequest.couponAmt = 0
  118. createOrderRequest.cashpayAmt = appointment.fee
  119. createOrderRequest.recStaff = Cookies.get('recStaff')
  120. store.dispatch({
  121. type: 'storeCreateOrderRequest',
  122. createOrderRequest,
  123. }).then(() => {
  124. router.push('/cashier')
  125. })
  126. }
  127. onMounted(() => {
  128. appointment.patientId = store.getters.getDefaultCard.patientId
  129. queryAppointmentCost()
  130. })
  131. </script>