user.vue 15 KB

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