index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <view>
  3. <view class="top-cont" :style="$store.state.theme.currentMoban">
  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">
  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>
  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/images/icon-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/images/common/new_icon.png" mode=""></image>
  34. </view>
  35. </uni-badge>
  36. </view>
  37. </view>
  38. <!-- 我的订单 -->
  39. <view class="my-order">
  40. <view class="inner" v-if="user.isShow==1">
  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/images/common/arrow_right.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/images/common/obligation.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/images/common/pending_shipment.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/images/common/dai_shouhuo.png" mode=""></image>
  64. <text class="text">待收货</text>
  65. </view>
  66. </uni-badge>
  67. <view class="item" @click="showOrder('3')">
  68. <image src="../../static/images/common/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/images/common/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
  86. v-for="(item,index) in toolsArr"
  87. :key="index"
  88. @click="navgetTo(item.url)"
  89. :class="(toolsArr.length - index) > toolsRemain?'item':'item no-marin-bottom'">
  90. <image :src="item.img" mode=""></image>
  91. <text class="text">{{ item.name }}</text>
  92. <button v-if="item.url == ''" class="contact-btn" open-type="contact"></button>
  93. </view> -->
  94. <!-- <view class="item" @click="navgetTo('/pages_user/user/doctorOrder')">
  95. <image src="../../static/images/my_ask.png" mode=""></image>
  96. <text class="text">我的问诊</text>
  97. </view> -->
  98. <!-- <view class="item" @click="navgetTo('/pages_user/user/prescribeOrder')">
  99. <image src="../../static/images/prescription.png" mode=""></image>
  100. <text class="text">我的处方</text>
  101. </view>
  102. <view class="item" @click="navgetTo('/pages_user/user/patient')">
  103. <image src="../../static/images/management.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="iconlist[0].icon" 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="iconlist[1].icon" 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="iconlist[2].icon" mode=""></image>
  116. <text class="text">优惠券</text>
  117. </view>
  118. <view class="item no-marin-bottom"
  119. @click="navgetTo('/pages_user/user/storeProductRelation')">
  120. <image :src="iconlist[3].icon" mode=""></image>
  121. <text class="text">我的足迹</text>
  122. </view>
  123. <view class="item no-marin-bottom" @click="openH5('/h5/userAgreement')">
  124. <image :src="iconlist[4].icon" mode=""></image>
  125. <text class="text">用户协议</text>
  126. </view>
  127. <view class="item no-marin-bottom align-top" @click="openH5('/h5/privacyPolicy')">
  128. <image :src="iconlist[5].icon" mode=""></image>
  129. <text class="text">隐私保护</text>
  130. </view>
  131. <view class="item no-marin-bottom">
  132. <image :src="iconlist[6].icon" mode=""></image>
  133. <text class="text">专属客服</text>
  134. <button class="contact-btn" open-type="contact"></button>
  135. </view>
  136. <view v-if="user.isPromoter==0" class="item no-marin-bottom"
  137. @click="navgetTo('/pages_user/user/userTuiAdd')">
  138. <image :src="iconlist[7].icon" mode=""></image>
  139. <text class="text">申请健康大使</text>
  140. </view>
  141. <view v-if="user.isPromoter==1" class="item no-marin-bottom"
  142. @click="navgetTo('/pages_user/user/userTui')">
  143. <image src="../../static/images/my_promotion.png" mode=""></image>
  144. <text class="text">我的推广</text>
  145. </view>
  146. <view class="item no-marin-bottom" @click="navgetTo('/pages/home/cert')">
  147. <image :src="iconlist[8].icon" mode=""></image>
  148. <text class="text">资质证书</text>
  149. </view>
  150. <view class="item no-marin-bottom" @click="toManager()">
  151. <image :src="iconlist[9].icon" mode=""></image>
  152. <text class="text">销售管理</text>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. <view class="log-out" @click="loginout">退出登录</view>
  158. <view class="banner">
  159. <image class="radius10"
  160. src="https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736956202172.jpg" mode="widthFix">
  161. </image>
  162. <view class="tel_btn" @click="callService()"></view>
  163. </view>
  164. <!-- 退出登录按钮 -->
  165. <view class="like-product">
  166. <likeProduct ref="product" />
  167. </view>
  168. </view>
  169. </view>
  170. <!-- <tabbar :actindex="3"></tabbar> -->
  171. </view>
  172. </template>
  173. <script>
  174. import {
  175. getOrderCount
  176. } from '@/api/storeOrder'
  177. import {
  178. getUserInfo,geticon
  179. } from '@/api/user'
  180. import likeProduct from '@/components/likeProduct.vue'
  181. export default {
  182. components: {
  183. likeProduct
  184. },
  185. data() {
  186. return {
  187. theme:'beiliyou',
  188. count0: 0,
  189. count1: 0,
  190. count2: 0,
  191. afterSalesCount: 0,
  192. user: {
  193. isPromoter: 0,
  194. isWeixinAuth: 0,
  195. phone: "",
  196. nickname: "用户昵称",
  197. avatarUrl: "/static/images/detault_head.png"
  198. },
  199. // 状态栏的高度
  200. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  201. // 消息数量
  202. msgNum: 0,
  203. iconlist:[]
  204. };
  205. },
  206. onLoad() {
  207. console.log("onload")
  208. },
  209. onShow() {
  210. console.log("onshow")
  211. this.geticon()
  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. uni.makePhoneCall({
  223. phoneNumber: "010-53822802",
  224. success: function() {
  225. console.log('拨打电话成功');
  226. },
  227. fail() {
  228. console.log('打电话失败了');
  229. }
  230. })
  231. },
  232. getOrderCount() {
  233. getOrderCount().then(
  234. res => {
  235. if (res.code == 200) {
  236. this.count0 = res.count0;
  237. this.count1 = res.count1;
  238. this.count2 = res.count2;
  239. this.afterSalesCount = res.afterSalesCount;
  240. }
  241. },
  242. rej => {}
  243. );
  244. },
  245. geticon(){
  246. geticon().then(res=>{
  247. this.iconlist=res.data
  248. console.log(res)
  249. })
  250. },
  251. toManager() {
  252. if (this.utils.checkCompanyUserLoginState()) {
  253. uni.navigateTo({
  254. url: '/pages_company/index'
  255. })
  256. } else {
  257. uni.navigateTo({
  258. url: '/pages_company/auth/login'
  259. })
  260. }
  261. },
  262. openH5(url) {
  263. var requestPath = uni.getStorageSync('requestPath');
  264. uni.setStorageSync('url', requestPath + url);
  265. uni.navigateTo({
  266. url: '../home/h5'
  267. })
  268. },
  269. getUserInfo() {
  270. getUserInfo().then(
  271. res => {
  272. if (res.code == 200) {
  273. if (res.user != null) {
  274. this.user = res.user;
  275. uni.setStorageSync('users',this.user)
  276. console.log(uni.getStorageSync('users',this.user))
  277. } else {
  278. this.utils.loginOut();
  279. }
  280. } else {
  281. uni.showToast({
  282. icon: 'none',
  283. title: "请求失败",
  284. });
  285. }
  286. },
  287. rej => {}
  288. );
  289. },
  290. loginout(){
  291. // 1. 清除所有本地存储的用户相关数据
  292. uni.removeStorageSync('AppToken'); // 清除登录Token
  293. uni.removeStorageSync('userInfo'); // 清除用户信息
  294. uni.removeStorageSync('users'); // 清除用户详细信息
  295. this.count0 = 0;
  296. this.count1 = 0;
  297. this.count2 = 0;
  298. // 3. 显示退出提示
  299. uni.showToast({
  300. title: '已退出登录',
  301. icon: 'success',
  302. duration: 500
  303. });
  304. // 4. 1.5秒后跳转首页
  305. setTimeout(() => {
  306. uni.reLaunch({
  307. url: '/pages/home/index' // 根据实际首页路径调整
  308. });
  309. }, 900);
  310. },
  311. // 跳转页面
  312. navgetTo(url) {
  313. this.utils.isLogin().then(res => {
  314. if (res) {
  315. uni.navigateTo({
  316. url: url
  317. })
  318. }
  319. })
  320. },
  321. // 查看订单
  322. showOrder(status) {
  323. uni.navigateTo({
  324. url: '/pages_user/user/storeOrder?status=' + status
  325. })
  326. }
  327. }
  328. }
  329. </script>
  330. <style lang="scss">
  331. .top-cont {
  332. width: 100%;
  333. height: 494upx;
  334. position: relative;
  335. // background-image: url(@/static/images/personl_top_bg.png);
  336. background-repeat: repeat-x;
  337. background-size: 40upx 100%;
  338. .bg{
  339. width: 100%;
  340. height: 380rpx;
  341. position: absolute;
  342. top: 0;
  343. left: 0;
  344. }
  345. .top-inner {
  346. width: 100%;
  347. height: 100%;
  348. position: absolute;
  349. top: 0;
  350. left: 0;
  351. z-index: 2;
  352. .user-info {
  353. padding: 88upx 30upx 0 30upx;
  354. display: flex;
  355. align-items: center;
  356. justify-content: space-between;
  357. .left {
  358. position: relative;
  359. display: flex;
  360. .head-img {
  361. width: 120upx;
  362. height: 120upx;
  363. border-radius: 50%;
  364. overflow: hidden;
  365. margin-right: 30upx;
  366. border: 4upx solid #FFFFFF;
  367. box-shadow: 0px 5px 15px 2px rgba(0, 0, 0, 0.1);
  368. image {
  369. width: 100%;
  370. height: 100%;
  371. }
  372. }
  373. .name-phone {
  374. padding-top: 15upx;
  375. .name {
  376. font-size: 40upx;
  377. font-family: PingFang SC;
  378. font-weight: bold;
  379. color: #111111;
  380. line-height: 1;
  381. }
  382. .phone {
  383. font-size: 28upx;
  384. font-family: PingFang SC;
  385. font-weight: 500;
  386. color: #666666;
  387. line-height: 1;
  388. margin-top: 30upx;
  389. }
  390. }
  391. }
  392. .right {
  393. display: flex;
  394. align-items: center;
  395. justify-content: center;
  396. .msg-box {
  397. margin-left: 10upx;
  398. width: 44upx;
  399. height: 44upx;
  400. image {
  401. width: 100%;
  402. height: 100%;
  403. }
  404. }
  405. .set {
  406. width: 44upx;
  407. height: 44upx;
  408. image {
  409. width: 100%;
  410. height: 100%;
  411. }
  412. }
  413. }
  414. }
  415. .my-order {
  416. padding: 50upx 20upx 0;
  417. .inner {
  418. box-sizing: border-box;
  419. height: 245upx;
  420. background: #FFFFFF;
  421. border-radius: 16upx;
  422. padding: 40upx 30upx;
  423. display: flex;
  424. flex-direction: column;
  425. justify-content: space-between;
  426. .title-box {
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. .title {
  431. font-size: 34upx;
  432. font-family: PingFang SC;
  433. font-weight: bold;
  434. color: #222222;
  435. line-height: 1;
  436. }
  437. .all-order {
  438. display: flex;
  439. align-items: center;
  440. .text {
  441. font-size: 26upx;
  442. font-family: PingFang SC;
  443. font-weight: 500;
  444. color: #999999;
  445. line-height: 1;
  446. }
  447. image {
  448. width: 40upx;
  449. height: 40upx;
  450. }
  451. }
  452. }
  453. .status-box {
  454. display: flex;
  455. align-items: center;
  456. justify-content: space-between;
  457. padding: 0 10upx;
  458. .item {
  459. display: flex;
  460. flex-direction: column;
  461. align-items: center;
  462. justify-content: center;
  463. image {
  464. width: 40upx;
  465. height: 40upx;
  466. margin-bottom: 18upx;
  467. }
  468. .text {
  469. font-size: 26upx;
  470. font-family: PingFang SC;
  471. font-weight: 500;
  472. color: #111111;
  473. line-height: 1;
  474. }
  475. }
  476. }
  477. }
  478. }
  479. }
  480. }
  481. .content {
  482. margin-top: 20upx;
  483. padding: 0 20upx;
  484. display: flex;
  485. align-items: center;
  486. justify-content: center;
  487. .used-tools {
  488. box-sizing: border-box;
  489. background: #FFFFFF;
  490. border-radius: 16upx;
  491. padding: 40upx 30upx;
  492. .title {
  493. font-size: 34upx;
  494. font-family: PingFang SC;
  495. font-weight: bold;
  496. color: #222222;
  497. line-height: 1;
  498. }
  499. .tools-list {
  500. margin-top: 50upx;
  501. display: flex;
  502. flex-wrap: wrap;
  503. width: 100%;
  504. .item {
  505. box-sizing: border-box;
  506. width: 25%;
  507. display: flex;
  508. flex-direction: column;
  509. align-items: center;
  510. justify-content: center;
  511. margin-bottom: 50upx;
  512. position: relative;
  513. image {
  514. width: 44upx;
  515. height: 44upx;
  516. }
  517. .text {
  518. font-size: 24upx;
  519. font-family: PingFang SC;
  520. font-weight: 500;
  521. color: #111111;
  522. line-height: 1;
  523. margin-top: 20upx;
  524. }
  525. .contact-btn {
  526. display: inline-block;
  527. position: absolute;
  528. top: 0;
  529. left: 0;
  530. width: 100%;
  531. height: 100%;
  532. opacity: 0;
  533. }
  534. }
  535. }
  536. }
  537. }
  538. .sub-btn {
  539. position: absolute;
  540. width: 100%;
  541. height: 100%;
  542. opacity: 0;
  543. }
  544. .like-product {
  545. padding: 0 20rpx;
  546. }
  547. .banner {
  548. padding: 20rpx 20rpx 0rpx 20rpx;
  549. height: 200rpx;
  550. position: relative;
  551. display: flex;
  552. align-items: center;
  553. justify-content: center;
  554. image {
  555. width: 100%;
  556. height: 100%;
  557. }
  558. .tel_btn {
  559. width: 100%;
  560. height: 100%;
  561. top: 0upx;
  562. position: absolute;
  563. opacity: 0.0;
  564. }
  565. }
  566. .log-out {
  567. height: 80upx;
  568. width: 80%;
  569. background:#fff;
  570. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  571. line-height: 80upx;
  572. text-align: center;
  573. font-size: 26upx;
  574. font-family: PingFang SC;
  575. font-weight: 500;
  576. color: #018C39;
  577. margin: 0 auto;
  578. border-radius: 16upx;
  579. margin-top: 20upx;
  580. }
  581. </style>