user.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  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:false
  113. },
  114. {
  115. num:1,
  116. name: '承运信息',
  117. icon:'cuIcon-calendar',
  118. tips: 0,
  119. url:'/pages/tran/my_tran?TabCur=1',
  120. show:false
  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:false
  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:false
  153. },
  154. {
  155. num:6,
  156. name: '联系我们',
  157. icon:'cuIcon-phone',
  158. tips: 0,
  159. url:'/pages/user/contact',
  160. show:false
  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. mask:true
  238. })
  239. that.$api.request('integral', 'getIndexData', failres => {
  240. that.$api.msg(failres.errmsg)
  241. uni.hideLoading()
  242. }).then(res => {
  243. let data = res.data
  244. uni.setStorageSync("message", data.message);
  245. uni.setStorageSync("task", data.task);
  246. uni.setStorageSync("contract", data.contract);
  247. uni.setStorageSync('showTran', data.showTran);
  248. that.showTran = data.showTran
  249. that.gridList[4].tips = data.task
  250. that.gridList[2].tips = data.contract
  251. that.companyId = data.companyId
  252. uni.hideLoading()
  253. })
  254. },
  255. gridClick (item, index) {
  256. var that = this
  257. if(item.name == "退出登录"){
  258. this.logout()
  259. return;
  260. }
  261. else if(item.name == "联系我们"){
  262. //#ifdef MP
  263. this.inputShow = true
  264. this.inputStatus = 'inline'
  265. this.feild = "nickname"
  266. this.inputContent = ''
  267. //#endif
  268. //#ifdef APP-PLUS
  269. this.contactUs()
  270. //#endif
  271. return;
  272. }
  273. else if(item.name == '我的车辆'){
  274. const that = this
  275. uni.showLoading({
  276. title: '正在加载',
  277. mask:true
  278. })
  279. that.$api.request('tran', 'getMyCarList', failres => {
  280. that.$api.msg(failres.errmsg)
  281. uni.hideLoading()
  282. }).then(res => {
  283. that.carInfo = res.data
  284. if(that.carInfo.length == 0){
  285. that.$api.msg('暂无车辆信息')
  286. }
  287. else{
  288. var height = that.carInfo.length * 100
  289. var width = 500
  290. that.mycarStyle = "height:"+height+"rpx;width:" + width+"rpx"
  291. that.modalName = 'MycarModal'
  292. }
  293. uni.hideLoading()
  294. })
  295. return;
  296. }
  297. if(item.url){
  298. uni.navigateTo({
  299. url: item.url+`?companyId=${that.companyId}`
  300. })
  301. }
  302. },
  303. toLogin() {
  304. if (!this.hasLogin) {
  305. uni.navigateTo({
  306. url: '/pages/public/login'
  307. })
  308. }
  309. else if(!this.userInfo.nickname){
  310. this.inputShow = true
  311. this.inputStatus = 'inline'
  312. this.feild = "nickname"
  313. this.inputContent = ''
  314. }
  315. },
  316. confirm() {
  317. const that = this
  318. if (!that.inputContent) {
  319. that.$api.msg('输入不能为空')
  320. return
  321. }
  322. let obj = {}
  323. obj[that.feild] = that.inputContent
  324. that.$api.request('user', 'syncUserInfo', obj).then(res => {
  325. that.userInfo.nickname = that.inputContent
  326. that.inputContent = ''
  327. that.$store.commit('login', that.userInfo)
  328. })
  329. },
  330. cancel() {
  331. this.inputShow = false
  332. this.inputStatus = 'none'
  333. this.genderShow = false
  334. },
  335. myAccount(){
  336. uni.navigateTo({
  337. url: `/pageA/pages/contract`
  338. })
  339. },
  340. logout() {
  341. const that = this
  342. uni.showModal({
  343. title: '询问',
  344. content: '您确定要退出吗?',
  345. cancelText: '取消',
  346. confirmText: '确定',
  347. success: (e) => {
  348. if (e.confirm) {
  349. uni.clearStorageSync();
  350. that.$store.commit('logout')
  351. that.$api.logout()
  352. }
  353. }
  354. })
  355. },
  356. /**
  357. * 统一跳转接口,拦截未登录路由
  358. * navigator标签现在默认没有转场动画,所以用view
  359. */
  360. navTo(url){
  361. if(!this.hasLogin){
  362. url = '/pages/public/login';
  363. }
  364. uni.navigateTo({
  365. url
  366. })
  367. },
  368. mycarClick(carNo){
  369. this.modalName = null
  370. uni.navigateTo({
  371. url: `/pageB/car/mycar_detail?carNo=${carNo}`
  372. })
  373. },
  374. qrClick(userInfo){
  375. this.modalName = null
  376. uni.navigateTo({
  377. url: `/pages/user/qr`
  378. })
  379. },
  380. scanCode(){
  381. uni.scanCode({
  382. success: function (res) {
  383. uni.navigateTo({
  384. url: res.result
  385. })
  386. }
  387. })
  388. },
  389. hideModal(e) {
  390. this.modalName = null
  391. },
  392. }
  393. }
  394. </script>
  395. <style lang='scss' scoped>
  396. .cu-tag.badge {
  397. right: 26rpx;
  398. }
  399. .path {
  400. color: #007aff;
  401. display: inline-block;
  402. text-align: center;
  403. }
  404. .icon{
  405. margin-right:10rpx;
  406. }
  407. .portrait-box{
  408. margin-top:20rpx;
  409. }
  410. .qr-wrap{
  411. margin-top:20upx;
  412. color:#fff;
  413. font-size: 32rpx;
  414. }
  415. .cu-list{
  416. /* height: 483rpx;
  417. overflow-y: scroll; */
  418. margin-top: 42rpx;
  419. margin-bottom:80rpx;
  420. }
  421. .badge_user{
  422. color: #fff;
  423. background-color: #dc3545;
  424. display: inline-block;
  425. padding: .25em .4em;
  426. font-size: 75%;
  427. font-weight: 700;
  428. line-height: 1;
  429. text-align: center;
  430. white-space: nowrap;
  431. vertical-align: top;
  432. border-radius: 50%;
  433. transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  434. }
  435. @keyframes move_wave {
  436. 0% {
  437. transform: translateX(0) translateZ(0) scaleY(1)
  438. }
  439. 50% {
  440. transform: translateX(-25%) translateZ(0) scaleY(0.55)
  441. }
  442. 100% {
  443. transform: translateX(-50%) translateZ(0) scaleY(1)
  444. }
  445. }
  446. .bg {
  447. position: relative;
  448. height:300rpx;
  449. /* background: linear-gradient(to bottom, #56ccf2, #2f80ed); */
  450. /*background: linear-gradient(to bottom, #0be9fe, #4bb0fe); */
  451. background: linear-gradient(to bottom, #d5f8ff, #56ccf2);
  452. }
  453. .bg_ware {
  454. position: absolute;
  455. left: 0;
  456. bottom: -2rpx;
  457. width: 100%;
  458. mix-blend-mode: screen;
  459. height: 224rpx;
  460. }
  461. %flex-center {
  462. display:flex;
  463. flex-direction: column;
  464. justify-content: center;
  465. align-items: center;
  466. }
  467. %section {
  468. display:flex;
  469. justify-content: space-around;
  470. align-content: center;
  471. background: #fff;
  472. border-radius: 10upx;
  473. }
  474. .grid-item-box {
  475. flex: 1;
  476. /* position: relative;
  477. */
  478. /* #ifndef APP-NVUE */
  479. display: flex;
  480. /* #endif */
  481. flex-direction: column;
  482. align-items: center;
  483. justify-content: center;
  484. padding: 15px 0;
  485. }
  486. .image {
  487. width: 80rpx;
  488. height: 80rpx;
  489. }
  490. .text {
  491. font-size: 26rpx;
  492. margin-top: 10rpx;
  493. }
  494. .user-section{
  495. height: 520upx;
  496. padding: 100upx 30upx 0;
  497. position:relative;
  498. .bg{
  499. position:absolute;
  500. left: 0;
  501. top: 0;
  502. width: 100%;
  503. height: 100%;
  504. filter: blur(1px);
  505. box-shadow: 0px 1px 8px #ccc;
  506. /* background:linear-gradient(#0eb0c9,#126bae); */
  507. /* opacity: .7; */
  508. }
  509. }
  510. .user-info-box{
  511. height: 180upx;
  512. /* display:flex; */
  513. /* align-items:center; */
  514. text-align:center;
  515. position:relative;
  516. z-index: 1;
  517. .portrait{
  518. width: 130upx;
  519. height: 130upx;
  520. border:5upx solid #fff;
  521. border-radius: 50%;
  522. }
  523. .username{
  524. font-size: $font-lg + 3upx;
  525. color: #fff;
  526. margin-top: 20upx;
  527. }
  528. }
  529. .vip-card-box{
  530. display:flex;
  531. flex-direction: column;
  532. color: #f7d680;
  533. height: 240upx;
  534. background: linear-gradient(left, rgba(0,0,0,.7), rgba(0,0,0,.8));
  535. border-radius: 16upx 16upx 0 0;
  536. overflow: hidden;
  537. position: relative;
  538. padding: 20upx 24upx;
  539. .card-bg{
  540. position:absolute;
  541. top: 20upx;
  542. right: 0;
  543. width: 380upx;
  544. height: 260upx;
  545. }
  546. .b-btn{
  547. position: absolute;
  548. right: 20upx;
  549. top: 16upx;
  550. width: 132upx;
  551. height: 40upx;
  552. text-align: center;
  553. line-height: 40upx;
  554. font-size: 22upx;
  555. color: #36343c;
  556. border-radius: 20px;
  557. background: linear-gradient(left, #f9e6af, #ffd465);
  558. z-index: 1;
  559. }
  560. .tit{
  561. font-size: $font-base+2upx;
  562. color: #f7d680;
  563. margin-bottom: 28upx;
  564. .yticon{
  565. color: #f6e5a3;
  566. margin-right: 16upx;
  567. }
  568. }
  569. .e-b{
  570. font-size: $font-sm;
  571. color: #d8cba9;
  572. margin-top: 10upx;
  573. }
  574. }
  575. .cover-container{
  576. padding-bottom: 200upx;
  577. .arc{
  578. position:absolute;
  579. left: 0;
  580. top: -34upx;
  581. width: 100%;
  582. height: 36upx;
  583. }
  584. }
  585. .tj-sction{
  586. @extend %section;
  587. .tj-item{
  588. @extend %flex-center;
  589. flex-direction: column;
  590. height: 140upx;
  591. font-size: $font-sm;
  592. color: #75787d;
  593. }
  594. .num{
  595. font-size: $font-lg;
  596. color: $font-color-dark;
  597. margin-bottom: 8upx;
  598. }
  599. }
  600. .order-section{
  601. @extend %section;
  602. padding: 28upx 0;
  603. margin-top: 20upx;
  604. .order-item{
  605. @extend %flex-center;
  606. width: 120upx;
  607. height: 120upx;
  608. border-radius: 10upx;
  609. font-size: $font-sm;
  610. color: $font-color-dark;
  611. }
  612. .yticon{
  613. font-size: 48upx;
  614. margin-bottom: 18upx;
  615. color: #fa436a;
  616. }
  617. .icon-shouhoutuikuan{
  618. font-size:44upx;
  619. }
  620. }
  621. .history-section{
  622. padding: 30upx 0 0;
  623. margin-top: 20upx;
  624. background: #fff;
  625. border-radius:10upx;
  626. .sec-header{
  627. display:flex;
  628. align-items: center;
  629. font-size: $font-base;
  630. color: $font-color-dark;
  631. line-height: 40upx;
  632. margin-left: 30upx;
  633. .yticon{
  634. font-size: 44upx;
  635. color: #5eba8f;
  636. margin-right: 16upx;
  637. line-height: 40upx;
  638. }
  639. }
  640. .h-list{
  641. white-space: nowrap;
  642. padding: 30upx 30upx 0;
  643. image{
  644. display:inline-block;
  645. width: 160upx;
  646. height: 160upx;
  647. margin-right: 20upx;
  648. border-radius: 10upx;
  649. }
  650. }
  651. }
  652. .grid{
  653. display: flex;
  654. align-items: center;
  655. flex-wrap: wrap;
  656. /* border-top: 2upx solid rgba(172,172,172,.2); */
  657. .grid-item-3{
  658. box-sizing: border-box;
  659. width: calc(100% / 3);
  660. border-bottom: 2upx solid rgba(172,172,172,.2);
  661. border-right: 2upx solid rgba(172,172,172,.2);
  662. text-align: center;
  663. padding: 40upx 0;
  664. position: relative;
  665. /* view{
  666. font-size: $font-sm;
  667. margin-top: 16upx;
  668. color: $font-color-dark;
  669. } */
  670. .grid_icon{
  671. font-size: 48upx;
  672. margin-bottom: 18upx;
  673. color: #fa436a;
  674. }
  675. .tip_text{
  676. display: block;
  677. padding: 4upx 8upx;
  678. text-align: center;
  679. border-radius: 36upx;
  680. font-size: 24upx;
  681. background-color: #fa436a;
  682. color: rgba(255,255,255,1);
  683. position: absolute;
  684. right: 6upx;
  685. top: 6upx;
  686. }
  687. }
  688. .grid-item-3:nth-child(3n + 3),.grid-item-4:nth-child(4n + 4){
  689. border-right: none;
  690. }
  691. }
  692. </style>