index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <template>
  2. <view>
  3. <view class="top-cont">
  4. <image class="bg" src="@/static/image/top_bg.png" mode="widthFix"></image>
  5. <view class="top-inner">
  6. <!-- 这里是状态栏 -->
  7. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  8. <view class="user-info">
  9. <view class="left">
  10. <view class="head-img">
  11. <image :src="user.avatar==null?'/static/image/my_heads_icon64.png':user.avatar" mode="aspectFill"></image>
  12. </view>
  13. <view class="name-phone">
  14. <view class="x-f">
  15. <view class="name" v-if="UserInfo">{{user.nickname}}</view>
  16. <view class="name" v-else>请先登录</view>
  17. <text>{{user.phone?utils.parsePhone(user.phone):'-'}}</text>
  18. </view>
  19. <!-- <view class="phone">
  20. <image class="w32 h32" src="../../static/images/company/phone_icon16.png" mode=""></image>
  21. <text>{{user.phone?utils.parsePhone(user.phone):'-'}}</text>
  22. </view> -->
  23. <view class="vip">
  24. <image class="w24 h24" src="../../static/image/icon_v.png" mode=""></image>
  25. 已认证
  26. </view>
  27. </view>
  28. </view>
  29. <view class="right">
  30. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  31. <image class="w48 h48" src="../../static/image/right_arrow_black_icon24.png" mode=""></image>
  32. </view>
  33. <!-- <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  34. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  35. <image class="w48 h48" src="../../static/images/user/center_set_icon.png" mode=""></image>
  36. </view>
  37. </uni-badge>
  38. <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  39. <view class="msg-box" @click="navgetTo('/pages_user/user/message')">
  40. <image class="w48 h48" src="../../static/images/user/center_new_icon.png" mode=""></image>
  41. </view>
  42. </uni-badge> -->
  43. <!-- <uni-badge size="small" absolute="rightTop" type="error">
  44. <view class="msg-box ml10" @click="navgetTo('/pages_user/user/complaint')">
  45. <u-icon name="edit-pen" color="#222426" size="28"></u-icon>
  46. </view>
  47. </uni-badge> -->
  48. </view>
  49. </view>
  50. <view class="vipbox">
  51. <image src="@/static/image/img_renzheng.png" mode="widthFix"></image>
  52. </view>
  53. <view class="content">
  54. <view class="task-list">
  55. <view class="item" v-for="(item,index) in tabs" :key="index" @click="openLink(item)">
  56. <view class="left">
  57. <image :src="item.icon" mode=""></image>
  58. <view class="title-l">{{item.name}}</view>
  59. </view>
  60. <view class="right">
  61. <!-- <view class="num" v-if="item.num!==0">{{item.num}}</view> -->
  62. <image src="@/static/image/icon_my_more.png" mode=""></image>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- 退出登录按钮 -->
  67. <view class="log-out" @click="logOut">退出登录</view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import {getOrderCount} from '@/api/storeOrder'
  75. import {getUserInfo} from '@/api/user'
  76. export default {
  77. data() {
  78. return {
  79. count0:0,
  80. count1:0,
  81. count2:0,
  82. afterSalesCount:0,
  83. tabs:[
  84. {name:'我的积分',num:12,icon:'/static/image/icon_my_points.png',url:'/pages_user/points'},
  85. {name:'服务单确认',num:3,icon:'/static/image/icon_my_servicelist.png',url:''},
  86. {name:'银行卡',num:8,icon:'/static/image/icon_my_card.png',url:''},
  87. {name:'设置密码',num:0,icon:'/static/image/icon_my_password.png',url:''},
  88. {name:'用户协议',num:0,icon:'/static/image/icon_my_useragreement.png',url:'/web/userAgreement'},
  89. ],
  90. user:{
  91. isPromoter:0,
  92. isWeixinAuth:0,
  93. phone:"",
  94. nickname:"用户昵称",
  95. avatarUrl:"/static/images/detault_head.png"
  96. },
  97. // 状态栏的高度
  98. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  99. // 消息数量
  100. msgNum: 0,
  101. isShow:true,
  102. UserInfo: uni.getStorageSync('AppToken')
  103. };
  104. },
  105. onLoad() {
  106. console.log("onload")
  107. },
  108. onShow() {
  109. console.log("onshow")
  110. //this.getUserInfo();
  111. //this.getOrderCount();
  112. },
  113. onReachBottom() {
  114. console.log("onReachBottom")
  115. this.$refs.product.getGoodsProducts();
  116. },
  117. methods: {
  118. seeChange(){
  119. this.isShow=!this.isShow
  120. },
  121. callService(){
  122. uni.makePhoneCall({
  123. phoneNumber:"4000717770",
  124. success:function(){
  125. console.log('拨打电话成功');
  126. },
  127. fail() {
  128. console.log('打电话失败了');
  129. }
  130. })
  131. },
  132. getOrderCount(){
  133. getOrderCount().then(
  134. res => {
  135. if(res.code==200){
  136. this.count0=res.count0;
  137. this.count1=res.count1;
  138. this.count2=res.count2;
  139. this.afterSalesCount=res.afterSalesCount;
  140. }
  141. },
  142. rej => {}
  143. );
  144. },
  145. logOut(){
  146. uni.showModal({
  147. title:"提示",
  148. content:"确认退出登录吗?",
  149. showCancel:true,
  150. cancelText:'取消',
  151. confirmText:'确定',
  152. success:res=>{
  153. if(res.confirm){
  154. uni.setStorageSync('CompanyUserToken',null);
  155. uni.setStorageSync('AppToken',null);
  156. uni.setStorageSync('userInfo',null);
  157. uni.$emit('refreshLogin');
  158. uni.navigateTo({
  159. url: '/pages/auth/login'
  160. })
  161. }else{
  162. }
  163. }
  164. })
  165. },
  166. openLink(item){
  167. if(item.name=='用户协议'){
  168. this.openH5()
  169. return;
  170. }
  171. uni.navigateTo({
  172. url: item.url
  173. })
  174. // this.utils.isLogin().then(res => {
  175. // if(res){
  176. // uni.navigateTo({
  177. // url: url+'?userId='+this.user.userId
  178. // })
  179. // }
  180. // })
  181. },
  182. toManager(){
  183. // uni.navigateTo({
  184. // url: '/pages_company/index'
  185. // })
  186. if(this.utils.checkCompanyUserLoginState()){
  187. uni.navigateTo({
  188. url: '/pages_company/index'
  189. })
  190. }
  191. else{
  192. uni.navigateTo({
  193. url: '/pages_company/auth/login'
  194. })
  195. }
  196. },
  197. openH5(url){
  198. var requestPath = uni.getStorageSync('requestPath');
  199. uni.setStorageSync('url',requestPath+url);
  200. uni.navigateTo({
  201. url: '../home/web'
  202. })
  203. },
  204. getUserInfo(){
  205. getUserInfo().then(
  206. res => {
  207. if(res.code==200){
  208. if(res.user!=null){
  209. this.user=res.user;
  210. }
  211. else{
  212. this.utils.loginOut();
  213. }
  214. }else{
  215. uni.showToast({
  216. icon:'none',
  217. title: "请求失败",
  218. });
  219. }
  220. },
  221. rej => {}
  222. );
  223. },
  224. // 跳转页面
  225. navgetTo(url) {
  226. this.utils.isLogin().then(res => {
  227. if(res){
  228. uni.navigateTo({
  229. url: url+'?userId='+this.user.userId
  230. })
  231. }
  232. })
  233. },
  234. // 查看订单
  235. showOrder(status) {
  236. uni.navigateTo({
  237. url: '/pages_user/user/storeOrder?status=' + status
  238. })
  239. }
  240. }
  241. }
  242. </script>
  243. <style lang="scss">
  244. .top-cont{
  245. width: 100%;
  246. height: 600rpx;
  247. position: relative;
  248. // background-image: url(../../static/image/top_bg.png);
  249. // background-repeat:no-repeat;
  250. // background-size:100%;
  251. .bg{
  252. width: 100%;
  253. position: absolute;
  254. top: 0;
  255. left: 0;
  256. }
  257. .top-inner{
  258. width: 100%;
  259. height: 100%;
  260. position: absolute;
  261. top: 0;
  262. left: 0;
  263. z-index: 2;
  264. .user-info{
  265. padding: 88upx 30upx 32upx 30upx;
  266. display: flex;
  267. align-items: center;
  268. justify-content: space-between;
  269. .left{
  270. position: relative;
  271. display: flex;
  272. .head-img{
  273. width: 112upx;
  274. height: 112upx;
  275. border-radius: 50%;
  276. overflow: hidden;
  277. margin-right: 32upx;
  278. border: 4upx solid #FFFFFF;
  279. //box-shadow: 0px 5px 15px 2px rgba(0,0,0,0.1);
  280. image{
  281. width: 100%;
  282. height: 100%;
  283. }
  284. }
  285. .name-phone{
  286. // padding-top: 15upx;
  287. display: flex;
  288. align-items: flex-start;
  289. flex-direction: column;
  290. justify-content: space-around;
  291. .name{
  292. font-size: 40upx;
  293. font-family: PingFang SC;
  294. font-weight: bold;
  295. color: #111111;
  296. line-height: 1;
  297. }
  298. text{
  299. font-family: PingFang SC, PingFang SC;
  300. font-weight: 600;
  301. font-size: 28rpx;
  302. }
  303. .phone{
  304. width: 220rpx;
  305. height: 48rpx;
  306. margin-top: 30upx;
  307. background: linear-gradient( 90deg, #FEA501 0%, #FECB8A 100%);
  308. border-radius: 24rpx 24rpx 24rpx 24rpx;
  309. border: 1rpx solid #FEDDB9;
  310. display: flex;
  311. align-items: center;
  312. justify-content: center;
  313. text{
  314. font-size: 24upx;
  315. font-family: PingFang SC;
  316. font-weight: 500;
  317. color: #fff;
  318. line-height: 1;
  319. margin-left: 4rpx;
  320. }
  321. }
  322. .vip{
  323. display: flex;
  324. align-items: center;
  325. justify-content: center;
  326. width: 120rpx;
  327. height: 40rpx;
  328. background: linear-gradient( 90deg, #FFEBAA 0%, #FFD45D 100%);
  329. border-radius: 38rpx 38rpx 38rpx 38rpx;
  330. font-family: PingFang SC, PingFang SC;
  331. font-weight: 500;
  332. font-size: 20rpx;
  333. color: #694511;
  334. }
  335. }
  336. }
  337. .right{
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. .msg-box{
  342. // margin-left: 10upx;
  343. width: 48upx;
  344. height: 48upx;
  345. // image{
  346. // width: 100%;
  347. // height: 100%;
  348. // }
  349. }
  350. .set{
  351. width: 48rpx;
  352. height: 48rpx;
  353. // margin-right: 20rpx;
  354. // image{
  355. // width: 100%;
  356. // height: 100%;
  357. // }
  358. }
  359. }
  360. }
  361. .balance{
  362. padding: 30rpx;
  363. height: 180rpx;
  364. margin: 50rpx 20rpx 0;
  365. border-radius: 16rpx 16rpx 16rpx 16rpx;
  366. background: linear-gradient( 266deg, #E83924 0%, #FEA603 100%);
  367. // background-image:url(../../static/images/balancebg.png);
  368. // background-repeat: no-repeat;
  369. // background-size: 100%;
  370. display: flex;
  371. align-items: center;
  372. justify-content: space-between;
  373. .left{
  374. display: flex;
  375. flex-direction: column;
  376. align-items: flex-start;
  377. justify-content:space-around;
  378. height: 100%;
  379. .text{
  380. font-family: PingFang SC;
  381. font-weight: 400;
  382. font-size: 26rpx;
  383. color: #FFFFFF;
  384. text-align: left;
  385. margin-right: 16rpx;
  386. }
  387. .num{
  388. font-family: Roboto, Roboto;
  389. font-weight: 500;
  390. font-size: 64rpx;
  391. color: #FFFFFF;
  392. }
  393. }
  394. .right{
  395. width: 132rpx;
  396. height: 64rpx;
  397. line-height: 64rpx;
  398. background: #FFFFFF;
  399. border-radius: 32rpx 32rpx 32rpx 32rpx;
  400. font-family: PingFang SC, PingFang SC;
  401. font-weight: 500;
  402. font-size: 26rpx;
  403. color: #FF5030;
  404. text-align: center;
  405. }
  406. }
  407. .my-order{
  408. padding: 20upx 20upx 0;
  409. .inner{
  410. box-sizing: border-box;
  411. height: 245upx;
  412. background: #FFFFFF;
  413. border-radius: 16upx;
  414. padding: 40upx 30upx;
  415. display: flex;
  416. flex-direction: column;
  417. justify-content: space-between;
  418. .title-box{
  419. display: flex;
  420. align-items: center;
  421. justify-content: space-between;
  422. .title{
  423. font-size: 36upx;
  424. font-family: PingFang SC;
  425. font-weight: bold;
  426. color: #222222;
  427. line-height: 1;
  428. }
  429. .all-order{
  430. display: flex;
  431. align-items: center;
  432. .text{
  433. font-size: 26upx;
  434. font-family: PingFang SC;
  435. font-weight: 500;
  436. color: #999999;
  437. line-height: 1;
  438. margin-right: 8upx;
  439. }
  440. // image{
  441. // width: 14upx;
  442. // height: 24upx;
  443. // }
  444. }
  445. }
  446. .status-box{
  447. display: flex;
  448. align-items: center;
  449. justify-content: space-between;
  450. padding: 0 10upx;
  451. .item{
  452. display: flex;
  453. flex-direction: column;
  454. align-items: center;
  455. justify-content: center;
  456. image{
  457. width: 48upx;
  458. height: 48upx;
  459. margin-bottom: 18upx;
  460. }
  461. .text{
  462. font-size: 26upx;
  463. font-family: PingFang SC;
  464. font-weight: 500;
  465. color: #111111;
  466. line-height: 1;
  467. }
  468. }
  469. }
  470. }
  471. }
  472. }
  473. }
  474. .vipbox{
  475. margin-top: 24upx;
  476. padding: 0 24upx;
  477. image{
  478. width: 100%;
  479. }
  480. }
  481. .content{
  482. margin-top: 24upx;
  483. padding: 0 24upx;
  484. // display: flex;
  485. align-items: center;
  486. justify-content: center;
  487. .task-list{
  488. // padding: 24rpx;
  489. display: flex;
  490. align-items: center;
  491. flex-direction: column;
  492. justify-content: flex-start;
  493. width: 100%;
  494. box-sizing: border-box;
  495. border-radius: 24rpx;
  496. background: #FFFFFF;
  497. .item{
  498. width: 100%;
  499. display: flex;
  500. align-items: center;
  501. justify-content: space-between;
  502. padding:28rpx 24rpx;
  503. box-sizing: border-box;
  504. // margin-bottom: 24rpx;
  505. .left{
  506. display: flex;
  507. align-items: center;
  508. justify-content: center;
  509. image{
  510. width: 48rpx;
  511. height: 48rpx;
  512. margin-right: 32rpx;
  513. }
  514. .title-l{
  515. font-family: PingFang SC, PingFang SC;
  516. font-weight: 400;
  517. font-size: 32rpx;
  518. color: #333333;
  519. }
  520. }
  521. .right{
  522. display: flex;
  523. align-items: center;
  524. .num{
  525. text-align: center;
  526. width: 50rpx;
  527. height: 36rpx;
  528. line-height: 36rpx;
  529. background: rgba(56,139,255,0.16);
  530. border-radius: 34rpx 34rpx 34rpx 34rpx;
  531. font-family: PingFang SC, PingFang SC;
  532. font-weight: 400;
  533. font-size: 24rpx;
  534. color: #388BFF;
  535. }
  536. image{
  537. width: 32rpx;
  538. height: 32rpx;
  539. margin-left: 12rpx;
  540. }
  541. }
  542. }
  543. }
  544. .used-tools{
  545. box-sizing: border-box;
  546. background: #FFFFFF;
  547. border-radius: 16upx;
  548. padding: 40upx 30upx;
  549. .title{
  550. font-size: 36upx;
  551. font-family: PingFang SC;
  552. font-weight: bold;
  553. color: #222222;
  554. line-height: 1;
  555. }
  556. .tools-list{
  557. margin-top: 50upx;
  558. display: flex;
  559. flex-wrap: wrap;
  560. width: 100%;
  561. .item{
  562. box-sizing: border-box;
  563. width: 25%;
  564. display: flex;
  565. flex-direction: column;
  566. align-items: center;
  567. justify-content: center;
  568. margin-bottom: 50upx;
  569. position: relative;
  570. image{
  571. width: 48upx;
  572. height: 48upx;
  573. }
  574. .text{
  575. font-size: 24upx;
  576. font-family: PingFang SC;
  577. font-weight: 500;
  578. color: #333;
  579. line-height: 1;
  580. margin-top: 20upx;
  581. }
  582. .contact-btn{
  583. display: inline-block;
  584. position: absolute;
  585. top: 0;
  586. left: 0;
  587. width: 100%;
  588. height: 100%;
  589. opacity: 0;
  590. }
  591. }
  592. }
  593. }
  594. .log-out{
  595. height: 88upx;
  596. line-height: 88upx;
  597. text-align: center;
  598. font-family: PingFang SC, PingFang SC;
  599. font-weight: 500;
  600. font-size: 28rpx;
  601. color: #666666;
  602. background: #FFFFFF;
  603. border-radius: 16upx;
  604. margin-top: 52upx;
  605. }
  606. }
  607. .sub-btn{
  608. position: absolute;
  609. width: 100%;
  610. height: 100%;
  611. opacity: 0;
  612. }
  613. .like-product{
  614. padding: 0 20rpx;
  615. }
  616. .banner{
  617. padding: 20rpx 20rpx 0rpx 20rpx;
  618. height: 200rpx;
  619. position: relative;
  620. display: flex;
  621. align-items: center;
  622. justify-content: center;
  623. image{
  624. width:100%;
  625. height: 100%;
  626. border-radius: 16rpx 16rpx 16rpx 16rpx;
  627. }
  628. .tel_btn{
  629. width: 100%;
  630. height: 100%;
  631. top:0upx;
  632. position: absolute;
  633. opacity:0.0;
  634. }
  635. }
  636. </style>