user.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view class="container">
  3. <view class="user-info-box">
  4. <view class="detail flex" @click="navTo('/pages/set/userinfo')">
  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" @click="navTo('/pages/user/upgrade')"><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="tocall(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. saveUrl();
  80. interceptor();
  81. }
  82. },
  83. fail: e => {
  84. console.log(e);
  85. }
  86. });
  87. }
  88. },
  89. methods: {
  90. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  91. loadBaseData() {
  92. getUserInfo({})
  93. .then(({ data }) => {
  94. console.log(data,'UserInfo+++++++++++++++++')
  95. this.setUserInfo(data);
  96. })
  97. .catch(e => {
  98. console.log(e);
  99. });
  100. },
  101. navTo(url) {
  102. if (!this.hasLogin) {
  103. // 保存地址
  104. saveUrl();
  105. // 登录拦截
  106. interceptor();
  107. } else {
  108. uni.navigateTo({
  109. url
  110. });
  111. }
  112. },
  113. open() {
  114. console.log('点击出现弹窗');
  115. this.$refs.popup.open();
  116. },
  117. // 客服弹窗 - 取消
  118. cancel() {
  119. this.$refs.popup.close();
  120. },
  121. tocall(num) {
  122. console.log(num);
  123. uni.makePhoneCall({
  124. phoneNumber: num //仅为示例
  125. });
  126. },
  127. }
  128. };
  129. </script>
  130. <style lang="scss">
  131. page,
  132. .container {
  133. background: #000;
  134. height: 100%;
  135. }
  136. .user-info-box {
  137. padding: 40rpx 46rpx 0;
  138. height: 180rpx;
  139. color: white;
  140. display: flex;
  141. align-items: center;
  142. justify-content: space-between;
  143. position: relative;
  144. z-index: 1;
  145. .detail {
  146. height: 130rpx;
  147. .portrait-box {
  148. height: 100%;
  149. .portrait {
  150. width: 130rpx;
  151. height: 100%;
  152. border: 5rpx solid #fff;
  153. border-radius: 50%;
  154. }
  155. }
  156. .info-box {
  157. margin-left: 20rpx;
  158. line-height: 1.5;
  159. .username {
  160. font-size: $font-lg + 6rpx;
  161. height: 100%;
  162. }
  163. }
  164. }
  165. .config {
  166. font-size: 48rpx;
  167. }
  168. }
  169. .vip-box {
  170. width: 690rpx;
  171. height: 200rpx;
  172. margin: 60rpx auto 0;
  173. image {
  174. width: 100%;
  175. height: 100%;
  176. }
  177. }
  178. .tt {
  179. margin: 0 auto;
  180. width: 750rpx;
  181. padding: 40rpx 70rpx;
  182. background-color: #000;
  183. .tt-box {
  184. padding: 20rpx;
  185. height: 100rpx;
  186. display: flex;
  187. align-items: center;
  188. border-bottom: 1px solid #838383;
  189. .tt-icon1 {
  190. width: 42rpx;
  191. height: 37rpx;
  192. }
  193. .tt-icon2 {
  194. width: 49rpx;
  195. height: 38rpx;
  196. }
  197. .tt-icon3 {
  198. width: 46rpx;
  199. height: 40rpx;
  200. }
  201. .tt-icon4 {
  202. width: 40rpx;
  203. height: 42rpx;
  204. }
  205. .tt-icon5 {
  206. width: 44rpx;
  207. height: 40rpx;
  208. }
  209. .tt-txt {
  210. font-size: 28rpx;
  211. font-family: PingFang SC;
  212. font-weight: 500;
  213. color: #ffffff;
  214. margin-left: 36rpx;
  215. color: #ffffff;
  216. flex: 1;
  217. }
  218. .next-icon {
  219. width: 16rpx;
  220. height: 25rpx;
  221. }
  222. }
  223. .border-b {
  224. border-bottom: 1px solid #f0f0f0;
  225. }
  226. }
  227. .popup-box {
  228. width: 522rpx;
  229. height: 605rpx;
  230. background-color: #ffffff;
  231. border-radius: 20rpx;
  232. position: relative;
  233. .img {
  234. position: relative;
  235. top: -56rpx;
  236. left: 0;
  237. width: 522rpx;
  238. height: 132rpx;
  239. display: flex;
  240. justify-content: center;
  241. image {
  242. border-radius: 20rpx 20rpx 0 0;
  243. width: 450rpx;
  244. height: 132rpx;
  245. }
  246. }
  247. .mian {
  248. margin-top: -44rpx;
  249. display: flex;
  250. flex-direction: column;
  251. align-items: center;
  252. // padding: 32rpx 32rpx;
  253. background-color: #ffffff;
  254. border-radius: 0 0 20rpx 20rpx;
  255. text-align: center;
  256. .delivery {
  257. font-size: 40rpx;
  258. color: #333333;
  259. display: flex;
  260. align-items: center;
  261. flex-direction: column;
  262. .title {
  263. }
  264. image {
  265. margin-top: 48rpx;
  266. width: 172rpx;
  267. height: 160rpx;
  268. }
  269. }
  270. .nocancel {
  271. font-size: 32rpx;
  272. color: #333333;
  273. margin-top: 14rpx;
  274. }
  275. .comfirm-box {
  276. margin-top: 52rpx;
  277. display: flex;
  278. // margin-bottom: 32rpx;
  279. // justify-content: space-around;
  280. .cancel {
  281. display: flex;
  282. align-items: center;
  283. justify-content: center;
  284. width: 197rpx;
  285. height: 74rpx;
  286. border: 1px solid #dcc786;
  287. border-radius: 38rpx;
  288. font-size: 32rpx;
  289. color: #605128;
  290. }
  291. .comfirm {
  292. margin-left: 32rpx;
  293. display: flex;
  294. align-items: center;
  295. justify-content: center;
  296. width: 197rpx;
  297. height: 74rpx;
  298. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  299. border-radius: 38px;
  300. font-size: 32rpx;
  301. color: #605128;
  302. }
  303. }
  304. }
  305. }
  306. </style>