user.vue 7.8 KB

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