index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <template>
  2. <view>
  3. <view class="top-cont">
  4. <view class="top-inner">
  5. <!-- 这里是状态栏 -->
  6. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  7. <view class="user-info">
  8. <view class="left">
  9. <view class="head-img">
  10. <image :src="user.avatar==null?'/static/detault_head.jpg':user.avatar" mode="aspectFill"></image>
  11. </view>
  12. <view class="name-phone" v-if="UserInfo">
  13. <view class="name">{{user.nickname}}
  14. <text class="fs24 ml12 base-color mb20 " v-if="user.isShow==1"
  15. >会员</text>
  16. <text class="fs24 ml12 mb20 " style="color: #666;" v-else
  17. >非会员</text>
  18. </view>
  19. <view class="phone">{{utils.parsePhone(user.phone)}}</view>
  20. </view>
  21. <view class="fs40 bold name-phone center " @click='getOrderCount()'
  22. v-else>立即登录</view>
  23. </view>
  24. <view class="right">
  25. <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  26. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  27. <image src="/static/set.png" mode=""></image>
  28. </view>
  29. </uni-badge>
  30. <!-- <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  31. <view class="msg-box" @click="navgetTo('/pages_user/user/message')">
  32. <image src="/static/icon-msg.png" mode=""></image>
  33. </view>
  34. </uni-badge> -->
  35. </view>
  36. </view>
  37. <!-- 我的订单 -->
  38. <view class="my-order" v-if="user.isShow==1">
  39. <view class="inner">
  40. <view class="title-box">
  41. <text class="title">我的订单</text>
  42. <view class="all-order" @click="showOrder('')">
  43. <text class="text">全部订单</text>
  44. <image src="/static/right_arrow.png" mode=""></image>
  45. </view>
  46. </view>
  47. <view class="status-box">
  48. <uni-badge size="small" :text=count0 absolute="rightTop" type="error">
  49. <view class="item" @click="showOrder('0')">
  50. <image src="/static/payment.png" mode=""></image>
  51. <text class="text">待付款</text>
  52. </view>
  53. </uni-badge>
  54. <uni-badge size="small" :text=count1 absolute="rightTop" type="error">
  55. <view class="item" @click="showOrder('1')">
  56. <image src="/static/send_goods.png" mode=""></image>
  57. <text class="text">待发货</text>
  58. </view>
  59. </uni-badge>
  60. <uni-badge size="small" :text=count2 absolute="rightTop" type="error">
  61. <view class="item" @click="showOrder('2')">
  62. <image src="/static/sou_goods.png" mode=""></image>
  63. <text class="text">待收货</text>
  64. </view>
  65. </uni-badge>
  66. <view class="item" @click="showOrder('3')">
  67. <image src="/static/completed.png" mode=""></image>
  68. <text class="text">已完成</text>
  69. </view>
  70. <uni-badge size="small" :text=afterSalesCount absolute="rightTop" type="error">
  71. <view class="item" @click="navgetTo('/pages_user/user/refundOrderList')">
  72. <image src="/static/after_sales.png" mode=""></image>
  73. <text class="text">售后/退款</text>
  74. </view>
  75. </uni-badge>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="content">
  80. <!-- 常用工具 -->
  81. <view class="used-tools">
  82. <view class="title">我的服务</view>
  83. <view class="my-modules">
  84. <view class="module-item" @click="navgetTo('/pages/learn/index')">
  85. <image class="bg" src="/static/bg_myclass.png" mode="aspectFill"></image>
  86. <image class="icon" src="/static/icon_myclass.png" mode=""></image>
  87. <view class="module-info">
  88. <text class="m-title">我的课程</text>
  89. <view class="m-desc">开始学习<image class="desc-icon" src="/static/icon_direction_right2.png" mode=""></image></view>
  90. </view>
  91. </view>
  92. <view class="module-item" @click="navgetTo('')">
  93. <image class="bg" src="/static/bg_video.png" mode="aspectFill"></image>
  94. <image class="icon" src="/static/icon_video.png" mode=""></image>
  95. <view class="module-info">
  96. <text class="m-title">我的收藏</text>
  97. <view class="m-desc color">立即查看<image class="desc-icon" src="/static/icon_direction_right.png" mode=""></image></view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="tools-list">
  102. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/storeProductRelation')">
  103. <image src="/static/footprint.png" mode=""></image>
  104. <text class="text">我的足迹</text>
  105. </view>
  106. <view class="item" @click="navgetTo('/pages_user/user/address')" v-if="user.isShow==1">
  107. <image src="/static/address.png" mode=""></image>
  108. <text class="text">收货地址</text>
  109. </view>
  110. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/integral')">
  111. <image src="/static/integral.png" mode=""></image>
  112. <text class="text">积分管理</text>
  113. </view>
  114. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/shopping/myCoupon')">
  115. <image src="/static/mycoupon.png" mode=""></image>
  116. <text class="text">优惠券</text>
  117. </view>
  118. <view class="item no-marin-bottom" @click="navgetTo('/pages/home/cert')">
  119. <image src="/static/qualification.png" mode=""></image>
  120. <text class="text">资质证书</text>
  121. </view>
  122. <view class="item no-marin-bottom">
  123. <image src="/static/customer1.png" mode=""></image>
  124. <text class="text">专属客服</text>
  125. <button class="contact-btn" open-type="contact"></button>
  126. </view>
  127. <view class="item no-marin-bottom" @click="openH5('userRegister')">
  128. <image src="/static/service_file.png" mode=""></image>
  129. <text class="text">用户协议</text>
  130. </view>
  131. <view class="item no-marin-bottom align-top" @click="openH5('userPrivacy')">
  132. <image src="/static/advice.png" mode=""></image>
  133. <text class="text">隐私保护</text>
  134. </view>
  135. <!-- <view v-if="user.isPromoter==0" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTuiAdd')">
  136. <image src="/static/my_promotion.png" mode=""></image>
  137. <text class="text">申请健康大使</text>
  138. </view> -->
  139. <!-- <view v-if="user.isPromoter==1" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTui')">
  140. <image src="/static/my_promotion.png" mode=""></image>
  141. <text class="text">我的推广</text>
  142. </view> -->
  143. <view class="item no-marin-bottom" @click="toManager()">
  144. <image src="/static/sale_file.png" mode=""></image>
  145. <text class="text">制单管理</text>
  146. </view>
  147. <!-- <view class="item no-marin-bottom" @click="toManagerCourse()">
  148. <image src="/static/sale_file.png" mode=""></image>
  149. <text class="text">销售管理</text>
  150. </view> -->
  151. </view>
  152. </view>
  153. </view>
  154. <!-- <view class="banner">
  155. <image src="https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221125/71ddd95044bb46d5b27e19a5f61cf5ab.png"></image>
  156. <view class="tel_btn" @click="callService()"></view>
  157. </view> -->
  158. <view style="padding-bottom: 20rpx;" v-if="UserInfo">
  159. <view @tap="loginOUt" class="log-out x-c" >退出登录</view>
  160. </view>
  161. <!-- <view class="like-product">
  162. <likeProduct ref="product" />
  163. </view> -->
  164. <!-- 退出登录按钮 -->
  165. </view>
  166. </view>
  167. </view>
  168. </template>
  169. <script>
  170. import {getOrderCount} from '@/api/storeOrder'
  171. import {getUserInfo} from '@/api/user'
  172. import likeProduct from '@/components/likeProduct.vue'
  173. export default {
  174. components: {
  175. likeProduct
  176. },
  177. data() {
  178. return {
  179. count0:0,
  180. count1:0,
  181. count2:0,
  182. afterSalesCount:0,
  183. user:{
  184. isPromoter:0,
  185. isWeixinAuth:0,
  186. phone:"",
  187. nickname:"用户昵称",
  188. avatarUrl:"/static/detault_head.png"
  189. },
  190. // 状态栏的高度
  191. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  192. // 消息数量
  193. msgNum: 0,
  194. UserInfo:uni.getStorageSync('AppToken')
  195. };
  196. },
  197. watch: {
  198. UserInfo() {
  199. return uni.getStorageSync('AppToken')
  200. }
  201. },
  202. onLoad() {
  203. console.log("onload")
  204. },
  205. onShow() {
  206. console.log("onshow")
  207. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  208. if(this.UserInfo){
  209. this.getUserInfo()
  210. }else{
  211. // this.isuser=true
  212. }
  213. // this.getUserInfo();
  214. // this.getOrderCount();
  215. },
  216. onReachBottom() {
  217. console.log("onReachBottom")
  218. this.$refs.product.getGoodsProducts();
  219. },
  220. methods: {
  221. callService(){
  222. let orderKey='5d81cf01-6f8d-4e1a-ae7a-dbc26c965b01';
  223. uni.navigateTo({
  224. url: '/pages_company/order/confirmOrder?orderKey='+orderKey
  225. })
  226. return;
  227. uni.makePhoneCall({
  228. phoneNumber:"4000717770",
  229. success:function(){
  230. console.log('拨打电话成功');
  231. },
  232. fail() {
  233. console.log('打电话失败了');
  234. }
  235. })
  236. },
  237. getOrderCount(){
  238. getOrderCount().then(
  239. res => {
  240. if(res.code==200){
  241. this.count0=res.count0;
  242. this.count1=res.count1;
  243. this.count2=res.count2;
  244. this.afterSalesCount=res.afterSalesCount;
  245. }
  246. },
  247. rej => {}
  248. );
  249. },
  250. toManager(){
  251. if(this.utils.checkCompanyUserLoginState()){
  252. uni.navigateTo({
  253. url: '/pages_company/index'
  254. })
  255. }
  256. else{
  257. uni.navigateTo({
  258. url: '/pages_company/auth/login'
  259. })
  260. }
  261. },
  262. toManagerCourse(){
  263. if(uni.getStorageSync('ManageToken')){
  264. uni.navigateTo({
  265. url: '/pages_manage/index'
  266. })
  267. }
  268. else{
  269. uni.navigateTo({
  270. url: '/pages_manage/login'
  271. })
  272. }
  273. },
  274. openH5(url){
  275. var requestPath = uni.getStorageSync('requestPath');
  276. uni.setStorageSync('url',requestPath+url);
  277. uni.navigateTo({
  278. url: '../home/h5?data='+url
  279. })
  280. },
  281. getUserInfo(){
  282. getUserInfo().then(
  283. res => {
  284. if(res.code==200){
  285. if(res.user!=null){
  286. this.user=res.user;
  287. }
  288. else{
  289. this.utils.loginOut();
  290. }
  291. }else{
  292. uni.showToast({
  293. icon:'none',
  294. title: "请求失败",
  295. });
  296. }
  297. },
  298. rej => {}
  299. );
  300. },
  301. // 跳转页面
  302. navgetTo(url) {
  303. this.utils.isLogin().then(res => {
  304. if(res){
  305. uni.navigateTo({
  306. url: url
  307. })
  308. }
  309. })
  310. },
  311. // 查看订单
  312. showOrder(status) {
  313. uni.navigateTo({
  314. url: '/pages_user/user/storeOrder?status=' + status
  315. })
  316. },
  317. loginOUt(){
  318. this.utils.loginOut();
  319. this.getUserInfo();
  320. }
  321. }
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. .top-cont{
  326. width: 100%;
  327. height: 494upx;
  328. position: relative;
  329. // background-image: url(/static/personl_top_bg.png);
  330. background-repeat: repeat-x;
  331. background-size: 40upx 100%;
  332. .top-inner{
  333. width: 100%;
  334. height: 100%;
  335. position: absolute;
  336. top: 0;
  337. left: 0;
  338. z-index: 2;
  339. .user-info{
  340. padding: 88upx 30upx 0 30upx;
  341. display: flex;
  342. align-items: center;
  343. justify-content: space-between;
  344. .left{
  345. position: relative;
  346. display: flex;
  347. .head-img{
  348. width: 120upx;
  349. height: 120upx;
  350. border-radius: 50%;
  351. overflow: hidden;
  352. margin-right: 30upx;
  353. border: 4upx solid #FFFFFF;
  354. box-shadow: 0px 5px 15px 2px rgba(0,0,0,0.1);
  355. image{
  356. width: 100%;
  357. height: 100%;
  358. }
  359. }
  360. .name-phone{
  361. padding-top: 15upx;
  362. .name{
  363. font-size: 40upx;
  364. font-family: PingFang SC;
  365. font-weight: bold;
  366. color: #111111;
  367. line-height: 1;
  368. }
  369. .phone{
  370. font-size: 28upx;
  371. font-family: PingFang SC;
  372. font-weight: 500;
  373. color: #666666;
  374. line-height: 1;
  375. margin-top: 30upx;
  376. }
  377. }
  378. }
  379. .right{
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. .msg-box{
  384. margin-left: 10upx;
  385. width: 44upx;
  386. height: 44upx;
  387. image{
  388. width: 100%;
  389. height: 100%;
  390. }
  391. }
  392. .set{
  393. width: 44upx;
  394. height: 44upx;
  395. image{
  396. width: 100%;
  397. height: 100%;
  398. }
  399. }
  400. }
  401. }
  402. .my-order{
  403. padding: 50upx 20upx 0;
  404. .inner{
  405. box-sizing: border-box;
  406. height: 245upx;
  407. // height: 105upx;
  408. background: #FFFFFF;
  409. border-radius: 16upx;
  410. padding: 40upx 30upx;
  411. display: flex;
  412. flex-direction: column;
  413. justify-content: space-between;
  414. .title-box{
  415. display: flex;
  416. align-items: center;
  417. justify-content: space-between;
  418. .title{
  419. font-size: 34upx;
  420. font-family: PingFang SC;
  421. font-weight: bold;
  422. color: #222222;
  423. line-height: 1;
  424. }
  425. .all-order{
  426. display: flex;
  427. align-items: center;
  428. .text{
  429. font-size: 26upx;
  430. font-family: PingFang SC;
  431. font-weight: 500;
  432. color: #999999;
  433. line-height: 1;
  434. margin-right: 8upx;
  435. }
  436. image{
  437. width: 14upx;
  438. height: 24upx;
  439. }
  440. }
  441. }
  442. .status-box{
  443. display: flex;
  444. align-items: center;
  445. justify-content: space-between;
  446. padding: 0 10upx;
  447. .item{
  448. display: flex;
  449. flex-direction: column;
  450. align-items: center;
  451. justify-content: center;
  452. image{
  453. width: 40upx;
  454. height: 40upx;
  455. margin-bottom: 18upx;
  456. }
  457. .text{
  458. font-size: 26upx;
  459. font-family: PingFang SC;
  460. font-weight: 500;
  461. color: #111111;
  462. line-height: 1;
  463. }
  464. }
  465. }
  466. }
  467. }
  468. }
  469. }
  470. .content{
  471. margin-top: 20upx;
  472. padding: 0 20upx;
  473. display: flex;
  474. align-items: center;
  475. justify-content: center;
  476. .used-tools{
  477. box-sizing: border-box;
  478. background: #FFFFFF;
  479. border-radius: 16upx;
  480. padding: 40upx 30upx;
  481. width: 100%;
  482. .title{
  483. font-size: 34upx;
  484. font-family: PingFang SC;
  485. font-weight: bold;
  486. color: #222222;
  487. line-height: 1;
  488. }
  489. .my-modules {
  490. display: flex;
  491. justify-content: space-between;
  492. margin-top: 40upx;
  493. .module-item {
  494. position: relative;
  495. width: 310upx;
  496. height: 140upx;
  497. border-radius: 16upx;
  498. overflow: hidden;
  499. display: flex;
  500. align-items: center;
  501. justify-content: space-around;
  502. z-index: 2;
  503. .icon{
  504. // position: absolute;
  505. // top: 20upx;
  506. // left: 20upx;
  507. width: 64upx;
  508. height: 64upx;
  509. }
  510. .bg {
  511. position: absolute;
  512. top: 0;
  513. left: 0;
  514. width: 100%;
  515. height: 100%;
  516. z-index: -1;
  517. }
  518. .module-info {
  519. position: relative;
  520. z-index: 1;
  521. padding: 25upx 20upx;
  522. display: flex;
  523. flex-direction: column;
  524. .m-title {
  525. font-size: 30upx;
  526. font-weight: bold;
  527. color: #222222;
  528. }
  529. .m-desc {
  530. display: flex;
  531. align-items: center;
  532. font-size: 22upx;
  533. color: #6154DC;
  534. margin-top: 10upx;
  535. &.color{
  536. color: #F5723A;
  537. }
  538. .desc-icon{
  539. width: 24upx;
  540. height: 24upx;
  541. margin-left:4upx;
  542. }
  543. }
  544. }
  545. }
  546. }
  547. .tools-list{
  548. margin-top: 50upx;
  549. display: flex;
  550. flex-wrap: wrap;
  551. width: 100%;
  552. .item{
  553. box-sizing: border-box;
  554. width: 25%;
  555. display: flex;
  556. flex-direction: column;
  557. align-items: center;
  558. justify-content: center;
  559. margin-bottom: 50upx;
  560. position: relative;
  561. image{
  562. width: 44upx;
  563. height: 44upx;
  564. }
  565. .text{
  566. font-size: 24upx;
  567. font-family: PingFang SC;
  568. font-weight: 500;
  569. color: #111111;
  570. line-height: 1;
  571. margin-top: 20upx;
  572. }
  573. .contact-btn{
  574. display: inline-block;
  575. position: absolute;
  576. top: 0;
  577. left: 0;
  578. width: 100%;
  579. height: 100%;
  580. opacity: 0;
  581. }
  582. }
  583. }
  584. }
  585. }
  586. .log-out{
  587. height: 80upx;
  588. line-height: 80upx;
  589. text-align: center;
  590. font-size: 26upx;
  591. font-family: PingFang SC;
  592. font-weight: 500;
  593. color: #666666;
  594. background: #FFFFFF;
  595. border-radius: 16upx;
  596. margin-top: 20upx;
  597. }
  598. .sub-btn{
  599. position: absolute;
  600. width: 100%;
  601. height: 100%;
  602. opacity: 0;
  603. }
  604. .like-product{
  605. padding: 0 20rpx;
  606. }
  607. .banner{
  608. padding: 20rpx 20rpx 0rpx 20rpx;
  609. height: 200rpx;
  610. position: relative;
  611. display: flex;
  612. align-items: center;
  613. justify-content: center;
  614. image{
  615. width:100%;
  616. height: 100%;
  617. }
  618. .tel_btn{
  619. width: 100%;
  620. height: 100%;
  621. top:0upx;
  622. position: absolute;
  623. opacity:0.0;
  624. }
  625. }
  626. .log-out{
  627. height: 100rpx;line-height: 100rpx;
  628. margin: 10px;
  629. border-radius: 20rpx;
  630. }
  631. </style>