user.vue 15 KB

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