index.vue 17 KB

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