userPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <scroll-view class="content-box" scroll-y="true">
  5. <view class="user-section">
  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="user.avatar || '/static/error/missing-face.png'"></image>
  10. </view>
  11. <view class="info-box">
  12. <view class="username flex-start">
  13. <text class="clamp padding-r-20">
  14. {{ user.nickname || '游客' }}
  15. </text>
  16. <image v-if="user.level>0" class="tipLevel flex-shrink-false"
  17. :src="`../../static/image/level${user.level-1}.png`" mode="heightFix"></image>
  18. </view>
  19. <view class="flex-start flex">
  20. <view class="authentication"
  21. @click="navTo('/pages/shop/attestation')"
  22. v-if="userInfo.is_real==0||!userInfo.is_real">未实名认证</view>
  23. <view class="authentication success" v-else>已认证</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="cover-container">
  30. <view class="tj-sction">
  31. <view class="tj-item" @click="navTo('./money/wallet')">
  32. <text class="num">{{ user.now_money || '0.00' }}</text>
  33. <text>余额</text>
  34. </view>
  35. <view v-if="fx" class="tj-item" @click="navTo('/pages/user/award/award')">
  36. <text class="num">{{ user.brokerage_price || '0.00' }}</text>
  37. <text>佣金</text>
  38. </view>
  39. <!-- <view class="tj-item" @click="navTo('/pages/index/route')">
  40. <text class="num">{{ user.record_sum || '0' }}</text>
  41. <text>行程</text>
  42. </view> -->
  43. <!-- <view class="tj-item" @click="navTo('/pages/index/notice')">
  44. <text class="num">{{ notic|| '0' }}</text>
  45. <text>消息</text>
  46. </view> -->
  47. <view class="tj-item" @click="navTo('/pages/user/money/qxq')">
  48. <text class="num">{{ user.certificate || '0.00' }}</text>
  49. <text>骑行券</text>
  50. </view>
  51. </view>
  52. <!-- 订单 -->
  53. <view class="item-box">
  54. <view class="box-title flex">
  55. <view class="title"><text>我的订单</text></view>
  56. <!-- <view class="link" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover">
  57. <text>全部订单</text>
  58. <text class="iconfont iconenter"></text>
  59. </view> -->
  60. </view>
  61. <view class="order-section">
  62. <view class="order-item" @click="navTo('/pages/order/order?state=3')" hover-class="common-hover"
  63. :hover-stay-time="50">
  64. <view class=" icon position-relative">
  65. <image class="icon-img" src="../../static/icon/userIconAll.png" mode="aspectFit">
  66. </image>
  67. <!-- <view class="corner" v-if="orderInfo.unshipped_count > 0">
  68. <text>{{ orderInfo.unshipped_count }}</text>
  69. </view> -->
  70. </view>
  71. <text>已完成</text>
  72. </view>
  73. <view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover"
  74. :hover-stay-time="50">
  75. <view class=" icon position-relative">
  76. <image class="icon-img" src="../../static/icon/userIconPay.png" mode="aspectFit">
  77. </image>
  78. <view class="corner" v-if="user.unpaid_count > 0">
  79. <text>{{ user.unpaid_count }}</text>
  80. </view>
  81. </view>
  82. <text>待付款</text>
  83. </view>
  84. <view class="order-item" @click="navTo('/pages/order/order?state=2')" hover-class="common-hover"
  85. :hover-stay-time="50">
  86. <view class="icon position-relative">
  87. <image class="icon-img" src="../../static/icon/userIconGet.png" mode="aspectFit">
  88. </image>
  89. <view class="corner" v-if="user.received_count > 0">
  90. <text>{{ user.received_count }}</text>
  91. </view>
  92. </view>
  93. <text>待收货</text>
  94. </view>
  95. <view class="order-item" @click="navTo('/pages/order/orderAfter?state=0')"
  96. hover-class="common-hover" :hover-stay-time="50">
  97. <view class="icon position-relative">
  98. <image class="icon-img" src="../../static/icon/userIconout.png" mode="aspectFit">
  99. </image>
  100. <!-- <view class="corner" v-if="orderInfo.complete_count > 0">
  101. <text>{{ orderInfo.complete_count }}</text>
  102. </view> -->
  103. </view>
  104. <text>售后</text>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="listBox">
  109. <view class="list">
  110. <view class="flex listItem" @click="navTo('/pages/user/sqmy')" v-if="userInfo.uid && userInfo.battery_deposit !== 1">
  111. <view class="flex titleBox">
  112. <image class="listIconImg" src="../../static/icon/sqmy.png" mode=""></image>
  113. <text class="title">申请免押</text>
  114. </view>
  115. <view class="right flex">
  116. <text></text>
  117. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  118. </view>
  119. </view>
  120. <view class="flex listItem" @click="navTo('/pages/user/myRent')">
  121. <view class="flex titleBox">
  122. <image class="listIconImg" src="../../static/icon/dc.png" mode=""></image>
  123. <text class="title">我的设备</text>
  124. </view>
  125. <view class="right flex">
  126. <text></text>
  127. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  128. </view>
  129. </view>
  130. <view class="flex listItem" @click="navTo('/pages/index/actionList')">
  131. <view class="flex titleBox">
  132. <image class="listIconImg" src="../../static/icon/action.png" mode=""></image>
  133. <text class="title">活动</text>
  134. </view>
  135. <view class="right flex">
  136. <text></text>
  137. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  138. </view>
  139. </view>
  140. <view class="flex listItem" @click="navTo('/pages/user/storage')">
  141. <view class="flex titleBox">
  142. <image class="listIconImg" src="../../static/icon/myaction.png" mode=""></image>
  143. <text class="title">我的活动</text>
  144. </view>
  145. <view class="right flex">
  146. <text></text>
  147. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  148. </view>
  149. </view>
  150. <!-- store_auth -->
  151. <!-- v-if="user.uid && user.store_auth != 0" -->
  152. <view class="flex listItem" @click="navTo('/pages/user/storage')">
  153. <view class="flex titleBox">
  154. <image class="listIconImg" src="../../static/icon/ruku.png" mode=""></image>
  155. <text class="title">入库</text>
  156. </view>
  157. <view class="right flex">
  158. <text></text>
  159. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  160. </view>
  161. </view>
  162. <!-- <view class="flex listItem" @click="navTo('/pages/user/myCart/myCart')">
  163. <view class="flex titleBox">
  164. <image class="listIconImg" src="../../static/icon/myCart.png" mode="widthFix"></image>
  165. <text class="title">我的车辆</text>
  166. </view>
  167. <view class="right flex">
  168. <text></text>
  169. </view>
  170. </view> -->
  171. <!-- <view class="flex listItem" @click="navTo('/pages/user/repair/userRepair')">
  172. <view class="flex titleBox">
  173. <image class="listIconImg" src="../../static/icon/myWx.png" mode="widthFix"></image>
  174. <text class="title">维修历史</text>
  175. </view>
  176. <view class="right flex">
  177. <text></text>
  178. </view>
  179. </view> -->
  180. <view class="flex listItem" v-if="fx" @click="navTo('/pages/user/myteam')">
  181. <view class="flex titleBox">
  182. <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
  183. <text class="title">我的团队</text>
  184. </view>
  185. <view class="right flex">
  186. <text></text>
  187. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  188. </view>
  189. </view>
  190. <view class="flex listItem" @click="navTo('/pages/set/address')">
  191. <view class="flex titleBox">
  192. <image class="listIconImg" src="../../static/icon/myAddress.png" mode="widthFix">
  193. </image>
  194. <text class="title">我的地址</text>
  195. </view>
  196. <view class="right flex">
  197. <text></text>
  198. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  199. </view>
  200. </view>
  201. <!-- #ifndef APP -->
  202. <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
  203. <view class="flex titleBox">
  204. <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
  205. <text class="title">邀请好友</text>
  206. </view>
  207. <view class="right flex">
  208. <text></text>
  209. </view>
  210. </view>
  211. <!-- #endif -->
  212. <!-- #ifdef APP -->
  213. <view class="flex listItem" @click="shareDomApp">
  214. <view class="flex titleBox">
  215. <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
  216. <text class="title">邀请好友</text>
  217. </view>
  218. <view class="right flex">
  219. <text></text>
  220. </view>
  221. </view>
  222. <!-- #endif -->
  223. <!-- #ifndef MP -->
  224. <view class="flex listItem" @click="navTo('/pages/public/workwork')">
  225. <view class="flex titleBox">
  226. <image class="listIconImg" src="../../static/icon/myServer.png" mode="widthFix"></image>
  227. <text class="title">关于我们</text>
  228. </view>
  229. <view class="right flex">
  230. <text></text>
  231. </view>
  232. </view>
  233. <!-- #endif -->
  234. <view class="flex listItem" @click="navTo('/pages/set/set')">
  235. <view class="flex titleBox">
  236. <image class="listIconImg" src="../../static/icon/mySet.png" mode="widthFix"></image>
  237. <text class="title">设置</text>
  238. </view>
  239. <view class="right flex">
  240. <text></text>
  241. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  242. </view>
  243. </view>
  244. </view>
  245. </view>
  246. <view class="tapBottom" v-if='user.adminid' @click="changeTab">
  247. 前往商家界面
  248. </view>
  249. </view>
  250. </scroll-view>
  251. </view>
  252. </template>
  253. <script>
  254. import {
  255. mapState,
  256. mapMutations
  257. } from 'vuex';
  258. import {
  259. share
  260. } from '@/api/wx';
  261. import {
  262. getUser
  263. } from '@/api/user.js';
  264. import {
  265. articleList,
  266. notify
  267. } from '@/api/index.js';
  268. import {
  269. saveUrl,
  270. interceptor
  271. } from '@/utils/loginUtils.js';
  272. export default {
  273. data() {
  274. return {
  275. user: {
  276. avatar: '', //头像
  277. nickname: '', //昵称
  278. now_money: 0, //余额
  279. brokerage_price: 0, //佣金
  280. record_sum: 0, //行程
  281. notice_sum: 0, //报警信息
  282. question_sum: 0, //系统消息
  283. // 订单数据类型
  284. orderStatusNum: {
  285. unpaid_count: 0, //待付款
  286. received_count: 0, //待收货
  287. },
  288. },
  289. shareData: {}
  290. };
  291. },
  292. computed: {
  293. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  294. ...mapState(['baseURL', 'urlFile']),
  295. ...mapState(['fx']),
  296. // 总消息条数
  297. notic() {
  298. return this.user.question_sum + this.user.notice_sum;
  299. },
  300. },
  301. // 创建时获取分享信息
  302. created() {
  303. share().then((res) => {
  304. this.shareData = res.data.data
  305. }).catch((res) => {
  306. console.log(res, '分享加载失败');
  307. })
  308. },
  309. methods: {
  310. //#ifdef APP
  311. shareDomApp() {
  312. uni.share({
  313. provider: 'weixin',
  314. type: 0,
  315. title: '卡羚能服智能电动车',
  316. summary: '新一代智能电动车,手机开关锁、智能防盗、卫星定位,时刻掌握爱车位置。品牌大厂生产,质量好,款式多,售后优,所有车辆支持0元购新车!',
  317. imageUrl: this.shareData.img,
  318. href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
  319. })
  320. },
  321. //#endif
  322. // 获取用户数据
  323. getUser() {
  324. const that = this;
  325. getUser({}).then((e) => {
  326. this.user = e.data;
  327. }).catch((e) => {
  328. console.log(e);
  329. })
  330. // 系统消息
  331. articleList({}, 1).then((e) => {
  332. that.user.question_sum = e.data.count
  333. console.log(that, 1);
  334. }).catch((e) => {
  335. console.log(e);
  336. })
  337. // 报警消息
  338. notify().then((e) => {
  339. that.user.notice_sum = e.data.count
  340. }).catch((e) => {
  341. console.log(e);
  342. })
  343. },
  344. changeTab() {
  345. this.$emit('tab', true)
  346. },
  347. navTo(url) {
  348. if (!this.hasLogin) {
  349. // 保存地址
  350. saveUrl();
  351. // 登录拦截
  352. interceptor();
  353. } else {
  354. uni.navigateTo({
  355. url,
  356. fail(e) {
  357. console.log(e);
  358. }
  359. });
  360. }
  361. },
  362. }
  363. };
  364. </script>
  365. <style lang="scss">
  366. page {
  367. height: 100%;
  368. }
  369. .tapBottom {
  370. margin: 0 50rpx;
  371. text-align: center;
  372. color: #FFFFFF;
  373. border: 1px solid $color-red;
  374. background-color: $color-red;
  375. line-height: 1;
  376. padding: 25rpx;
  377. border-radius: 100rpx;
  378. margin-top: 50rpx;
  379. }
  380. .listBox {
  381. margin-top: 20rpx;
  382. background-color: #FFFFFF;
  383. border-radius: 20rpx;
  384. overflow: hidden;
  385. }
  386. .list {
  387. .listItem {
  388. padding: 35rpx 40rpx;
  389. border-bottom: 1px solid $page-color-light;
  390. }
  391. .listIconImg {
  392. width: 36rpx;
  393. height: 36rpx;
  394. }
  395. .right {
  396. .img {
  397. width: 26rpx;
  398. }
  399. }
  400. .titleBox {
  401. .title {
  402. padding-left: 20rpx;
  403. color: $font-color-base;
  404. font-size: $font-base;
  405. }
  406. }
  407. }
  408. %flex-center {
  409. display: flex;
  410. flex-direction: column;
  411. justify-content: center;
  412. align-items: center;
  413. }
  414. %section {
  415. display: flex;
  416. justify-content: space-around;
  417. align-content: center;
  418. border-radius: 10rpx;
  419. }
  420. .container {
  421. height: 100%;
  422. background-color: $page-color-base;
  423. }
  424. .content-box {
  425. height: 100%;
  426. }
  427. .vheigh {
  428. height: var(--status-bar-height);
  429. }
  430. .user-section {
  431. padding: 15rpx 30rpx 0;
  432. position: relative;
  433. }
  434. .user-info-box {
  435. height: 180rpx;
  436. color: white;
  437. display: flex;
  438. align-items: center;
  439. justify-content: space-between;
  440. position: relative;
  441. z-index: 1;
  442. .detail {
  443. height: 130rpx;
  444. flex-grow: 1;
  445. overflow: hidden;
  446. .portrait-box {
  447. height: 100%;
  448. .portrait {
  449. width: 130rpx;
  450. height: 100%;
  451. border: 5rpx solid #fff;
  452. border-radius: 50%;
  453. }
  454. }
  455. .info-box {
  456. margin-left: 20rpx;
  457. line-height: 1.5;
  458. flex-grow: 1;
  459. overflow: hidden;
  460. .tipLevel {
  461. height: 36rpx;
  462. margin-right: 20rpx;
  463. }
  464. .username {
  465. font-size: 40rpx;
  466. color: $font-color-dark;
  467. font-weight: bold;
  468. height: 100%;
  469. }
  470. .authentication {
  471. border: 2rpx solid #FF4241;
  472. border-radius: 20px;
  473. padding: 0 25rpx;
  474. font-size: 24rpx;
  475. color: #FF4241;
  476. float: left;
  477. &.success {
  478. border: 2rpx solid $color-green;
  479. color: $color-green;
  480. }
  481. }
  482. }
  483. }
  484. }
  485. .cover-container {
  486. padding: 0 30rpx;
  487. position: relative;
  488. padding-bottom: 20rpx;
  489. }
  490. .tj-sction {
  491. @extend %section;
  492. .tj-item {
  493. @extend %flex-center;
  494. flex-direction: column;
  495. height: 100rpx;
  496. font-size: $font-sm;
  497. color: $font-color-light;
  498. }
  499. .num {
  500. font-size: $font-base;
  501. color: $font-color-dark;
  502. margin-bottom: 8rpx;
  503. font-weight: bold;
  504. }
  505. }
  506. .item-box {
  507. border-radius: 20rpx;
  508. background-color: white;
  509. margin-top: 20rpx;
  510. .box-title {
  511. line-height: 1;
  512. padding: 30rpx;
  513. .title {
  514. font-size: $font-lg;
  515. font-weight: bold;
  516. }
  517. .link {
  518. font-size: $font-base - 2rpx;
  519. color: $font-color-light;
  520. }
  521. }
  522. .order-section {
  523. @extend %section;
  524. padding: 28rpx 0;
  525. padding-top: 0;
  526. .order-item {
  527. @extend %flex-center;
  528. width: 120rpx;
  529. height: 120rpx;
  530. border-radius: 10rpx;
  531. font-size: $font-sm;
  532. color: $font-color-dark;
  533. }
  534. .iconfont {
  535. font-size: 48rpx;
  536. margin-bottom: 18rpx;
  537. color: #fa436a;
  538. }
  539. .icon-shouhoutuikuan {
  540. font-size: 44rpx;
  541. }
  542. .icon {
  543. height: 50rpx;
  544. width: 48rpx;
  545. margin-bottom: 18rpx;
  546. background-size: 100%;
  547. background-repeat: no-repeat;
  548. background-position: center;
  549. .icon-img {
  550. width: 100%;
  551. height: 100%;
  552. }
  553. }
  554. }
  555. }
  556. .history-section {
  557. // padding: 30rpx 0 0;
  558. margin-top: 20rpx;
  559. background: #fff;
  560. border-radius: 10rpx;
  561. .h-list {
  562. white-space: nowrap;
  563. padding: 30rpx 30rpx 0;
  564. .h-list-image {
  565. display: inline-block;
  566. width: 160rpx;
  567. height: 160rpx;
  568. margin-right: 20rpx;
  569. border-radius: 10rpx;
  570. }
  571. }
  572. }
  573. </style>