waitRegistration.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="container">
  3. <view class="content_x">
  4. <view class="doc_info">
  5. <image class="doc_img" :src="doctorItem.PhotoUrl || iconUrl.icon_doctor"></image>
  6. <view class="doc_con">
  7. <view class="doc_name">{{ doctorItem.DoctorName }}</view>
  8. <view class="doc_tip">{{ doctorItem.DeptName }} | {{ doctorItem.Title }}</view>
  9. </view>
  10. </view>
  11. <view class="info_list">
  12. <view class="info_item border_bottom">
  13. <view class="info_item_tit">就诊人</view>
  14. <view class="info_item_val">{{ currentUser.memberName }}({{ currentUser.sex == '1' ? '男' : currentUser.sex == '2' ? '女' : '未知' }}/{{ currentUser.ageStr }})</view>
  15. </view>
  16. <view class="info_item border_bottom" v-if="currentUser.isChildren == 0">
  17. <view class="info_item_tit">身份证号</view>
  18. <view class="info_item_val">{{ currentUser.certNum }}</view>
  19. </view>
  20. <view class="info_item border_bottom" v-if="currentUser.isChildren == 1">
  21. <view class="info_item_tit">监护人身份证号</view>
  22. <view class="info_item_val">{{ currentUser.guardianCertNum }}</view>
  23. </view>
  24. <view class="info_item border_bottom">
  25. <view class="info_item_tit">候补排班</view>
  26. <view class="info_item_val">{{ dateInfoSelected.RegDate }} {{ dateInfoSelected.WeekName }}{{ dateInfoSelected.TimeSliceStr }}</view>
  27. </view>
  28. <view class="info_item" v-if="false">
  29. <view class="info_item_tit">候补截止</view>
  30. <view class="info_item_val">
  31. <picker mode="date" class="picker" :value="waitDate" :start="today" :end="endDate" @change="bindDateChange">
  32. {{ waitDate }}
  33. </picker>
  34. {{ waitDateName }}{{ waitTimeName }}
  35. <picker mode="time" class="picker" :value="waitTime" :end="endTime" @change="bindTimeChange">
  36. {{ waitTime }}
  37. </picker>
  38. <image class="right" :src="iconUrl.icon_right"></image>
  39. </view>
  40. </view>
  41. <view class="info_item_tip">
  42. 截至{{ waitDate }} {{ waitTime }}之前,系统将一直为您尝试预约挂号候补
  43. </view>
  44. </view>
  45. <view class="public_btn_con">
  46. <view class="public_btn backgroundCustom" @click="jumpAppointmentSuccess">确认登记</view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script setup lang="ts">
  52. import { ref } from 'vue';
  53. import { onLoad } from '@dcloudio/uni-app';
  54. import { common } from '@/utils';
  55. import icon from '@/utils/icon';
  56. import { waitListApiAdd } from '@/pagesPatient/service/yygh';
  57. const app = getApp();
  58. const iconUrl = ref(icon);
  59. const waitDate = ref(''); //候补日期
  60. const waitDateName = ref(''); //星期
  61. const waitTime = ref('16:00'); //候补时间
  62. const waitTimeName = ref(''); //上下午
  63. const endTime = ref("23:59"); //截止时间
  64. const endDate = ref(''); //截止日期
  65. const showMore = ref(false); //是否展示过敏史等
  66. const currentUser = ref<any>({});
  67. const doctorItem = ref<any>({});
  68. const dateInfoSelected = ref<any>({});
  69. const today = ref('');
  70. onLoad((options: any) => {
  71. let user = app.globalData.currentUser;
  72. let querBen = options.querBen ? JSON.parse(decodeURIComponent(options.querBen)) : {};
  73. let doctor = querBen.doctorItem; //医生信息
  74. let dateInfo = querBen.dateInfoSelected; //排班信息
  75. let wDate = dateInfo.RegDate;
  76. currentUser.value = user;
  77. doctorItem.value = doctor;
  78. dateInfoSelected.value = dateInfo;
  79. waitDate.value = wDate;
  80. today.value = common.afterFewDays(1);
  81. endDate.value = wDate;
  82. waitDateName.value = common.getWeekName(new Date(wDate).getDay(), 1);
  83. waitTimeName.value = getWaitTimeName(waitTime.value);
  84. });
  85. const getWaitTimeName = (str: string) => {
  86. let val = Number(str.replace(':', ''));
  87. if (val >= 0 && val <= 1200) {
  88. return '上午';
  89. } else if (val > 1200 && val <= 2359) {
  90. return '下午';
  91. }
  92. return '';
  93. };
  94. // 选择截止日期
  95. const bindDateChange = (e: any) => {
  96. let val = e.detail.value;
  97. waitDate.value = val;
  98. waitDateName.value = common.getWeekName(new Date(e.detail.value).getDay(), 1);
  99. };
  100. const bindTimeChange = (e: any) => {
  101. waitTime.value = e.detail.value;
  102. waitTimeName.value = getWaitTimeName(e.detail.value);
  103. };
  104. // 跳转候补成功
  105. const jumpAppointmentSuccess = async () => {
  106. let user = currentUser.value;
  107. let doctor = doctorItem.value;
  108. let dateInfo = dateInfoSelected.value;
  109. let queryData = {
  110. HosId: app.globalData.districtId || app.globalData.hosId,
  111. OpenId: uni.getStorageSync("openid"),
  112. MemberId: user.memberId,
  113. MemberName: user.memberName,
  114. CertType: user.isChildren == '1' ? user.guardianCertType : user.certType,
  115. CertNum: user.isChildren == '1' ? user.guardianCertNum : user.certNum,
  116. ScheduleId: dateInfo.ScheduleId,
  117. DeptCode: doctor.DeptCode,
  118. DeptName: doctor.DeptName,
  119. DoctorCode: doctor.DoctorCode,
  120. DoctorName: doctor.DoctorName,
  121. RegDate: dateInfo.RegDate,
  122. WeekId: dateInfo.WeekId,
  123. TimeId: dateInfo.TimeSlice,
  124. RegFee: dateInfo.RegFee,
  125. InvalidDate: `${waitDate.value} ${waitTime.value}:00`,
  126. ServiceId: '0',
  127. MemberStore: {
  128. cardEncryptionStore: user.encryptionStore || '',
  129. baseMemberEncryptionStore: user.baseMemberEncryptionStore
  130. }
  131. };
  132. // Note: Original code destructures {resp, resData}, but handle.promistHandleNew usually returns [err, res] or just res depending on implementation.
  133. // Assuming standard usage: let resp = await api(...)
  134. // Based on waitListApiAdd implementation in index.ts:
  135. // let resp = handle.promistHandleNew(...)
  136. // return handle.catchPromiseNew(resp, () => resp);
  137. // So resp will be the result array/object.
  138. // However, looking at original code: let {resp,resData} = await yygh.waitListApiAdd(queryData)
  139. // It seems it expects an object with resp and resData.
  140. // But waitListApiAdd in index.ts returns `handle.catchPromiseNew(resp, () => resp)`.
  141. // If promistHandleNew returns [err, res], then catchPromiseNew usually returns res if no error.
  142. // Let's look at `handle.promistHandleNew` usage pattern in other files if possible, or assume standard uni-app-base pattern.
  143. // In `record/index.ts`, `waitListApiAdd` was not present, I added it to `yygh/index.ts`.
  144. // Standard `handle.catchPromiseNew(resp, () => resp)` usually returns the data directly.
  145. // The original code `let {resp,resData} = await ...` suggests the return value is an object containing these keys.
  146. // But my implementation of `waitListApiAdd` returns `resp` directly (or whatever `catchPromiseNew` returns).
  147. // If `catchPromiseNew` returns the response body, we should check `RespCode` on it.
  148. let resp = await waitListApiAdd(queryData);
  149. // Assuming resp is the data object or array.
  150. // If resp is array (common in some frameworks), check resp[0].
  151. // If resp is object, check resp.RespCode.
  152. // Let's assume resp is the response object.
  153. // If the original code destructured it, maybe the library returns {resp, resData}.
  154. // But I'm using the standard `handle` from `pagesPatient/service/yygh/index.ts`.
  155. // Let's check `regSignForHis` usage in `signInList.vue` I just wrote:
  156. // let resp = await regSignForHis(querData)
  157. // if (!common.isEmpty(resp)) { ... resp[0] ... }
  158. // This suggests `resp` is an array of results.
  159. // Wait, the original code used `yygh.waitListApiAdd`.
  160. // I should check if I should return `resp` or `resp[0]`.
  161. // Usually `handle.catchPromiseNew` returns the business data.
  162. // If the API returns a list, it's a list. If it returns an object, it's an object.
  163. // `waitListApiAdd` likely returns a status object.
  164. if (resp && resp.RespCode == '10000') {
  165. common.goToUrl(`/pagesPatient/st1/business/yygh/waitSuccess/waitSuccess`);
  166. } else if (Array.isArray(resp) && resp[0] && resp[0].RespCode == '10000') {
  167. common.goToUrl(`/pagesPatient/st1/business/yygh/waitSuccess/waitSuccess`);
  168. } else {
  169. // If response structure is different, we might need to adjust.
  170. // For now, let's assume if it returns success it might be in resp.RespCode or we just check if it's not empty.
  171. // But explicit check for 10000 is better.
  172. // Let's try to be robust.
  173. if ((resp && resp.RespCode == '10000') || (Array.isArray(resp) && resp[0] && resp[0].RespCode == '10000')) {
  174. common.goToUrl(`/pagesPatient/st1/business/yygh/waitSuccess/waitSuccess`);
  175. }
  176. }
  177. };
  178. </script>
  179. <style scoped>
  180. .content_x {
  181. width: 100%;
  182. display: inline-block;
  183. padding-bottom: 170upx;
  184. }
  185. .doc_info {
  186. position: relative;
  187. padding: 30upx;
  188. display: flex;
  189. align-items: center;
  190. background-color: #fff;
  191. margin-bottom: 20upx;
  192. }
  193. .right {
  194. position: absolute;
  195. right: 30upx;
  196. top: 0;
  197. bottom: 0;
  198. margin: auto 0;
  199. width: 12upx;
  200. height: 24upx;
  201. }
  202. .info_item .right {
  203. position: inherit;
  204. margin-left: 12upx;
  205. }
  206. .doc_img {
  207. width: 88upx;
  208. height: 88upx;
  209. flex-shrink: 0;
  210. margin-right: 24upx;
  211. border-radius: 50%;
  212. }
  213. .doc_con {
  214. width: 100%;
  215. }
  216. .doc_name {
  217. font-size: 32upx;
  218. font-family: PingFang SC;
  219. font-weight: bold;
  220. color: #333;
  221. line-height: 18upx;
  222. margin-bottom: 15upx;
  223. }
  224. .doc_tip {
  225. font-size: 26upx;
  226. font-family: PingFang SC;
  227. color: #999;
  228. }
  229. .info_list {
  230. background-color: #fff;
  231. display: inline-block;
  232. width: 100%;
  233. margin-bottom: 20upx;
  234. padding: 0 30upx;
  235. }
  236. .info_item {
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-between;
  240. font-size: 32upx;
  241. font-family: PingFang SC;
  242. color: #333;
  243. }
  244. .info_item_val {
  245. padding: 38upx 0;
  246. display: flex;
  247. align-items: center;
  248. font-size: 32upx;
  249. font-family: PingFang SC;
  250. color: #666666;
  251. line-height: 38upx;
  252. }
  253. .info_item_tip {
  254. font-size: 28upx;
  255. font-family: PingFang SC;
  256. color: #999;
  257. line-height: 42upx;
  258. padding: 25upx 30upx;
  259. background: #f7f7f7;
  260. border-radius: 10upx;
  261. position: relative;
  262. margin-bottom: 30upx;
  263. }
  264. .info_item_tip::after {
  265. display: block;
  266. content: "";
  267. width: 20upx;
  268. height: 20upx;
  269. background-color: #f7f7f7;
  270. transform-origin: 50%;
  271. transform: rotateZ(45deg);
  272. position: absolute;
  273. left: 30upx;
  274. top: -10upx;
  275. }
  276. .picker {
  277. margin: 0 20upx;
  278. }
  279. </style>