user.vue 16 KB

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