user.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  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">
  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">
  58. <image class="oitem-image" src="../../static/user/user6.png" mode=""></image>
  59. <view class="oitem-font">待付款</view>
  60. </view>
  61. <view class="oitem">
  62. <image class="oitem-image" src="../../static/user/user7.png" mode=""></image>
  63. <view class="oitem-font">待发货</view>
  64. </view>
  65. <view class="oitem">
  66. <image class="oitem-image" src="../../static/user/user8.png" mode=""></image>
  67. <view class="oitem-font">待收货</view>
  68. </view>
  69. <view class="oitem">
  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/approve')" thumb="/static/user/user11.png"></uni-list-item>
  78. <uni-list-item title="收款方式" @click="navTo('/pages/set/address')" 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. // if (!this.hasLogin) {
  275. // // 保存地址
  276. // saveUrl();
  277. // // 登录拦截
  278. // interceptor();
  279. // } else {
  280. uni.navigateTo({
  281. url
  282. });
  283. // }
  284. },
  285. useTool(e) {
  286. this.navTo(e.path);
  287. },
  288. // 签到弹窗
  289. goQd() {
  290. this.$refs.popupqd.open();
  291. this.qded = true;
  292. },
  293. // 关闭签到弹窗
  294. closeQd() {
  295. this.$refs.popupqd.close();
  296. },
  297. // 打开客服
  298. openKf() {
  299. this.$refs.popupkf.open();
  300. },
  301. // 关闭客服
  302. cancel() {
  303. this.$refs.popupkf.close();
  304. }
  305. }
  306. };
  307. </script>
  308. <style lang="scss">
  309. %flex-center {
  310. display: flex;
  311. flex-direction: column;
  312. justify-content: center;
  313. align-items: center;
  314. }
  315. %section {
  316. display: flex;
  317. justify-content: space-around;
  318. align-content: center;
  319. background: #fff;
  320. border-radius: 10rpx;
  321. }
  322. .container,
  323. page {
  324. min-height: 100%;
  325. height: auto;
  326. background-color: $page-color-base;
  327. }
  328. .vheigh {
  329. height: var(--status-bar-height);
  330. background-color: $base-color;
  331. }
  332. .top-image {
  333. position: absolute;
  334. top: 0;
  335. left: 0;
  336. right: 0;
  337. height: 230rpx;
  338. image {
  339. width: 100%;
  340. height: 100%;
  341. }
  342. }
  343. .tool-list {
  344. width: 690rpx;
  345. margin: auto;
  346. margin-top: 20rpx;
  347. background: #ffffff;
  348. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  349. border-radius: 20rpx;
  350. }
  351. .popup-box {
  352. width: 522rpx;
  353. height: 605rpx;
  354. background-color: #ffffff;
  355. border-radius: 20rpx;
  356. position: relative;
  357. .img {
  358. position: relative;
  359. top: -56rpx;
  360. left: 0;
  361. width: 522rpx;
  362. height: 132rpx;
  363. display: flex;
  364. justify-content: center;
  365. image {
  366. border-radius: 20rpx 20rpx 0 0;
  367. width: 450rpx;
  368. height: 132rpx;
  369. }
  370. }
  371. .mian {
  372. margin-top: -44rpx;
  373. display: flex;
  374. flex-direction: column;
  375. align-items: center;
  376. // padding: 32rpx 32rpx;
  377. background-color: #ffffff;
  378. border-radius: 0 0 20rpx 20rpx;
  379. text-align: center;
  380. .delivery {
  381. font-size: 40rpx;
  382. color: #333333;
  383. display: flex;
  384. align-items: center;
  385. flex-direction: column;
  386. image {
  387. margin-top: 48rpx;
  388. width: 172rpx;
  389. height: 160rpx;
  390. }
  391. }
  392. .nocancel {
  393. font-size: 32rpx;
  394. color: #333333;
  395. margin-top: 14rpx;
  396. }
  397. .comfirm-box {
  398. margin-top: 52rpx;
  399. display: flex;
  400. // margin-bottom: 32rpx;
  401. // justify-content: space-around;
  402. .cancel {
  403. display: flex;
  404. align-items: center;
  405. justify-content: center;
  406. width: 197rpx;
  407. height: 74rpx;
  408. border: 1px solid #dcc786;
  409. border-radius: 38rpx;
  410. font-size: 32rpx;
  411. color: #605128;
  412. }
  413. .comfirm {
  414. margin-left: 32rpx;
  415. display: flex;
  416. align-items: center;
  417. justify-content: center;
  418. width: 197rpx;
  419. height: 74rpx;
  420. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  421. border-radius: 38px;
  422. font-size: 32rpx;
  423. color: #605128;
  424. }
  425. }
  426. }
  427. }
  428. .popup {
  429. width: 560rpx;
  430. padding-bottom: 45rpx;
  431. background-color: #ffffff;
  432. border-radius: 15rpx;
  433. text-align: center;
  434. line-height: 1;
  435. .popup-dox {
  436. position: relative;
  437. .popup-logo {
  438. margin: -160rpx auto 0;
  439. width: 400rpx;
  440. height: 200rpx;
  441. }
  442. }
  443. .popup-title {
  444. margin-top: 85rpx;
  445. font-size: 40rpx;
  446. font-family: PingFang SC;
  447. font-weight: bold;
  448. color: #2a2a2a;
  449. text {
  450. font-size: 56rpx;
  451. color: #e83f30;
  452. }
  453. }
  454. .popup-tip {
  455. margin-top: 20rpx;
  456. font-size: 28rpx;
  457. font-family: PingFang SC;
  458. font-weight: 500;
  459. color: #8c8c8c;
  460. text {
  461. color: #e83f30;
  462. }
  463. }
  464. .popup-btn {
  465. margin: 58rpx auto 0;
  466. width: 270rpx;
  467. height: 66rpx;
  468. background: #f0c838;
  469. border-radius: 34rpx;
  470. text-align: center;
  471. line-height: 66rpx;
  472. font-size: 36rpx;
  473. font-family: Source Han Sans CN;
  474. font-weight: 500;
  475. color: #ffffff;
  476. }
  477. }
  478. .user-wrap {
  479. position: relative;
  480. z-index: 10;
  481. width: 690rpx;
  482. height: 283rpx;
  483. background: #ffffff;
  484. box-shadow: 0px 4rpx 13rpx 0px rgba(229, 229, 229, 0.46);
  485. border-radius: 20rpx;
  486. padding: 34rpx 0 40rpx;
  487. margin: auto;
  488. .info-left {
  489. padding-left: 34rpx;
  490. .user-name {
  491. display: flex;
  492. align-items: center;
  493. image {
  494. width: 120rpx;
  495. height: 120rpx;
  496. border-radius: 50%;
  497. }
  498. .user-font {
  499. padding-left: 34rpx;
  500. .name {
  501. width: 250rpx;
  502. font-size: 40rpx;
  503. font-family: Source Han Sans CN;
  504. font-weight: 400;
  505. color: #333333;
  506. }
  507. .phone {
  508. margin-top: 10rpx;
  509. font-size: 20rpx;
  510. font-family: PingFang SC;
  511. font-weight: 500;
  512. color: #999999;
  513. }
  514. }
  515. }
  516. .kpi {
  517. background: #f5eede;
  518. border-radius: 30rpx 0px 0px 30rpx;
  519. padding: 18rpx 24rpx;
  520. font-size: 26rpx;
  521. font-family: PingFang SC;
  522. font-weight: bold;
  523. color: #c6914e;
  524. }
  525. }
  526. .info-right {
  527. display: flex;
  528. align-items: center;
  529. margin-top: 54rpx;
  530. padding: 0 34rpx;
  531. .iright-icon {
  532. width: 32rpx;
  533. height: 32rpx;
  534. }
  535. .iright-font {
  536. margin-left: 12rpx;
  537. font-size: 28rpx;
  538. font-family: PingFang SC;
  539. font-weight: bold;
  540. color: #333333;
  541. }
  542. }
  543. }
  544. .user-set {
  545. view {
  546. flex-shrink: 0;
  547. }
  548. padding: 30rpx;
  549. image {
  550. height: 40rpx;
  551. width: 40rpx;
  552. }
  553. }
  554. .main-box {
  555. margin: 20rpx auto 0;
  556. width: 690rpx;
  557. background: #ffffff;
  558. box-shadow: 0px 4rpx 14rpx 0px rgba(229, 229, 229, 0.46);
  559. border-radius: 20rpx;
  560. .title {
  561. display: flex;
  562. justify-content: space-between;
  563. align-items: center;
  564. padding: 24rpx;
  565. border-bottom: 1px solid #EEEEEE;
  566. .title-left {
  567. display: flex;
  568. align-items: center;
  569. .title-icon {
  570. width: 32rpx;
  571. height: 32rpx;
  572. }
  573. .title-font {
  574. margin-left: 20rpx;
  575. font-size: 28rpx;
  576. font-family: PingFang SC;
  577. font-weight: bold;
  578. color: #333333;
  579. }
  580. }
  581. .title-right {
  582. width: 14rpx;
  583. height: 24rpx;
  584. }
  585. }
  586. .main {
  587. padding:50rpx 0 30rpx;
  588. .item {
  589. padding-bottom: 20rpx;
  590. width: 33%;
  591. display: flex;
  592. flex-direction: column;
  593. align-items: center;
  594. .item-num {
  595. font-size: 36rpx;
  596. font-family: PingFang SC;
  597. font-weight: bold;
  598. color: #333333;
  599. }
  600. .item-font {
  601. margin-top: 18rpx;
  602. font-size: 22rpx;
  603. font-family: PingFang SC;
  604. font-weight: 500;
  605. color: #666666;
  606. }
  607. }
  608. .oitem {
  609. width: 25%;
  610. display: flex;
  611. flex-direction: column;
  612. align-items: center;
  613. .oitem-image {
  614. height: 50rpx;
  615. width: 48rpx;
  616. }
  617. .oitem-font {
  618. margin-top: 20rpx;
  619. font-size: 24rpx;
  620. font-family: PingFang SC;
  621. font-weight: 500;
  622. color: #333333;
  623. }
  624. }
  625. }
  626. }
  627. </style>