user.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view>
  3. <view class="user-header" v-if="userInfo">
  4. <view class="avatar-btn">
  5. <image :src="userInfo?userInfo.avatar:'https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png'"></image>
  6. </view>
  7. <view class="user-info">
  8. <view class="name">{{userInfo.nickname}}</view>
  9. <!-- <view class="desc">180*******22</view> -->
  10. </view>
  11. </view>
  12. <view class="user-header" v-else>
  13. <view class="avatar-btn">
  14. <image src="https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png"></image>
  15. </view>
  16. <view class="user-info">
  17. <view class="name" @click="toLogin">请先登录</view>
  18. </view>
  19. </view>
  20. <view class="user-menu">
  21. <view class="menu-item">
  22. <view class="icon"><image src="/static/image/yuyue.png"></image></view>
  23. <view class="name">我的预约</view>
  24. <view class="right"><image src="/static/image/right.png"></image></view>
  25. </view>
  26. <view class="menu-item">
  27. <view class="icon"><image src="/static/image/info.png"></image></view>
  28. <view class="name">个人信息</view>
  29. <view class="right"><image src="/static/image/right.png"></image></view>
  30. </view>
  31. <view class="menu-item" @click="showService(1)">
  32. <view class="icon"><image src="/static/image/service.png"></image></view>
  33. <view class="name">商家客服</view>
  34. <view class="right"><image src="/static/image/right.png"></image></view>
  35. </view>
  36. <navigator hover-class="none" class="menu-item" url="/pages/user/license">
  37. <view class="icon"><image src="/static/image/zizhi.png"></image></view>
  38. <view class="name">服务资质</view>
  39. <view class="right"><image src="/static/image/right.png"></image></view>
  40. </navigator>
  41. <view class="menu-item" @click="outLogin">
  42. <view class="icon"><image src="/static/image/out.png"></image></view>
  43. <view class="name">退出</view>
  44. <view class="right"><image src="/static/image/right.png"></image></view>
  45. </view>
  46. </view>
  47. <uni-popup ref="maskpopup" type="bottom" border-radius="10px 10px 0 0" background-color="#ffffff" :mask-click="false">
  48. <view class="service-popup">
  49. <view class="top">
  50. <view class="item">客服时间:{{storeData.start_at}}-{{storeData.end_at}}</view>
  51. <view class="item">
  52. <button class="btn" @click="$dialog.jumpUri('/pages/service/chat/chat?poi='+storeData.poi_id+'&source=user',1);showService(2)">在线咨询商家</button>
  53. </view>
  54. <view class="item" v-if="storeData.service_mobile" @click="callMobile(storeData.service_mobile)">商家客服电话</view>
  55. </view>
  56. <view class="foot" @click="showService(2)">取消</view>
  57. </view>
  58. </uni-popup>
  59. </view>
  60. </template>
  61. <script>
  62. var app;
  63. import * as Api from "@/static/api/user.js";
  64. export default {
  65. data() {
  66. return {
  67. userInfo:null,
  68. storeData:{}
  69. }
  70. },
  71. onShow() {
  72. this.getUser()
  73. },
  74. onLoad() {
  75. app = this;
  76. app.storeData = uni.getStorageSync("contact");
  77. },
  78. methods: {
  79. getUser(){
  80. Api.data().then((res)=>{
  81. if (res.code == 0) {
  82. return ;
  83. }
  84. app.userInfo = res.data;
  85. })
  86. },
  87. outLogin(order){
  88. app.$dialog.showError("确定要退出登录吗",function(res){
  89. if (res.confirm) {
  90. app.userInfo = null;
  91. uni.clearStorageSync();
  92. }
  93. })
  94. },
  95. toLogin(){
  96. uni.navigateTo({
  97. url:"/pages/auth/login",
  98. animationType:"slide-in-bottom"
  99. })
  100. },
  101. callMobile(mobile){
  102. uni.makePhoneCall({
  103. phoneNumber:mobile,
  104. success(res) {
  105. console.log(res)
  106. },fail(res) {
  107. console.log(res)
  108. }
  109. })
  110. },
  111. showService(type){
  112. if (type == 1) {
  113. uni.hideTabBar()
  114. app.$refs.maskpopup.open()
  115. } else {
  116. this.$nextTick(() => {
  117. uni.showTabBar()
  118. })
  119. app.$refs.maskpopup.close()
  120. }
  121. }
  122. }
  123. }
  124. </script>
  125. <style>
  126. page{background-color: #f8f8f8;}
  127. .user-header{background-color: #005bac;padding: 40upx;display: flex;align-items: center;background: linear-gradient(to right, #094d89, #007aff);width: calc(95% - 80upx);margin: 40upx auto;border-radius: 10upx;}
  128. .user-header image{width: 100upx;height: 100upx;border-radius: 100upx;}
  129. .user-header .user-info{margin-left: 20upx;}
  130. .user-header .name{font-size: 32upx;color: #fff;}
  131. .user-header .desc{font-size: 24upx;color: #f8f8f8;margin-top: 20upx;}
  132. .user-menu{width: 95%;margin: 40upx auto;border-radius: 10upx;background-color: #fff;}
  133. .user-menu .menu-item{height: 100upx;line-height: 100upx;display: flex;align-items: center;font-size: 28upx;color: #333;padding: 0 20upx;border-bottom: 2upx solid #f8f8f8;}
  134. .user-menu .menu-item .icon{margin-right: 20upx;display: flex;align-items: center;justify-content: center;}
  135. .user-menu .menu-item .right{margin-right: 0;margin-left: auto;}
  136. .user-menu .menu-item .icon image{width: 40upx;height: 40upx;}
  137. .user-menu .menu-item .right image{width: 40upx;height: 40upx;}
  138. .service-popup .item{height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;border-bottom: 2upx solid #f8f8f8;}
  139. .service-popup .item .btn{background-color: #fff;border: 0;height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;}
  140. .service-popup .item .btn::after{border: 0;}
  141. .service-popup .foot{height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;border-top: 20upx solid #f8f8f8;}
  142. </style>