userPage.vue 14 KB

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