index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <template>
  2. <view>
  3. <view class="top-cont">
  4. <image class="bg" src="/static/home_top_bg.png" mode="aspectFill"></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/detault_head.jpg':user.avatar" mode="aspectFill"></image>
  12. </view>
  13. <view class="name-phone" v-if="UserInfo">
  14. <view class="name">{{user.nickname}}
  15. <text class="fs24 ml12 base-color mb20 " v-if="user.isShow==1"
  16. >会员</text>
  17. <text class="fs24 ml12 mb20 " style="color: #666;" v-else
  18. >非会员</text>
  19. </view>
  20. <view class="phone">{{utils.parsePhone(user.phone)}}</view>
  21. </view>
  22. <view class="fs40 bold name-phone center " @click='getOrderCount()'
  23. v-else>立即登录</view>
  24. </view>
  25. <view class="right">
  26. <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  27. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  28. <image src="/static/set.png" mode=""></image>
  29. </view>
  30. </uni-badge>
  31. <!-- <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  32. <view class="msg-box" @click="navgetTo('/pages_user/user/message')">
  33. <image src="/static/icon-msg.png" mode=""></image>
  34. </view>
  35. </uni-badge> -->
  36. </view>
  37. </view>
  38. <!-- 我的订单 -->
  39. <view class="my-order" v-if="user.isShow==1">
  40. <view class="inner">
  41. <view class="title-box">
  42. <text class="title">我的订单</text>
  43. <view class="all-order" @click="showOrder('')">
  44. <text class="text">全部订单</text>
  45. <image src="/static/right_arrow.png" mode=""></image>
  46. </view>
  47. </view>
  48. <view class="status-box">
  49. <uni-badge size="small" :text=count0 absolute="rightTop" type="error">
  50. <view class="item" @click="showOrder('0')">
  51. <image src="/static/payment.png" mode=""></image>
  52. <text class="text">待付款</text>
  53. </view>
  54. </uni-badge>
  55. <uni-badge size="small" :text=count1 absolute="rightTop" type="error">
  56. <view class="item" @click="showOrder('1')">
  57. <image src="/static/send_goods.png" mode=""></image>
  58. <text class="text">待发货</text>
  59. </view>
  60. </uni-badge>
  61. <uni-badge size="small" :text=count2 absolute="rightTop" type="error">
  62. <view class="item" @click="showOrder('2')">
  63. <image src="/static/sou_goods.png" mode=""></image>
  64. <text class="text">待收货</text>
  65. </view>
  66. </uni-badge>
  67. <view class="item" @click="showOrder('3')">
  68. <image src="/static/completed.png" mode=""></image>
  69. <text class="text">已完成</text>
  70. </view>
  71. <uni-badge size="small" :text=afterSalesCount absolute="rightTop" type="error">
  72. <view class="item" @click="navgetTo('/pages_user/user/refundOrderList')">
  73. <image src="/static/after_sales.png" mode=""></image>
  74. <text class="text">售后/退款</text>
  75. </view>
  76. </uni-badge>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="content">
  81. <!-- 常用工具 -->
  82. <view class="used-tools">
  83. <view class="title">我的服务</view>
  84. <view class="tools-list">
  85. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/storeProductRelation')">
  86. <image src="/static/icon_myclass.png" mode=""></image>
  87. <text class="text">我的课程</text>
  88. </view>
  89. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/storeProductRelation')">
  90. <image src="/static/icon_video.png" mode=""></image>
  91. <text class="text">赞过的课程</text>
  92. </view>
  93. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/storeProductRelation')">
  94. <image src="/static/footprint.png" mode=""></image>
  95. <text class="text">我的足迹</text>
  96. </view>
  97. <view class="item" @click="navgetTo('/pages_user/user/address')" v-if="user.isShow==1">
  98. <image src="/static/address.png" mode=""></image>
  99. <text class="text">收货地址</text>
  100. </view>
  101. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/integral')">
  102. <image src="/static/integral.png" mode=""></image>
  103. <text class="text">积分管理</text>
  104. </view>
  105. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/shopping/myCoupon')">
  106. <image src="/static/mycoupon.png" mode=""></image>
  107. <text class="text">优惠券</text>
  108. </view>
  109. <view class="item no-marin-bottom" @click="navgetTo('/pages/home/cert')">
  110. <image src="/static/qualification.png" mode=""></image>
  111. <text class="text">资质证书</text>
  112. </view>
  113. <view class="item no-marin-bottom">
  114. <image src="/static/customer1.png" mode=""></image>
  115. <text class="text">专属客服</text>
  116. <button class="contact-btn" open-type="contact"></button>
  117. </view>
  118. <view class="item no-marin-bottom" @click="openH5('userRegister')">
  119. <image src="/static/service_file.png" mode=""></image>
  120. <text class="text">用户协议</text>
  121. </view>
  122. <view class="item no-marin-bottom align-top" @click="openH5('userPrivacy')">
  123. <image src="/static/advice.png" mode=""></image>
  124. <text class="text">隐私保护</text>
  125. </view>
  126. <!-- <view v-if="user.isPromoter==0" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTuiAdd')">
  127. <image src="/static/my_promotion.png" mode=""></image>
  128. <text class="text">申请健康大使</text>
  129. </view> -->
  130. <!-- <view v-if="user.isPromoter==1" class="item no-marin-bottom" @click="navgetTo('/pages_user/user/userTui')">
  131. <image src="/static/my_promotion.png" mode=""></image>
  132. <text class="text">我的推广</text>
  133. </view> -->
  134. <view class="item no-marin-bottom" @click="toManager()">
  135. <image src="/static/sale_file.png" mode=""></image>
  136. <text class="text">制单管理</text>
  137. </view>
  138. <!-- <view class="item no-marin-bottom" @click="toManagerCourse()">
  139. <image src="/static/sale_file.png" mode=""></image>
  140. <text class="text">销售管理</text>
  141. </view> -->
  142. </view>
  143. </view>
  144. </view>
  145. <!-- <view class="banner">
  146. <image src="https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221125/71ddd95044bb46d5b27e19a5f61cf5ab.png"></image>
  147. <view class="tel_btn" @click="callService()"></view>
  148. </view> -->
  149. <view style="padding-bottom: 20rpx;" v-if="UserInfo">
  150. <view @tap="loginOUt" class="log-out x-c" >退出登录</view>
  151. </view>
  152. <view class="like-product">
  153. <likeProduct ref="product" />
  154. </view>
  155. <!-- 退出登录按钮 -->
  156. </view>
  157. </view>
  158. </view>
  159. </template>
  160. <script>
  161. import {getOrderCount} from '@/api/storeOrder'
  162. import {getUserInfo} from '@/api/user'
  163. import likeProduct from '@/components/likeProduct.vue'
  164. export default {
  165. components: {
  166. likeProduct
  167. },
  168. data() {
  169. return {
  170. count0:0,
  171. count1:0,
  172. count2:0,
  173. afterSalesCount:0,
  174. user:{
  175. isPromoter:0,
  176. isWeixinAuth:0,
  177. phone:"",
  178. nickname:"用户昵称",
  179. avatarUrl:"/static/detault_head.png"
  180. },
  181. // 状态栏的高度
  182. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  183. // 消息数量
  184. msgNum: 0,
  185. UserInfo:uni.getStorageSync('AppToken')
  186. };
  187. },
  188. watch: {
  189. UserInfo() {
  190. return uni.getStorageSync('AppToken')
  191. }
  192. },
  193. onLoad() {
  194. console.log("onload")
  195. },
  196. onShow() {
  197. console.log("onshow")
  198. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  199. if(this.UserInfo){
  200. this.getUserInfo()
  201. }else{
  202. // this.isuser=true
  203. }
  204. // this.getUserInfo();
  205. // this.getOrderCount();
  206. },
  207. onReachBottom() {
  208. console.log("onReachBottom")
  209. this.$refs.product.getGoodsProducts();
  210. },
  211. methods: {
  212. callService(){
  213. let orderKey='5d81cf01-6f8d-4e1a-ae7a-dbc26c965b01';
  214. uni.navigateTo({
  215. url: '/pages_company/order/confirmOrder?orderKey='+orderKey
  216. })
  217. return;
  218. uni.makePhoneCall({
  219. phoneNumber:"4000717770",
  220. success:function(){
  221. console.log('拨打电话成功');
  222. },
  223. fail() {
  224. console.log('打电话失败了');
  225. }
  226. })
  227. },
  228. getOrderCount(){
  229. getOrderCount().then(
  230. res => {
  231. if(res.code==200){
  232. this.count0=res.count0;
  233. this.count1=res.count1;
  234. this.count2=res.count2;
  235. this.afterSalesCount=res.afterSalesCount;
  236. }
  237. },
  238. rej => {}
  239. );
  240. },
  241. toManager(){
  242. if(this.utils.checkCompanyUserLoginState()){
  243. uni.navigateTo({
  244. url: '/pages_company/index'
  245. })
  246. }
  247. else{
  248. uni.navigateTo({
  249. url: '/pages_company/auth/login'
  250. })
  251. }
  252. },
  253. toManagerCourse(){
  254. if(uni.getStorageSync('ManageToken')){
  255. uni.navigateTo({
  256. url: '/pages_manage/index'
  257. })
  258. }
  259. else{
  260. uni.navigateTo({
  261. url: '/pages_manage/login'
  262. })
  263. }
  264. },
  265. openH5(url){
  266. var requestPath = uni.getStorageSync('requestPath');
  267. uni.setStorageSync('url',requestPath+url);
  268. uni.navigateTo({
  269. url: '../home/h5?data='+url
  270. })
  271. },
  272. getUserInfo(){
  273. getUserInfo().then(
  274. res => {
  275. if(res.code==200){
  276. if(res.user!=null){
  277. this.user=res.user;
  278. }
  279. else{
  280. this.utils.loginOut();
  281. }
  282. }else{
  283. uni.showToast({
  284. icon:'none',
  285. title: "请求失败",
  286. });
  287. }
  288. },
  289. rej => {}
  290. );
  291. },
  292. // 跳转页面
  293. navgetTo(url) {
  294. this.utils.isLogin().then(res => {
  295. if(res){
  296. uni.navigateTo({
  297. url: url
  298. })
  299. }
  300. })
  301. },
  302. // 查看订单
  303. showOrder(status) {
  304. uni.navigateTo({
  305. url: '/pages_user/user/storeOrder?status=' + status
  306. })
  307. },
  308. loginOUt(){
  309. this.utils.loginOut();
  310. this.getUserInfo();
  311. }
  312. }
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. .top-cont{
  317. width: 100%;
  318. height: 494upx;
  319. position: relative;
  320. // background-image: url(/static/personl_top_bg.png);
  321. background-repeat: repeat-x;
  322. background-size: 40upx 100%;
  323. z-index: 2;
  324. .bg{
  325. width: 100%;
  326. height: 382upx;
  327. position: absolute;
  328. top: 0;
  329. left: 0;
  330. z-index: -1;
  331. }
  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. .tools-list{
  490. margin-top: 50upx;
  491. display: flex;
  492. flex-wrap: wrap;
  493. width: 100%;
  494. .item{
  495. box-sizing: border-box;
  496. width: 25%;
  497. display: flex;
  498. flex-direction: column;
  499. align-items: center;
  500. justify-content: center;
  501. margin-bottom: 50upx;
  502. position: relative;
  503. image{
  504. width: 44upx;
  505. height: 44upx;
  506. }
  507. .text{
  508. font-size: 24upx;
  509. font-family: PingFang SC;
  510. font-weight: 500;
  511. color: #111111;
  512. line-height: 1;
  513. margin-top: 20upx;
  514. }
  515. .contact-btn{
  516. display: inline-block;
  517. position: absolute;
  518. top: 0;
  519. left: 0;
  520. width: 100%;
  521. height: 100%;
  522. opacity: 0;
  523. }
  524. }
  525. }
  526. }
  527. }
  528. .log-out{
  529. height: 80upx;
  530. line-height: 80upx;
  531. text-align: center;
  532. font-size: 26upx;
  533. font-family: PingFang SC;
  534. font-weight: 500;
  535. color: #666666;
  536. background: #FFFFFF;
  537. border-radius: 16upx;
  538. margin-top: 20upx;
  539. }
  540. .sub-btn{
  541. position: absolute;
  542. width: 100%;
  543. height: 100%;
  544. opacity: 0;
  545. }
  546. .like-product{
  547. padding: 0 20rpx;
  548. }
  549. .banner{
  550. padding: 20rpx 20rpx 0rpx 20rpx;
  551. height: 200rpx;
  552. position: relative;
  553. display: flex;
  554. align-items: center;
  555. justify-content: center;
  556. image{
  557. width:100%;
  558. height: 100%;
  559. }
  560. .tel_btn{
  561. width: 100%;
  562. height: 100%;
  563. top:0upx;
  564. position: absolute;
  565. opacity:0.0;
  566. }
  567. }
  568. .log-out{
  569. height: 100rpx;line-height: 100rpx;
  570. margin: 10px;
  571. border-radius: 20rpx;
  572. }
  573. </style>