普兆健康管家前端代码仓库
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
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. // todo: check key
  105. { id: '003', label: '服用说明', icon: '/pages_order/static/center/icon-instruc.png', path: `/pages_order/common?key=instruc&title=服用说明` },
  106. // todo: check key
  107. { id: '004', label: '用户须知', icon: '/pages_order/static/center/icon-userAgreement.png', path: `/pages_order/common?key=userAgreement&title=用户须知` },
  108. ],
  109. list2: [
  110. { id: '005', label: '我的评价', icon: '/pages_order/static/center/icon-comment.png', key: 'comment' },
  111. // todo: check key
  112. { id: '006', label: '关于我们', icon: '/pages_order/static/center/icon-aboutUs.png', path: `/pages_order/common?key=aboutUs&title=关于我们` },
  113. { id: '007', label: '修改信息', icon: '/pages_order/static/center/icon-modifyInfo.png', path: `/pages_order/auth/wxUserInfo?mode=edit` },
  114. { id: '008', label: '退出登录', icon: '/pages_order/static/center/icon-logout.png', key: 'logout' },
  115. ],
  116. }
  117. },
  118. computed: {
  119. ...mapState(['userInfo', 'configList']),
  120. isLogin() {
  121. return this.userInfo && this.userInfo.id
  122. }
  123. },
  124. onShow() {
  125. if(uni.getStorageSync('token')){
  126. this.$store.commit('getUserInfo')
  127. this.fetchOrderStatistics()
  128. }
  129. },
  130. methods: {
  131. onClick(target) {
  132. const { key, path } = target
  133. switch(key) {
  134. case 'comment':
  135. this.$utils.navigateTo('/pages_order/comment/commentRecords')
  136. break
  137. case 'logout':
  138. this.$store.commit('logout')
  139. break
  140. default:
  141. path && this.$utils.navigateTo(path)
  142. break
  143. }
  144. },
  145. async fetchOrderStatistics() {
  146. try {
  147. this.statistics = await this.$fetch('getOrderStatistics', { id: '' })
  148. } catch (err) {
  149. }
  150. },
  151. },
  152. }
  153. </script>
  154. <style scoped lang="scss">
  155. .page__view {
  156. width: 100vw;
  157. min-height: 100vh;
  158. background-color: $uni-bg-color;
  159. position: relative;
  160. /deep/ .nav-bar__view {
  161. position: fixed;
  162. top: 0;
  163. left: 0;
  164. }
  165. .nav-icon {
  166. width: 200rpx;
  167. height: auto;
  168. vertical-align: top;
  169. }
  170. }
  171. .bg {
  172. width: 100vw;
  173. height: auto;
  174. }
  175. .main {
  176. position: absolute;
  177. top: 176rpx;
  178. left: 0;
  179. width: 100%;
  180. }
  181. .content {
  182. width: 100%;
  183. padding: 16rpx 32rpx 80rpx 32rpx;
  184. box-sizing: border-box;
  185. }
  186. .user {
  187. column-gap: 24rpx;
  188. &-avatar {
  189. flex: none;
  190. width: 100rpx;
  191. height: 100rpx;
  192. border: 4rpx solid #FFFFFF;
  193. border-radius: 50%;
  194. overflow: hidden;
  195. &.is-default {
  196. width: 108rpx;
  197. height: 108rpx;
  198. border: none;
  199. }
  200. &-img {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. &-info {
  206. flex: 1;
  207. &-name {
  208. font-family: PingFang SC;
  209. font-weight: 600;
  210. font-size: 36rpx;
  211. line-height: 1.2;
  212. color: #FFFFFF;
  213. }
  214. &-desc {
  215. margin-top: 8rpx;
  216. font-family: PingFang SC;
  217. font-weight: 400;
  218. font-size: 24rpx;
  219. line-height: 1.5;
  220. color: #F4F4F4;
  221. }
  222. &-tips {
  223. font-family: PingFang SC;
  224. font-weight: 400;
  225. font-size: 36rpx;
  226. line-height: 1.2;
  227. color: #FFFFFF;
  228. }
  229. }
  230. }
  231. .card {
  232. margin-top: 32rpx;
  233. width: 100%;
  234. background: #FAFAFF;
  235. border: 2rpx solid #FFFFFF;
  236. border-radius: 32rpx;
  237. box-sizing: border-box;
  238. .row {
  239. justify-content: space-between;
  240. width: 100%;
  241. padding: 40rpx;
  242. box-sizing: border-box;
  243. .label {
  244. font-family: PingFang SC;
  245. font-weight: 400;
  246. font-size: 28rpx;
  247. line-height: 1;
  248. color: #252545;
  249. .icon {
  250. margin-right: 16rpx;
  251. width: 40rpx;
  252. height: 40rpx;
  253. }
  254. }
  255. }
  256. }
  257. .btn-service {
  258. border: none;
  259. padding: 0;
  260. }
  261. .login {
  262. margin-top: 307rpx;
  263. padding: 0 128rpx;
  264. .btn {
  265. padding: 16rpx 0;
  266. font-family: PingFang SC;
  267. font-weight: 500;
  268. font-size: 36rpx;
  269. line-height: 1.4;
  270. color: #FFFFFF;
  271. background-image: linear-gradient(to right, #4B348F, #845CFA);
  272. border-radius: 41rpx;
  273. }
  274. .tips {
  275. margin-top: 16rpx;
  276. text-align: center;
  277. font-family: PingFang SC;
  278. font-weight: 400;
  279. font-size: 26rpx;
  280. line-height: 1.4;
  281. color: #A3A3A3;
  282. }
  283. }
  284. </style>