user.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="container">
  3. <view class="user-info-box">
  4. <view class="detail flex">
  5. <view class="portrait-box"><image class="portrait" :src=" userInfo.avatar || '../../static/error/missing-face.png'"></image></view>
  6. <view class="info-box">
  7. <view class="username">{{userInfo.nickname||"游客"}}</view>
  8. <view class="font-size-sm">{{userInfo.mobile || ''}}</view>
  9. </view>
  10. </view>
  11. <view class="config iconfont"><text class="setting iconsetting" @click="navTo('/pages/set/userinfo')"></text></view>
  12. </view>
  13. <view class="vip-box"><image src="../../static/img/vip.png" mode=""></image></view>
  14. <view class="tt">
  15. <view class="tt-box" @click="navTo('/pages/user/promotion')">
  16. <image src="../../static/img/tuiguang.png" class="tt-icon1" mode=""></image>
  17. <view class="tt-txt">我的推广</view>
  18. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  19. </view>
  20. <view class="tt-box" @click="navTo('/pages/user/team')">
  21. <image src="../../static/img/team.png" class="tt-icon1" mode=""></image>
  22. <view class="tt-txt">我的团队</view>
  23. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  24. </view>
  25. <view class="tt-box" @click="navTo('/pages/user/shareQrCode')">
  26. <image src="../../static/img/share.png" class="tt-icon1" mode=""></image>
  27. <view class="tt-txt">分享好友</view>
  28. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  29. </view>
  30. <view class="tt-box" @click="open()">
  31. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  32. <view class="tt-txt">联系客服</view>
  33. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  34. </view>
  35. </view>
  36. <uni-popup ref="popup" type="center">
  37. <view class="popup-box">
  38. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  39. <view class="mian">
  40. <view class="delivery">
  41. <view class="title">已经为您定制专属客服</view>
  42. <image src="../../static/img/img010.png" mode=""></image>
  43. </view>
  44. <view class="nocancel">客服电话: {{ text }}</view>
  45. <view class="comfirm-box">
  46. <view class="cancel" @click="cancel">取消</view>
  47. <view class="comfirm" @click="comfirm(text)">拨打电话</view>
  48. </view>
  49. </view>
  50. </view>
  51. </uni-popup>
  52. </view>
  53. </template>
  54. <script>
  55. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  56. import uniCopy from '@/utils/uni-copy.js';
  57. import { mapState, mapMutations } from 'vuex';
  58. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  59. import { getUserInfo } from '@/api/user.js';
  60. export default {
  61. data() {
  62. return {
  63. text:'123456789'
  64. };
  65. },
  66. computed:{
  67. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  68. },
  69. onShow() {
  70. //判断是否已经登录
  71. if (this.hasLogin) {
  72. this.loadBaseData();
  73. } else {
  74. uni.showModal({
  75. title: '登录',
  76. content: '您未登录,是否马上登陆?',
  77. success: e => {
  78. if (e.confirm) {
  79. interceptor();
  80. }
  81. },
  82. fail: e => {
  83. console.log(e);
  84. }
  85. });
  86. }
  87. },
  88. methods: {
  89. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  90. loadBaseData() {
  91. getUserInfo({})
  92. .then(({ data }) => {
  93. console.log(data,'UserInfo+++++++++++++++++')
  94. this.setUserInfo(data);
  95. })
  96. .catch(e => {
  97. console.log(e);
  98. });
  99. },
  100. navTo(url) {
  101. if (!this.hasLogin) {
  102. // 保存地址
  103. saveUrl();
  104. // 登录拦截
  105. interceptor();
  106. } else {
  107. uni.navigateTo({
  108. url
  109. });
  110. }
  111. },
  112. open() {
  113. console.log('点击出现弹窗');
  114. this.$refs.popup.open();
  115. },
  116. // 客服弹窗 - 取消
  117. cancel() {
  118. this.$refs.popup.close();
  119. }
  120. }
  121. };
  122. </script>
  123. <style lang="scss">
  124. page,
  125. .container {
  126. background: #000;
  127. height: 100%;
  128. }
  129. .user-info-box {
  130. padding: 40rpx 46rpx 0;
  131. height: 180rpx;
  132. color: white;
  133. display: flex;
  134. align-items: center;
  135. justify-content: space-between;
  136. position: relative;
  137. z-index: 1;
  138. .detail {
  139. height: 130rpx;
  140. .portrait-box {
  141. height: 100%;
  142. .portrait {
  143. width: 130rpx;
  144. height: 100%;
  145. border: 5rpx solid #fff;
  146. border-radius: 50%;
  147. }
  148. }
  149. .info-box {
  150. margin-left: 20rpx;
  151. line-height: 1.5;
  152. .username {
  153. font-size: $font-lg + 6rpx;
  154. height: 100%;
  155. }
  156. }
  157. }
  158. .config {
  159. font-size: 48rpx;
  160. }
  161. }
  162. .vip-box {
  163. width: 690rpx;
  164. height: 200rpx;
  165. margin: 60rpx auto 0;
  166. image {
  167. width: 100%;
  168. height: 100%;
  169. }
  170. }
  171. .tt {
  172. margin: 0 auto;
  173. width: 750rpx;
  174. padding: 40rpx 70rpx;
  175. background-color: #000;
  176. .tt-box {
  177. padding: 20rpx;
  178. height: 100rpx;
  179. display: flex;
  180. align-items: center;
  181. border-bottom: 1px solid #838383;
  182. .tt-icon1 {
  183. width: 42rpx;
  184. height: 37rpx;
  185. }
  186. .tt-icon2 {
  187. width: 49rpx;
  188. height: 38rpx;
  189. }
  190. .tt-icon3 {
  191. width: 46rpx;
  192. height: 40rpx;
  193. }
  194. .tt-icon4 {
  195. width: 40rpx;
  196. height: 42rpx;
  197. }
  198. .tt-icon5 {
  199. width: 44rpx;
  200. height: 40rpx;
  201. }
  202. .tt-txt {
  203. font-size: 28rpx;
  204. font-family: PingFang SC;
  205. font-weight: 500;
  206. color: #ffffff;
  207. margin-left: 36rpx;
  208. color: #ffffff;
  209. flex: 1;
  210. }
  211. .next-icon {
  212. width: 16rpx;
  213. height: 25rpx;
  214. }
  215. }
  216. .border-b {
  217. border-bottom: 1px solid #f0f0f0;
  218. }
  219. }
  220. .popup-box {
  221. width: 522rpx;
  222. height: 605rpx;
  223. background-color: #ffffff;
  224. border-radius: 20rpx;
  225. position: relative;
  226. .img {
  227. position: relative;
  228. top: -56rpx;
  229. left: 0;
  230. width: 522rpx;
  231. height: 132rpx;
  232. display: flex;
  233. justify-content: center;
  234. image {
  235. border-radius: 20rpx 20rpx 0 0;
  236. width: 450rpx;
  237. height: 132rpx;
  238. }
  239. }
  240. .mian {
  241. margin-top: -44rpx;
  242. display: flex;
  243. flex-direction: column;
  244. align-items: center;
  245. // padding: 32rpx 32rpx;
  246. background-color: #ffffff;
  247. border-radius: 0 0 20rpx 20rpx;
  248. text-align: center;
  249. .delivery {
  250. font-size: 40rpx;
  251. color: #333333;
  252. display: flex;
  253. align-items: center;
  254. flex-direction: column;
  255. .title {
  256. }
  257. image {
  258. margin-top: 48rpx;
  259. width: 172rpx;
  260. height: 160rpx;
  261. }
  262. }
  263. .nocancel {
  264. font-size: 32rpx;
  265. color: #333333;
  266. margin-top: 14rpx;
  267. }
  268. .comfirm-box {
  269. margin-top: 52rpx;
  270. display: flex;
  271. // margin-bottom: 32rpx;
  272. // justify-content: space-around;
  273. .cancel {
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. width: 197rpx;
  278. height: 74rpx;
  279. border: 1px solid #dcc786;
  280. border-radius: 38rpx;
  281. font-size: 32rpx;
  282. color: #605128;
  283. }
  284. .comfirm {
  285. margin-left: 32rpx;
  286. display: flex;
  287. align-items: center;
  288. justify-content: center;
  289. width: 197rpx;
  290. height: 74rpx;
  291. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  292. border-radius: 38px;
  293. font-size: 32rpx;
  294. color: #605128;
  295. }
  296. }
  297. }
  298. }
  299. </style>