普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
8.2 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="我的预约" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#F3F2F7" />
  4. <template v-if="detail">
  5. <view class="main">
  6. <view class="flex flex-column status">
  7. <template v-if="orderSuccess">
  8. <image class="icon" src="@/pages_order/static/checkup/icon-success.png" mode="widthFix"></image>
  9. </template>
  10. <template v-else>
  11. <image class="icon" src="@/pages_order/static/checkup/icon-error.png" mode="widthFix"></image>
  12. </template>
  13. <view>{{ statusDesc }}</view>
  14. </view>
  15. <!-- 自采 -->
  16. <template v-if="detail.type == 1">
  17. <view class="card">
  18. <view class="card-header">自采检测预约信息</view>
  19. <view class="flex row">
  20. <view class="row-label">姓名</view>
  21. <view class="row-content">{{ detail.userName }}</view>
  22. </view>
  23. <view class="flex row">
  24. <view class="row-label">寄送地址</view>
  25. <view class="row-content">{{ detail.addressDesc }}</view>
  26. </view>
  27. <view class="flex row">
  28. <view class="row-label">电话</view>
  29. <view class="row-content">{{ detail.phone }}</view>
  30. </view>
  31. </view>
  32. </template>
  33. <!-- 上门 -->
  34. <template v-else-if="detail.type == 2">
  35. <view class="card">
  36. <view class="card-header">上门检测预约信息</view>
  37. <view class="flex row">
  38. <view class="row-label">姓名</view>
  39. <view class="row-content">{{ detail.userName }}</view>
  40. </view>
  41. <view class="flex row">
  42. <view class="row-label">体检地址</view>
  43. <view class="row-content">{{ detail.addressDesc }}</view>
  44. </view>
  45. <view class="flex row">
  46. <view class="row-label">时间</view>
  47. <view class="row-content highlight">{{ detail.timeDesc }}</view>
  48. </view>
  49. <view class="flex row">
  50. <view class="row-label">电话</view>
  51. <view class="row-content">{{ detail.phone }}</view>
  52. </view>
  53. </view>
  54. </template>
  55. <!-- 到店 -->
  56. <template v-else-if="detail.type == 3">
  57. <view class="card">
  58. <view class="card-header">到店检测预约信息</view>
  59. <view class="flex row">
  60. <view class="row-label">姓名</view>
  61. <view class="row-content">{{ detail.userName }}</view>
  62. </view>
  63. <view class="flex row">
  64. <view class="row-label">时间</view>
  65. <view class="row-content highlight">{{ detail.timeDesc }}</view>
  66. </view>
  67. <view class="flex row">
  68. <view class="row-label">电话</view>
  69. <view class="row-content">{{ detail.phone }}</view>
  70. </view>
  71. <view class="flex row">
  72. <view class="row-label">医院</view>
  73. <view class="row-content">{{ detail.hospitalDesc }}</view>
  74. </view>
  75. </view>
  76. </template>
  77. </view>
  78. <view class="flex bottom">
  79. <!-- 自采 -->
  80. <template v-if="detail.status == 1">
  81. <button class="btn btn-plain" open-type="contact">客服</button>
  82. <button class="btn" @click="openTrackingNoPopup">已回寄</button>
  83. </template>
  84. <!-- 上门, 到店, 预约失败 -->
  85. <template v-else-if="[2, 3, 6].includes(detail.status)">
  86. <button class="btn btn-plain" @click="onCancel">取消</button>
  87. <button class="btn" @click="onEdit">修改</button>
  88. </template>
  89. <!-- 已完成 -->
  90. <template v-else-if="detail.status == 4">
  91. <button class="btn" @click="jumpToReportDetail">报告查看</button>
  92. </template>
  93. </view>
  94. </template>
  95. <checkupServicePopup ref="checkupServicePopup"></checkupServicePopup>
  96. <checkupTrackingNoPopup ref="checkupTrackingNoPopup" @submitted="getData"></checkupTrackingNoPopup>
  97. </view>
  98. </template>
  99. <script>
  100. import checkupServicePopup from '@/pages_order/checkup/checkupServicePopup.vue'
  101. import checkupTrackingNoPopup from '@/pages_order/checkup/checkupTrackingNoPopup.vue'
  102. export default {
  103. components: {
  104. checkupServicePopup,
  105. checkupTrackingNoPopup,
  106. },
  107. data() {
  108. return {
  109. id: null,
  110. detail: null,
  111. hospitalOptions: [
  112. { id: '001', label: '湖南省长沙市湘雅第一医院' },
  113. { id: '002', label: '湖南省长沙市湘雅第二医院' },
  114. { id: '003', label: '湖南省长沙市湘雅第三医院' },
  115. { id: '004', label: '湖南省长沙市湘雅第四医院' },
  116. ]
  117. }
  118. },
  119. onLoad(arg) {
  120. this.id = arg.id
  121. this.getData()
  122. },
  123. computed: {
  124. orderSuccess() {
  125. // todo: check status
  126. return this.detail?.status < 5
  127. },
  128. statusDesc() {
  129. const status = this.detail?.status
  130. if (status < 4) {
  131. return '预约成功'
  132. }
  133. if (status == 4) {
  134. return '已完成'
  135. }
  136. if (status == 6) {
  137. return '预约失败'
  138. }
  139. return ''
  140. },
  141. },
  142. methods: {
  143. getData() {
  144. // todo: fetch by id
  145. let detail = {
  146. id: '003',
  147. url: '',
  148. title: '孕产妇体检套餐',
  149. userName: '周小艺',
  150. phone: '15558661691',
  151. amount: 688,
  152. area: ['海南省', '海口市', '秀英区'],
  153. address: '秀英街道5单元183室',
  154. hospital: '001',
  155. createTime: '2025-04-28 08:14',
  156. appointmentDate: '2025-04-28',
  157. appointmentTime: ['08:00', '09:00'],
  158. type: 2,
  159. status: 4,
  160. }
  161. detail.addressDesc = this.getAddressDesc(detail)
  162. detail.timeDesc = this.getTimeDesc(detail)
  163. detail.hospitalDesc = this.getHospitalDesc(detail)
  164. this.detail = detail
  165. if ([2, 3].includes(this.detail.status)) {
  166. this.$refs.checkupServicePopup.open()
  167. }
  168. },
  169. getAddressDesc(data) {
  170. if (!data) {
  171. return ''
  172. }
  173. console.log('detail', data)
  174. const { area, address } = data
  175. console.log('area', area, 'address', address)
  176. return `${(area || []).join('')}${address}`
  177. },
  178. getTimeDesc(data) {
  179. if (!data) {
  180. return ''
  181. }
  182. const { appointmentDate, appointmentTime } = data
  183. return `${appointmentDate} ${(appointmentTime || []).join('~')}`
  184. },
  185. getHospitalDesc(data) {
  186. const { hospital } = data
  187. return this.hospitalOptions.find(item => item.id == hospital)?.label
  188. },
  189. openTrackingNoPopup() {
  190. this.$refs.checkupTrackingNoPopup.open(this.id)
  191. },
  192. onEdit() {
  193. this.$utils.navigateTo(`/pages_order/checkup/checkupBook/apply?id=${this.detail.id}&type=${this.detail.type}`)
  194. },
  195. onCancel() {
  196. // todo: fetch
  197. uni.showToast({
  198. title: '取消成功',
  199. });
  200. setTimeout(() => {
  201. this.$utils.navigateBack()
  202. }, 800)
  203. },
  204. jumpToReportDetail() {
  205. this.$utils.navigateTo(`/pages_order/checkup/checkupReport/index?id=${this.detail.id}`)
  206. },
  207. },
  208. }
  209. </script>
  210. <style scoped lang="scss">
  211. @import './style.scss';
  212. .status {
  213. margin-bottom: 40rpx;
  214. row-gap: 4rpx;
  215. width: 100%;
  216. padding: 24rpx 0;
  217. box-sizing: border-box;
  218. font-family: PingFang SC;
  219. font-weight: 400;
  220. font-size: 28rpx;
  221. line-height: 1.4;
  222. color: #252545;
  223. background: #FFFFFF;
  224. border-radius: 24rpx;
  225. .icon {
  226. width: 84rpx;
  227. height: auto;
  228. }
  229. }
  230. .row {
  231. &-content {
  232. text-align: right;
  233. font-size: 28rpx;
  234. color: #393939;
  235. &.highlight {
  236. font-weight: 500;
  237. color: #7451DE;
  238. }
  239. }
  240. }
  241. .bottom {
  242. align-items: flex-start;
  243. column-gap: 32rpx;
  244. .btn {
  245. flex: 1;
  246. &-plain {
  247. padding: 14rpx 0;
  248. color: #252545;
  249. background: transparent;
  250. border: 2rpx solid #252545;
  251. }
  252. }
  253. }
  254. </style>