mine1.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="mine_ybt bg_color_primary">
  3. <view class="mine_ybt_top pad30">
  4. <headerInfo title="个人中心"></headerInfo>
  5. <view class="flex-center-between color_fff mg20">
  6. <u-avatar @click="toUser"
  7. size="100rpx"
  8. shape="circle"
  9. :src="appStore?.userInfo?.avatar"
  10. mode="aspectFill"
  11. ></u-avatar>
  12. <view class="flex_1 flex-center-between ml20">
  13. <view class="">
  14. <view class="font_size35">
  15. <text v-if="appStore.userInfo?.userPhone" class="mr20" @click="toUser">{{appStore.userInfo?.nickName}}</text>
  16. <!-- <text v-else @click="toLogin()">请点击登录</text> -->
  17. <button v-else
  18. class="login-btn"
  19. open-type="getPhoneNumber"
  20. @getphonenumber="getPhoneNumberFn"
  21. >
  22. 请点击登录
  23. </button>
  24. <text v-if="appStore.userInfo?.memberStatus==1" class="memberPlanName">{{appStore.userInfo?.memberPlanName}}</text>
  25. </view>
  26. <view class="font_size25 mt20" v-if="appStore.userInfo?.memberExpire">
  27. <!-- <text>{{appStore.userInfo?.memberPlanName}}</text> -->
  28. <text class="vipTime">到期时间:{{appStore.userInfo?.memberExpire}}</text>
  29. </view>
  30. </view>
  31. <view class="order_btn flex-center share_btn" @click="toUser">
  32. <view class="flex-center border_radius_20">
  33. <text>编辑资料</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="border_radius_20 padding20 vipCar flex-center-between">
  39. <view class="flex_1 flex-center-flex-start mr20">
  40. <image src="/static/img/mine/vipcard.png" mode="" class="vipcard-img mr10"></image>
  41. <text style="color: rgb(246, 223, 185);">开通会员解锁更多权益</text>
  42. </view>
  43. <view class="order_btns jiesuo border_radius_20 font_size25" @click="toVip">
  44. {{appStore.userInfo?.memberStatus==1?'查看权益' : '立即解锁'}}
  45. </view>
  46. </view>
  47. </view>
  48. <view class="mine_content padding30 mt20">
  49. <!-- 我的订单 -->
  50. <view class="font_size25 padding20 border_radius_20 bg_color_fff mb20">
  51. <view class="flex-center-between paddingTB20 border-bottom menuList"
  52. @click="toPage(item)"
  53. v-for="(item, index) in menuList" :key="index">
  54. <view class="flex-center-flex-start mr20 flex_1">
  55. <image :src="item.img" mode="" class="order-img mr20"></image>
  56. <text>{{item.name}}</text>
  57. </view>
  58. <image src="/static/img/arrow-right.png" mode="widthFix" class="menu_img"></image>
  59. </view>
  60. <view class="flex-center-between paddingTB20 border-bottom menuList" @click="makePhoneCall">
  61. <view class="flex-center-flex-start mr20 flex_1">
  62. <image src="/static/img/mine/kefu.png" mode="" class="order-img mr20"></image>
  63. <text>服务热线</text>
  64. </view>
  65. <image src="/static/img/arrow-right.png" mode="widthFix" class="menu_img"></image>
  66. </view>
  67. <view class="flex-center-between paddingTB20 border-bottom menuList" v-if="appStore.userInfo?.userPhone"
  68. @click="userLogoutFn(item)">
  69. <view class="flex-center-flex-start mr20 flex_1">
  70. <image src="/static/img/mine/Logout.png" mode="" class="order-img mr20"></image>
  71. <text>退出登录</text>
  72. </view>
  73. <image src="/static/img/arrow-right.png" mode="widthFix" class="menu_img"></image>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script setup>
  80. import { ref } from "vue";
  81. import { userLogout } from "@/api/user.js";
  82. import { getAdServicePhone } from "@/api/home.js";
  83. import headerInfo from "@/components/headerInfo.vue";
  84. import { telEncrypt,checkLoginShowModal, getPhoneNumber } from "@/utils/util.js";
  85. import { onLoad, onShareAppMessage} from '@dcloudio/uni-app'
  86. import { useAppStore } from "@/stores/app";
  87. const appStore = useAppStore();
  88. onShareAppMessage((res) => {
  89. return appStore.onShareAppMessageObj
  90. })
  91. const menuList = ref([
  92. {
  93. name: '我的钱包',
  94. img: "/static/img/mine/money.png",
  95. url: '/pages/recharge/wallet'
  96. },
  97. {
  98. name: '去充值',
  99. img: "/static/img/mine/vip.png",
  100. url: '/pages/recharge/recharge'
  101. },
  102. // {
  103. // name: '会员充值记录',
  104. // img: "/static/img/mine/chongzhijulu.png",
  105. // url: ''
  106. // },
  107. {
  108. name: '我的订单',
  109. img: "/static/img/mine/order.png",
  110. url: '/pages/order/order_list'
  111. }
  112. ]);
  113. onLoad(() => {
  114. getAdServicePhoneFn();
  115. });
  116. async function toUser(){
  117. if(!await checkLoginShowModal())return;
  118. uni.navigateTo({
  119. url: '/pages/user/user'
  120. });
  121. }
  122. async function toVip(){
  123. if(!await checkLoginShowModal())return;
  124. uni.navigateTo({
  125. url: '/pages/recharge/vip'
  126. });
  127. }
  128. async function toPage(item){
  129. if(!await checkLoginShowModal())return;
  130. if(!item.url) return;
  131. uni.navigateTo({
  132. url: item.url
  133. });
  134. }
  135. function getPhoneNumberFn(e){
  136. getPhoneNumber(e)
  137. };
  138. // 退出登录
  139. function userLogoutFn(){
  140. //确认退出登录吗
  141. uni.showModal({
  142. title: '提示',
  143. content: '确认要退出登录吗?',
  144. success: function (res) {
  145. if (res.confirm) {
  146. userLogout({}).then(res=>{
  147. appStore.LOGOUT();
  148. })
  149. }
  150. }
  151. })
  152. }
  153. // 获取客服电话
  154. const phoneNumber = ref('');
  155. function getAdServicePhoneFn() {
  156. getAdServicePhone({}).then(res => {
  157. phoneNumber.value = res.data?.servicePhone || '';
  158. }).catch(err => {
  159. console.log(err);
  160. });
  161. }
  162. // 拨打电话方法
  163. const makePhoneCall = () => {
  164. if(!phoneNumber.value){
  165. Toast({title:'请先配置客服电话'})
  166. return;
  167. }
  168. uni.makePhoneCall({
  169. phoneNumber:phoneNumber.value,
  170. success: () => {
  171. console.log('成功唤起拨号界面');
  172. },
  173. fail: (err) => {
  174. console.error('唤起拨号界面失败', err);
  175. }
  176. });
  177. };
  178. </script>
  179. <style lang="less" scoped>
  180. .mine_ybt{
  181. height: 100vh;
  182. .vipCar{
  183. margin-top: 30rpx;
  184. background: linear-gradient(97.4139deg, rgb(137, 153, 191) 4.58393%, rgb(89, 88, 103) 97.8314%);
  185. .jiesuo{
  186. background: linear-gradient(94.5323deg, rgb(251, 239, 216) 10.1217%, rgb(241, 210, 164) 94.0504%);
  187. }
  188. .vipcard-img{
  189. width: 80rpx;
  190. height: 80rpx;
  191. }
  192. }
  193. // background-size: 100% 100%;
  194. .order_btns{
  195. padding: 8rpx 20rpx;
  196. display: inline-block;
  197. &.active{
  198. background: #fc4f1d;
  199. }
  200. }
  201. .share_btn{
  202. border:1px solid #ffffff;
  203. padding: 10rpx 20rpx;
  204. background: transparent;
  205. .share_img{
  206. width: 30rpx;
  207. }
  208. }
  209. .mine_content{
  210. border-radius: 30rpx 30rpx 0 0;
  211. background: #f5f5f5;
  212. min-height: calc(100vh - 200rpx);
  213. }
  214. .order-img{
  215. width: 40rpx;
  216. height: 40rpx;
  217. }
  218. .menu_img{
  219. width: 50rpx;
  220. height: 50rpx;
  221. }
  222. .menuList{
  223. &:last-child{
  224. border-bottom: none;
  225. }
  226. }
  227. .vipTime{
  228. opacity: .7;
  229. }
  230. /* 登录按钮 */
  231. .login-btn {
  232. background-color: transparent;
  233. color: #fff;
  234. font-size: 35rpx;
  235. font-weight: bold;
  236. text-align: left;
  237. }
  238. .memberPlanName{
  239. background: linear-gradient(90deg, #FDE492 0%, #FDB85D 100%);
  240. color: #874605 ;
  241. padding: 5rpx 10rpx;
  242. border-radius: 20rpx;
  243. font-size: 24rpx;
  244. }
  245. }
  246. </style>