user.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  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 || '../../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" @click="navTo('/pages/user/myxfjf')">
  21. <image class="iright-icon" src="../../static/user/user3.png" mode=""></image>
  22. <view class="iright-font">消费积分:{{ userInfo.now_money }}</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" @click="navTo('/pages/user/mygwjf')">
  35. <view class="item-num">{{ userInfo.sp_final}}</view>
  36. <view class="item-font">购物积分</view>
  37. </view>
  38. <view class="item" @click="navTo('/pages/user/mythq')">
  39. <view class="item-num">{{userInfo.top_ticket }}</view>
  40. <view class="item-font">提货券</view>
  41. </view>
  42. <view class="item" @click="navTo('/pages/user/myggz')">
  43. <view class="item-num">{{userInfo.aid_val}}</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. this.loadBaseData();
  203. },
  204. onReady() {
  205. // 初始化获取页面宽度
  206. uni.createSelectorQuery()
  207. .select('.container')
  208. .fields(
  209. {
  210. size: true
  211. },
  212. data => {
  213. // 计算最多下拉的高度
  214. this.userDowm = Math.floor((data.width / 750) * 185);
  215. // 计算最大触发修改高度事件
  216. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  217. }
  218. )
  219. .exec();
  220. },
  221. // #ifndef MP
  222. // onNavigationBarButtonTap(e) {
  223. // const index = e.index;
  224. // if (index === 0) {
  225. // this.navTo('/pages/set/set');
  226. // } else if (index === 1) {
  227. // // #ifdef APP-PLUS
  228. // const pages = getCurrentPages();
  229. // const page = pages[pages.length - 1];
  230. // const currentWebview = page.$getAppWebview();
  231. // currentWebview.hideTitleNViewButtonRedDot({
  232. // index
  233. // });
  234. // // #endif
  235. // uni.navigateTo({
  236. // url: '/pages/user/notice'
  237. // });
  238. // }
  239. // },
  240. // #endif
  241. computed: {
  242. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  243. },
  244. methods: {
  245. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  246. // 加载初始数据
  247. loadBaseData() {
  248. getUserInfo({})
  249. .then(({ data }) => {
  250. this.setUserInfo(data);
  251. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  252. orderData({})
  253. .then(({ data }) => {
  254. this.setOrderInfo(data);
  255. })
  256. .catch(e => {
  257. this.setOrderInfo({
  258. complete_count: 0, //完成
  259. received_count: 0, //待收货
  260. unshipped_count: 0, //待发货
  261. order_count: 0, //订单总数
  262. unpaid_count: 0 //待付款
  263. });
  264. });
  265. })
  266. .catch(e => {
  267. console.log(e);
  268. });
  269. },
  270. /**
  271. * 统一跳转接口,拦截未登录路由
  272. * navigator标签现在默认没有转场动画,所以用view
  273. */
  274. navTo(url) {
  275. console.log(url);
  276. // if (!this.hasLogin) {
  277. // // 保存地址
  278. // saveUrl();
  279. // // 登录拦截
  280. // interceptor();
  281. // } else {
  282. uni.navigateTo({
  283. url
  284. });
  285. // }
  286. },
  287. useTool(e) {
  288. this.navTo(e.path);
  289. },
  290. // 签到弹窗
  291. goQd() {
  292. this.$refs.popupqd.open();
  293. this.qded = true;
  294. },
  295. // 关闭签到弹窗
  296. closeQd() {
  297. this.$refs.popupqd.close();
  298. },
  299. // 打开客服
  300. openKf() {
  301. this.$refs.popupkf.open();
  302. },
  303. // 关闭客服
  304. cancel() {
  305. this.$refs.popupkf.close();
  306. }
  307. }
  308. };
  309. </script>
  310. <style lang="scss">
  311. %flex-center {
  312. display: flex;
  313. flex-direction: column;
  314. justify-content: center;
  315. align-items: center;
  316. }
  317. %section {
  318. display: flex;
  319. justify-content: space-around;
  320. align-content: center;
  321. background: #fff;
  322. border-radius: 10rpx;
  323. }
  324. .container,
  325. page {
  326. min-height: 100%;
  327. height: auto;
  328. background-color: $page-color-base;
  329. }
  330. .vheigh {
  331. height: var(--status-bar-height);
  332. background-color: $base-color;
  333. }
  334. .top-image {
  335. position: absolute;
  336. top: 0;
  337. left: 0;
  338. right: 0;
  339. height: 230rpx;
  340. image {
  341. width: 100%;
  342. height: 100%;
  343. }
  344. }
  345. .tool-list {
  346. width: 690rpx;
  347. margin: auto;
  348. margin-top: 20rpx;
  349. background: #ffffff;
  350. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  351. border-radius: 20rpx;
  352. }
  353. .popup-box {
  354. width: 522rpx;
  355. height: 605rpx;
  356. background-color: #ffffff;
  357. border-radius: 20rpx;
  358. position: relative;
  359. .img {
  360. position: relative;
  361. top: -56rpx;
  362. left: 0;
  363. width: 522rpx;
  364. height: 132rpx;
  365. display: flex;
  366. justify-content: center;
  367. image {
  368. border-radius: 20rpx 20rpx 0 0;
  369. width: 450rpx;
  370. height: 132rpx;
  371. }
  372. }
  373. .mian {
  374. margin-top: -44rpx;
  375. display: flex;
  376. flex-direction: column;
  377. align-items: center;
  378. // padding: 32rpx 32rpx;
  379. background-color: #ffffff;
  380. border-radius: 0 0 20rpx 20rpx;
  381. text-align: center;
  382. .delivery {
  383. font-size: 40rpx;
  384. color: #333333;
  385. display: flex;
  386. align-items: center;
  387. flex-direction: column;
  388. image {
  389. margin-top: 48rpx;
  390. width: 172rpx;
  391. height: 160rpx;
  392. }
  393. }
  394. .nocancel {
  395. font-size: 32rpx;
  396. color: #333333;
  397. margin-top: 14rpx;
  398. }
  399. .comfirm-box {
  400. margin-top: 52rpx;
  401. display: flex;
  402. // margin-bottom: 32rpx;
  403. // justify-content: space-around;
  404. .cancel {
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. width: 197rpx;
  409. height: 74rpx;
  410. border: 1px solid #dcc786;
  411. border-radius: 38rpx;
  412. font-size: 32rpx;
  413. color: #605128;
  414. }
  415. .comfirm {
  416. margin-left: 32rpx;
  417. display: flex;
  418. align-items: center;
  419. justify-content: center;
  420. width: 197rpx;
  421. height: 74rpx;
  422. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  423. border-radius: 38px;
  424. font-size: 32rpx;
  425. color: #605128;
  426. }
  427. }
  428. }
  429. }
  430. .popup {
  431. width: 560rpx;
  432. padding-bottom: 45rpx;
  433. background-color: #ffffff;
  434. border-radius: 15rpx;
  435. text-align: center;
  436. line-height: 1;
  437. .popup-dox {
  438. position: relative;
  439. .popup-logo {
  440. margin: -160rpx auto 0;
  441. width: 400rpx;
  442. height: 200rpx;
  443. }
  444. }
  445. .popup-title {
  446. margin-top: 85rpx;
  447. font-size: 40rpx;
  448. font-family: PingFang SC;
  449. font-weight: bold;
  450. color: #2a2a2a;
  451. text {
  452. font-size: 56rpx;
  453. color: #e83f30;
  454. }
  455. }
  456. .popup-tip {
  457. margin-top: 20rpx;
  458. font-size: 28rpx;
  459. font-family: PingFang SC;
  460. font-weight: 500;
  461. color: #8c8c8c;
  462. text {
  463. color: #e83f30;
  464. }
  465. }
  466. .popup-btn {
  467. margin: 58rpx auto 0;
  468. width: 270rpx;
  469. height: 66rpx;
  470. background: #f0c838;
  471. border-radius: 34rpx;
  472. text-align: center;
  473. line-height: 66rpx;
  474. font-size: 36rpx;
  475. font-family: Source Han Sans CN;
  476. font-weight: 500;
  477. color: #ffffff;
  478. }
  479. }
  480. .user-wrap {
  481. position: relative;
  482. z-index: 10;
  483. width: 690rpx;
  484. height: 283rpx;
  485. background: #ffffff;
  486. box-shadow: 0px 4rpx 13rpx 0px rgba(229, 229, 229, 0.46);
  487. border-radius: 20rpx;
  488. padding: 34rpx 0 40rpx;
  489. margin: auto;
  490. .info-left {
  491. padding-left: 34rpx;
  492. .user-name {
  493. display: flex;
  494. align-items: center;
  495. image {
  496. width: 120rpx;
  497. height: 120rpx;
  498. border-radius: 50%;
  499. }
  500. .user-font {
  501. padding-left: 34rpx;
  502. .name {
  503. width: 250rpx;
  504. font-size: 40rpx;
  505. font-family: Source Han Sans CN;
  506. font-weight: 400;
  507. color: #333333;
  508. }
  509. .phone {
  510. margin-top: 10rpx;
  511. font-size: 20rpx;
  512. font-family: PingFang SC;
  513. font-weight: 500;
  514. color: #999999;
  515. }
  516. }
  517. }
  518. .kpi {
  519. background: #f5eede;
  520. border-radius: 30rpx 0px 0px 30rpx;
  521. padding: 18rpx 24rpx;
  522. font-size: 26rpx;
  523. font-family: PingFang SC;
  524. font-weight: bold;
  525. color: #c6914e;
  526. }
  527. }
  528. .info-right {
  529. display: flex;
  530. align-items: center;
  531. margin-top: 54rpx;
  532. padding: 0 34rpx;
  533. .iright-icon {
  534. width: 32rpx;
  535. height: 32rpx;
  536. }
  537. .iright-font {
  538. margin-left: 12rpx;
  539. font-size: 28rpx;
  540. font-family: PingFang SC;
  541. font-weight: bold;
  542. color: #333333;
  543. }
  544. }
  545. }
  546. .user-set {
  547. view {
  548. flex-shrink: 0;
  549. }
  550. padding: 30rpx;
  551. image {
  552. height: 40rpx;
  553. width: 40rpx;
  554. }
  555. }
  556. .main-box {
  557. margin: 20rpx auto 0;
  558. width: 690rpx;
  559. background: #ffffff;
  560. box-shadow: 0px 4rpx 14rpx 0px rgba(229, 229, 229, 0.46);
  561. border-radius: 20rpx;
  562. .title {
  563. display: flex;
  564. justify-content: space-between;
  565. align-items: center;
  566. padding: 24rpx;
  567. border-bottom: 1px solid #EEEEEE;
  568. .title-left {
  569. display: flex;
  570. align-items: center;
  571. .title-icon {
  572. width: 32rpx;
  573. height: 32rpx;
  574. }
  575. .title-font {
  576. margin-left: 20rpx;
  577. font-size: 28rpx;
  578. font-family: PingFang SC;
  579. font-weight: bold;
  580. color: #333333;
  581. }
  582. }
  583. .title-right {
  584. width: 14rpx;
  585. height: 24rpx;
  586. }
  587. }
  588. .main {
  589. padding:50rpx 0 30rpx;
  590. .item {
  591. padding-bottom: 20rpx;
  592. width: 33%;
  593. display: flex;
  594. flex-direction: column;
  595. align-items: center;
  596. .item-num {
  597. font-size: 36rpx;
  598. font-family: PingFang SC;
  599. font-weight: bold;
  600. color: #333333;
  601. }
  602. .item-font {
  603. margin-top: 18rpx;
  604. font-size: 22rpx;
  605. font-family: PingFang SC;
  606. font-weight: 500;
  607. color: #666666;
  608. }
  609. }
  610. .oitem {
  611. width: 25%;
  612. display: flex;
  613. flex-direction: column;
  614. align-items: center;
  615. .oitem-image {
  616. height: 50rpx;
  617. width: 48rpx;
  618. }
  619. .oitem-font {
  620. margin-top: 20rpx;
  621. font-size: 24rpx;
  622. font-family: PingFang SC;
  623. font-weight: 500;
  624. color: #333333;
  625. }
  626. }
  627. }
  628. }
  629. </style>