user.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. <template>
  2. <view class="container">
  3. <!-- <view class="user-section">
  4. <view class="bg">
  5. <image class="bg_ware" src="https://moyv.top/wechat/images/bg_wave.gif"></image>
  6. </view>
  7. <view class="user-info-box">
  8. <view class="portrait-box">
  9. <image v-if="userInfo" class="portrait" :src="userInfo.avatarUrl"></image>
  10. <u-avatar v-else class="portrait" text=""></u-avatar>
  11. </view>
  12. <view class="info-box">
  13. <view @click="toLogin" class="username">{{hasLogin? (userInfo.userName || '点击修改昵称') : '立即登录' }}</view>
  14. </view>
  15. </view>
  16. </view> -->
  17. <view class="indexUp flex">
  18. <image src="../../static/img/myimg/YongHu@3x.png" class="headPortrait"></image>
  19. <view class="personal">
  20. <view class="information">用户名:</view>
  21. <view class="information">手机号:</view>
  22. </view>
  23. </view>
  24. <view class="cover-container">
  25. <view class="cu-list menu text-left solid-top indexlow">
  26. <view class="cu-item" v-for="(item, index) in gridList" v-if="item.show" :key="index"
  27. @click="gridClick(item, index)" hover-class="common-hover" :hover-stay-time="50">
  28. <view>
  29. <text :class="item.icon" class="grid_icon icon text-grey"></text>
  30. <text class="text-grey">{{item.name}}</text>
  31. </view>
  32. <view>
  33. <text v-if='item.num==4&&taskTip' class='badge_user'>{{taskTip}}</text>
  34. <text v-if='item.num==2&&contractTip' class='badge_user'>{{contractTip}}</text>
  35. <text class='tip_text cuIcon-right'></text>
  36. </view>
  37. </view>
  38. <!-- <view class='cu-item' @click='scanCode'>
  39. <view>
  40. <text class="cuIcon-scan icon text-grey"></text>
  41. <text class="text-grey">扫一扫</text>
  42. </view>
  43. <view class = 'tip_text cuIcon-right' ></view>
  44. </view> -->
  45. </view>
  46. <view style='text-align:center;'>
  47. <navigator
  48. url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/userAgreement.html"
  49. class="path" hover-class="navigator-hover">《服务协议》</navigator>|<navigator
  50. url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/screctAgreement.html"
  51. class="path" hover-class="navigator-hover">《隐私政策》</navigator>
  52. </view>
  53. </view>
  54. <neil-modal :show="inputShow" @close="cancel" :style="{display:inputStatus}" title="修改昵称" showCancel="true">
  55. <input v-model="inputContent" style="margin:20upx;" placeholder="请输入昵称" />
  56. <button class="margin:20upx;bg-green">
  57. 确认修改
  58. </button>
  59. </neil-modal>
  60. </view>
  61. </template>
  62. <script>
  63. import dragButton from "@/components/drag-button/drag-button.vue";
  64. import neilModal from '@/components/neil-modal/neil-modal.vue';
  65. import {
  66. mapState
  67. } from 'vuex';
  68. let startY = 0,
  69. moveY = 0,
  70. pageAtTop = true;
  71. export default {
  72. components: {
  73. neilModal,
  74. dragButton
  75. },
  76. data() {
  77. return {
  78. inputShow: false,
  79. modalName: '',
  80. mycarStyle: '',
  81. feild: undefined,
  82. inputContent: '',
  83. coverTransform: 'translateY(0px)',
  84. coverTransition: '0s',
  85. moving: false,
  86. footprintList: [],
  87. isVip: false,
  88. userInfoTmp: [],
  89. inputStatus: 'none',
  90. carInfo: [],
  91. gridList: [
  92. // {
  93. // num:0,
  94. // name: '货源信息',
  95. // icon:'cuIcon-apps',
  96. // tips: 0,
  97. // url:'/pages/tran/my_tran?TabCur=0',
  98. // show:true
  99. // },
  100. // {
  101. // num:1,
  102. // name: '承运信息',
  103. // icon:'cuIcon-calendar',
  104. // tips: 0,
  105. // url:'/pages/tran/my_tran?TabCur=1',
  106. // show:true
  107. // },
  108. // {
  109. // num:2,
  110. // name: '我的合同',
  111. // icon:'cuIcon-copy',
  112. // tips: 0,
  113. // url:'/pageB/contract/contract',
  114. // show:true
  115. // },
  116. // {
  117. // num:3,
  118. // name: '消息列表',
  119. // icon:'cuIcon-news',
  120. // tips: 0,
  121. // url:'/pages/user/message',
  122. // show:true
  123. // },
  124. // {
  125. // num:4,
  126. // name: '任务中心',
  127. // icon:'cuIcon-copy',
  128. // tips: 0,
  129. // url:`/pages/user/task`,
  130. // show:true
  131. // },
  132. // {
  133. // num:5,
  134. // name: '我的车辆',
  135. // icon:'cuIcon-deliver',
  136. // tips: 0,
  137. // url:'',
  138. // show:true
  139. // },
  140. // {
  141. // num:6,
  142. // name: '联系我们',
  143. // icon:'cuIcon-phone',
  144. // tips: 0,
  145. // url:'/pages/user/contact',
  146. // show:true
  147. // },
  148. // {
  149. {
  150. num: 0,
  151. name: '身份认证',
  152. icon: 'cuIcon-apps',
  153. tips: 0,
  154. url: '/pages/attestation/index',
  155. show: true
  156. },
  157. {
  158. num: 1,
  159. name: '我的合同',
  160. icon: 'cuIcon-calendar',
  161. tips: 0,
  162. url: '/pageB/contract/contract',
  163. show: true
  164. },
  165. {
  166. num: 2,
  167. name: '我的任务',
  168. icon: 'cuIcon-copy',
  169. tips: 0,
  170. url: '/pages/task/my_task',
  171. show: true
  172. },
  173. {
  174. num: 3,
  175. name: '我的发布',
  176. icon: 'cuIcon-news',
  177. tips: 0,
  178. url: `/pages/release/release`,
  179. show: true
  180. },
  181. {
  182. num: 4,
  183. name: '货运收发',
  184. icon: 'cuIcon-copy',
  185. tips: 0,
  186. url: `/pages/user/task`,
  187. show: true
  188. },
  189. // {
  190. // num:5,
  191. // name: '退出登录',
  192. // icon:'cuIcon-exit',
  193. // tips: 0,
  194. // url:'',
  195. // show:true
  196. // },
  197. ],
  198. showTran: true,
  199. companyId: 1,
  200. current: 4
  201. }
  202. },
  203. onShow() {
  204. console.log(uni.getStorageSync('userInfo'))
  205. uni.showTabBar()
  206. this.loadData()
  207. },
  208. onLoad() {},
  209. // #ifndef MP
  210. onNavigationBarButtonTap(e) {
  211. const index = e.index;
  212. if (index === 0) {
  213. this.navTo('/pages/set/set');
  214. } else if (index === 1) {
  215. // #ifdef APP-PLUS
  216. const pages = getCurrentPages();
  217. const page = pages[pages.length - 1];
  218. const currentWebview = page.$getAppWebview();
  219. currentWebview.hideTitleNViewButtonRedDot({
  220. index
  221. });
  222. // #endif
  223. uni.navigateTo({
  224. url: '/pages/notice/notice'
  225. })
  226. }
  227. },
  228. // #endif
  229. computed: {
  230. ...mapState(['hasLogin', 'userInfo'])
  231. },
  232. methods: {
  233. zhibo() {
  234. uni.navigateTo({
  235. url: `/pageB/video/broadcast`
  236. })
  237. },
  238. look() {
  239. uni.navigateTo({
  240. url: `/pageB/video/look`
  241. })
  242. },
  243. contactUs() {
  244. const that = this
  245. uni.makePhoneCall({
  246. // 手机号
  247. phoneNumber: '18241771147',
  248. // 成功回调
  249. success: (res) => {},
  250. // 失败回调
  251. fail: (res) => {}
  252. });
  253. },
  254. loadData() {
  255. // const that = this
  256. // if(uni.getStorageSync("PageCur")){
  257. // that.PageCur = uni.getStorageSync("PageCur");
  258. // }
  259. // that.userInfoTmp = uni.getStorageSync("userInfo")
  260. // uni.showLoading({
  261. // title: '正在加载',
  262. // mask:true
  263. // })
  264. // that.$api.request('integral', 'getIndexData', failres => {
  265. // that.$api.msg(failres.errmsg)
  266. // uni.hideLoading()
  267. // }).then(res => {
  268. // let data = res.data
  269. // uni.setStorageSync("message", data.message);
  270. // uni.setStorageSync("task", data.task);
  271. // uni.setStorageSync("contract", data.contract);
  272. // uni.setStorageSync('showTran', data.showTran);
  273. // that.showTran = data.showTran
  274. // that.gridList[4].tips = data.task
  275. // that.gridList[2].tips = data.contract
  276. // that.companyId = data.companyId
  277. // uni.hideLoading()
  278. // })
  279. },
  280. gridClick(item, index) {
  281. var that = this
  282. if (item.name == "退出登录") {
  283. this.logout()
  284. return;
  285. } else if (item.name == "联系我们") {
  286. //#ifdef MP
  287. this.inputShow = true
  288. this.inputStatus = 'inline'
  289. this.feild = "nickname"
  290. this.inputContent = ''
  291. //#endif
  292. //#ifdef APP-PLUS
  293. this.contactUs()
  294. //#endif
  295. return;
  296. } else if (item.name == '我的车辆') {
  297. const that = this
  298. uni.showLoading({
  299. title: '正在加载',
  300. mask: true
  301. })
  302. that.$api.request('tran', 'getMyCarList', failres => {
  303. that.$api.msg(failres.errmsg)
  304. uni.hideLoading()
  305. }).then(res => {
  306. that.carInfo = res.data
  307. if (that.carInfo.length == 0) {
  308. that.$api.msg('暂无车辆信息')
  309. } else {
  310. var height = that.carInfo.length * 100
  311. var width = 500
  312. that.mycarStyle = "height:" + height + "rpx;width:" + width + "rpx"
  313. that.modalName = 'MycarModal'
  314. }
  315. uni.hideLoading()
  316. })
  317. return;
  318. }
  319. if (item.url) {
  320. uni.navigateTo({
  321. url: item.url + `?companyId=${that.companyId}`
  322. })
  323. }
  324. },
  325. toLogin() {
  326. if (!this.hasLogin) {
  327. uni.navigateTo({
  328. url: '/pages/public/login'
  329. })
  330. }
  331. // else if(!this.userInfo.nickname){
  332. // this.inputShow = true
  333. // this.inputStatus = 'inline'
  334. // this.feild = "nickname"
  335. // this.inputContent = ''
  336. // }
  337. },
  338. confirm() {
  339. const that = this
  340. if (!that.inputContent) {
  341. that.$api.msg('输入不能为空')
  342. return
  343. }
  344. let obj = {}
  345. obj[that.feild] = that.inputContent
  346. that.$api.request('user', 'syncUserInfo', obj).then(res => {
  347. that.userInfo.nickname = that.inputContent
  348. that.inputContent = ''
  349. that.$store.commit('login', that.userInfo)
  350. })
  351. },
  352. cancel() {
  353. this.inputShow = false
  354. this.inputStatus = 'none'
  355. this.genderShow = false
  356. },
  357. myAccount() {
  358. uni.navigateTo({
  359. url: `/pageA/pages/contract`
  360. })
  361. },
  362. logout() {
  363. const that = this
  364. uni.showModal({
  365. title: '询问',
  366. content: '您确定要退出吗?',
  367. cancelText: '取消',
  368. confirmText: '确定',
  369. success: (e) => {
  370. if (e.confirm) {
  371. uni.clearStorageSync();
  372. that.$store.commit('logout')
  373. that.$api.logout()
  374. }
  375. }
  376. })
  377. },
  378. /**
  379. * 统一跳转接口,拦截未登录路由
  380. * navigator标签现在默认没有转场动画,所以用view
  381. */
  382. navTo(url) {
  383. if (!this.hasLogin) {
  384. url = '/pages/public/login';
  385. }
  386. uni.navigateTo({
  387. url
  388. })
  389. },
  390. mycarClick(carNo) {
  391. this.modalName = null
  392. uni.navigateTo({
  393. url: `/pageB/car/mycar_detail?carNo=${carNo}`
  394. })
  395. },
  396. qrClick(userInfo) {
  397. this.modalName = null
  398. uni.navigateTo({
  399. url: `/pages/user/qr`
  400. })
  401. },
  402. scanCode() {
  403. uni.scanCode({
  404. success: function(res) {
  405. uni.navigateTo({
  406. url: res.result
  407. })
  408. }
  409. })
  410. },
  411. hideModal(e) {
  412. this.modalName = null
  413. },
  414. }
  415. }
  416. </script>
  417. <style lang='scss' scoped>
  418. .container {
  419. padding-top: 85px;
  420. background-color: #F5F6FA;
  421. position: relative;
  422. width: 100vw;
  423. height: 100vh;
  424. overflow: hidden;
  425. background: url('~@/static/img/login/bg.png');
  426. background-size: 100% 100%;
  427. margin: 0 auto;
  428. }
  429. .cu-tag.badge {
  430. right: 26rpx;
  431. }
  432. .path {
  433. color: #007aff;
  434. display: inline-block;
  435. text-align: center;
  436. }
  437. .icon {
  438. margin-right: 10rpx;
  439. }
  440. .portrait-box {
  441. margin-top: 20rpx;
  442. }
  443. .qr-wrap {
  444. margin-top: 20upx;
  445. color: #fff;
  446. font-size: 32rpx;
  447. }
  448. .cu-list {
  449. /* height: 483rpx;
  450. overflow-y: scroll; */
  451. margin-top: 42rpx;
  452. margin-bottom: 80rpx;
  453. }
  454. .badge_user {
  455. color: #fff;
  456. background-color: #dc3545;
  457. display: inline-block;
  458. padding: .25em .4em;
  459. font-size: 75%;
  460. font-weight: 700;
  461. line-height: 1;
  462. text-align: center;
  463. white-space: nowrap;
  464. vertical-align: top;
  465. border-radius: 50%;
  466. transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
  467. }
  468. @keyframes move_wave {
  469. 0% {
  470. transform: translateX(0) translateZ(0) scaleY(1)
  471. }
  472. 50% {
  473. transform: translateX(-25%) translateZ(0) scaleY(0.55)
  474. }
  475. 100% {
  476. transform: translateX(-50%) translateZ(0) scaleY(1)
  477. }
  478. }
  479. .bg {
  480. position: relative;
  481. height: 300rpx;
  482. /* background: linear-gradient(to bottom, #56ccf2, #2f80ed); */
  483. /*background: linear-gradient(to bottom, #0be9fe, #4bb0fe); */
  484. background: linear-gradient(to bottom, #d5f8ff, #56ccf2);
  485. }
  486. .bg_ware {
  487. position: absolute;
  488. left: 0;
  489. bottom: -2rpx;
  490. width: 100%;
  491. mix-blend-mode: screen;
  492. height: 224rpx;
  493. }
  494. %flex-center {
  495. display: flex;
  496. flex-direction: column;
  497. justify-content: center;
  498. align-items: center;
  499. }
  500. %section {
  501. display: flex;
  502. justify-content: space-around;
  503. align-content: center;
  504. background: #fff;
  505. border-radius: 10upx;
  506. }
  507. .grid-item-box {
  508. flex: 1;
  509. /* position: relative;
  510. */
  511. /* #ifndef APP-NVUE */
  512. display: flex;
  513. /* #endif */
  514. flex-direction: column;
  515. align-items: center;
  516. justify-content: center;
  517. padding: 15px 0;
  518. }
  519. .image {
  520. width: 80rpx;
  521. height: 80rpx;
  522. }
  523. .text {
  524. font-size: 26rpx;
  525. margin-top: 10rpx;
  526. }
  527. .user-section {
  528. height: 520upx;
  529. padding: 100upx 30upx 0;
  530. position: relative;
  531. .bg {
  532. position: absolute;
  533. left: 0;
  534. top: 0;
  535. width: 100%;
  536. height: 100%;
  537. filter: blur(1px);
  538. box-shadow: 0px 1px 8px #ccc;
  539. /* background:linear-gradient(#0eb0c9,#126bae); */
  540. /* opacity: .7; */
  541. }
  542. }
  543. .user-info-box {
  544. height: 180upx;
  545. /* display:flex; */
  546. /* align-items:center; */
  547. text-align: center;
  548. position: relative;
  549. z-index: 1;
  550. .portrait {
  551. width: 130upx;
  552. height: 130upx;
  553. border: 5upx solid #fff;
  554. border-radius: 50%;
  555. }
  556. .username {
  557. font-size: $font-lg + 3upx;
  558. color: #fff;
  559. margin-top: 20upx;
  560. }
  561. }
  562. .vip-card-box {
  563. display: flex;
  564. flex-direction: column;
  565. color: #f7d680;
  566. height: 240upx;
  567. background: linear-gradient(left, rgba(0, 0, 0, .7), rgba(0, 0, 0, .8));
  568. border-radius: 16upx 16upx 0 0;
  569. overflow: hidden;
  570. position: relative;
  571. padding: 20upx 24upx;
  572. .card-bg {
  573. position: absolute;
  574. top: 20upx;
  575. right: 0;
  576. width: 380upx;
  577. height: 260upx;
  578. }
  579. .b-btn {
  580. position: absolute;
  581. right: 20upx;
  582. top: 16upx;
  583. width: 132upx;
  584. height: 40upx;
  585. text-align: center;
  586. line-height: 40upx;
  587. font-size: 22upx;
  588. color: #36343c;
  589. border-radius: 20px;
  590. background: linear-gradient(left, #f9e6af, #ffd465);
  591. z-index: 1;
  592. }
  593. .tit {
  594. font-size: $font-base+2upx;
  595. color: #f7d680;
  596. margin-bottom: 28upx;
  597. .yticon {
  598. color: #f6e5a3;
  599. margin-right: 16upx;
  600. }
  601. }
  602. .e-b {
  603. font-size: $font-sm;
  604. color: #d8cba9;
  605. margin-top: 10upx;
  606. }
  607. }
  608. .cover-container {
  609. padding: 1px 10px ;
  610. padding-bottom: 200upx;
  611. background-color: #F5F6FA;
  612. /* border-radius: 20px; */
  613. margin-top: 50px;
  614. .arc {
  615. position: absolute;
  616. left: 0;
  617. top: -34upx;
  618. width: 100%;
  619. height: 36upx;
  620. }
  621. }
  622. .tj-sction {
  623. @extend %section;
  624. .tj-item {
  625. @extend %flex-center;
  626. flex-direction: column;
  627. height: 140upx;
  628. font-size: $font-sm;
  629. color: #75787d;
  630. }
  631. .num {
  632. font-size: $font-lg;
  633. color: $font-color-dark;
  634. margin-bottom: 8upx;
  635. }
  636. }
  637. .order-section {
  638. @extend %section;
  639. padding: 28upx 0;
  640. margin-top: 20upx;
  641. .order-item {
  642. @extend %flex-center;
  643. width: 120upx;
  644. height: 120upx;
  645. border-radius: 10upx;
  646. font-size: $font-sm;
  647. color: $font-color-dark;
  648. }
  649. .yticon {
  650. font-size: 48upx;
  651. margin-bottom: 18upx;
  652. color: #fa436a;
  653. }
  654. .icon-shouhoutuikuan {
  655. font-size: 44upx;
  656. }
  657. }
  658. .history-section {
  659. padding: 30upx 0 0;
  660. margin-top: 20upx;
  661. background: #fff;
  662. border-radius: 10upx;
  663. .sec-header {
  664. display: flex;
  665. align-items: center;
  666. font-size: $font-base;
  667. color: $font-color-dark;
  668. line-height: 40upx;
  669. margin-left: 30upx;
  670. .yticon {
  671. font-size: 44upx;
  672. color: #5eba8f;
  673. margin-right: 16upx;
  674. line-height: 40upx;
  675. }
  676. }
  677. .h-list {
  678. white-space: nowrap;
  679. padding: 30upx 30upx 0;
  680. image {
  681. display: inline-block;
  682. width: 160upx;
  683. height: 160upx;
  684. margin-right: 20upx;
  685. border-radius: 10upx;
  686. }
  687. }
  688. }
  689. .grid {
  690. display: flex;
  691. align-items: center;
  692. flex-wrap: wrap;
  693. /* border-top: 2upx solid rgba(172,172,172,.2); */
  694. .grid-item-3 {
  695. box-sizing: border-box;
  696. width: calc(100% / 3);
  697. border-bottom: 2upx solid rgba(172, 172, 172, .2);
  698. border-right: 2upx solid rgba(172, 172, 172, .2);
  699. text-align: center;
  700. padding: 40upx 0;
  701. position: relative;
  702. /* view{
  703. font-size: $font-sm;
  704. margin-top: 16upx;
  705. color: $font-color-dark;
  706. } */
  707. .grid_icon {
  708. font-size: 48upx;
  709. margin-bottom: 18upx;
  710. color: #fa436a;
  711. }
  712. .tip_text {
  713. display: block;
  714. padding: 4upx 8upx;
  715. text-align: center;
  716. border-radius: 36upx;
  717. font-size: 24upx;
  718. background-color: #fa436a;
  719. color: rgba(255, 255, 255, 1);
  720. position: absolute;
  721. right: 6upx;
  722. top: 6upx;
  723. }
  724. }
  725. .grid-item-3:nth-child(3n + 3),
  726. .grid-item-4:nth-child(4n + 4) {
  727. border-right: none;
  728. }
  729. }
  730. .headPortrait {
  731. width: 75px;
  732. height: 75px;
  733. border-radius: 40px;
  734. margin-left: 20px;
  735. border: 2px solid #ffffff;
  736. }
  737. .personal {
  738. margin-top: 10px;
  739. margin-left: 20px;
  740. }
  741. .information {
  742. font-size: 15px;
  743. font-weight: 600;
  744. height: 20px;
  745. }
  746. .indexlow{
  747. /* margin-top: 30px; */
  748. border-radius: 20px;
  749. }
  750. </style>