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

240 lines
5.5 KiB

  1. <template>
  2. <view class="card" @click="jumpToProductDetail">
  3. <view class="flex top">
  4. <view class="title">{{ data.title }}</view>
  5. <view :class="['flex', 'status', `status-${data.status}`]">{{ statusDesc }}</view>
  6. </view>
  7. <view class="flex main">
  8. <image class="img" :src="data.url" mode="scaleToFill"></image>
  9. <view class="info">
  10. <view class="flex row">
  11. <view class="row-label">客户姓名</view>
  12. <view class="row-content">{{ data.userName }}</view>
  13. </view>
  14. <template v-if="data.status == 0">
  15. <view class="flex row">
  16. <view class="row-label">下单时间</view>
  17. <view class="row-content">{{ data.createTime }}</view>
  18. </view>
  19. </template>
  20. <template v-else>
  21. <view class="flex row">
  22. <view class="row-label">检测类型</view>
  23. <view class="row-content">{{ data.typeDesc }}</view>
  24. </view>
  25. <view class="flex row">
  26. <view class="row-label">预约时间</view>
  27. <view class="row-content">{{ data.appointmentTime || '-' }}</view>
  28. </view>
  29. </template>
  30. <view class="flex row">
  31. <view class="row-label">联系电话</view>
  32. <view class="row-content">{{ data.phone }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="flex bottom">
  37. <view class="flex price">
  38. <text class="price-label">总价格</text>
  39. <text class="price-unit">¥</text><text class="price-value">{{ data.amount.toFixed(2) }}</text>
  40. </view>
  41. <view class="flex btns">
  42. <!-- 待预约 -->
  43. <template v-if="data.status == 0">
  44. <button class="btn" @click.stop="onBook">检测预约</button>
  45. </template>
  46. <!-- 自采 -->
  47. <template v-else-if="data.status == 1">
  48. <button class="btn" @click.stop="onSendBackOnline">线上回寄试剂盒</button>
  49. </template>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. const STATUS_AND_DESC_MAPPING = {
  56. 0: '待预约',
  57. 1: '自采',
  58. 2: '上门',
  59. 3: '到店',
  60. 4: '已完成',
  61. 5: '已取消',
  62. 6: '预约失败',
  63. }
  64. export default {
  65. props: {
  66. data: {
  67. type: Object,
  68. default() {
  69. return {}
  70. }
  71. }
  72. },
  73. computed: {
  74. statusDesc() {
  75. return STATUS_AND_DESC_MAPPING[this.data.status]
  76. },
  77. },
  78. methods: {
  79. onBook() {
  80. this.$utils.navigateTo(`/pages_order/checkup/checkupBook/apply?id=${this.data.id}&type=${this.data.type}`)
  81. },
  82. onSendBackOnline() {
  83. this.$emit('sendBack')
  84. },
  85. jumpToProductDetail() {
  86. console.log(this.data.id, 'jumpToProductDetail')
  87. if ([0, 5].includes(this.data.status) == 5) { // 0-待预约 5-已取消
  88. this.$utils.navigateTo(`/pages_order/order/orderDetail/index?id=${this.data.id}`)
  89. // todo: check product id
  90. // this.$utils.navigateTo(`/pages_order/product/productDetail?id=${this.data.id}`)
  91. } else {
  92. this.$utils.navigateTo(`/pages_order/checkup/checkupBook/detail?id=${this.data.id}`)
  93. }
  94. },
  95. },
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .card {
  100. width: 100%;
  101. padding: 32rpx;
  102. box-sizing: border-box;
  103. background: #FAFAFF;
  104. border: 2rpx solid #FFFFFF;
  105. border-radius: 32rpx;
  106. }
  107. .top {
  108. justify-content: space-between;
  109. .title {
  110. font-family: PingFang SC;
  111. font-weight: 500;
  112. font-size: 36rpx;
  113. line-height: 1.4;
  114. color: #252545;
  115. }
  116. .status {
  117. display: inline-flex;
  118. min-width: 120rpx;
  119. padding: 6rpx 0;
  120. box-sizing: border-box;
  121. font-family: PingFang SC;
  122. font-weight: 400;
  123. font-size: 24rpx;
  124. line-height: 1.4;
  125. color: #252545;
  126. background: #F3F3F3;
  127. border-radius: 12rpx;
  128. &-0 {
  129. color: #7D27E0;
  130. background: #F5EEFD;
  131. }
  132. &-1 {
  133. color: #2799E0;
  134. background: #EEF7FD;
  135. }
  136. &-2 {
  137. color: #E53C29;
  138. background: #FDE7E5;
  139. }
  140. &-3 {
  141. color: #10A934;
  142. background: #E2FDE9;
  143. }
  144. }
  145. }
  146. .main {
  147. margin: 24rpx 0;
  148. column-gap: 24rpx;
  149. .img {
  150. flex: none;
  151. width: 120rpx;
  152. height: 120rpx;
  153. }
  154. .info {
  155. flex: 1;
  156. padding: 24rpx;
  157. background: #FFFFFF;
  158. border-radius: 32rpx;
  159. }
  160. .row {
  161. justify-content: flex-start;
  162. column-gap: 4rpx;
  163. font-family: PingFang SC;
  164. font-weight: 400;
  165. font-size: 28rpx;
  166. line-height: 1.4;
  167. &-label {
  168. flex: none;
  169. color: #8B8B8B;
  170. }
  171. &-content {
  172. color: #393939;
  173. }
  174. }
  175. .row + .row {
  176. margin-top: 16rpx;
  177. }
  178. }
  179. .bottom {
  180. justify-content: space-between;
  181. .price {
  182. column-gap: 8rpx;
  183. font-family: PingFang SC;
  184. font-weight: 500;
  185. line-height: 1.4;
  186. &-label {
  187. font-weight: 400;
  188. font-size: 26rpx;
  189. color: #8B8B8B;
  190. }
  191. &-unit {
  192. font-size: 24rpx;
  193. color: #7451DE;
  194. }
  195. &-value {
  196. font-size: 32rpx;
  197. color: #7451DE;
  198. }
  199. }
  200. .btns {
  201. flex: 1;
  202. justify-content: flex-end;
  203. column-gap: 16rpx;
  204. }
  205. .btn {
  206. padding: 10rpx 22rpx;
  207. font-family: PingFang SC;
  208. font-weight: 400;
  209. font-size: 28rpx;
  210. line-height: 1.4;
  211. color: #393939;
  212. border: 2rpx solid #252545;
  213. border-radius: 32rpx;
  214. }
  215. }
  216. </style>