user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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 || $t('hea.yk') }}</view>
  8. <view class="font-size-sm">{{ userInfo.mobile || '' }}</view>
  9. </view>
  10. <view class="vip">
  11. <image v-if="isVip == 0" src="../../static/img/cjyg.png" mode=""></image>
  12. <image v-if="isVip == 1" src="../../static/img/v1.png" mode=""></image>
  13. <image v-if="isVip == 2" src="../../static/img/uservip.png" mode=""></image>
  14. </view>
  15. </view>
  16. <view class="config iconfont"><text class="setting iconsetting" @click="navTo('/pages/set/userinfo')"></text></view>
  17. </view>
  18. <!-- <view class="vip-box" @click="navTo('/pages/user/upgrade')"><image src="../../static/img/vip.png" mode=""></image></view> -->
  19. <view class="tt">
  20. <view class="tt-box" @click="navTo('/pages/user/promotion')">
  21. <image src="../../static/img/tuiguang.png" class="tt-icon1" mode=""></image>
  22. <view class="tt-txt">{{ $t('hea.wdtg') }}</view>
  23. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  24. </view>
  25. <view class="tt-box" @click="navTo('/pages/user/team')">
  26. <image src="../../static/img/team.png" class="tt-icon1" mode=""></image>
  27. <view class="tt-txt">{{ $t('hea.wdtd') }}</view>
  28. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  29. </view>
  30. <view class="tt-box" @click="navTo('/pages/profit/profit')">
  31. <image src="../../static/img/money.png" class="tt-icon5" mode=""></image>
  32. <view class="tt-txt">{{ $t('hea.syzx') }}</view>
  33. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  34. </view>
  35. <view class="tt-box" @click="navTo('/pages/user/shareQrCode')">
  36. <image src="../../static/img/share.png" class="tt-icon1" mode=""></image>
  37. <view class="tt-txt">{{ $t('hea.fxhy') }}</view>
  38. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  39. </view>
  40. <view class="tt-box" @click="open()">
  41. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  42. <view class="tt-txt">{{ $t('hea.lxkf') }}</view>
  43. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  44. </view>
  45. </view>
  46. <uni-popup ref="popup" type="center">
  47. <view class="popup-box">
  48. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  49. <view class="mian">
  50. <view class="delivery">
  51. <view class="title">{{ $t('foo.yjwndzzskf') }}</view>
  52. <image src="../../static/img/img010.png" mode=""></image>
  53. </view>
  54. <view class="nocancel">{{ $t('foo.kfwx') }}1: {{ text }}</view>
  55. <view class="nocancel">{{ $t('foo.kfwx') }}2: {{ text1 }}</view>
  56. <view class="nocancel">{{ $t('foo.kfwx') }}3: {{ text2 }}</view>
  57. <view class="comfirm-box">
  58. <view class="cancel" @click="tocall('1')">{{ $t('foo.fzwx') }}1</view>
  59. <view class="comfirm" @click="tocall('2')">{{ $t('foo.fzwx') }}2</view>
  60. </view>
  61. <view class="comfirm-box">
  62. <view class="comfirm" @click="tocall('3')">{{ $t('foo.fzwx') }}3</view>
  63. <view class="cancel" @click="cancel">{{ $t('foo.qx') }}</view>
  64. </view>
  65. </view>
  66. </view>
  67. </uni-popup>
  68. <u-tabbar :list="tabbar" bg-color="#000" active-color="#FAD6B0" inactive-color="#71614f" change="change"></u-tabbar>
  69. </view>
  70. </template>
  71. <script>
  72. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  73. import uniCopy from '@/utils/uni-copy.js';
  74. import { tabbar } from '@/components/tabbar/tabbar.js';
  75. import { mapState, mapMutations } from 'vuex';
  76. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  77. import { getApplyList } from '../../api/apply.js';
  78. import { getUserInfo } from '@/api/user.js';
  79. export default {
  80. data() {
  81. return {
  82. text: 'BYTCKF21',
  83. text1: 'BYTCKF33',
  84. text2: 'BYTCKF67',
  85. isVip: -1,
  86. tabbar: [
  87. {
  88. iconPath: '../../static/tabBar/home.png',
  89. selectedIconPath: '../../static/tabBar/home-action.png',
  90. text: this.$t('hea.sy'),
  91. pagePath: '/pages/index/index'
  92. },
  93. {
  94. iconPath: '../../static/tabBar/center.png',
  95. selectedIconPath: '../../static/tabBar/center-action.png',
  96. text: this.$t('hea.shlb'),
  97. count: 0,
  98. pagePath: '/pages/user/applyList'
  99. },
  100. {
  101. iconPath: '../../static/tabBar/user.png',
  102. selectedIconPath: '../../static/tabBar/user-action.png',
  103. text: this.$t('hea.wd'),
  104. pagePath: '/pages/user/user'
  105. }
  106. ]
  107. };
  108. },
  109. components: {
  110. uniPopup
  111. },
  112. watch: {
  113. lang(val) {
  114. console.log(val);
  115. this.$set(this.tabbar[0], 'text', this.$t('hea.sy'));
  116. this.$set(this.tabbar[1], 'text', this.$t('hea.shlb'));
  117. this.$set(this.tabbar[2], 'text', this.$t('hea.wd'));
  118. }
  119. },
  120. computed: {
  121. ...mapState(['lang']),
  122. ...mapState('user', ['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
  123. },
  124. onShow() {
  125. uni.setNavigationBarTitle({
  126. title: this.$t('foo.wd')
  127. });
  128. //判断是否已经登录
  129. if (this.hasLogin) {
  130. this.loadBaseData();
  131. } else {
  132. let obj = this;
  133. uni.showModal({
  134. title: obj.$t('hea.login'),
  135. content: obj.$t('hea.logininfo'),
  136. success: e => {
  137. if (e.confirm) {
  138. saveUrl();
  139. interceptor();
  140. }
  141. },
  142. fail: e => {
  143. console.log(e);
  144. }
  145. });
  146. }
  147. },
  148. methods: {
  149. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  150. loadBaseData() {
  151. getUserInfo({})
  152. .then(({ data }) => {
  153. console.log(data, 'UserInfo+++++++++++++++++');
  154. this.isVip = -1;
  155. if (data.activity[0].my_join) {
  156. console.log(333)
  157. if (data.activity[0].my_join.status == '1'){
  158. this.isVip = 0;
  159. }else {
  160. console.log(data.activity[0].my_join.status,'123')
  161. this.isVip = -1
  162. }
  163. }
  164. if (data.activity[1].my_join) {
  165. console.log(222)
  166. if (data.activity[1].my_join.status == '2') {
  167. console.log(111)
  168. this.isVip = 2;
  169. }else if (data.activity[1].my_join.status == '1'){
  170. this.isVip = 1;
  171. }else {
  172. console.log(data.activity[0].my_join.status)
  173. }
  174. }
  175. this.setUserInfo(data);
  176. })
  177. .catch(e => {
  178. console.log(e);
  179. });
  180. getApplyList({
  181. page: 1,
  182. limit: 1,
  183. status: 0
  184. }).then(({ data }) => {
  185. console.log(data,'1111')
  186. this.tabbar[1].count = data.count
  187. });
  188. },
  189. navTo(url) {
  190. console.log(url);
  191. if (!this.hasLogin) {
  192. // 保存地址
  193. saveUrl();
  194. // 登录拦截
  195. interceptor();
  196. } else {
  197. uni.navigateTo({
  198. url
  199. });
  200. }
  201. },
  202. open() {
  203. console.log('点击出现弹窗');
  204. this.$refs.popup.open();
  205. },
  206. // 客服弹窗 - 取消
  207. cancel() {
  208. this.$refs.popup.close();
  209. },
  210. tocall(type) {
  211. // #ifdef APP-PLUS
  212. console.log(type)
  213. let text ='';
  214. if(type == '1'){
  215. text = this.text
  216. }
  217. if(type == '2'){
  218. text = this.text1
  219. }
  220. if(type == '3'){
  221. text = this.text2
  222. }
  223. uni.setClipboardData({
  224. data: text,
  225. success: e => {
  226. uni.showToast({
  227. title: '复制成功!'
  228. });
  229. },
  230. fail(e) {
  231. uni.showToast({
  232. title: '复制失败',
  233. icon: false
  234. });
  235. console.log(e);
  236. }
  237. });
  238. // #endif
  239. }
  240. }
  241. };
  242. </script>
  243. <style lang="scss">
  244. page,
  245. .container {
  246. background: #000;
  247. height: 100%;
  248. }
  249. .user-info-box {
  250. padding: 40rpx 46rpx 0;
  251. height: 180rpx;
  252. color: white;
  253. display: flex;
  254. align-items: center;
  255. justify-content: space-between;
  256. position: relative;
  257. z-index: 1;
  258. .detail {
  259. height: 130rpx;
  260. .portrait-box {
  261. height: 100%;
  262. .portrait {
  263. width: 130rpx;
  264. height: 100%;
  265. border: 5rpx solid #fff;
  266. border-radius: 50%;
  267. }
  268. }
  269. .info-box {
  270. margin-left: 20rpx;
  271. line-height: 1.5;
  272. .username {
  273. font-size: $font-lg + 6rpx;
  274. height: 100%;
  275. }
  276. }
  277. .vip {
  278. margin-left: 20rpx;
  279. width: 122rpx;
  280. height: 36rpx;
  281. image {
  282. width: 100%;
  283. height: 100%;
  284. }
  285. }
  286. }
  287. .config {
  288. font-size: 48rpx;
  289. }
  290. }
  291. .vip-box {
  292. width: 690rpx;
  293. height: 200rpx;
  294. margin: 60rpx auto 0;
  295. image {
  296. width: 100%;
  297. height: 100%;
  298. }
  299. }
  300. .tt {
  301. margin: 0 auto;
  302. width: 750rpx;
  303. padding: 40rpx 70rpx;
  304. background-color: #000;
  305. .tt-box {
  306. padding: 20rpx;
  307. height: 100rpx;
  308. display: flex;
  309. align-items: center;
  310. border-bottom: 1px solid #838383;
  311. .tt-icon1 {
  312. width: 42rpx;
  313. height: 37rpx;
  314. }
  315. .tt-icon2 {
  316. width: 49rpx;
  317. height: 38rpx;
  318. }
  319. .tt-icon3 {
  320. width: 46rpx;
  321. height: 40rpx;
  322. }
  323. .tt-icon4 {
  324. width: 40rpx;
  325. height: 42rpx;
  326. }
  327. .tt-icon5 {
  328. width: 44rpx;
  329. height: 44rpx;
  330. }
  331. .tt-txt {
  332. font-size: 28rpx;
  333. font-family: PingFang SC;
  334. font-weight: 500;
  335. color: #ffffff;
  336. margin-left: 36rpx;
  337. color: #ffffff;
  338. flex: 1;
  339. }
  340. .next-icon {
  341. width: 16rpx;
  342. height: 25rpx;
  343. }
  344. }
  345. .border-b {
  346. border-bottom: 1px solid #f0f0f0;
  347. }
  348. }
  349. .popup-box {
  350. width: 522rpx;
  351. padding-bottom: 40rpx;
  352. background-color: #ffffff;
  353. border-radius: 20rpx;
  354. position: relative;
  355. .img {
  356. position: relative;
  357. top: -56rpx;
  358. left: 0;
  359. width: 522rpx;
  360. height: 132rpx;
  361. display: flex;
  362. justify-content: center;
  363. image {
  364. border-radius: 20rpx 20rpx 0 0;
  365. width: 450rpx;
  366. height: 132rpx;
  367. }
  368. }
  369. .mian {
  370. margin-top: -44rpx;
  371. display: flex;
  372. flex-direction: column;
  373. align-items: center;
  374. // padding: 32rpx 32rpx;
  375. background-color: #ffffff;
  376. border-radius: 0 0 20rpx 20rpx;
  377. text-align: center;
  378. .delivery {
  379. font-size: 40rpx;
  380. color: #333333;
  381. display: flex;
  382. align-items: center;
  383. flex-direction: column;
  384. .title {
  385. }
  386. image {
  387. margin-top: 48rpx;
  388. width: 172rpx;
  389. height: 160rpx;
  390. }
  391. }
  392. .nocancel {
  393. font-size: 32rpx;
  394. color: #333333;
  395. margin-top: 14rpx;
  396. }
  397. .comfirm-box {
  398. margin-top: 52rpx;
  399. display: flex;
  400. // margin-bottom: 32rpx;
  401. // justify-content: space-around;
  402. .cancel {
  403. margin-left: 32rpx;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. width: 197rpx;
  408. height: 74rpx;
  409. border: 1px solid #dcc786;
  410. border-radius: 38rpx;
  411. font-size: 32rpx;
  412. color: #605128;
  413. }
  414. .comfirm {
  415. margin-left: 32rpx;
  416. display: flex;
  417. align-items: center;
  418. justify-content: center;
  419. width: 197rpx;
  420. height: 74rpx;
  421. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  422. border-radius: 38px;
  423. font-size: 32rpx;
  424. color: #605128;
  425. }
  426. }
  427. }
  428. }
  429. </style>