普兆健康管家前端代码仓库
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.

327 lines
9.4 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. <!-- status 状态 0待预约 1待检测 2已完成 3已取消 -->
  8. <template v-if="['1', '2'].includes(detail.status)">
  9. <image class="icon" src="@/pages_order/static/checkup/icon-success.png" mode="widthFix"></image>
  10. </template>
  11. <template v-else-if="detail.status == '3'">
  12. <image class="icon" src="@/pages_order/static/checkup/icon-error.png" mode="widthFix"></image>
  13. </template>
  14. <view>{{ statusDesc }}</view>
  15. </view>
  16. <!-- 自采 -->
  17. <template v-if="detail.subscribeType == '0'">
  18. <view class="card">
  19. <view class="card-header">自采检测预约信息</view>
  20. <view class="flex row">
  21. <view class="row-label">姓名</view>
  22. <view class="row-content">{{ detail.name }}</view>
  23. </view>
  24. <view class="flex row">
  25. <view class="row-label">寄送地址</view>
  26. <view class="row-content">{{ addressDesc }}</view>
  27. </view>
  28. <view class="flex row">
  29. <view class="row-label">电话</view>
  30. <view class="row-content">{{ detail.phone }}</view>
  31. </view>
  32. </view>
  33. </template>
  34. <!-- 上门 -->
  35. <template v-else-if="detail.subscribeType == '1'">
  36. <view class="card">
  37. <view class="card-header">上门检测预约信息</view>
  38. <view class="flex row">
  39. <view class="row-label">姓名</view>
  40. <view class="row-content">{{ detail.name }}</view>
  41. </view>
  42. <view class="flex row">
  43. <view class="row-label">体检地址</view>
  44. <view class="row-content">{{ addressDesc }}</view>
  45. </view>
  46. <view class="flex row">
  47. <view class="row-label">时间</view>
  48. <view class="row-content highlight">{{ timeDesc }}</view>
  49. </view>
  50. <view class="flex row">
  51. <view class="row-label">电话</view>
  52. <view class="row-content">{{ detail.phone }}</view>
  53. </view>
  54. </view>
  55. </template>
  56. <!-- 到店 -->
  57. <template v-else-if="detail.subscribeType == '2'">
  58. <view class="card">
  59. <view class="card-header">到店检测预约信息</view>
  60. <view class="flex row">
  61. <view class="row-label">姓名</view>
  62. <view class="row-content">{{ detail.name }}</view>
  63. </view>
  64. <view class="flex row">
  65. <view class="row-label">时间</view>
  66. <view class="row-content highlight">{{ timeDesc }}</view>
  67. </view>
  68. <view class="flex row">
  69. <view class="row-label">电话</view>
  70. <view class="row-content">{{ detail.phone }}</view>
  71. </view>
  72. <view class="flex row">
  73. <view class="row-label">医院</view>
  74. <view class="row-content">{{ hospitalDesc }}</view>
  75. </view>
  76. </view>
  77. </template>
  78. </view>
  79. <view class="flex bottom" v-if="['0', '1', '2'].includes(detail.status)">
  80. <!-- status 状态 0待预约 1待检测 2已完成 3已取消 -->
  81. <!-- 待预约 -->
  82. <template v-if="detail.status == '0'">
  83. <button class="btn" @click="onBook">检测预约</button>
  84. </template>
  85. <!-- 待检测 -->
  86. <template v-else-if="detail.status == '1'">
  87. <!-- 自采 -->
  88. <template v-if="detail.subscribeType == '0'">
  89. <!-- <button class="btn btn-plain" open-type="contact">客服</button> -->
  90. <button plain class="flex flex-column btn btn-service" open-type="contact">
  91. <image class="btn-service-icon" src="@/pages_order/static/order/icon-service.png" mode="widthFix"></image>
  92. <view>联系客服</view>
  93. </button>
  94. <button class="btn" @click="openTrackingNoPopup">已回寄</button>
  95. </template>
  96. <!-- 上门, 到店 -->
  97. <template v-else-if="['1', '2'].includes(detail.subscribeType)">
  98. <button class="btn btn-plain" @click="onCancel">取消</button>
  99. <button class="btn" @click="onEdit">修改</button>
  100. </template>
  101. </template>
  102. <!-- 已完成 -->
  103. <template v-else-if="detail.status == '2'">
  104. <button class="btn" @click="jumpToReportDetail">报告查看</button>
  105. </template>
  106. </view>
  107. </template>
  108. <checkupServicePopup ref="checkupServicePopup"></checkupServicePopup>
  109. <checkupTrackingNoPopup ref="checkupTrackingNoPopup" @submitted="getData"></checkupTrackingNoPopup>
  110. </view>
  111. </template>
  112. <script>
  113. import checkupServicePopup from '@/pages_order/checkup/checkupServicePopup.vue'
  114. import checkupTrackingNoPopup from '@/pages_order/checkup/checkupTrackingNoPopup.vue'
  115. export default {
  116. components: {
  117. checkupServicePopup,
  118. checkupTrackingNoPopup,
  119. },
  120. data() {
  121. return {
  122. id: null,
  123. detail: null,
  124. hospitalOptions: []
  125. }
  126. },
  127. async onLoad(arg) {
  128. const { id } = arg
  129. this.id = id
  130. await this.getData()
  131. if (this.detail?.subscribeType == '2') { // 到店
  132. this.fetchHospitalOptions()
  133. }
  134. },
  135. // 下拉刷新
  136. onPullDownRefresh() {
  137. this.getData()
  138. },
  139. computed: {
  140. statusDesc() {
  141. // status 状态 0待预约 1待检测 2已完成 3已取消
  142. const { status } = this.detail || {}
  143. if (status == '0') {
  144. return '待预约'
  145. }
  146. if (status == '1') {
  147. return '预约成功'
  148. }
  149. if (status == '2') {
  150. return '已完成'
  151. }
  152. if (status == '3') {
  153. return '已取消'
  154. }
  155. return ''
  156. },
  157. addressDesc() {
  158. const { sendAddress, sendAddressDetail } = this.detail || {}
  159. return [sendAddress, sendAddressDetail].filter(val => val).join('')
  160. },
  161. timeDesc() {
  162. const { subscribeDate, subscribeTime } = this.detail || {}
  163. if (!subscribeTime) {
  164. return '--'
  165. }
  166. const timeRange = JSON.parse(subscribeTime).join('~')
  167. return `${subscribeDate} ${timeRange}`
  168. },
  169. hospitalDesc() {
  170. const { hospitalId } = this.detail || {}
  171. if (!hospitalId) {
  172. return '--'
  173. }
  174. return this.hospitalOptions?.find?.(item => item.id == hospitalId)?.name || '--'
  175. },
  176. },
  177. methods: {
  178. async getData() {
  179. try {
  180. this.detail = await this.$fetch('getSubscribeDetail', { id: this.id })
  181. const { status, subscribeType } = this.detail
  182. // status: 1待检测 & subscribeType: 1上门,2到店
  183. if (status == '1' && ['1', '2'].includes(subscribeType)) {
  184. this.$refs.checkupServicePopup.open()
  185. }
  186. } catch (err) {
  187. }
  188. uni.stopPullDownRefresh()
  189. },
  190. async fetchHospitalOptions() {
  191. try {
  192. this.hospitalOptions = await this.$fetch('getSubscribeHospital', { productId: this.detail.productId })
  193. } catch (err) {
  194. }
  195. },
  196. openTrackingNoPopup() {
  197. this.$refs.checkupTrackingNoPopup.open(this.id)
  198. },
  199. onBook() {
  200. this.$utils.redirectTo(`/pages_order/checkup/checkupBook/apply?id=${this.detail.id}&type=${this.detail.type}`)
  201. },
  202. onEdit() {
  203. this.$utils.redirectTo(`/pages_order/checkup/checkupBook/apply?id=${this.detail.id}&type=${this.detail.type}`)
  204. },
  205. async onCancel() {
  206. try {
  207. await this.$fetch('cancelSubscribe', { id: this.detail.id })
  208. uni.showToast({
  209. title: '取消成功',
  210. });
  211. // setTimeout(() => {
  212. // this.$utils.navigateBack()
  213. // }, 800)
  214. this.getData()
  215. } catch (err) {
  216. }
  217. },
  218. jumpToReportDetail() {
  219. this.$utils.navigateTo(`/pages_order/checkup/checkupReport/index?id=${this.detail.id}`)
  220. },
  221. },
  222. }
  223. </script>
  224. <style scoped lang="scss">
  225. @import './style.scss';
  226. .status {
  227. margin-bottom: 40rpx;
  228. row-gap: 4rpx;
  229. width: 100%;
  230. padding: 24rpx 0;
  231. box-sizing: border-box;
  232. font-family: PingFang SC;
  233. font-weight: 400;
  234. font-size: 28rpx;
  235. line-height: 1.4;
  236. color: #252545;
  237. background: #FFFFFF;
  238. border-radius: 24rpx;
  239. .icon {
  240. width: 84rpx;
  241. height: auto;
  242. }
  243. }
  244. .row {
  245. &-content {
  246. text-align: right;
  247. font-size: 28rpx;
  248. color: #393939;
  249. &.highlight {
  250. font-weight: 500;
  251. color: #7451DE;
  252. }
  253. }
  254. }
  255. .bottom {
  256. // align-items: flex-start;
  257. column-gap: 32rpx;
  258. .btn {
  259. width: auto;
  260. flex: 1;
  261. &-plain {
  262. padding: 14rpx 0;
  263. color: #252545;
  264. background: transparent;
  265. border: 2rpx solid #252545;
  266. }
  267. &-service {
  268. flex: none;
  269. row-gap: 4rpx;
  270. font-family: PingFang SC;
  271. font-weight: 400;
  272. font-size: 22rpx;
  273. line-height: 1.1;
  274. color: #999999;
  275. background: transparent;
  276. border: none;
  277. &-icon {
  278. width: 52rpx;
  279. height: auto;
  280. }
  281. }
  282. }
  283. }
  284. </style>