index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  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" @click="goVip">
  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. goVip(){
  167. uni.navigateTo({
  168. url: '/pages_user/certification'
  169. })
  170. },
  171. openLink(item){
  172. if(item.name=='用户协议'){
  173. this.openH5()
  174. return;
  175. }
  176. uni.navigateTo({
  177. url: item.url
  178. })
  179. // this.utils.isLogin().then(res => {
  180. // if(res){
  181. // uni.navigateTo({
  182. // url: url+'?userId='+this.user.userId
  183. // })
  184. // }
  185. // })
  186. },
  187. toManager(){
  188. // uni.navigateTo({
  189. // url: '/pages_company/index'
  190. // })
  191. if(this.utils.checkCompanyUserLoginState()){
  192. uni.navigateTo({
  193. url: '/pages_company/index'
  194. })
  195. }
  196. else{
  197. uni.navigateTo({
  198. url: '/pages_company/auth/login'
  199. })
  200. }
  201. },
  202. openH5(url){
  203. var requestPath = uni.getStorageSync('requestPath');
  204. uni.setStorageSync('url',requestPath+url);
  205. uni.navigateTo({
  206. url: '../home/web'
  207. })
  208. },
  209. getUserInfo(){
  210. getUserInfo().then(
  211. res => {
  212. if(res.code==200){
  213. if(res.user!=null){
  214. this.user=res.user;
  215. }
  216. else{
  217. this.utils.loginOut();
  218. }
  219. }else{
  220. uni.showToast({
  221. icon:'none',
  222. title: "请求失败",
  223. });
  224. }
  225. },
  226. rej => {}
  227. );
  228. },
  229. // 跳转页面
  230. navgetTo(url) {
  231. this.utils.isLogin().then(res => {
  232. if(res){
  233. uni.navigateTo({
  234. url: url+'?userId='+this.user.userId
  235. })
  236. }
  237. })
  238. },
  239. // 查看订单
  240. showOrder(status) {
  241. uni.navigateTo({
  242. url: '/pages_user/user/storeOrder?status=' + status
  243. })
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="scss">
  249. .top-cont{
  250. width: 100%;
  251. height: 600rpx;
  252. position: relative;
  253. // background-image: url(../../static/image/top_bg.png);
  254. // background-repeat:no-repeat;
  255. // background-size:100%;
  256. .bg{
  257. width: 100%;
  258. position: absolute;
  259. top: 0;
  260. left: 0;
  261. }
  262. .top-inner{
  263. width: 100%;
  264. height: 100%;
  265. position: absolute;
  266. top: 0;
  267. left: 0;
  268. z-index: 2;
  269. .user-info{
  270. padding: 88upx 30upx 32upx 30upx;
  271. display: flex;
  272. align-items: center;
  273. justify-content: space-between;
  274. .left{
  275. position: relative;
  276. display: flex;
  277. .head-img{
  278. width: 112upx;
  279. height: 112upx;
  280. border-radius: 50%;
  281. overflow: hidden;
  282. margin-right: 32upx;
  283. border: 4upx solid #FFFFFF;
  284. //box-shadow: 0px 5px 15px 2px rgba(0,0,0,0.1);
  285. image{
  286. width: 100%;
  287. height: 100%;
  288. }
  289. }
  290. .name-phone{
  291. // padding-top: 15upx;
  292. display: flex;
  293. align-items: flex-start;
  294. flex-direction: column;
  295. justify-content: space-around;
  296. .name{
  297. font-size: 40upx;
  298. font-family: PingFang SC;
  299. font-weight: bold;
  300. color: #111111;
  301. line-height: 1;
  302. }
  303. text{
  304. font-family: PingFang SC, PingFang SC;
  305. font-weight: 600;
  306. font-size: 28rpx;
  307. }
  308. .phone{
  309. width: 220rpx;
  310. height: 48rpx;
  311. margin-top: 30upx;
  312. background: linear-gradient( 90deg, #FEA501 0%, #FECB8A 100%);
  313. border-radius: 24rpx 24rpx 24rpx 24rpx;
  314. border: 1rpx solid #FEDDB9;
  315. display: flex;
  316. align-items: center;
  317. justify-content: center;
  318. text{
  319. font-size: 24upx;
  320. font-family: PingFang SC;
  321. font-weight: 500;
  322. color: #fff;
  323. line-height: 1;
  324. margin-left: 4rpx;
  325. }
  326. }
  327. .vip{
  328. display: flex;
  329. align-items: center;
  330. justify-content: center;
  331. width: 120rpx;
  332. height: 40rpx;
  333. background: linear-gradient( 90deg, #FFEBAA 0%, #FFD45D 100%);
  334. border-radius: 38rpx 38rpx 38rpx 38rpx;
  335. font-family: PingFang SC, PingFang SC;
  336. font-weight: 500;
  337. font-size: 20rpx;
  338. color: #694511;
  339. }
  340. }
  341. }
  342. .right{
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. .msg-box{
  347. // margin-left: 10upx;
  348. width: 48upx;
  349. height: 48upx;
  350. // image{
  351. // width: 100%;
  352. // height: 100%;
  353. // }
  354. }
  355. .set{
  356. width: 48rpx;
  357. height: 48rpx;
  358. // margin-right: 20rpx;
  359. // image{
  360. // width: 100%;
  361. // height: 100%;
  362. // }
  363. }
  364. }
  365. }
  366. .balance{
  367. padding: 30rpx;
  368. height: 180rpx;
  369. margin: 50rpx 20rpx 0;
  370. border-radius: 16rpx 16rpx 16rpx 16rpx;
  371. background: linear-gradient( 266deg, #E83924 0%, #FEA603 100%);
  372. // background-image:url(../../static/images/balancebg.png);
  373. // background-repeat: no-repeat;
  374. // background-size: 100%;
  375. display: flex;
  376. align-items: center;
  377. justify-content: space-between;
  378. .left{
  379. display: flex;
  380. flex-direction: column;
  381. align-items: flex-start;
  382. justify-content:space-around;
  383. height: 100%;
  384. .text{
  385. font-family: PingFang SC;
  386. font-weight: 400;
  387. font-size: 26rpx;
  388. color: #FFFFFF;
  389. text-align: left;
  390. margin-right: 16rpx;
  391. }
  392. .num{
  393. font-family: Roboto, Roboto;
  394. font-weight: 500;
  395. font-size: 64rpx;
  396. color: #FFFFFF;
  397. }
  398. }
  399. .right{
  400. width: 132rpx;
  401. height: 64rpx;
  402. line-height: 64rpx;
  403. background: #FFFFFF;
  404. border-radius: 32rpx 32rpx 32rpx 32rpx;
  405. font-family: PingFang SC, PingFang SC;
  406. font-weight: 500;
  407. font-size: 26rpx;
  408. color: #FF5030;
  409. text-align: center;
  410. }
  411. }
  412. .my-order{
  413. padding: 20upx 20upx 0;
  414. .inner{
  415. box-sizing: border-box;
  416. height: 245upx;
  417. background: #FFFFFF;
  418. border-radius: 16upx;
  419. padding: 40upx 30upx;
  420. display: flex;
  421. flex-direction: column;
  422. justify-content: space-between;
  423. .title-box{
  424. display: flex;
  425. align-items: center;
  426. justify-content: space-between;
  427. .title{
  428. font-size: 36upx;
  429. font-family: PingFang SC;
  430. font-weight: bold;
  431. color: #222222;
  432. line-height: 1;
  433. }
  434. .all-order{
  435. display: flex;
  436. align-items: center;
  437. .text{
  438. font-size: 26upx;
  439. font-family: PingFang SC;
  440. font-weight: 500;
  441. color: #999999;
  442. line-height: 1;
  443. margin-right: 8upx;
  444. }
  445. // image{
  446. // width: 14upx;
  447. // height: 24upx;
  448. // }
  449. }
  450. }
  451. .status-box{
  452. display: flex;
  453. align-items: center;
  454. justify-content: space-between;
  455. padding: 0 10upx;
  456. .item{
  457. display: flex;
  458. flex-direction: column;
  459. align-items: center;
  460. justify-content: center;
  461. image{
  462. width: 48upx;
  463. height: 48upx;
  464. margin-bottom: 18upx;
  465. }
  466. .text{
  467. font-size: 26upx;
  468. font-family: PingFang SC;
  469. font-weight: 500;
  470. color: #111111;
  471. line-height: 1;
  472. }
  473. }
  474. }
  475. }
  476. }
  477. }
  478. }
  479. .vipbox{
  480. margin-top: 24upx;
  481. padding: 0 24upx;
  482. image{
  483. width: 100%;
  484. }
  485. }
  486. .content{
  487. margin-top: 24upx;
  488. padding: 0 24upx;
  489. // display: flex;
  490. align-items: center;
  491. justify-content: center;
  492. .task-list{
  493. // padding: 24rpx;
  494. display: flex;
  495. align-items: center;
  496. flex-direction: column;
  497. justify-content: flex-start;
  498. width: 100%;
  499. box-sizing: border-box;
  500. border-radius: 24rpx;
  501. background: #FFFFFF;
  502. .item{
  503. width: 100%;
  504. display: flex;
  505. align-items: center;
  506. justify-content: space-between;
  507. padding:28rpx 24rpx;
  508. box-sizing: border-box;
  509. // margin-bottom: 24rpx;
  510. .left{
  511. display: flex;
  512. align-items: center;
  513. justify-content: center;
  514. image{
  515. width: 48rpx;
  516. height: 48rpx;
  517. margin-right: 32rpx;
  518. }
  519. .title-l{
  520. font-family: PingFang SC, PingFang SC;
  521. font-weight: 400;
  522. font-size: 32rpx;
  523. color: #333333;
  524. }
  525. }
  526. .right{
  527. display: flex;
  528. align-items: center;
  529. .num{
  530. text-align: center;
  531. width: 50rpx;
  532. height: 36rpx;
  533. line-height: 36rpx;
  534. background: rgba(56,139,255,0.16);
  535. border-radius: 34rpx 34rpx 34rpx 34rpx;
  536. font-family: PingFang SC, PingFang SC;
  537. font-weight: 400;
  538. font-size: 24rpx;
  539. color: #388BFF;
  540. }
  541. image{
  542. width: 32rpx;
  543. height: 32rpx;
  544. margin-left: 12rpx;
  545. }
  546. }
  547. }
  548. }
  549. .used-tools{
  550. box-sizing: border-box;
  551. background: #FFFFFF;
  552. border-radius: 16upx;
  553. padding: 40upx 30upx;
  554. .title{
  555. font-size: 36upx;
  556. font-family: PingFang SC;
  557. font-weight: bold;
  558. color: #222222;
  559. line-height: 1;
  560. }
  561. .tools-list{
  562. margin-top: 50upx;
  563. display: flex;
  564. flex-wrap: wrap;
  565. width: 100%;
  566. .item{
  567. box-sizing: border-box;
  568. width: 25%;
  569. display: flex;
  570. flex-direction: column;
  571. align-items: center;
  572. justify-content: center;
  573. margin-bottom: 50upx;
  574. position: relative;
  575. image{
  576. width: 48upx;
  577. height: 48upx;
  578. }
  579. .text{
  580. font-size: 24upx;
  581. font-family: PingFang SC;
  582. font-weight: 500;
  583. color: #333;
  584. line-height: 1;
  585. margin-top: 20upx;
  586. }
  587. .contact-btn{
  588. display: inline-block;
  589. position: absolute;
  590. top: 0;
  591. left: 0;
  592. width: 100%;
  593. height: 100%;
  594. opacity: 0;
  595. }
  596. }
  597. }
  598. }
  599. .log-out{
  600. height: 88upx;
  601. line-height: 88upx;
  602. text-align: center;
  603. font-family: PingFang SC, PingFang SC;
  604. font-weight: 500;
  605. font-size: 28rpx;
  606. color: #666666;
  607. background: #FFFFFF;
  608. border-radius: 16upx;
  609. margin-top: 52upx;
  610. }
  611. }
  612. .sub-btn{
  613. position: absolute;
  614. width: 100%;
  615. height: 100%;
  616. opacity: 0;
  617. }
  618. .like-product{
  619. padding: 0 20rpx;
  620. }
  621. .banner{
  622. padding: 20rpx 20rpx 0rpx 20rpx;
  623. height: 200rpx;
  624. position: relative;
  625. display: flex;
  626. align-items: center;
  627. justify-content: center;
  628. image{
  629. width:100%;
  630. height: 100%;
  631. border-radius: 16rpx 16rpx 16rpx 16rpx;
  632. }
  633. .tel_btn{
  634. width: 100%;
  635. height: 100%;
  636. top:0upx;
  637. position: absolute;
  638. opacity:0.0;
  639. }
  640. }
  641. </style>