index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. <template>
  2. <view class="page-container">
  3. <view class="top-cont">
  4. <image class="background-image" src="/static/message_top_bg.png" mode="aspectFill"></image>
  5. <view class="top-inner">
  6. <!-- 状态栏 -->
  7. <view class="status_bar" :style="{ height: statusBarHeight }"></view>
  8. <!-- 顶部标题 -->
  9. <view class="top-title">
  10. <text class="title-text">我的</text>
  11. </view>
  12. <!-- 用户信息区域 -->
  13. <view class="user-info">
  14. <view class="left">
  15. <view class="head-img">
  16. <image :src="user.avatarUrl ? user.avatarUrl : '/static/avatar.png'" mode="aspectFill">
  17. </image>
  18. </view>
  19. <view class="name-phone" v-if="UserInfo">
  20. <view class="name">{{ user.nickname }}
  21. <text class="fs24 ml12 mb20" style="color: #FF6633;" v-if="user.isShow == 1">会员</text>
  22. <text class="fs24 ml12 mb20" style="color: #666;" v-else>非会员</text>
  23. </view>
  24. <view class="phone">{{ user.phone }}</view>
  25. </view>
  26. <view class="fs40 bold name-phone center" @click='getOrderCount()' v-else>立即登录</view>
  27. </view>
  28. <!-- <view class="right">
  29. <uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
  30. <view class="set" @click="navgetTo('/pages_user/user/personInfo')">
  31. <image src="https://zlwh.obs.cn-southwest-2.myhuaweicloud.com/orangeShop/icon-set.png"
  32. mode=""></image>
  33. </view>
  34. </uni-badge>
  35. </view> -->
  36. </view>
  37. <!-- ✅ 四个栏目图标 - 移到 user-info 外面 -->
  38. <view class="columns">
  39. <view class="column-item" v-for="(item, index) in columns" :key="index">
  40. <view class="column-icon">
  41. <image :src="item.icon" mode="aspectFit"></image>
  42. </view>
  43. <text class="column-text">{{ item.text }}</text>
  44. </view>
  45. </view>
  46. <!-- ✅ 邀请好友横幅 - 移到 user-info 外面 -->
  47. <view class="invite-banner">
  48. <view class="invite-text">
  49. <view class="invite-title">邀请好友,可解锁xx课程</view>
  50. <view class="invite-subtitle">邀请减免无上限</view>
  51. </view>
  52. <view class="invite-icon">
  53. <image src="/static/course_img.png" mode="aspectFit"></image>
  54. </view>
  55. </view>
  56. </view>
  57. <view style="padding-bottom: 20rpx;" v-if="UserInfo">
  58. <view @tap="loginOUt" class="log-out x-c">退出登录</view>
  59. </view>
  60. </view>
  61. <!-- 功能列表 -->
  62. <view class="function-list">
  63. <view class="function-item" @click="navgetTo('/pages_user/user/myCourses')">
  64. <view class="function-left">
  65. <image class="function-icon" src="/static/my_courses.png" mode="aspectFit"></image>
  66. <text class="function-text">我的课程</text>
  67. </view>
  68. <image class="function-arrow" src="/static/right_arrow_right.png" mode="aspectFit"></image>
  69. </view>
  70. <view class="function-item" @click="navgetTo('/pages_user/user/myCollection')">
  71. <view class="function-left">
  72. <image class="function-icon" src="/static/my_collection.png" mode="aspectFit"></image>
  73. <text class="function-text">我的收藏</text>
  74. </view>
  75. <image class="function-arrow" src="/static/right_arrow_right.png" mode="aspectFit"></image>
  76. </view>
  77. </view>
  78. <view class="function-list">
  79. <view class="function-item" @click="navgetTo('/pages_user/user/contactService')">
  80. <view class="function-left">
  81. <image class="function-icon" src="/static/service_center.png" mode="aspectFit"></image>
  82. <text class="function-text">联系客服</text>
  83. </view>
  84. <image class="function-arrow" src="/static/right_arrow_right.png" mode="aspectFit"></image>
  85. </view>
  86. <view class="function-item" @click="navgetTo('/pages_user/user/settings')">
  87. <view class="function-left">
  88. <image class="function-icon" src="/static/set_icon.png" mode="aspectFit"></image>
  89. <text class="function-text">设置</text>
  90. </view>
  91. <image class="function-arrow" src="/static/right_arrow_right.png" mode="aspectFit"></image>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import {
  98. getOrderCount
  99. } from '@/api/storeOrder'
  100. import {
  101. getUserInfo
  102. } from '@/api/user'
  103. import likeProduct from '@/components/likeProduct.vue'
  104. export default {
  105. components: {
  106. likeProduct
  107. },
  108. data() {
  109. return {
  110. columns: [{
  111. text: '栏目1',
  112. icon: '/static/consultation_order_icon.png',
  113. },
  114. {
  115. text: '栏目2',
  116. icon: '/static/prescription_order.png',
  117. },
  118. {
  119. text: '栏目3',
  120. icon: '/static/service_pack.png',
  121. },
  122. {
  123. text: '栏目4',
  124. icon: '/static/my_service.png',
  125. }
  126. ],
  127. count0: 0,
  128. count1: 0,
  129. count2: 0,
  130. afterSalesCount: 0,
  131. user: {
  132. isPromoter: 0,
  133. isWeixinAuth: 0,
  134. phone: "",
  135. nickname: "用户昵称",
  136. avatarUrl: "https://zlwh.obs.cn-southwest-2.myhuaweicloud.com/orangeShop/detault_head.png"
  137. },
  138. // 状态栏的高度
  139. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  140. // 消息数量
  141. msgNum: 0,
  142. UserInfo: uni.getStorageSync('AppToken')
  143. };
  144. },
  145. watch: {
  146. UserInfo() {
  147. return uni.getStorageSync('AppToken')
  148. }
  149. },
  150. onLoad() {
  151. console.log("onload")
  152. },
  153. onShow() {
  154. console.log("onshow")
  155. this.UserInfo = uni.getStorageSync('AppToken') // 强制更新登录状态
  156. if (this.UserInfo) {
  157. this.getUserInfo()
  158. } else {
  159. // this.isuser=true
  160. }
  161. // this.getUserInfo();
  162. // this.getOrderCount();
  163. },
  164. onReachBottom() {
  165. console.log("onReachBottom")
  166. // 由于likeProduct组件已隐藏,暂时注释掉此调用
  167. // this.$refs.product.getGoodsProducts();
  168. },
  169. methods: {
  170. callService() {
  171. let orderKey = '5d81cf01-6f8d-4e1a-ae7a-dbc26c965b01';
  172. uni.navigateTo({
  173. url: '/pages_company/order/confirmOrder?orderKey=' + orderKey
  174. })
  175. return;
  176. },
  177. getOrderCount() {
  178. getOrderCount().then(
  179. res => {
  180. if (res.code == 200) {
  181. this.count0 = res.count0;
  182. this.count1 = res.count1;
  183. this.count2 = res.count2;
  184. this.afterSalesCount = res.afterSalesCount;
  185. }
  186. },
  187. rej => { }
  188. );
  189. },
  190. toManager() {
  191. if (this.utils.checkCompanyUserLoginState()) {
  192. uni.navigateTo({
  193. url: '/pages_company/index'
  194. })
  195. } else {
  196. uni.navigateTo({
  197. url: '/pages_company/auth/login'
  198. })
  199. }
  200. },
  201. toManagerCourse() {
  202. if (uni.getStorageSync('ManageToken')) {
  203. uni.navigateTo({
  204. url: '/pages_manage/index'
  205. })
  206. } else {
  207. uni.navigateTo({
  208. url: '/pages_manage/login'
  209. })
  210. }
  211. },
  212. openH5(url) {
  213. var requestPath = uni.getStorageSync('requestPath');
  214. uni.setStorageSync('url', requestPath + url);
  215. uni.navigateTo({
  216. url: '../home/h5?data=' + url
  217. })
  218. },
  219. getUserInfo() {
  220. getUserInfo().then(
  221. res => {
  222. if (res.code == 200) {
  223. if (res.user != null) {
  224. this.user = res.user;
  225. } else {
  226. this.utils.loginOut();
  227. }
  228. } else {
  229. uni.showToast({
  230. icon: 'none',
  231. title: "请求失败",
  232. });
  233. }
  234. },
  235. rej => { }
  236. );
  237. },
  238. // 跳转页面
  239. navgetTo(url) {
  240. this.utils.isLogin().then(res => {
  241. if (res) {
  242. uni.navigateTo({
  243. url: url
  244. })
  245. }
  246. })
  247. },
  248. // 查看订单
  249. showOrder(status) {
  250. uni.navigateTo({
  251. url: '/pages_user/user/storeOrder?status=' + status
  252. })
  253. },
  254. loginOUt() {
  255. this.utils.loginOut();
  256. this.getUserInfo();
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .page-container {
  263. width: 100%;
  264. min-height: 100vh;
  265. background-color: #f8f8f8;
  266. padding-bottom: 120rpx; // 为底部导航栏留出空间
  267. }
  268. .top-cont {
  269. width: 100%;
  270. min-height: 494rpx;
  271. position: relative;
  272. .background-image {
  273. position: absolute;
  274. top: 0;
  275. left: 0;
  276. width: 100%;
  277. height: 100%;
  278. z-index: 1;
  279. }
  280. .top-inner {
  281. width: 100%;
  282. height: 100%;
  283. position: relative;
  284. top: 0;
  285. left: 0;
  286. z-index: 2;
  287. .top-title {
  288. display: flex;
  289. align-items: center;
  290. justify-content: center;
  291. padding: 20rpx 30rpx;
  292. .title-text {
  293. font-weight: 500;
  294. font-size: 34rpx;
  295. color: #000000;
  296. }
  297. .top-right {
  298. display: flex;
  299. align-items: center;
  300. .icon {
  301. width: 40rpx;
  302. height: 40rpx;
  303. margin-left: 20rpx;
  304. }
  305. }
  306. }
  307. .columns {
  308. display: flex;
  309. align-items: center;
  310. justify-content: space-around;
  311. padding: 30rpx 0;
  312. .column-item {
  313. display: flex;
  314. flex-direction: column;
  315. align-items: center;
  316. justify-content: center;
  317. font-size: 24rpx;
  318. color: #222222;
  319. .column-icon {
  320. width: 56rpx;
  321. height: 56rpx;
  322. border-radius: 20rpx;
  323. display: flex;
  324. align-items: center;
  325. justify-content: center;
  326. margin-bottom: 10rpx;
  327. image {
  328. width: 100%;
  329. height: 100%;
  330. }
  331. }
  332. .column-text {
  333. font-size: 24rpx;
  334. font-family: PingFang SC;
  335. font-weight: 400;
  336. color: #333333;
  337. }
  338. }
  339. }
  340. .invite-banner {
  341. margin: 20rpx 30rpx;
  342. border-radius: 12rpx;
  343. display: flex;
  344. align-items: center;
  345. justify-content: space-between;
  346. background: linear-gradient(90deg, #FDF1BF 0%, #FFDB83 100%);
  347. border-radius: 64rpx 64rpx 64rpx 64rpx;
  348. .invite-text {
  349. flex: 1;
  350. margin-left: 46rpx;
  351. .invite-title {
  352. line-height: 1.2;
  353. font-weight: 500;
  354. font-size: 32rpx;
  355. color: #592706;
  356. }
  357. .invite-subtitle {
  358. font-size: 24rpx;
  359. color: rgba(89, 39, 6, 0.7);
  360. line-height: 1.2;
  361. }
  362. }
  363. .invite-icon {
  364. width: 128rpx;
  365. height: 128rpx;
  366. image {
  367. width: 100%;
  368. height: 100%;
  369. }
  370. }
  371. }
  372. .user-info {
  373. padding: 20rpx 30rpx 0 30rpx;
  374. display: flex;
  375. align-items: center;
  376. justify-content: flex-start;
  377. .left {
  378. position: relative;
  379. display: flex;
  380. .head-img {
  381. width: 100rpx;
  382. height: 100rpx;
  383. border-radius: 50%;
  384. overflow: hidden;
  385. margin-right: 20rpx;
  386. border: 3rpx solid #FFFFFF;
  387. box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.1);
  388. image {
  389. width: 100%;
  390. height: 100%;
  391. }
  392. }
  393. .name-phone {
  394. .name {
  395. font-size: 32rpx;
  396. font-family: PingFang SC;
  397. font-weight: 500;
  398. color: #333333;
  399. line-height: 1;
  400. }
  401. .phone {
  402. font-size: 24rpx;
  403. font-family: PingFang SC;
  404. font-weight: 400;
  405. color: #666666;
  406. line-height: 1;
  407. margin-top: 10rpx;
  408. }
  409. }
  410. }
  411. .right {
  412. display: none;
  413. }
  414. }
  415. }
  416. .my-order {
  417. padding: 50rpx 20rpx 0;
  418. .inner {
  419. box-sizing: border-box;
  420. height: 245rpx;
  421. // height: 105rpx;
  422. background: #FFFFFF;
  423. border-radius: 16rpx;
  424. padding: 40rpx 30rpx;
  425. display: flex;
  426. flex-direction: column;
  427. justify-content: space-between;
  428. .title-box {
  429. display: flex;
  430. align-items: center;
  431. justify-content: space-between;
  432. .title {
  433. font-size: 34rpx;
  434. font-family: PingFang SC;
  435. font-weight: bold;
  436. color: #222222;
  437. line-height: 1;
  438. }
  439. .all-order {
  440. display: flex;
  441. align-items: center;
  442. .text {
  443. font-size: 26rpx;
  444. font-family: PingFang SC;
  445. font-weight: 500;
  446. color: #999999;
  447. line-height: 1;
  448. margin-right: 8rpx;
  449. }
  450. image {
  451. width: 14rpx;
  452. height: 24rpx;
  453. }
  454. }
  455. }
  456. .status-box {
  457. display: flex;
  458. align-items: center;
  459. justify-content: space-between;
  460. padding: 0 10rpx;
  461. .item {
  462. display: flex;
  463. flex-direction: column;
  464. align-items: center;
  465. justify-content: center;
  466. image {
  467. width: 40rpx;
  468. height: 40rpx;
  469. margin-bottom: 18rpx;
  470. }
  471. .text {
  472. font-size: 26rpx;
  473. font-family: PingFang SC;
  474. font-weight: 500;
  475. color: #111111;
  476. line-height: 1;
  477. }
  478. }
  479. }
  480. }
  481. }
  482. .content {
  483. margin-top: 20rpx;
  484. padding: 0 20rpx;
  485. display: flex;
  486. align-items: center;
  487. justify-content: center;
  488. .used-tools {
  489. box-sizing: border-box;
  490. background: #FFFFFF;
  491. border-radius: 16rpx;
  492. padding: 40rpx 30rpx;
  493. .title {
  494. font-size: 34rpx;
  495. font-family: PingFang SC;
  496. font-weight: bold;
  497. color: #222222;
  498. line-height: 1;
  499. }
  500. .tools-list {
  501. margin-top: 50rpx;
  502. display: flex;
  503. flex-wrap: wrap;
  504. width: 100%;
  505. .item {
  506. box-sizing: border-box;
  507. width: 25%;
  508. display: flex;
  509. flex-direction: column;
  510. align-items: center;
  511. justify-content: center;
  512. margin-bottom: 50rpx;
  513. position: relative;
  514. image {
  515. width: 44rpx;
  516. height: 44rpx;
  517. }
  518. .text {
  519. font-size: 24rpx;
  520. font-family: PingFang SC;
  521. font-weight: 500;
  522. color: #111111;
  523. line-height: 1;
  524. margin-top: 20rpx;
  525. }
  526. .contact-btn {
  527. display: inline-block;
  528. position: absolute;
  529. top: 0;
  530. left: 0;
  531. width: 100%;
  532. height: 100%;
  533. opacity: 0;
  534. }
  535. }
  536. }
  537. }
  538. }
  539. .log-out {
  540. height: 80rpx;
  541. line-height: 80rpx;
  542. text-align: center;
  543. font-size: 26rpx;
  544. font-family: PingFang SC;
  545. font-weight: 500;
  546. color: #666666;
  547. background: #FFFFFF;
  548. border-radius: 16rpx;
  549. margin-top: 20rpx;
  550. }
  551. .sub-btn {
  552. position: absolute;
  553. width: 100%;
  554. height: 100%;
  555. opacity: 0;
  556. }
  557. .like-product {
  558. padding: 0 20rpx;
  559. }
  560. .banner {
  561. padding: 20rpx 20rpx 0rpx 20rpx;
  562. height: 200rpx;
  563. position: relative;
  564. display: flex;
  565. align-items: center;
  566. justify-content: center;
  567. image {
  568. width: 100%;
  569. height: 100%;
  570. }
  571. .tel_btn {
  572. width: 100%;
  573. height: 100%;
  574. top: 0rpx;
  575. position: absolute;
  576. opacity: 0.0;
  577. }
  578. }
  579. .log-out {
  580. height: 100rpx;
  581. line-height: 100rpx;
  582. margin: 10px;
  583. border-radius: 20rpx;
  584. }
  585. }
  586. /* 功能列表 */
  587. .function-list {
  588. margin: 24rpx 24rpx 0;
  589. background-color: #FFFFFF;
  590. border-radius: 16rpx;
  591. overflow: hidden;
  592. // box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
  593. .function-item {
  594. display: flex;
  595. align-items: center;
  596. justify-content: space-between;
  597. padding: 30rpx;
  598. // border-bottom: 1rpx solid #F0F0F0;
  599. &:last-child {
  600. border-bottom: none;
  601. }
  602. .function-left {
  603. display: flex;
  604. align-items: center;
  605. .function-icon {
  606. width: 48rpx;
  607. height: 48rpx;
  608. margin-right: 20rpx;
  609. }
  610. .function-text {
  611. font-size: 28rpx;
  612. font-family: PingFang SC;
  613. font-weight: 400;
  614. color: #333333;
  615. }
  616. }
  617. .function-arrow {
  618. width: 24rpx;
  619. height: 24rpx;
  620. }
  621. }
  622. }
  623. </style>