user.vue 12 KB

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