user.vue 8.0 KB

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