user.vue 15 KB

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