index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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[9].icon" mode=""></image>
  154. <text class="text">销售管理</text>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <view class="log-out" @click="loginout" v-if="UserInfo">退出登录</view>
  160. <view class="banner">
  161. <image class="radius10"
  162. src="https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736956202172.jpg" mode="widthFix">
  163. </image>
  164. <view class="tel_btn" @click="callService()"></view>
  165. </view>
  166. <!-- 退出登录按钮 -->
  167. <view class="like-product">
  168. <likeProduct ref="product" />
  169. </view>
  170. </view>
  171. </view>
  172. <!-- <tabbar :actindex="3"></tabbar> -->
  173. </view>
  174. </template>
  175. <script>
  176. import {
  177. getOrderCount
  178. } from '@/api/storeOrder'
  179. import {
  180. getUserInfo,geticon,checkLogin
  181. } from '@/api/user'
  182. import likeProduct from '@/components/likeProduct.vue'
  183. export default {
  184. components: {
  185. likeProduct
  186. },
  187. data() {
  188. return {
  189. theme:'beiliyou',
  190. count0: 0,
  191. count1: 0,
  192. count2: 0,
  193. afterSalesCount: 0,
  194. user: {
  195. isPromoter: 0,
  196. isWeixinAuth: 0,
  197. phone: "",
  198. nickname: "用户昵称",
  199. avatarUrl: "/static/images/detault_head.png"
  200. },
  201. // 状态栏的高度
  202. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  203. // 消息数量
  204. msgNum: 0,
  205. iconlist:[],
  206. UserInfo:uni.getStorageSync('AppToken')
  207. };
  208. },
  209. computed: {
  210. UserInfo() {
  211. return uni.getStorageSync('AppToken')
  212. }
  213. },
  214. onShow() {
  215. console.log("onshow")
  216. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  217. this.geticon()
  218. if(this.UserInfo) {
  219. this.getUserInfo()
  220. this.getOrderCount()
  221. this.checkLogins()
  222. }
  223. },
  224. onReachBottom() {
  225. console.log("onReachBottom")
  226. this.$refs.product.getGoodsProducts();
  227. },
  228. methods: {
  229. checkLogins(){
  230. checkLogin().then(res=>{
  231. if(res.code==200){
  232. console.log(res)
  233. }
  234. })
  235. },
  236. callService() {
  237. uni.makePhoneCall({
  238. phoneNumber: "010-53822802",
  239. success: function() {
  240. console.log('拨打电话成功');
  241. },
  242. fail() {
  243. console.log('打电话失败了');
  244. }
  245. })
  246. },
  247. getOrderCount() {
  248. getOrderCount().then(
  249. res => {
  250. if (res.code == 200) {
  251. this.count0 = res.count0;
  252. this.count1 = res.count1;
  253. this.count2 = res.count2;
  254. this.afterSalesCount = res.afterSalesCount;
  255. }
  256. },
  257. rej => {}
  258. );
  259. },
  260. geticon(){
  261. geticon().then(res=>{
  262. this.iconlist=res.data
  263. console.log(res)
  264. })
  265. },
  266. toManager() {
  267. if (this.utils.checkCompanyUserLoginState()) {
  268. uni.navigateTo({
  269. url: '/pages_company/index'
  270. })
  271. } else {
  272. uni.navigateTo({
  273. url: '/pages_company/auth/login'
  274. })
  275. }
  276. },
  277. openH5(url) {
  278. var requestPath = uni.getStorageSync('requestPath');
  279. uni.setStorageSync('url', requestPath + url);
  280. uni.navigateTo({
  281. url: '../home/h5'
  282. })
  283. },
  284. getUserInfo() {
  285. getUserInfo().then(
  286. res => {
  287. if (res.code == 200) {
  288. if (res.user != null) {
  289. uni.setStorageSync('users',this.user)
  290. this.user = Object.assign({}, res.user) // 使用新对象触发响应式
  291. uni.$forceUpdate() // 强制更新视图
  292. } else {
  293. this.utils.loginOut();
  294. }
  295. } else {
  296. uni.showToast({
  297. icon: 'none',
  298. title: "请求失败",
  299. });
  300. }
  301. },
  302. rej => {}
  303. );
  304. },
  305. loginout(){
  306. uni.removeStorageSync('AppToken')
  307. uni.removeStorageSync('userInfo')
  308. uni.removeStorageSync('users')
  309. // 响应式更新数据
  310. this.UserInfo = null
  311. this.user = {
  312. isPromoter: 0,
  313. isWeixinAuth: 0,
  314. phone: "",
  315. nickname: "用户昵称",
  316. avatarUrl: "/static/images/detault_head.png"
  317. }
  318. uni.showToast({ title: '已退出登录', icon: 'success' })
  319. setTimeout(() => uni.reLaunch({ url: '/pages/home/index' }), 900)
  320. },
  321. // 跳转页面
  322. navgetTo(url) {
  323. this.utils.isLogin().then(res => {
  324. if (res) {
  325. uni.navigateTo({
  326. url: url
  327. })
  328. }
  329. })
  330. },
  331. // 查看订单
  332. showOrder(status) {
  333. uni.navigateTo({
  334. url: '/pages_user/user/storeOrder?status=' + status
  335. })
  336. }
  337. }
  338. }
  339. </script>
  340. <style lang="scss">
  341. .top-cont {
  342. width: 100%;
  343. height: 494upx;
  344. position: relative;
  345. // background-image: url(@/static/images/personl_top_bg.png);
  346. background-repeat: repeat-x;
  347. background-size: 40upx 100%;
  348. .bg{
  349. width: 100%;
  350. height: 380rpx;
  351. position: absolute;
  352. top: 0;
  353. left: 0;
  354. }
  355. .top-inner {
  356. width: 100%;
  357. height: 100%;
  358. position: absolute;
  359. top: 0;
  360. left: 0;
  361. z-index: 2;
  362. .user-info {
  363. padding: 88upx 30upx 0 30upx;
  364. display: flex;
  365. align-items: center;
  366. justify-content: space-between;
  367. .left {
  368. position: relative;
  369. display: flex;
  370. .head-img {
  371. width: 120upx;
  372. height: 120upx;
  373. border-radius: 50%;
  374. overflow: hidden;
  375. margin-right: 30upx;
  376. border: 4upx solid #FFFFFF;
  377. box-shadow: 0px 5px 15px 2px rgba(0, 0, 0, 0.1);
  378. image {
  379. width: 100%;
  380. height: 100%;
  381. }
  382. }
  383. .name-phone {
  384. padding-top: 15upx;
  385. .name {
  386. font-size: 40upx;
  387. font-family: PingFang SC;
  388. font-weight: bold;
  389. color: #111111;
  390. line-height: 1;
  391. }
  392. .phone {
  393. font-size: 28upx;
  394. font-family: PingFang SC;
  395. font-weight: 500;
  396. color: #666666;
  397. line-height: 1;
  398. margin-top: 30upx;
  399. }
  400. }
  401. }
  402. .right {
  403. display: flex;
  404. align-items: center;
  405. justify-content: center;
  406. .msg-box {
  407. margin-left: 10upx;
  408. width: 44upx;
  409. height: 44upx;
  410. image {
  411. width: 100%;
  412. height: 100%;
  413. }
  414. }
  415. .set {
  416. width: 44upx;
  417. height: 44upx;
  418. image {
  419. width: 100%;
  420. height: 100%;
  421. }
  422. }
  423. }
  424. }
  425. .my-order {
  426. padding: 50upx 20upx 0;
  427. .inner {
  428. box-sizing: border-box;
  429. height: 245upx;
  430. background: #FFFFFF;
  431. border-radius: 16upx;
  432. padding: 40upx 30upx;
  433. display: flex;
  434. flex-direction: column;
  435. justify-content: space-between;
  436. .title-box {
  437. display: flex;
  438. align-items: center;
  439. justify-content: space-between;
  440. .title {
  441. font-size: 34upx;
  442. font-family: PingFang SC;
  443. font-weight: bold;
  444. color: #222222;
  445. line-height: 1;
  446. }
  447. .all-order {
  448. display: flex;
  449. align-items: center;
  450. .text {
  451. font-size: 26upx;
  452. font-family: PingFang SC;
  453. font-weight: 500;
  454. color: #999999;
  455. line-height: 1;
  456. }
  457. image {
  458. width: 40upx;
  459. height: 40upx;
  460. }
  461. }
  462. }
  463. .status-box {
  464. display: flex;
  465. align-items: center;
  466. justify-content: space-between;
  467. padding: 0 10upx;
  468. .item {
  469. display: flex;
  470. flex-direction: column;
  471. align-items: center;
  472. justify-content: center;
  473. image {
  474. width: 40upx;
  475. height: 40upx;
  476. margin-bottom: 18upx;
  477. }
  478. .text {
  479. font-size: 26upx;
  480. font-family: PingFang SC;
  481. font-weight: 500;
  482. color: #111111;
  483. line-height: 1;
  484. }
  485. }
  486. }
  487. }
  488. }
  489. }
  490. }
  491. .content {
  492. margin-top: 20upx;
  493. padding: 0 20upx;
  494. display: flex;
  495. align-items: center;
  496. justify-content: center;
  497. .used-tools {
  498. box-sizing: border-box;
  499. background: #FFFFFF;
  500. border-radius: 16upx;
  501. padding: 40upx 30upx;
  502. .title {
  503. font-size: 34upx;
  504. font-family: PingFang SC;
  505. font-weight: bold;
  506. color: #222222;
  507. line-height: 1;
  508. }
  509. .tools-list {
  510. margin-top: 50upx;
  511. display: flex;
  512. flex-wrap: wrap;
  513. width: 100%;
  514. .item {
  515. box-sizing: border-box;
  516. width: 25%;
  517. display: flex;
  518. flex-direction: column;
  519. align-items: center;
  520. justify-content: center;
  521. margin-bottom: 50upx;
  522. position: relative;
  523. image {
  524. width: 44upx;
  525. height: 44upx;
  526. }
  527. .text {
  528. font-size: 24upx;
  529. font-family: PingFang SC;
  530. font-weight: 500;
  531. color: #111111;
  532. line-height: 1;
  533. margin-top: 20upx;
  534. }
  535. .contact-btn {
  536. display: inline-block;
  537. position: absolute;
  538. top: 0;
  539. left: 0;
  540. width: 100%;
  541. height: 100%;
  542. opacity: 0;
  543. }
  544. }
  545. }
  546. }
  547. }
  548. .sub-btn {
  549. position: absolute;
  550. width: 100%;
  551. height: 100%;
  552. opacity: 0;
  553. }
  554. .like-product {
  555. padding: 0 20rpx;
  556. }
  557. .banner {
  558. padding: 20rpx 20rpx 0rpx 20rpx;
  559. height: 200rpx;
  560. position: relative;
  561. display: flex;
  562. align-items: center;
  563. justify-content: center;
  564. image {
  565. width: 100%;
  566. height: 100%;
  567. }
  568. .tel_btn {
  569. width: 100%;
  570. height: 100%;
  571. top: 0upx;
  572. position: absolute;
  573. opacity: 0.0;
  574. }
  575. }
  576. .log-out {
  577. height: 80upx;
  578. width: 80%;
  579. background:#fff;
  580. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  581. line-height: 80upx;
  582. text-align: center;
  583. font-size: 26upx;
  584. font-family: PingFang SC;
  585. font-weight: 500;
  586. color: #018C39;
  587. margin: 0 auto;
  588. border-radius: 16upx;
  589. margin-top: 20upx;
  590. }
  591. </style>