user.vue 14 KB

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