user.vue 15 KB

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