user.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <view class="top-image"><image src="../../static/user/user-top.png" mode=""></image></view>
  5. <view class="user-set flex">
  6. <view class="set-logo" @click="navTo('/pages/set/userinfo')"><image src="../../static/user/user1.png" mode=""></image></view>
  7. <!-- <view class="xx-logo"><image src="../../static/user/user2.png" mode=""></image></view> -->
  8. </view>
  9. <view class="user-wrap">
  10. <view class="info-left flex">
  11. <view class="user-name">
  12. <image :src="userInfo.avatar" mode="" v-if="userInfo.avatar"></image>
  13. <image src="../../static/error/missing-face.png" mode="" v-else></image>
  14. <view class="gpai" v-if="userInfo.is_real">团队长</view>
  15. <view class="user-font">
  16. <view class="name clamp">{{ userInfo.nickname }}</view>
  17. <view class="phone">{{ userInfo.phone }}</view>
  18. <view class="phone" v-if="userInfo.uid">邀请码:{{ userInfo.uid }}</view>
  19. </view>
  20. </view>
  21. <view class="kpi">今日KPI:{{userInfo.kpi|| 0}}</view>
  22. </view>
  23. <view class="info-right" @click="navTo('/pages/user/myxfjf')">
  24. <image class="iright-icon" src="../../static/user/user3.png" mode=""></image>
  25. <view class="iright-font">消费积分:{{ userInfo.now_money || 0}}</view>
  26. </view>
  27. </view>
  28. <view class="main-box">
  29. <view class="title flex">
  30. <view class="title-left">
  31. <image class="title-icon" src="../../static/user/user4.png" mode=""></image>
  32. <view class="title-font">我的资产</view>
  33. </view>
  34. <image class="title-right" src="../../static/img/back.png" mode=""></image>
  35. </view>
  36. <view class="main flex">
  37. <view class="item" @click="navTo('/pages/user/mygwjf')">
  38. <view class="item-num">{{ userInfo.sp_final || 0}}</view>
  39. <view class="item-font">购物积分</view>
  40. </view>
  41. <view class="item" @click="navTo('/pages/user/mythq')">
  42. <view class="item-num">{{userInfo.top_ticket || 0}}</view>
  43. <view class="item-font">提货券</view>
  44. </view>
  45. <view class="item" @click="navTo('/pages/user/myggz')">
  46. <view class="item-num">{{userInfo.aid_val || 0}}</view>
  47. <view class="item-font">广告值</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="main-box">
  52. <view class="title flex" @click="navTo('/pages/order/order1?state=0')">
  53. <view class="title-left">
  54. <image class="title-icon" src="../../static/user/user5.png" mode=""></image>
  55. <view class="title-font">我的订单</view>
  56. </view>
  57. <image class="title-right" src="../../static/img/back.png" mode=""></image>
  58. </view>
  59. <view class="main flex">
  60. <view class="oitem" @click="navTo('/pages/order/order1?state=0')">
  61. <image class="oitem-image" src="../../static/user/user6.png" mode=""></image>
  62. <view class="oitem-font">待付款</view>
  63. </view>
  64. <view class="oitem" @click="navTo('/pages/order/order1?state=1')">
  65. <image class="oitem-image" src="../../static/user/user7.png" mode=""></image>
  66. <view class="oitem-font">待发货</view>
  67. </view>
  68. <view class="oitem" @click="navTo('/pages/order/order1?state=2')">
  69. <image class="oitem-image" src="../../static/user/user8.png" mode=""></image>
  70. <view class="oitem-font">待收货</view>
  71. </view>
  72. <view class="oitem" @click="navTo('/pages/order/order1?state=3')">
  73. <image class="oitem-image" src="../../static/user/user9.png" mode=""></image>
  74. <view class="oitem-font">已完成</view>
  75. </view>
  76. </view>
  77. </view>
  78. <uni-list class="tool-list">
  79. <uni-list-item title="邀请有礼" @click="navTo('/pages/user/shareQrCode')" thumb="/static/user/user10.png"></uni-list-item>
  80. <uni-list-item title="我的推广" @click="navTo('/pages/user/mytg')" thumb="/static/icon/mytg.png"></uni-list-item>
  81. <uni-list-item title="支付密码" @click="navTo('/pages/money/moneyPwd')" thumb="/static/icon/g9.png"></uni-list-item>
  82. <uni-list-item title="我的收藏" @click="navTo('/pages/user/favorites')" thumb="/static/user/user11.png"></uni-list-item>
  83. <uni-list-item title="收款方式" @click="navTo('/pages/collection/collection')" thumb="/static/user/user12.png"></uni-list-item>
  84. <uni-list-item title="客服中心" @click="openKf()" thumb="/static/user/user13.png"></uni-list-item>
  85. </uni-list>
  86. <uni-popup ref="popupkf" type="center">
  87. <view class="popup-box">
  88. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  89. <view class="mian">
  90. <view class="delivery">
  91. <view class="title">已经为您定制专属客服</view>
  92. <image src="../../static/img/img010.png" mode=""></image>
  93. </view>
  94. <view class="nocancel">客服VX:{{ text }}</view>
  95. <view class="comfirm-box">
  96. <view class="cancel" @click="cancel">取消</view>
  97. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  98. </view>
  99. </view>
  100. </view>
  101. </uni-popup>
  102. <uni-popup ref="popupqd" type="center">
  103. <view class="popup">
  104. <view class="popup-dox"><image class="popup-logo" src="../../static/img/sign-popup.png"></image></view>
  105. <view class="popup-title">
  106. 获得
  107. <text>{{ today_integral }}</text>
  108. {{ today_type }}
  109. </view>
  110. <view class="popup-tip">
  111. 明天签到可得
  112. <text>{{ tom_integral }}</text>
  113. {{ tom_type }}
  114. </view>
  115. <view class="popup-btn" @click="closeQd">知道了</view>
  116. </view>
  117. <!-- <view class="close_icon" @click="close">
  118. <image src="../../static/img/Close.png"></image>
  119. </view> -->
  120. </uni-popup>
  121. </view>
  122. </template>
  123. <script>
  124. import { tabbar1 } from '@/utils/tabbar.js';
  125. import { mapState, mapMutations } from 'vuex';
  126. import uniList from '@/components/uni-list/uni-list.vue';
  127. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  128. import { orderData, getUserInfo } from '@/api/user.js';
  129. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  130. let startY = 0,
  131. moveY = 0,
  132. pageAtTop = true;
  133. export default {
  134. components: {
  135. uniList,
  136. uniListItem
  137. },
  138. data() {
  139. return {
  140. current: 4,
  141. tabbar: tabbar1,
  142. qded: false, //是否已签到
  143. text: '', //客服微信
  144. today_integral: '', //签到获得的数值
  145. today_type: '', //签到获得的数值单位
  146. tom_integral: '', //明天签到获得的数值
  147. tom_type: '', //签到获得的数值单位
  148. userDowm: 0, //卡片升级专属高度
  149. userMaxDowm: 0, //卡片最高高度
  150. toolList: [
  151. {
  152. id: 't1',
  153. name: '新人通道',
  154. width: '56rpx',
  155. heigt: '54rpx',
  156. img: '../../static/icon/tool-1.png',
  157. path: '/pages/user/xrtd'
  158. },
  159. {
  160. id: 't2',
  161. name: '邀请好友',
  162. width: '56rpx',
  163. heigt: '57rpx',
  164. img: '../../static/icon/tool-2.png',
  165. path: '/pages/user/shareQrCode'
  166. },
  167. {
  168. id: 't3',
  169. name: '我的粉丝',
  170. width: '68rpx',
  171. heigt: '53rpx',
  172. img: '../../static/icon/tool-3.png',
  173. path: '/pages/user/myfans'
  174. },
  175. {
  176. id: 't4',
  177. name: '我的订单',
  178. width: '55rpx',
  179. heigt: '54rpx',
  180. img: '../../static/icon/tool-4.png',
  181. path: '/pages/order/order'
  182. },
  183. {
  184. id: 't5',
  185. name: '我的商品',
  186. width: '50rpx',
  187. heigt: '58rpx',
  188. img: '../../static/icon/tool-5.png',
  189. path: '/pages/order/order'
  190. },
  191. {
  192. id: 't6',
  193. name: '馆长申请',
  194. width: '59rpx',
  195. heigt: '56rpx',
  196. img: '../../static/icon/tool-6.png',
  197. path: '/pages/user/gzsq'
  198. }
  199. ]
  200. };
  201. },
  202. onShow() {
  203. // 判断是否已经登录
  204. if (this.hasLogin) {
  205. this.loadBaseData();
  206. }
  207. this.loadBaseData();
  208. },
  209. onReady() {
  210. // 初始化获取页面宽度
  211. uni.createSelectorQuery()
  212. .select('.container')
  213. .fields(
  214. {
  215. size: true
  216. },
  217. data => {
  218. // 计算最多下拉的高度
  219. this.userDowm = Math.floor((data.width / 750) * 185);
  220. // 计算最大触发修改高度事件
  221. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  222. }
  223. )
  224. .exec();
  225. },
  226. // #ifndef MP
  227. // onNavigationBarButtonTap(e) {
  228. // const index = e.index;
  229. // if (index === 0) {
  230. // this.navTo('/pages/set/set');
  231. // } else if (index === 1) {
  232. // // #ifdef APP-PLUS
  233. // const pages = getCurrentPages();
  234. // const page = pages[pages.length - 1];
  235. // const currentWebview = page.$getAppWebview();
  236. // currentWebview.hideTitleNViewButtonRedDot({
  237. // index
  238. // });
  239. // // #endif
  240. // uni.navigateTo({
  241. // url: '/pages/user/notice'
  242. // });
  243. // }
  244. // },
  245. // #endif
  246. computed: {
  247. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  248. },
  249. methods: {
  250. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  251. // 加载初始数据
  252. loadBaseData() {
  253. getUserInfo({})
  254. .then(({ data }) => {
  255. this.setUserInfo(data);
  256. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  257. orderData({})
  258. .then(({ data }) => {
  259. this.setOrderInfo(data);
  260. })
  261. .catch(e => {
  262. this.setOrderInfo({
  263. complete_count: 0, //完成
  264. received_count: 0, //待收货
  265. unshipped_count: 0, //待发货
  266. order_count: 0, //订单总数
  267. unpaid_count: 0 //待付款
  268. });
  269. });
  270. })
  271. .catch(e => {
  272. console.log(e);
  273. });
  274. },
  275. /**
  276. * 统一跳转接口,拦截未登录路由
  277. * navigator标签现在默认没有转场动画,所以用view
  278. */
  279. navTo(url) {
  280. console.log(url);
  281. if (!this.hasLogin) {
  282. // 保存地址
  283. saveUrl();
  284. // 登录拦截
  285. interceptor();
  286. } else {
  287. uni.navigateTo({
  288. url
  289. });
  290. }
  291. },
  292. useTool(e) {
  293. this.navTo(e.path);
  294. },
  295. // 签到弹窗
  296. goQd() {
  297. this.$refs.popupqd.open();
  298. this.qded = true;
  299. },
  300. // 关闭签到弹窗
  301. closeQd() {
  302. this.$refs.popupqd.close();
  303. },
  304. // 打开客服
  305. openKf() {
  306. this.$refs.popupkf.open();
  307. },
  308. // 关闭客服
  309. cancel() {
  310. this.$refs.popupkf.close();
  311. }
  312. }
  313. };
  314. </script>
  315. <style lang="scss">
  316. %flex-center {
  317. display: flex;
  318. flex-direction: column;
  319. justify-content: center;
  320. align-items: center;
  321. }
  322. %section {
  323. display: flex;
  324. justify-content: space-around;
  325. align-content: center;
  326. background: #fff;
  327. border-radius: 10rpx;
  328. }
  329. .container,
  330. page {
  331. min-height: 100%;
  332. height: auto;
  333. background-color: $page-color-base;
  334. }
  335. .vheigh {
  336. height: var(--status-bar-height);
  337. background-color: $base-color;
  338. }
  339. .top-image {
  340. position: absolute;
  341. top: 0;
  342. left: 0;
  343. right: 0;
  344. height: 230rpx;
  345. image {
  346. width: 100%;
  347. height: 100%;
  348. }
  349. }
  350. .tool-list {
  351. width: 690rpx;
  352. margin: auto;
  353. margin-top: 20rpx;
  354. background: #ffffff;
  355. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  356. border-radius: 20rpx;
  357. }
  358. .popup-box {
  359. width: 522rpx;
  360. height: 605rpx;
  361. background-color: #ffffff;
  362. border-radius: 20rpx;
  363. position: relative;
  364. .img {
  365. position: relative;
  366. top: -56rpx;
  367. left: 0;
  368. width: 522rpx;
  369. height: 132rpx;
  370. display: flex;
  371. justify-content: center;
  372. image {
  373. border-radius: 20rpx 20rpx 0 0;
  374. width: 450rpx;
  375. height: 132rpx;
  376. }
  377. }
  378. .mian {
  379. margin-top: -44rpx;
  380. display: flex;
  381. flex-direction: column;
  382. align-items: center;
  383. // padding: 32rpx 32rpx;
  384. background-color: #ffffff;
  385. border-radius: 0 0 20rpx 20rpx;
  386. text-align: center;
  387. .delivery {
  388. font-size: 40rpx;
  389. color: #333333;
  390. display: flex;
  391. align-items: center;
  392. flex-direction: column;
  393. image {
  394. margin-top: 48rpx;
  395. width: 172rpx;
  396. height: 160rpx;
  397. }
  398. }
  399. .nocancel {
  400. font-size: 32rpx;
  401. color: #333333;
  402. margin-top: 14rpx;
  403. }
  404. .comfirm-box {
  405. margin-top: 52rpx;
  406. display: flex;
  407. // margin-bottom: 32rpx;
  408. // justify-content: space-around;
  409. .cancel {
  410. display: flex;
  411. align-items: center;
  412. justify-content: center;
  413. width: 197rpx;
  414. height: 74rpx;
  415. border: 1px solid #dcc786;
  416. border-radius: 38rpx;
  417. font-size: 32rpx;
  418. color: #605128;
  419. }
  420. .comfirm {
  421. margin-left: 32rpx;
  422. display: flex;
  423. align-items: center;
  424. justify-content: center;
  425. width: 197rpx;
  426. height: 74rpx;
  427. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  428. border-radius: 38px;
  429. font-size: 32rpx;
  430. color: #605128;
  431. }
  432. }
  433. }
  434. }
  435. .popup {
  436. width: 560rpx;
  437. padding-bottom: 45rpx;
  438. background-color: #ffffff;
  439. border-radius: 15rpx;
  440. text-align: center;
  441. line-height: 1;
  442. .popup-dox {
  443. position: relative;
  444. .popup-logo {
  445. margin: -160rpx auto 0;
  446. width: 400rpx;
  447. height: 200rpx;
  448. }
  449. }
  450. .popup-title {
  451. margin-top: 85rpx;
  452. font-size: 40rpx;
  453. font-family: PingFang SC;
  454. font-weight: bold;
  455. color: #2a2a2a;
  456. text {
  457. font-size: 56rpx;
  458. color: #e83f30;
  459. }
  460. }
  461. .popup-tip {
  462. margin-top: 20rpx;
  463. font-size: 28rpx;
  464. font-family: PingFang SC;
  465. font-weight: 500;
  466. color: #8c8c8c;
  467. text {
  468. color: #e83f30;
  469. }
  470. }
  471. .popup-btn {
  472. margin: 58rpx auto 0;
  473. width: 270rpx;
  474. height: 66rpx;
  475. background: #f0c838;
  476. border-radius: 34rpx;
  477. text-align: center;
  478. line-height: 66rpx;
  479. font-size: 36rpx;
  480. font-family: Source Han Sans CN;
  481. font-weight: 500;
  482. color: #ffffff;
  483. }
  484. }
  485. .user-wrap {
  486. position: relative;
  487. z-index: 10;
  488. width: 690rpx;
  489. height: 283rpx;
  490. background: #ffffff;
  491. box-shadow: 0px 4rpx 13rpx 0px rgba(229, 229, 229, 0.46);
  492. border-radius: 20rpx;
  493. padding: 34rpx 0 40rpx;
  494. margin: auto;
  495. .info-left {
  496. padding-left: 34rpx;
  497. .user-name {
  498. display: flex;
  499. align-items: center;
  500. image {
  501. width: 120rpx;
  502. height: 120rpx;
  503. border-radius: 50%;
  504. }
  505. .user-font {
  506. padding-left: 34rpx;
  507. .name {
  508. width: 250rpx;
  509. font-size: 40rpx;
  510. font-family: Source Han Sans CN;
  511. font-weight: 400;
  512. color: #333333;
  513. }
  514. .phone {
  515. margin-top: 10rpx;
  516. font-size: 20rpx;
  517. font-family: PingFang SC;
  518. font-weight: 500;
  519. color: #999999;
  520. }
  521. }
  522. }
  523. .kpi {
  524. background: #f5eede;
  525. border-radius: 30rpx 0px 0px 30rpx;
  526. padding: 18rpx 24rpx;
  527. font-size: 26rpx;
  528. font-family: PingFang SC;
  529. font-weight: bold;
  530. color: #c6914e;
  531. }
  532. }
  533. .info-right {
  534. display: flex;
  535. align-items: center;
  536. margin-top: 54rpx;
  537. padding: 0 34rpx;
  538. .iright-icon {
  539. width: 32rpx;
  540. height: 32rpx;
  541. }
  542. .iright-font {
  543. margin-left: 12rpx;
  544. font-size: 28rpx;
  545. font-family: PingFang SC;
  546. font-weight: bold;
  547. color: #333333;
  548. }
  549. }
  550. }
  551. .user-set {
  552. justify-content: flex-end;
  553. view {
  554. flex-shrink: 0;
  555. }
  556. padding: 30rpx;
  557. image {
  558. height: 40rpx;
  559. width: 40rpx;
  560. }
  561. }
  562. .main-box {
  563. margin: 20rpx auto 0;
  564. width: 690rpx;
  565. background: #ffffff;
  566. box-shadow: 0px 4rpx 14rpx 0px rgba(229, 229, 229, 0.46);
  567. border-radius: 20rpx;
  568. .title {
  569. display: flex;
  570. justify-content: space-between;
  571. align-items: center;
  572. padding: 24rpx;
  573. border-bottom: 1px solid #EEEEEE;
  574. .title-left {
  575. display: flex;
  576. align-items: center;
  577. .title-icon {
  578. width: 32rpx;
  579. height: 32rpx;
  580. }
  581. .title-font {
  582. margin-left: 20rpx;
  583. font-size: 28rpx;
  584. font-family: PingFang SC;
  585. font-weight: bold;
  586. color: #333333;
  587. }
  588. }
  589. .title-right {
  590. width: 14rpx;
  591. height: 24rpx;
  592. }
  593. }
  594. .main {
  595. padding:50rpx 0 30rpx;
  596. .item {
  597. padding-bottom: 20rpx;
  598. width: 33%;
  599. display: flex;
  600. flex-direction: column;
  601. align-items: center;
  602. .item-num {
  603. font-size: 36rpx;
  604. font-family: PingFang SC;
  605. font-weight: bold;
  606. color: #333333;
  607. }
  608. .item-font {
  609. margin-top: 18rpx;
  610. font-size: 22rpx;
  611. font-family: PingFang SC;
  612. font-weight: 500;
  613. color: #666666;
  614. }
  615. }
  616. .oitem {
  617. width: 25%;
  618. display: flex;
  619. flex-direction: column;
  620. align-items: center;
  621. .oitem-image {
  622. height: 50rpx;
  623. width: 48rpx;
  624. }
  625. .oitem-font {
  626. margin-top: 20rpx;
  627. font-size: 24rpx;
  628. font-family: PingFang SC;
  629. font-weight: 500;
  630. color: #333333;
  631. }
  632. }
  633. }
  634. }
  635. .gpai {
  636. width: 100rpx;
  637. line-height: 40rpx;
  638. border-radius: 25rpx;
  639. position: absolute;
  640. top: 120rpx;
  641. left: 40rpx;
  642. font-size: 24rpx;
  643. color: #c6914e;
  644. text-align: center;
  645. background-color: #f2d4ae;
  646. }
  647. </style>