user.vue 16 KB

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