user.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. <template>
  2. <view class="container">
  3. <scroll-view class="content-box" scroll-y="true">
  4. <view class="user-section">
  5. <view class="bg"><image src="/static/user/bg.png" mode=""></image></view>
  6. <view class="user-info-box ">
  7. <view class="detail flex">
  8. <view class="portrait-box" @click="navTo('/pages/set/userinfo')">
  9. <image class="portrait" :src="userInfo.avatar || '/static/error/missing-face.png'"></image>
  10. </view>
  11. <view class="info-box">
  12. <view class="info-top flex">
  13. <view class="username clamp">{{ userInfo.nickname || '游客' }}</view>
  14. <view class="vip" v-if="userInfo.level > 0">
  15. <image class="vip-bg" src="../../static/img/vip.png" mode=""></image>
  16. <view class="vip-title">V{{ userInfo.level }}会员</view>
  17. </view>
  18. </view>
  19. <view class="font-size-sm">{{ userInfo.account }}</view>
  20. </view>
  21. </view>
  22. <view class="my-info flex" @click="navTo('/pages/set/userinfo')" v-if="hasLogin">
  23. <image src="../../static/user/set.png" mode=""></image>
  24. <view class="title">设置</view>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 订单 -->
  29. <view class="item-box item-box-b">
  30. <view class="box-title flex borde-b">
  31. <view class="title"><text>我的订单</text></view>
  32. <view class="link" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover"><text class="iconfont iconenter"></text></view>
  33. </view>
  34. <view class="order-section">
  35. <view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover" :hover-stay-time="50">
  36. <view class=" icon position-relative">
  37. <image class="icon-img" src="/static/user/order1.png" mode="aspectFit"></image>
  38. <view class="corner" v-if="orderInfo.unpaid_count > 0">
  39. <text>{{ orderInfo.unpaid_count }}</text>
  40. </view>
  41. </view>
  42. <text>待付款</text>
  43. </view>
  44. <view class="order-item" @click="navTo('/pages/order/order?state=1')" hover-class="common-hover" :hover-stay-time="50">
  45. <view class=" icon position-relative">
  46. <image class="icon-img" src="/static/user/order2.png" mode="aspectFit"></image>
  47. <view class="corner" v-if="orderInfo.unshipped_count > 0">
  48. <text>{{ orderInfo.unshipped_count }}</text>
  49. </view>
  50. </view>
  51. <text>待发货</text>
  52. </view>
  53. <view class="order-item" @click="navTo('/pages/order/order?state=2')" hover-class="common-hover" :hover-stay-time="50">
  54. <view class="icon position-relative">
  55. <image class="icon-img" src="/static/user/order3.png" mode="aspectFit"></image>
  56. <view class="corner" v-if="orderInfo.received_count > 0">
  57. <text>{{ orderInfo.received_count }}</text>
  58. </view>
  59. </view>
  60. <text>待收货</text>
  61. </view>
  62. <view class="order-item" @click="navTo('/pages/order/order?state=4')" hover-class="common-hover" :hover-stay-time="50">
  63. <view class="icon position-relative"><image class="icon-img" src="/static/user/order4.png" mode="aspectFit"></image></view>
  64. <text>已完成</text>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="vip-box" @click="navTo('/pages/category/vip')"><image src="../../static/user/open-m.png" mode=""></image></view>
  69. <view>
  70. <view class="item-box item-box-a">
  71. <view class="order-section">
  72. <view class="order-item" @click="navTo('/pages/money/wallet')" hover-class="common-hover" :hover-stay-time="50">
  73. <view class="icon icon-b"><image class="icon-img" src="/static/user/yue.png" mode="aspectFit"></image></view>
  74. <view class="order-font">我的奖金</view>
  75. </view>
  76. <view class="order-item" @click="navTo('/pages/user/award')" hover-class="common-hover" :hover-stay-time="50">
  77. <view class="icon icon-b"><image class="icon-img" src="/static/user/yongjin.png" mode="aspectFit"></image></view>
  78. <view class="order-font">我的余额</view>
  79. </view>
  80. <view class="order-item" @click="navTo('/pages/user/jindou')" hover-class="common-hover" :hover-stay-time="50">
  81. <view class="icon icon-b"><image class="icon-img" src="/static/user/yaoqing.png" mode="aspectFit"></image></view>
  82. <view class="order-font">我的金豆</view>
  83. </view>
  84. <view class="order-item" @click="navTo('/pages/user/team')" hover-class="common-hover" :hover-stay-time="50">
  85. <view class="icon icon-b"><image class="icon-img" src="/static/user/tuiguang.png" mode="aspectFit"></image></view>
  86. <view class="order-font">我的推广</view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="history-section icon">
  91. <uni-list>
  92. <uni-list-item title="批发订单" @click="navTo('/pages/user/myWholesale')" thumb="/static/user/u1.png"></uni-list-item>
  93. <uni-list-item title="金豆池" @click="navTo('/pages/user/JDcool')" thumb="/static/user/u2.png"></uni-list-item>
  94. <uni-list-item title="申请美容院" @click="navTo('/pages/category/apply')" thumb="/static/user/u3.png"></uni-list-item>
  95. <uni-list-item title="分享海报" @click="navTo('/pages/user/shareQrCode')" thumb="/static/user/u4.png"></uni-list-item>
  96. <uni-list-item title="我的收藏" @click="navTo('/pages/user/favorites')" thumb="/static/user/u5.png"></uni-list-item>
  97. <uni-list-item title="收货地址" @click="navTo('/pages/set/address')" thumb="/static/user/u6.png"></uni-list-item>
  98. <uni-list-item title="交易密码" @click="navTo('/pages/money/moneyPwd')" thumb="/static/user/u7.png"></uni-list-item>
  99. </uni-list>
  100. </view>
  101. </view>
  102. </scroll-view>
  103. </view>
  104. </template>
  105. <script>
  106. import { mapState, mapMutations } from 'vuex';
  107. import uniList from '@/components/uni-list/uni-list.vue';
  108. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  109. import { orderData, getUserInfo } from '@/api/user.js';
  110. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  111. let startY = 0,
  112. moveY = 0,
  113. pageAtTop = true;
  114. export default {
  115. components: {
  116. uniList,
  117. uniListItem
  118. },
  119. data() {
  120. return {};
  121. },
  122. onShow() {
  123. // 判断是否已经登录
  124. if (this.hasLogin) {
  125. this.loadBaseData();
  126. }
  127. },
  128. onReady() {
  129. // 初始化获取页面宽度
  130. uni.createSelectorQuery()
  131. .select('.container')
  132. .fields(
  133. {
  134. size: true
  135. },
  136. data => {
  137. // 计算最多下拉的高度
  138. this.userDowm = Math.floor((data.width / 750) * 185);
  139. // 计算最大触发修改高度事件
  140. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  141. }
  142. )
  143. .exec();
  144. },
  145. computed: {
  146. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  147. },
  148. methods: {
  149. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  150. // 加载初始数据
  151. loadBaseData() {
  152. getUserInfo({})
  153. .then(({ data }) => {
  154. this.setUserInfo(data);
  155. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  156. orderData({})
  157. .then(({ data }) => {
  158. this.setOrderInfo(data);
  159. })
  160. .catch(e => {
  161. this.setOrderInfo({
  162. complete_count: 0, //完成
  163. received_count: 0, //待收货
  164. unshipped_count: 0, //待发货
  165. order_count: 0, //订单总数
  166. unpaid_count: 0 //待付款
  167. });
  168. });
  169. })
  170. .catch(e => {
  171. console.log(e);
  172. });
  173. },
  174. /**
  175. * 统一跳转接口,拦截未登录路由
  176. * navigator标签现在默认没有转场动画,所以用view
  177. */
  178. navTo(url) {
  179. // if (!this.hasLogin) {
  180. // // 保存地址
  181. // saveUrl();
  182. // // 登录拦截
  183. // interceptor();
  184. // } else {
  185. uni.navigateTo({
  186. url
  187. });
  188. // }
  189. }
  190. }
  191. };
  192. </script>
  193. <style lang="scss">
  194. page {
  195. height: 100%;
  196. background-color: $page-color-base;
  197. }
  198. %flex-center {
  199. display: flex;
  200. flex-direction: column;
  201. justify-content: center;
  202. align-items: center;
  203. }
  204. %section {
  205. display: flex;
  206. justify-content: space-around;
  207. align-content: center;
  208. background: #fff;
  209. border-radius: 10rpx;
  210. }
  211. .container {
  212. height: 100%;
  213. background-color: #fff;
  214. }
  215. .content-box {
  216. height: 100%;
  217. }
  218. .user-section {
  219. height: 420rpx;
  220. padding: 50rpx 0rpx 0 30rpx;
  221. position: relative;
  222. .bg {
  223. position: absolute;
  224. left: 0;
  225. top: 0;
  226. width: 750rpx;
  227. height: 420rpx;
  228. image {
  229. width: 750rpx;
  230. height: 420rpx;
  231. }
  232. }
  233. }
  234. .user-info-box {
  235. height: 180rpx;
  236. color: white;
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-between;
  240. position: relative;
  241. z-index: 1;
  242. .detail {
  243. height: 130rpx;
  244. .portrait-box {
  245. height: 100%;
  246. .portrait {
  247. width: 130rpx;
  248. height: 100%;
  249. border: 5rpx solid #fff;
  250. border-radius: 50%;
  251. }
  252. }
  253. .info-box {
  254. margin-left: 20rpx;
  255. line-height: 1.5;
  256. .username {
  257. font-size: $font-lg + 2rpx;
  258. height: 100%;
  259. max-width: 200rpx;
  260. }
  261. .vip {
  262. position: relative;
  263. margin-left: 12rpx;
  264. width: 120rpx;
  265. height: 40rpx;
  266. .vip-bg {
  267. position: absolute;
  268. top: 0;
  269. left: 0;
  270. right: 0;
  271. width: 100%;
  272. height: 100%;
  273. }
  274. .vip-title {
  275. position: relative;
  276. z-index: 10;
  277. font-size: 20rpx;
  278. font-family: PingFang SC;
  279. font-weight: 500;
  280. color: #93794b;
  281. padding-left: 36rpx;
  282. line-height: 40rpx;
  283. }
  284. }
  285. .username-t {
  286. font-size: $font-lg + 6rpx;
  287. // height: 32rpx;
  288. display: flex;
  289. align-items: center;
  290. image {
  291. display: inline-block;
  292. margin-left: 10rpx;
  293. width: 147rpx;
  294. height: 32rpx;
  295. }
  296. }
  297. .user-get {
  298. font-size: $font-lg;
  299. text {
  300. font-size: $font-lg + 6rpx;
  301. }
  302. }
  303. }
  304. }
  305. .config {
  306. font-size: 48rpx;
  307. height: 130rpx;
  308. .setting {
  309. margin-right: 51rpx;
  310. }
  311. }
  312. .my-info {
  313. margin-right: 30rpx;
  314. width: 130rpx;
  315. height: 50rpx;
  316. border: 1px solid #ffffff;
  317. border-radius: 26rpx;
  318. justify-content: center;
  319. image {
  320. width: 30rpx;
  321. height: 30rpx;
  322. }
  323. .title {
  324. padding-left: 9rpx;
  325. font-size: 24rpx;
  326. font-family: PingFang SC;
  327. font-weight: 500;
  328. color: #ffffff;
  329. }
  330. }
  331. }
  332. .vip-card-box {
  333. display: flex;
  334. flex-direction: column;
  335. color: #f7d680;
  336. height: 240rpx;
  337. background: linear-gradient(left, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.8));
  338. border-radius: 16rpx 16rpx 0 0;
  339. overflow: hidden;
  340. position: relative;
  341. padding: 20rpx 24rpx;
  342. .card-bg {
  343. position: absolute;
  344. top: 20rpx;
  345. right: 0;
  346. width: 380rpx;
  347. height: 260rpx;
  348. }
  349. .b-btn {
  350. position: absolute;
  351. right: 20rpx;
  352. top: 16rpx;
  353. width: 132rpx;
  354. height: 40rpx;
  355. text-align: center;
  356. line-height: 40rpx;
  357. font-size: 22rpx;
  358. color: #36343c;
  359. border-radius: 20px;
  360. background: linear-gradient(left, #f9e6af, #ffd465);
  361. z-index: 1;
  362. }
  363. .tit {
  364. font-size: $font-base + 2rpx;
  365. color: #f7d680;
  366. margin-bottom: 28rpx;
  367. .iconfont {
  368. color: #f6e5a3;
  369. margin-right: 16rpx;
  370. }
  371. }
  372. .e-b {
  373. font-size: $font-sm;
  374. color: #d8cba9;
  375. margin-top: 10rpx;
  376. }
  377. }
  378. .cover-container {
  379. background: $page-color-base;
  380. margin-top: -150rpx;
  381. padding: 0 30rpx;
  382. position: relative;
  383. background: #f5f5f5;
  384. padding-bottom: 20rpx;
  385. .arc {
  386. position: absolute;
  387. left: 0;
  388. top: -34rpx;
  389. width: 100%;
  390. height: 36rpx;
  391. }
  392. }
  393. .tj-sction {
  394. @extend %section;
  395. .tj-item {
  396. @extend %flex-center;
  397. flex-direction: column;
  398. height: 140rpx;
  399. font-size: $font-sm;
  400. color: #75787d;
  401. }
  402. .num {
  403. font-size: $font-lg;
  404. color: $font-color-dark;
  405. margin-bottom: 8rpx;
  406. }
  407. }
  408. .vip-box {
  409. width: 710rpx;
  410. height: 90rpx;
  411. margin: 32rpx auto 0;
  412. image {
  413. width: 100%;
  414. height: 100%;
  415. }
  416. }
  417. .item-box {
  418. // width: 710rpx;
  419. // height: 221rpx;
  420. // background: #FFFFFF;
  421. // box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  422. // border-radius: 20rpx;
  423. // position: relative;
  424. // top: -150rpx;
  425. // left: 0;
  426. // right: 0;
  427. // margin: 0 auto -150rpx;
  428. margin: 20rpx 0;
  429. .box-title {
  430. background-color: #fff;
  431. line-height: 1;
  432. // padding: 30rpx;
  433. padding: 0 36rpx 0 35rpx;
  434. height: 73rpx;
  435. border-radius: 20rpx 20rpx 0 0;
  436. .title {
  437. font-weight: bold;
  438. font-size: 30rpx;
  439. font-family: PingFang SC;
  440. font-weight: bold;
  441. color: #333333;
  442. }
  443. .link {
  444. font-size: $font-base - 2rpx;
  445. color: $font-color-light;
  446. }
  447. }
  448. .order-section {
  449. height: 146rpx;
  450. @extend %section;
  451. // padding: 28rpx 0;
  452. .order-item {
  453. @extend %flex-center;
  454. width: 120rpx;
  455. height: 146rpx;
  456. border-radius: 10rpx;
  457. font-size: $font-sm;
  458. color: $font-color-dark;
  459. }
  460. .iconfont {
  461. font-size: 48rpx;
  462. margin-bottom: 18rpx;
  463. color: #fa436a;
  464. }
  465. .icon-shouhoutuikuan {
  466. font-size: 44rpx;
  467. }
  468. .icon {
  469. height: 50rpx;
  470. width: 48rpx;
  471. margin-bottom: 18rpx;
  472. background-size: 100%;
  473. background-repeat: no-repeat;
  474. background-position: center;
  475. .icon-img {
  476. width: 100%;
  477. height: 100%;
  478. }
  479. }
  480. .icon-b {
  481. height: 90rpx;
  482. width: 88rpx;
  483. }
  484. }
  485. }
  486. .history-section {
  487. // padding: 30rpx 0 0;
  488. margin-top: 20rpx;
  489. background: #fff;
  490. border-radius: 10rpx;
  491. .sec-header {
  492. display: flex;
  493. align-items: center;
  494. font-size: $font-base;
  495. color: $font-color-dark;
  496. line-height: 40rpx;
  497. margin-left: 30rpx;
  498. padding-top: 30rpx;
  499. .iconfont {
  500. font-size: 44rpx;
  501. color: $color-red;
  502. margin-right: 16rpx;
  503. line-height: 40rpx;
  504. }
  505. }
  506. .h-list {
  507. white-space: nowrap;
  508. padding: 30rpx 30rpx 0;
  509. .h-list-image {
  510. display: inline-block;
  511. width: 160rpx;
  512. height: 160rpx;
  513. margin-right: 20rpx;
  514. border-radius: 10rpx;
  515. }
  516. }
  517. }
  518. .up-box {
  519. margin: 21rpx auto;
  520. width: 710rpx;
  521. height: 90rpx;
  522. background: linear-gradient(73deg, #ffffff 0%, #fffbeb 0%, #fff1da 0%, #fed591 100%);
  523. border-radius: 20rpx;
  524. image {
  525. width: 100%;
  526. height: 100%;
  527. border-radius: 20rpx;
  528. }
  529. }
  530. .item-box-b {
  531. width: 710rpx;
  532. height: 221rpx;
  533. background: #ffffff;
  534. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.5);
  535. border-radius: 20rpx;
  536. position: relative;
  537. top: -150rpx;
  538. left: 0;
  539. right: 0;
  540. margin: 0 auto -150rpx;
  541. }
  542. .popup-box {
  543. width: 522rpx;
  544. height: 605rpx;
  545. background-color: #ffffff;
  546. border-radius: 20rpx;
  547. position: relative;
  548. .img {
  549. position: relative;
  550. top: -56rpx;
  551. left: 0;
  552. width: 522rpx;
  553. height: 132rpx;
  554. display: flex;
  555. justify-content: center;
  556. image {
  557. border-radius: 20rpx 20rpx 0 0;
  558. width: 450rpx;
  559. height: 132rpx;
  560. }
  561. }
  562. .mian {
  563. margin-top: -44rpx;
  564. display: flex;
  565. flex-direction: column;
  566. align-items: center;
  567. // padding: 32rpx 32rpx;
  568. background-color: #ffffff;
  569. border-radius: 0 0 20rpx 20rpx;
  570. text-align: center;
  571. .delivery {
  572. font-size: 40rpx;
  573. color: #333333;
  574. display: flex;
  575. align-items: center;
  576. flex-direction: column;
  577. .title {
  578. }
  579. image {
  580. margin-top: 48rpx;
  581. width: 172rpx;
  582. height: 160rpx;
  583. }
  584. }
  585. .nocancel {
  586. font-size: 32rpx;
  587. color: #333333;
  588. margin-top: 14rpx;
  589. }
  590. .comfirm-box {
  591. margin-top: 52rpx;
  592. display: flex;
  593. // margin-bottom: 32rpx;
  594. // justify-content: space-around;
  595. .cancel {
  596. display: flex;
  597. align-items: center;
  598. justify-content: center;
  599. width: 197rpx;
  600. height: 74rpx;
  601. border: 1px solid #dcc786;
  602. border-radius: 38rpx;
  603. font-size: 32rpx;
  604. color: #605128;
  605. }
  606. .comfirm {
  607. margin-left: 32rpx;
  608. display: flex;
  609. align-items: center;
  610. justify-content: center;
  611. width: 197rpx;
  612. height: 74rpx;
  613. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  614. border-radius: 38px;
  615. font-size: 32rpx;
  616. color: #605128;
  617. }
  618. }
  619. }
  620. }
  621. .outlogin {
  622. margin: 40rpx auto;
  623. width: 500rpx;
  624. background-color: #fff;
  625. color: #ff4c4b;
  626. border: 1px solid #ff4c4b;
  627. text-align: center;
  628. padding: 10rpx 0rpx;
  629. border-radius: 50rpx;
  630. }
  631. .order-font {
  632. margin-top: -24rpx;
  633. }
  634. </style>