AppointmentConfirm.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <window-size>
  3. <van-cell title="医生姓名" :value="data.appointment.doctorName" />
  4. <van-cell title="医生号别" :value="data.appointment.doctorTitle" />
  5. <van-cell title="就诊科室" :value="data.appointment.deptName" />
  6. <van-cell title="就诊时段">
  7. <template #default>
  8. <div style="color: orangered">
  9. {{ data.appointment.date }}&nbsp;&nbsp;{{ data.week }}&nbsp;&nbsp;{{ data.appointment.ampm }}
  10. </div>
  11. </template>
  12. </van-cell>
  13. <div style="height: 5px"></div>
  14. <van-cell title="挂号金额">
  15. <template #default>
  16. <div style="color: orangered">¥{{ data.appointment.fee }}</div>
  17. </template>
  18. </van-cell>
  19. <div style="height: 5px"></div>
  20. <van-radio-group v-model="data.appointment.patientId">
  21. <van-cell-group>
  22. <div v-for="item in patientCards" :key="item.patientId">
  23. <van-cell
  24. center
  25. icon="user-o"
  26. :label="item.patientId"
  27. clickable
  28. @click="data.appointment.patientId = item.patientId"
  29. >
  30. <template #title>
  31. <span class="custom-title">{{ item.name }}</span>
  32. &nbsp;
  33. <van-tag type="primary" plain v-if="item.isDefault === 1">默认</van-tag>
  34. </template>
  35. <template #right-icon>
  36. <van-radio :name="item.patientId" />
  37. </template>
  38. </van-cell>
  39. </div>
  40. </van-cell-group>
  41. </van-radio-group>
  42. <van-cell
  43. v-if="showAddCard"
  44. icon="add-o"
  45. title="添加就诊人"
  46. :value="addCardText"
  47. is-link
  48. @click="showCreatedCardMethod = true"
  49. ></van-cell>
  50. <div style="height: 10px"></div>
  51. <van-button type="primary" block @click="confirmAppointment" :disabled="disableGhBtn">确认挂号</van-button>
  52. <van-dialog
  53. v-model:show="showCreatedCardMethod"
  54. title="请选择绑定方式"
  55. :show-confirm-button="false"
  56. show-cancel-button
  57. >
  58. <div style="padding: 20px">
  59. <van-button type="primary" block to="/bindPatientCard">绑定就诊卡</van-button>
  60. <div style="height: 10px"></div>
  61. <van-button type="primary" plain block to="/createPatientCard">新建就诊卡</van-button>
  62. </div>
  63. </van-dialog>
  64. </window-size>
  65. </template>
  66. <script>
  67. import store from '../../../store'
  68. import { computed, onMounted, reactive, ref, watchEffect } from 'vue'
  69. import Cookies from 'js-cookie'
  70. import { getGhFee, hasValidCovidAssessment } from '../../../api/appointment'
  71. import router from '../../../router'
  72. export default {
  73. name: 'AppointConfirm',
  74. setup() {
  75. const showCreatedCardMethod = ref(false)
  76. const week = Cookies.get('week')
  77. const data = reactive({
  78. week: week ? week : localStorage.week,
  79. appointment: store.state.appointmentInfo,
  80. })
  81. const patientCards = computed(() => {
  82. return store.state.patientCards
  83. })
  84. watchEffect(() => {
  85. patientCards.value.forEach((item) => {
  86. if (item.isDefault === 1) {
  87. data.appointment.patientId = item.patientId
  88. }
  89. })
  90. })
  91. const showAddCard = computed(() => {
  92. return patientCards.value.length < 5
  93. })
  94. const addCardText = computed(() => {
  95. return '还可添加' + (5 - patientCards.value.length) + '人'
  96. })
  97. const confirmAppointment = () => {
  98. if (Cookies.get('appointmentDeptCode') !== '1260000') {
  99. hasValidCovidAssessment(data.appointment.patientId).then((res) => {
  100. if (res === 'no valid assessment') {
  101. router.push('/assessments/covid/' + data.appointment.patientId)
  102. } else {
  103. toPayPage()
  104. }
  105. })
  106. } else {
  107. toPayPage()
  108. }
  109. }
  110. const toPayPage = () => {
  111. data.appointment.week = data.week
  112. patientCards.value.forEach((item) => {
  113. if (item.patientId === data.appointment.patientId) {
  114. data.appointment.patientName = item.name
  115. }
  116. })
  117. store.commit('SET_APPOINTMENTINFO', data.appointment)
  118. router.push('/payAppointmentFee')
  119. }
  120. const disableGhBtn = ref(true)
  121. onMounted(() => {
  122. getGhFee(data.appointment)
  123. .then((res) => {
  124. data.appointment.fee = res
  125. disableGhBtn.value = false
  126. })
  127. .catch(() => {
  128. data.appointment.fee = '获取失败'
  129. disableGhBtn.value = true
  130. })
  131. })
  132. return {
  133. showCreatedCardMethod,
  134. data,
  135. patientCards,
  136. showAddCard,
  137. addCardText,
  138. confirmAppointment,
  139. disableGhBtn,
  140. }
  141. },
  142. }
  143. </script>