user.vue 15 KB

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