zhengyiming
1 天以前 c0bcba49bef43b880978ff63b2ac00f1ba5c5c6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
  <PageLayoutWithBg class="mine-page-wrapper" :need-auth="false">
    <template #navigationBar>
      <TransparentNavigationBar :title="'个人中心'" :is-absolute="false">
      </TransparentNavigationBar>
    </template>
    <template #bg>
      <img :src="OssAssets.common.MinePageBg" class="mine-page-bg" />
    </template>
    <div class="mine-page-top-view" @click="goLogin">
      <img class="mine-avatar" :src="DefaultAvatar" alt="" />
      <div class="user-info">
        <div class="user-info-name" v-if="isLogin">
          {{ hiddenPhoneNumber(virtualPhoneNumber) }}
        </div>
        <div class="mine-go-login" v-else>登录</div>
      </div>
    </div>
    <ContentScrollView style="background-color: transparent">
      <List class="mine-list-wrapper">
        <ListItemV2 :icon="IconMineOrder" title="订单管理" @click="goOrderManage"></ListItemV2>
        <ListItemV2 :icon="IconMineUserId" title="户号管理" @click="goUserAccountList"></ListItemV2>
        <template v-if="isChannelAccount">
          <ListItemV2 :icon="IconMineDataBoard" title="数据看板" @click="goDashboard"></ListItemV2>
          <ListItemV2
            :icon="IconMinePromotion"
            title="推广二维码"
            @click="goShareQrcode"
          ></ListItemV2>
        </template>
        <ListItemV2
          :icon="IconMineCustomerService"
          v-if="isWeb && !isInAlipay"
          title="在线客服"
          @click="handleChat"
        ></ListItemV2>
        <ListItemV2
          v-if="isLogin"
          title="退出登录"
          @click="goLogout"
          :icon="IconMineExist"
        ></ListItemV2>
      </List>
    </ContentScrollView>
  </PageLayoutWithBg>
</template>
 
<script setup lang="ts">
import { TransparentNavigationBar, List, ListItemV2 } from '@/components';
import { useUser, useIsLogin, useGoLogin, useAccessLogin, useOnlineService } from '@/hooks';
import Taro from '@tarojs/taro';
import { RouterPath, OssAssets } from '@/constants';
import DefaultAvatar from '@/assets/components/icon-default-avatar.png';
import IconMineOrder from '@/assets/mine/icon-mine-order.png';
import IconMineUserId from '@/assets/mine/icon-mine-userId.png';
import IconMineDataBoard from '@/assets/mine/icon-mine-data-board.png';
import IconMinePromotion from '@/assets/mine/icon-mine-promotion.png';
import IconMineCustomerService from '@/assets/mine/icon-mine-customer-service.png';
import IconMineExist from '@/assets/mine/icon-mine-exist.png';
import { useSystemStore } from '@/stores/modules/system';
import { useUserStore } from '@/stores/modules/user';
import { Message } from '@/utils';
import { isWeb, isInAlipay } from '@/utils/env';
import { useLifeRechargeContext } from '@life-payment/core-vue';
import { hiddenPhoneNumber } from '@life-payment/utils';
 
const { userDetail, virtualPhoneNumber, isChannelAccount } = useUser();
 
const isLogin = useIsLogin();
const systemStore = useSystemStore();
const userStore = useUserStore();
const { blLifeRecharge } = useLifeRechargeContext();
 
const { goLoginFn } = useGoLogin();
const bgHeight = computed(() => 133 + systemStore.navHeight);
 
function goLogin() {
  if (!isLogin.value) {
    goLoginFn();
  }
}
 
function goPage(routeName: string) {
  RouteHelper.navigateTo({
    url: routeName,
  });
}
 
// Taro.showShareMenu({
//   showShareItems: ['shareAppMessage'],
// });
// Taro.useShareAppMessage((res) => {
//   return {
//     title: `${userDetail.value?.contacter}名片`,
//     // path: `${RouterPath.userHomePage}?userId=${userDetail.value?.userId}`,
//     imageUrl: userDetail.value?.avatarUrl,
//   };
// });
 
const goOrderManage = useAccessLogin(() => goPage(RouterPath.order));
const goUserAccountList = useAccessLogin(() => goPage(RouterPath.userAccountList));
const goShareQrcode = useAccessLogin(() => goPage(RouterPath.shareQrcode));
const goDashboard = useAccessLogin(() => goPage(RouterPath.dashboard));
 
async function goLogout() {
  try {
    await Message.confirm({
      message: '确定要退出登录吗?',
    });
    userStore.logout();
    blLifeRecharge.loginout();
  } catch (error) {}
}
 
const { onlineServiceLink } = useOnlineService();
 
function handleChat() {
  if (isWeb && onlineServiceLink.value) {
    if (isInAlipay) {
      Message.warning('请在微信中打开使用该功能');
    } else {
      window.open(onlineServiceLink.value, '_blank');
    }
  }
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
@import './index.scss';
</style>