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

324 lines
7.5 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page__view">
  3. <image class="bg" :src="configList.center_bg" mode="widthFix"></image>
  4. <view class="main">
  5. <navbar bgColor="transparent" >
  6. <image class="nav-icon" :src="configList.icon_nav_light" mode="widthFix"></image>
  7. </navbar>
  8. <view class="content">
  9. <view class="flex user">
  10. <!-- 用户信息 -->
  11. <template v-if="isLogin">
  12. <view class="user-avatar">
  13. <image class="user-avatar-img" :src="userInfo.avatar" mode="scaleToFill"></image>
  14. </view>
  15. <view class="user-info">
  16. <view class="user-info-name">{{ userInfo.name }}</view>
  17. <view class="user-info-desc">{{ userInfo.phone }}</view>
  18. </view>
  19. </template>
  20. <template v-else>
  21. <view class="user-avatar is-default">
  22. <image class="user-avatar-img" src="@/pages_order/static/center/avatar-default.png" mode="scaleToFill"></image>
  23. </view>
  24. <view class="user-info">
  25. <view class="user-info-tips">暂未登录 请先登录</view>
  26. </view>
  27. </template>
  28. </view>
  29. <!-- 体检报告 -->
  30. <report-card></report-card>
  31. <!-- 订单信息 -->
  32. <template v-if="isLogin">
  33. <order-card :statistics="statistics"></order-card>
  34. </template>
  35. <!-- 微信公众号 -->
  36. <account-card></account-card>
  37. <!-- 用户菜单 -->
  38. <template v-if="isLogin">
  39. <view class="card">
  40. <view v-for="item in list1" :key="item.id">
  41. <template v-if="item.key === 'service'">
  42. <button plain class="flex btn-service" open-type="contact">
  43. <view class="flex row">
  44. <view class="flex label">
  45. <image class="icon" :src="item.icon" mode="scaleToFill"></image>
  46. <view>{{ item.label }}</view>
  47. </view>
  48. <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
  49. </view>
  50. </button>
  51. </template>
  52. <view v-else class="flex row" @click="onClick(item)">
  53. <view class="flex label">
  54. <image class="icon" :src="item.icon" mode="scaleToFill"></image>
  55. <view>{{ item.label }}</view>
  56. </view>
  57. <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="card">
  62. <view v-for="item in list2" :key="item.id">
  63. <view class="flex row" @click="onClick(item)">
  64. <view class="flex label">
  65. <image class="icon" :src="item.icon" mode="scaleToFill"></image>
  66. <view>{{ item.label }}</view>
  67. </view>
  68. <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <!-- 用户登陆 -->
  74. <template v-else>
  75. <view class="login">
  76. <button class="btn" @click="$utils.toLogin">立即登录</button>
  77. <view class="tips">暂未登录 请先登录</view>
  78. </view>
  79. </template>
  80. </view>
  81. <tabber select="center" />
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import { mapState } from 'vuex'
  87. import tabber from '@/components/base/tabbar.vue'
  88. import reportCard from '@/pages_order/center/reportCard.vue'
  89. import orderCard from '@/pages_order/center/orderCard.vue'
  90. import accountCard from '@/pages_order/center/accountCard.vue'
  91. export default {
  92. components: {
  93. reportCard,
  94. orderCard,
  95. accountCard,
  96. tabber,
  97. },
  98. data() {
  99. return {
  100. statistics: {},
  101. list1: [
  102. { id: '001', label: '检测预约', icon: '/pages_order/static/center/icon-detectBook.png', path: '/pages_order/checkup/checkupRecords' },
  103. { id: '002', label: '联系客服', icon: '/pages_order/static/center/icon-service.png', key: 'service' },
  104. { id: '003', label: '服用说明', icon: '/pages_order/static/center/icon-instruc.png', path: `/pages_order/common?key=medication_instructions&title=服用说明` },
  105. { id: '004', label: '用户须知', icon: '/pages_order/static/center/icon-userAgreement.png', path: `/pages_order/common?key=user_notice&title=用户须知` },
  106. ],
  107. list2: [
  108. { id: '005', label: '我的评价', icon: '/pages_order/static/center/icon-comment.png', key: 'comment' },
  109. { id: '006', label: '关于我们', icon: '/pages_order/static/center/icon-aboutUs.png', path: `/pages_order/common?key=about_us&title=关于我们` },
  110. { id: '007', label: '修改信息', icon: '/pages_order/static/center/icon-modifyInfo.png', path: `/pages_order/auth/wxUserInfo?mode=edit` },
  111. { id: '008', label: '退出登录', icon: '/pages_order/static/center/icon-logout.png', key: 'logout' },
  112. ],
  113. }
  114. },
  115. computed: {
  116. ...mapState(['userInfo', 'configList']),
  117. isLogin() {
  118. return this.userInfo && this.userInfo.id
  119. }
  120. },
  121. onShow() {
  122. if(uni.getStorageSync('token')){
  123. this.$store.commit('getUserInfo')
  124. this.fetchOrderStatistics()
  125. }
  126. },
  127. methods: {
  128. onClick(target) {
  129. const { key, path } = target
  130. switch(key) {
  131. case 'comment':
  132. this.$utils.navigateTo('/pages_order/comment/commentRecords')
  133. break
  134. case 'logout':
  135. this.$store.commit('logout')
  136. break
  137. default:
  138. path && this.$utils.navigateTo(path)
  139. break
  140. }
  141. },
  142. async fetchOrderStatistics() {
  143. try {
  144. this.statistics = await this.$fetch('getOrderStatistics', { id: '' })
  145. } catch (err) {
  146. }
  147. },
  148. },
  149. }
  150. </script>
  151. <style scoped lang="scss">
  152. .page__view {
  153. width: 100vw;
  154. min-height: 100vh;
  155. background-color: $uni-bg-color;
  156. position: relative;
  157. /deep/ .nav-bar__view {
  158. position: fixed;
  159. top: 0;
  160. left: 0;
  161. }
  162. .nav-icon {
  163. width: 200rpx;
  164. height: auto;
  165. vertical-align: top;
  166. }
  167. }
  168. .bg {
  169. width: 100vw;
  170. height: auto;
  171. }
  172. .main {
  173. position: absolute;
  174. top: 176rpx;
  175. left: 0;
  176. width: 100%;
  177. }
  178. .content {
  179. width: 100%;
  180. padding: 16rpx 32rpx 80rpx 32rpx;
  181. box-sizing: border-box;
  182. }
  183. .user {
  184. column-gap: 24rpx;
  185. &-avatar {
  186. flex: none;
  187. width: 100rpx;
  188. height: 100rpx;
  189. border: 4rpx solid #FFFFFF;
  190. border-radius: 50%;
  191. overflow: hidden;
  192. &.is-default {
  193. width: 108rpx;
  194. height: 108rpx;
  195. border: none;
  196. }
  197. &-img {
  198. width: 100%;
  199. height: 100%;
  200. }
  201. }
  202. &-info {
  203. flex: 1;
  204. &-name {
  205. font-family: PingFang SC;
  206. font-weight: 600;
  207. font-size: 36rpx;
  208. line-height: 1.2;
  209. color: #FFFFFF;
  210. }
  211. &-desc {
  212. margin-top: 8rpx;
  213. font-family: PingFang SC;
  214. font-weight: 400;
  215. font-size: 24rpx;
  216. line-height: 1.5;
  217. color: #F4F4F4;
  218. }
  219. &-tips {
  220. font-family: PingFang SC;
  221. font-weight: 400;
  222. font-size: 36rpx;
  223. line-height: 1.2;
  224. color: #FFFFFF;
  225. }
  226. }
  227. }
  228. .card {
  229. margin-top: 32rpx;
  230. width: 100%;
  231. background: #FAFAFF;
  232. border: 2rpx solid #FFFFFF;
  233. border-radius: 32rpx;
  234. box-sizing: border-box;
  235. .row {
  236. justify-content: space-between;
  237. width: 100%;
  238. padding: 40rpx;
  239. box-sizing: border-box;
  240. .label {
  241. font-family: PingFang SC;
  242. font-weight: 400;
  243. font-size: 28rpx;
  244. line-height: 1;
  245. color: #252545;
  246. .icon {
  247. margin-right: 16rpx;
  248. width: 40rpx;
  249. height: 40rpx;
  250. }
  251. }
  252. }
  253. }
  254. .btn-service {
  255. border: none;
  256. padding: 0;
  257. }
  258. .login {
  259. margin-top: 307rpx;
  260. padding: 0 128rpx;
  261. .btn {
  262. padding: 16rpx 0;
  263. font-family: PingFang SC;
  264. font-weight: 500;
  265. font-size: 36rpx;
  266. line-height: 1.4;
  267. color: #FFFFFF;
  268. background-image: linear-gradient(to right, #4B348F, #845CFA);
  269. border-radius: 41rpx;
  270. }
  271. .tips {
  272. margin-top: 16rpx;
  273. text-align: center;
  274. font-family: PingFang SC;
  275. font-weight: 400;
  276. font-size: 26rpx;
  277. line-height: 1.4;
  278. color: #A3A3A3;
  279. }
  280. }
  281. </style>