|
|
- <template>
- <view class="page__view">
-
- <image class="bg" :src="configList.center_bg" mode="widthFix"></image>
-
- <view class="main">
-
- <navbar bgColor="transparent" >
- <image class="nav-icon" :src="configList.icon_nav_light" mode="widthFix"></image>
- </navbar>
-
- <view class="content">
- <view class="flex user">
- <!-- 用户信息 -->
- <template v-if="isLogin">
- <view class="user-avatar">
- <image class="user-avatar-img" :src="userInfo.avatar" mode="scaleToFill"></image>
- </view>
- <view class="user-info">
- <view class="user-info-name">{{ userInfo.name }}</view>
- <view class="user-info-desc">{{ userInfo.phone }}</view>
- </view>
- </template>
- <template v-else>
- <view class="user-avatar is-default">
- <image class="user-avatar-img" src="@/pages_order/static/center/avatar-default.png" mode="scaleToFill"></image>
- </view>
- <view class="user-info">
- <view class="user-info-tips">暂未登录 请先登录</view>
- </view>
- </template>
- </view>
-
- <!-- 体检报告 -->
- <report-card></report-card>
-
- <!-- 订单信息 -->
- <template v-if="isLogin">
- <order-card :statistics="statistics"></order-card>
- </template>
-
- <!-- 微信公众号 -->
- <account-card></account-card>
-
- <!-- 用户菜单 -->
- <template v-if="isLogin">
-
- <view class="card">
- <view v-for="item in list1" :key="item.id">
- <template v-if="item.key === 'service'">
- <button plain class="flex btn-service" open-type="contact">
- <view class="flex row">
- <view class="flex label">
- <image class="icon" :src="item.icon" mode="scaleToFill"></image>
- <view>{{ item.label }}</view>
- </view>
- <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
- </view>
- </button>
- </template>
- <view v-else class="flex row" @click="onClick(item)">
- <view class="flex label">
- <image class="icon" :src="item.icon" mode="scaleToFill"></image>
- <view>{{ item.label }}</view>
- </view>
- <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
- </view>
- </view>
- </view>
-
- <view class="card">
- <view v-for="item in list2" :key="item.id">
- <view class="flex row" @click="onClick(item)">
- <view class="flex label">
- <image class="icon" :src="item.icon" mode="scaleToFill"></image>
- <view>{{ item.label }}</view>
- </view>
- <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
- </view>
- </view>
- </view>
-
- </template>
- <!-- 用户登陆 -->
- <template v-else>
- <view class="login">
- <button class="btn" @click="$utils.toLogin">立即登录</button>
- <view class="tips">暂未登录 请先登录</view>
- </view>
- </template>
-
- </view>
-
- <tabber select="center" />
-
- </view>
-
- </view>
- </template>
-
- <script>
- import { mapState } from 'vuex'
-
- import tabber from '@/components/base/tabbar.vue'
- import reportCard from '@/pages_order/center/reportCard.vue'
- import orderCard from '@/pages_order/center/orderCard.vue'
- import accountCard from '@/pages_order/center/accountCard.vue'
-
- export default {
- components: {
- reportCard,
- orderCard,
- accountCard,
- tabber,
- },
- data() {
- return {
- statistics: {},
- list1: [
- { id: '001', label: '检测预约', icon: '/pages_order/static/center/icon-detectBook.png', path: '/pages_order/checkup/checkupRecords' },
- { id: '002', label: '联系客服', icon: '/pages_order/static/center/icon-service.png', key: 'service' },
- { id: '003', label: '服用说明', icon: '/pages_order/static/center/icon-instruc.png', path: `/pages_order/common?key=medication_instructions&title=服用说明` },
- { id: '004', label: '用户须知', icon: '/pages_order/static/center/icon-userAgreement.png', path: `/pages_order/common?key=user_notice&title=用户须知` },
- ],
- list2: [
- { id: '005', label: '我的评价', icon: '/pages_order/static/center/icon-comment.png', key: 'comment' },
- { id: '006', label: '关于我们', icon: '/pages_order/static/center/icon-aboutUs.png', path: `/pages_order/common?key=about_us&title=关于我们` },
- { id: '007', label: '修改信息', icon: '/pages_order/static/center/icon-modifyInfo.png', path: `/pages_order/auth/wxUserInfo?mode=edit` },
- { id: '008', label: '退出登录', icon: '/pages_order/static/center/icon-logout.png', key: 'logout' },
- ],
- }
- },
- computed: {
- ...mapState(['userInfo', 'configList']),
- isLogin() {
- return this.userInfo && this.userInfo.id
- }
- },
- onShow() {
- if(uni.getStorageSync('token')){
- this.$store.commit('getUserInfo')
- this.fetchOrderStatistics()
- }
- },
- methods: {
- onClick(target) {
- const { key, path } = target
-
- switch(key) {
- case 'comment':
- this.$utils.navigateTo('/pages_order/comment/commentRecords')
- break
- case 'logout':
- this.$store.commit('logout')
- break
- default:
- path && this.$utils.navigateTo(path)
- break
- }
- },
- async fetchOrderStatistics() {
- try {
- this.statistics = await this.$fetch('getOrderStatistics', { id: '' })
- } catch (err) {
-
- }
- },
- },
- }
- </script>
-
- <style scoped lang="scss">
-
- .page__view {
- width: 100vw;
- min-height: 100vh;
- background-color: $uni-bg-color;
- position: relative;
-
- /deep/ .nav-bar__view {
- position: fixed;
- top: 0;
- left: 0;
- }
-
- .nav-icon {
- width: 200rpx;
- height: auto;
- vertical-align: top;
- }
-
- }
-
- .bg {
- width: 100vw;
- height: auto;
- }
-
- .main {
- position: absolute;
- top: 176rpx;
- left: 0;
- width: 100%;
- }
-
- .content {
- width: 100%;
- padding: 16rpx 32rpx 80rpx 32rpx;
- box-sizing: border-box;
- }
-
- .user {
- column-gap: 24rpx;
-
- &-avatar {
- flex: none;
- width: 100rpx;
- height: 100rpx;
- border: 4rpx solid #FFFFFF;
- border-radius: 50%;
- overflow: hidden;
-
- &.is-default {
- width: 108rpx;
- height: 108rpx;
- border: none;
- }
-
- &-img {
- width: 100%;
- height: 100%;
- }
- }
-
- &-info {
- flex: 1;
-
- &-name {
- font-family: PingFang SC;
- font-weight: 600;
- font-size: 36rpx;
- line-height: 1.2;
- color: #FFFFFF;
- }
-
- &-desc {
- margin-top: 8rpx;
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- line-height: 1.5;
- color: #F4F4F4;
- }
-
- &-tips {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 36rpx;
- line-height: 1.2;
- color: #FFFFFF;
- }
- }
- }
-
- .card {
- margin-top: 32rpx;
- width: 100%;
- background: #FAFAFF;
- border: 2rpx solid #FFFFFF;
- border-radius: 32rpx;
- box-sizing: border-box;
-
- .row {
- justify-content: space-between;
- width: 100%;
- padding: 40rpx;
- box-sizing: border-box;
-
- .label {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- line-height: 1;
- color: #252545;
-
- .icon {
- margin-right: 16rpx;
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- }
-
- .btn-service {
- border: none;
- padding: 0;
- }
-
- .login {
- margin-top: 307rpx;
- padding: 0 128rpx;
-
- .btn {
- padding: 16rpx 0;
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 36rpx;
- line-height: 1.4;
- color: #FFFFFF;
- background-image: linear-gradient(to right, #4B348F, #845CFA);
- border-radius: 41rpx;
- }
-
- .tips {
- margin-top: 16rpx;
- text-align: center;
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- line-height: 1.4;
- color: #A3A3A3;
- }
- }
- </style>
|