index.vue 16 KB

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