index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. <template>
  2. <view>
  3. <view class="top-cont" >
  4. <image class="bg"
  5. src="https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736955760372.png" mode=""></image>
  6. <view class="top-inner">
  7. <!-- 这里是状态栏 -->
  8. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  9. <view class="user-info">
  10. <view class="left">
  11. <view class="head-img" @click="navgetTo('/pages_user/user/personInfo')">
  12. <image :src="user.avatar==null?'/static/images/common/my_heads.png':user.avatar"
  13. mode="aspectFill"></image>
  14. </view>
  15. <view class="name-phone" v-if="UserInfo">
  16. <view class="name">{{user.nickname}}
  17. <text class="fs24 ml12 base-color mb20 " v-if="user.isShow==1"
  18. >会员</text>
  19. <text class="fs24 ml12 mb20 " style="color: #666;" v-else
  20. >非会员</text>
  21. </view>
  22. <view class="phone">{{utils.parsePhone(user.phone)}}</view>
  23. </view>
  24. <view class="fs40 bold name-phone center " @click='getOrderCount()'
  25. v-else>立即登录</view>
  26. </view>
  27. <view class="right">
  28. <!-- <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  29. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  30. <image src="../../static/images/icon-set.png" mode=""></image>
  31. </view>
  32. </uni-badge> -->
  33. <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  34. <view class="msg-box" @click="navgetTo('/pages_user/user/message')">
  35. <image src="../../static/images/common/new_icon.png" mode=""></image>
  36. </view>
  37. </uni-badge>
  38. </view>
  39. </view>
  40. <!-- 我的订单 -->
  41. <view class="my-order">
  42. <view class="inner" v-if="user.isShow==1">
  43. <view class="title-box">
  44. <text class="title">我的订单</text>
  45. <view class="all-order" @click="showOrder('')">
  46. <text class="text">全部订单</text>
  47. <image src="../../static/images/common/arrow_right.png" mode=""></image>
  48. </view>
  49. </view>
  50. <view class="status-box">
  51. <uni-badge size="small" :text=count0 absolute="rightTop" type="error">
  52. <view class="item" @click="showOrder('0')">
  53. <image src="../../static/images/common/obligation.png" mode=""></image>
  54. <text class="text">待付款</text>
  55. </view>
  56. </uni-badge>
  57. <uni-badge size="small" :text=count1 absolute="rightTop" type="error">
  58. <view class="item" @click="showOrder('1')">
  59. <image src="../../static/images/common/pending_shipment.png" mode=""></image>
  60. <text class="text">待发货</text>
  61. </view>
  62. </uni-badge>
  63. <uni-badge size="small" :text=count2 absolute="rightTop" type="error">
  64. <view class="item" @click="showOrder('2')">
  65. <image src="../../static/images/common/dai_shouhuo.png" mode=""></image>
  66. <text class="text">待收货</text>
  67. </view>
  68. </uni-badge>
  69. <view class="item" @click="showOrder('3')">
  70. <image src="../../static/images/common/completed.png" mode=""></image>
  71. <text class="text">已完成</text>
  72. </view>
  73. <uni-badge size="small" :text=afterSalesCount absolute="rightTop" type="error">
  74. <view class="item" @click="navgetTo('/pages_user/user/refundOrderList')">
  75. <image src="../../static/images/common/after_sales.png" mode=""></image>
  76. <text class="text">售后/退款</text>
  77. </view>
  78. </uni-badge>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="content">
  83. <!-- 常用工具 -->
  84. <view class="used-tools">
  85. <view class="title">常用工具</view>
  86. <view class="tools-list">
  87. <!-- <view
  88. v-for="(item,index) in toolsArr"
  89. :key="index"
  90. @click="navgetTo(item.url)"
  91. :class="(toolsArr.length - index) > toolsRemain?'item':'item no-marin-bottom'">
  92. <image :src="item.img" mode=""></image>
  93. <text class="text">{{ item.name }}</text>
  94. <button v-if="item.url == ''" class="contact-btn" open-type="contact"></button>
  95. </view> -->
  96. <!-- <view class="item" @click="navgetTo('/pages_user/user/doctorOrder')">
  97. <image src="../../static/images/my_ask.png" mode=""></image>
  98. <text class="text">我的问诊</text>
  99. </view> -->
  100. <!-- <view class="item" @click="navgetTo('/pages_user/user/prescribeOrder')">
  101. <image src="../../static/images/prescription.png" mode=""></image>
  102. <text class="text">我的处方</text>
  103. </view>
  104. <view class="item" @click="navgetTo('/pages_user/user/patient')">
  105. <image src="../../static/images/management.png" mode=""></image>
  106. <text class="text">就诊人管理</text>
  107. </view> -->
  108. <view class="item" @click="navgetTo('/pages_user/user/address')" v-if="user.isShow==1">
  109. <image :src="iconlist[0].icon" mode=""></image>
  110. <text class="text">收货地址</text>
  111. </view>
  112. <view class="item no-marin-bottom" @click="navgetTo('/pages_user/user/integral')">
  113. <image :src="iconlist[1].icon" mode=""></image>
  114. <text class="text">积分管理</text>
  115. </view>
  116. <view class="item no-marin-bottom" @click="navgetTo('/pages_shopping/shopping/myCoupon')">
  117. <image :src="iconlist[2].icon" mode=""></image>
  118. <text class="text">优惠券</text>
  119. </view>
  120. <view class="item no-marin-bottom"
  121. @click="navgetTo('/pages_user/user/storeProductRelation')">
  122. <image :src="iconlist[3].icon" mode=""></image>
  123. <text class="text">我的足迹</text>
  124. </view>
  125. <view class="item no-marin-bottom" @click="openH5('/h5/userAgreement')">
  126. <image :src="iconlist[4].icon" mode=""></image>
  127. <text class="text">用户协议</text>
  128. </view>
  129. <view class="item no-marin-bottom align-top" @click="openH5('/h5/privacyPolicy')">
  130. <image :src="iconlist[5].icon" mode=""></image>
  131. <text class="text">隐私保护</text>
  132. </view>
  133. <view class="item no-marin-bottom">
  134. <image :src="iconlist[6].icon" mode=""></image>
  135. <text class="text">专属客服</text>
  136. <button class="contact-btn" open-type="contact"></button>
  137. </view>
  138. <view v-if="user.isPromoter==0" class="item no-marin-bottom"
  139. @click="navgetTo('/pages_user/user/userTuiAdd')">
  140. <image :src="iconlist[7].icon" mode=""></image>
  141. <text class="text">申请健康大使</text>
  142. </view>
  143. <view v-if="user.isPromoter==1" class="item no-marin-bottom"
  144. @click="navgetTo('/pages_user/user/userTui')">
  145. <image src="../../static/images/my_promotion.png" mode=""></image>
  146. <text class="text">我的推广</text>
  147. </view>
  148. <view class="item no-marin-bottom" @click="navgetTo('/pages/home/cert')">
  149. <image :src="iconlist[8].icon" mode=""></image>
  150. <text class="text">资质证书</text>
  151. </view>
  152. <view class="item no-marin-bottom" @click="toManager()">
  153. <image :src="iconlist[4].icon" mode=""></image>
  154. <text class="text">制单管理</text>
  155. </view>
  156. <!-- <view class="item no-marin-bottom" @click="toManagerCourse()">
  157. <image :src="iconlist[9].icon" mode=""></image>
  158. <text class="text">销售管理</text>
  159. </view> -->
  160. </view>
  161. </view>
  162. </view>
  163. <view class="log-out" @click="loginout" v-if="UserInfo">退出登录</view>
  164. <view class="banner">
  165. <image class="radius10"
  166. src="https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736956202172.jpg" mode="widthFix">
  167. </image>
  168. <view class="tel_btn" @click="callService()"></view>
  169. </view>
  170. <!-- 退出登录按钮 -->
  171. <view class="like-product">
  172. <likeProduct ref="product" />
  173. </view>
  174. </view>
  175. </view>
  176. <!-- <tabbar :actindex="3"></tabbar> -->
  177. </view>
  178. </template>
  179. <script>
  180. import {
  181. getOrderCount
  182. } from '@/api/storeOrder'
  183. import {
  184. getUserInfo,geticon,checkLogin
  185. } from '@/api/user'
  186. import likeProduct from '@/components/likeProduct.vue'
  187. export default {
  188. components: {
  189. likeProduct
  190. },
  191. data() {
  192. return {
  193. count0: 0,
  194. count1: 0,
  195. count2: 0,
  196. afterSalesCount: 0,
  197. user: {
  198. isPromoter: 0,
  199. isWeixinAuth: 0,
  200. phone: "",
  201. nickname: "用户昵称",
  202. avatarUrl: "/static/images/detault_head.png"
  203. },
  204. // 状态栏的高度
  205. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  206. // 消息数量
  207. msgNum: 0,
  208. iconlist:[],
  209. UserInfo:uni.getStorageSync('AppToken')
  210. };
  211. },
  212. computed: {
  213. UserInfo() {
  214. return uni.getStorageSync('AppToken')
  215. }
  216. },
  217. onShow() {
  218. console.log("onshow")
  219. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  220. this.geticon()
  221. if(this.UserInfo) {
  222. this.getUserInfo()
  223. this.getOrderCount()
  224. this.checkLogins()
  225. }
  226. },
  227. onReachBottom() {
  228. console.log("onReachBottom")
  229. this.$refs.product.getGoodsProducts();
  230. },
  231. methods: {
  232. checkLogins(){
  233. checkLogin().then(res=>{
  234. if(res.code==200){
  235. console.log(res)
  236. }
  237. })
  238. },
  239. callService() {
  240. uni.makePhoneCall({
  241. phoneNumber: "010-53822802",
  242. success: function() {
  243. console.log('拨打电话成功');
  244. },
  245. fail() {
  246. console.log('打电话失败了');
  247. }
  248. })
  249. },
  250. getOrderCount() {
  251. getOrderCount().then(
  252. res => {
  253. if (res.code == 200) {
  254. this.count0 = res.count0;
  255. this.count1 = res.count1;
  256. this.count2 = res.count2;
  257. this.afterSalesCount = res.afterSalesCount;
  258. }
  259. },
  260. rej => {}
  261. );
  262. },
  263. geticon(){
  264. geticon().then(res=>{
  265. this.iconlist=res.data
  266. console.log(res)
  267. })
  268. },
  269. toManagerCourse(){
  270. if(uni.getStorageSync('ManageToken')){
  271. uni.navigateTo({
  272. url: '/pages_manage/index'
  273. })
  274. }
  275. else{
  276. uni.navigateTo({
  277. url: '/pages_manage/login'
  278. })
  279. }
  280. },
  281. toManager() {
  282. if (this.utils.checkCompanyUserLoginState()) {
  283. uni.navigateTo({
  284. url: '/pages_company/index'
  285. })
  286. } else {
  287. uni.navigateTo({
  288. url: '/pages_company/auth/login'
  289. })
  290. }
  291. },
  292. openH5(url) {
  293. var requestPath = uni.getStorageSync('requestPath');
  294. uni.setStorageSync('url', requestPath + url);
  295. uni.navigateTo({
  296. url: '../home/h5'
  297. })
  298. },
  299. getUserInfo() {
  300. getUserInfo().then(
  301. res => {
  302. if (res.code == 200) {
  303. if (res.user != null) {
  304. uni.setStorageSync('users',this.user)
  305. this.user = Object.assign({}, res.user) // 使用新对象触发响应式
  306. this.$forceUpdate() // 强制更新视图
  307. } else {
  308. this.utils.loginOut();
  309. }
  310. } else {
  311. uni.showToast({
  312. icon: 'none',
  313. title: "请求失败",
  314. });
  315. }
  316. },
  317. rej => {}
  318. );
  319. },
  320. loginout(){
  321. uni.removeStorageSync('AppToken')
  322. uni.removeStorageSync('userInfo')
  323. uni.removeStorageSync('users')
  324. // 响应式更新数据
  325. this.UserInfo = null
  326. this.user = {
  327. isPromoter: 0,
  328. isWeixinAuth: 0,
  329. phone: "",
  330. nickname: "用户昵称",
  331. avatarUrl: "/static/images/detault_head.png"
  332. }
  333. uni.showToast({ title: '已退出登录', icon: 'success' })
  334. setTimeout(() => uni.reLaunch({ url: '/pages/home/index' }), 900)
  335. },
  336. // 跳转页面
  337. navgetTo(url) {
  338. this.utils.isLogin().then(res => {
  339. if (res) {
  340. uni.navigateTo({
  341. url: url
  342. })
  343. }
  344. })
  345. },
  346. // 查看订单
  347. showOrder(status) {
  348. uni.navigateTo({
  349. url: '/pages_user/user/storeOrder?status=' + status
  350. })
  351. }
  352. }
  353. }
  354. </script>
  355. <style lang="scss">
  356. .top-cont {
  357. width: 100%;
  358. height: 494upx;
  359. position: relative;
  360. // background-image: url(@/static/images/personl_top_bg.png);
  361. background-repeat: repeat-x;
  362. background-size: 40upx 100%;
  363. .bg{
  364. width: 100%;
  365. height: 380rpx;
  366. position: absolute;
  367. top: 0;
  368. left: 0;
  369. }
  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. }
  472. image {
  473. width: 40upx;
  474. height: 40upx;
  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: 40upx;
  490. height: 40upx;
  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. .content {
  507. margin-top: 20upx;
  508. padding: 0 20upx;
  509. display: flex;
  510. align-items: center;
  511. justify-content: center;
  512. .used-tools {
  513. box-sizing: border-box;
  514. background: #FFFFFF;
  515. border-radius: 16upx;
  516. padding: 40upx 30upx;
  517. .title {
  518. font-size: 34upx;
  519. font-family: PingFang SC;
  520. font-weight: bold;
  521. color: #222222;
  522. line-height: 1;
  523. }
  524. .tools-list {
  525. margin-top: 50upx;
  526. display: flex;
  527. flex-wrap: wrap;
  528. width: 100%;
  529. .item {
  530. box-sizing: border-box;
  531. width: 25%;
  532. display: flex;
  533. flex-direction: column;
  534. align-items: center;
  535. justify-content: center;
  536. margin-bottom: 50upx;
  537. position: relative;
  538. image {
  539. width: 44upx;
  540. height: 44upx;
  541. }
  542. .text {
  543. font-size: 24upx;
  544. font-family: PingFang SC;
  545. font-weight: 500;
  546. color: #111111;
  547. line-height: 1;
  548. margin-top: 20upx;
  549. }
  550. .contact-btn {
  551. display: inline-block;
  552. position: absolute;
  553. top: 0;
  554. left: 0;
  555. width: 100%;
  556. height: 100%;
  557. opacity: 0;
  558. }
  559. }
  560. }
  561. }
  562. }
  563. .sub-btn {
  564. position: absolute;
  565. width: 100%;
  566. height: 100%;
  567. opacity: 0;
  568. }
  569. .like-product {
  570. padding: 0 20rpx;
  571. }
  572. .banner {
  573. padding: 20rpx 20rpx 0rpx 20rpx;
  574. height: 200rpx;
  575. position: relative;
  576. display: flex;
  577. align-items: center;
  578. justify-content: center;
  579. image {
  580. width: 100%;
  581. height: 100%;
  582. }
  583. .tel_btn {
  584. width: 100%;
  585. height: 100%;
  586. top: 0upx;
  587. position: absolute;
  588. opacity: 0.0;
  589. }
  590. }
  591. .log-out {
  592. height: 80upx;
  593. width: 80%;
  594. background:#fff;
  595. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  596. line-height: 80upx;
  597. text-align: center;
  598. font-size: 26upx;
  599. font-family: PingFang SC;
  600. font-weight: 500;
  601. color: #018C39;
  602. margin: 0 auto;
  603. border-radius: 16upx;
  604. margin-top: 20upx;
  605. }
  606. </style>