index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <template>
  2. <view>
  3. <!-- 状态栏高度 -->
  4. <view :style="{ height: `${statusBarHeight}px` }"></view>
  5. <!-- 导航栏 -->
  6. <view :style="{ height: `${navigationBarHeight}px`,lineHeight: `${navigationBarHeight}px`}" class="order-nav">
  7. 个人中心
  8. </view>
  9. <view style="background-color: #FF6702;height: 60rpx;"></view>
  10. <view class="card">
  11. <view class="card-left">
  12. <view class="name" v-if="!isLogin" @tap="openAuto">
  13. <image class="avatar tui-skeleton-rect" :src='userInfo.avatar' v-if="userInfo.avatar" @click="goEdit()"></image>
  14. <image v-else class="avatar tui-skeleton-rect" :src="urlDomain+'crmebimage/presets/morenT.png'" mode="" @click="goEdit()">
  15. </image>
  16. <view class="username">请点击登录</view>
  17. </view>
  18. <template v-else>
  19. <image class="avatar tui-skeleton-rect" :src='userInfo.avatar' v-if="userInfo.avatar" @click="goEdit()"></image>
  20. <image v-else class="avatar tui-skeleton-rect" :src="urlDomain+'crmebimage/presets/morenT.png'" mode="" @click="goEdit()">
  21. </image>
  22. <view class="username">
  23. {{userInfo.nickname}}
  24. <!-- <image src="/static/img/ic-code.png" class="code"></image> -->
  25. </view>
  26. <view class="phone-info">
  27. <text>绑定手机号:{{userInfo.phone}}</text>
  28. <image src="/static/img/ic-copy.png">
  29. </image>
  30. </view>
  31. </template>
  32. </view>
  33. <view class="card-right">
  34. <view class="card-content">
  35. <view class="content-item">
  36. <img class="content-icon" src="/static/img/ic-tickets.png" alt="我的票劵">
  37. <view class="content-text1">我的票劵</view>
  38. </view>
  39. <view class="content-item" @click="menusTap('/pages/goods/order_list/index')">
  40. <img class="content-icon" src="/static/img/ic-order.png" alt="我的订单">
  41. <view class="content-text2">我的订单</view>
  42. </view>
  43. <view class="content-item">
  44. <img class="content-icon" src="/static/img/ic-gold.png" alt="我的金币">
  45. <view class="content-text3">我的金币</view>
  46. </view>
  47. </view>
  48. <!-- <view class="profile-link">
  49. <text>个人中心</text>
  50. <img src="/static/img/ic-right.png" />
  51. </view> -->
  52. </view>
  53. </view>
  54. <view style="position: relative;top: -90rpx;">
  55. <view class="item-settled">
  56. <image @tap="menusTap('/pages/users/settled/index')" src="/static/img/ic-settled-left.png" style="width: 350rpx;height: 116rpx;"></image>
  57. <image src="/static/img/ic-bg-line.png" style="width: 10rpx;height: 154rpx;margin: 0 20rpx;"></image>
  58. <image v-if="!userInfo.isRider" @tap="menusRider('/pages/users/user_rider/index')" src="/static/img/ic-settled-right.png"
  59. style="width: 350rpx;height: 116rpx;"></image>
  60. <image v-else @tap="menusRider('/pages/rider_index/index', true)" src="/static/img/go-shipping.png" style="width: 350rpx;height: 116rpx;"></image>
  61. </view>
  62. <view class="order-box">
  63. <view class="order-hd flex">
  64. <view class="left">订单中心</view>
  65. <view class="right flex" @click="menusTap('/pages/goods/order_list/index')">查看全部
  66. <text class="iconfont icon-xiangyou"></text>
  67. </view>
  68. </view>
  69. <view class="order-bd">
  70. <block v-for="(item,index) in orderMenu" :key="index">
  71. <view class="order-item" @click="menusTap(item.url)">
  72. <view class="pic">
  73. <text class="iconfont pic_status" :class="item.img"></text>
  74. <text class="order-status-num" v-if="item.num > 0">{{ item.num }}</text>
  75. </view>
  76. <view class="txt tui-skeleton-rect">{{item.title}}</view>
  77. </view>
  78. </block>
  79. </view>
  80. </view>
  81. <view class="item-features" v-if="isLogin">
  82. <view class="item-features-title">我的功能</view>
  83. <div class="grid-container">
  84. <!-- 示例:12 个格子(3行x4列) -->
  85. <div class="grid-item" v-for="item in featuresList" :key="item.id" @click="menusTap(item.url)">
  86. <img class="grid-img" :src="item.icon">
  87. <div class="grid-text">{{item.text}}</div>
  88. </div>
  89. </div>
  90. </view>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  96. let app = getApp();
  97. import {
  98. userCenterInfo,
  99. copyrightImageApi
  100. } from '@/api/user.js';
  101. import Cache from '@/utils/cache';
  102. import {
  103. toLogin
  104. } from '@/libs/login.js';
  105. import {
  106. mapGetters
  107. } from "vuex";
  108. import {
  109. BACK_URL
  110. } from '@/config/cache';
  111. import animationType from '@/utils/animationType.js'
  112. export default {
  113. computed: mapGetters(['isLogin']),
  114. data() {
  115. return {
  116. statusBarHeight: app.globalData.statusBarHeight,
  117. navigationBarHeight: 0,
  118. userInfo: {},
  119. urlDomain: this.$Cache.get("imgHost"),
  120. orderMenu: [{
  121. img: 'icon-daifukuan',
  122. title: '待付款',
  123. url: '/pages/goods/order_list/index?status=0',
  124. num: 0
  125. },
  126. {
  127. img: 'icon-daifahuo',
  128. title: '待发货',
  129. url: '/pages/goods/order_list/index?status=1',
  130. num: 0
  131. },
  132. {
  133. img: 'icon-daihexiao',
  134. title: '待核销',
  135. url: '/pages/goods/order_list/index?status=3',
  136. num: 0
  137. },
  138. {
  139. img: 'icon-daishouhuo',
  140. title: '待收货',
  141. url: '/pages/goods/order_list/index?status=4',
  142. num: 0
  143. },
  144. {
  145. img: 'icon-daipingjia',
  146. title: '待评价',
  147. url: '/pages/goods/evaluation_list/index',
  148. num: 0
  149. },
  150. {
  151. img: 'icon-a-shouhoutuikuan',
  152. title: '售后/退款',
  153. url: '/pages/goods/user_return_list/index',
  154. num: 0
  155. },
  156. ],
  157. featuresList: [{
  158. id: 1,
  159. icon: '/static/img/ic-express.png',
  160. text: '我的快递',
  161. url: ''
  162. },
  163. {
  164. id: 2,
  165. icon: '/static/img/ic-address.png',
  166. text: '通用地址',
  167. url: '/pages/address/user_address_list/index'
  168. },
  169. {
  170. id: 3,
  171. icon: '/static/img/ic-comments.png',
  172. text: '我的评论',
  173. url: ''
  174. },
  175. {
  176. id: 4,
  177. icon: '/static/img/ic-collection.png',
  178. text: '我的收藏',
  179. url: '/pages/goods/user_goods_collection/index'
  180. },
  181. {
  182. id: 5,
  183. icon: '/static/img/ic-buy.png',
  184. text: '我的团购',
  185. url: ''
  186. },
  187. {
  188. id: 6,
  189. icon: '/static/img/ic-vouchers.png',
  190. text: '我的卡券',
  191. url: '/pages/users/user_coupon/index'
  192. },
  193. {
  194. id: 7,
  195. icon: '/static/img/ic-distribution.png',
  196. text: '我的分销',
  197. url: '/pages/users/user_spread_user/index'
  198. },
  199. {
  200. id: 8,
  201. icon: '/static/img/ic-friend.png',
  202. text: '邀请好友',
  203. url: ''
  204. },
  205. {
  206. id: 9,
  207. icon: '/static/img/ic-feedback.png',
  208. text: '帮助反馈',
  209. url: ''
  210. },
  211. {
  212. id: 10,
  213. icon: '/static/img/ic-security-settings.png',
  214. text: '安全设置',
  215. url: '/pages/users/user_setting/index'
  216. }
  217. ],
  218. }
  219. },
  220. onLoad(options) {
  221. let that = this;
  222. //首页数据加载
  223. // this.getIndexConfig();
  224. // #ifdef MP-WEIXIN
  225. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  226. const custom = wx.getMenuButtonBoundingClientRect()
  227. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  228. this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  229. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  230. // #endif
  231. },
  232. onShow: function() {
  233. if (this.isLogin) {
  234. this.getUserCenterInfo();
  235. }
  236. },
  237. methods: {
  238. /**
  239. *
  240. * 获取个人中心详情
  241. */
  242. getUserCenterInfo: function() {
  243. userCenterInfo().then(res => {
  244. let data = res.data;
  245. this.userInfo = data;
  246. console.log(this, UserInfo)
  247. // this.showSkeleton = false;
  248. }).catch(err => {
  249. // this.showSkeleton = false;
  250. });
  251. },
  252. menusTap(url) {
  253. if (!this.isLogin) {
  254. this.openAuto();
  255. } else {
  256. if (url === '') return
  257. this.$util.navigateTo(url);
  258. }
  259. },
  260. // 打开授权
  261. openAuto() {
  262. Cache.set(BACK_URL, '')
  263. toLogin();
  264. },
  265. // 跳转骑手
  266. menusRider(url, falg) {
  267. if (!this.isLogin) {
  268. this.openAuto();
  269. } else {
  270. if (url === '') return
  271. falg ? uni.reLaunch({
  272. url: url
  273. }) : this.$util.navigateTo(url)
  274. }
  275. },
  276. // 编辑页面
  277. goEdit() {
  278. if (this.isLogin == false) {
  279. this.openAuto();
  280. } else {
  281. uni.navigateTo({
  282. animationType: animationType.type,
  283. animationDuration: animationType.duration,
  284. url: '/pages/users/user_info/index'
  285. })
  286. }
  287. },
  288. },
  289. }
  290. </script>
  291. <style lang="scss" scoped>
  292. .order-nav {
  293. font-weight: 500;
  294. font-size: 35rpx;
  295. color: #FFFFFF;
  296. background-color: #FF6702;
  297. text-align: center;
  298. }
  299. .item-settled {
  300. background: linear-gradient(135deg, #FED0A7 0%, #FFF3E2 52%, #FAEDD3 100%);
  301. border-radius: 8rpx;
  302. padding: 20rpx;
  303. box-shadow: 0 0 0 2rpx rgba(255, 220, 135, 1);
  304. position: relative;
  305. // top: -90rpx;
  306. margin: 0 20rpx;
  307. display: flex;
  308. align-items: center;
  309. }
  310. .item-settled::after {
  311. content: "";
  312. position: absolute;
  313. top: -2rpx;
  314. left: -2rpx;
  315. right: -2rpx;
  316. bottom: -2rpx;
  317. background: linear-gradient(200deg, rgba(255, 220, 135, 1), rgba(255, 172, 33, 1), rgba(255, 201, 24, 1));
  318. border-radius: 10rpx;
  319. z-index: -1;
  320. pointer-events: none;
  321. }
  322. .card {
  323. position: relative;
  324. display: flex;
  325. /* 启用flex布局 */
  326. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  327. padding: 40rpx 30rpx 120rpx 30rpx;
  328. box-sizing: border-box;
  329. background: linear-gradient(225deg, #ECF3FE 0%, #FEFEFE 100%);
  330. border-radius: 23rpx;
  331. top: -20rpx;
  332. }
  333. .card-left {
  334. position: relative;
  335. }
  336. .card-right {
  337. flex: 1;
  338. }
  339. .avatar {
  340. position: absolute;
  341. top: -80rpx;
  342. left: 0;
  343. width: 131rpx;
  344. height: 131rpx;
  345. background-color: #D8D8D8;
  346. border: 4rpx solid #FFFFFF;
  347. border-radius: 50%;
  348. object-fit: cover;
  349. }
  350. .username {
  351. margin-top: 70rpx;
  352. color: #141414;
  353. font-size: 35rpx;
  354. font-weight: bold;
  355. }
  356. .code {
  357. width: 31rpx;
  358. height: 31rpx;
  359. margin-left: 20rpx;
  360. }
  361. .card-content {
  362. display: flex;
  363. justify-content: space-between;
  364. }
  365. .content-item {
  366. display: flex;
  367. flex-direction: column;
  368. align-items: center;
  369. width: 33%;
  370. }
  371. .content-icon {
  372. width: 70rpx;
  373. height: 70rpx;
  374. margin-bottom: 15rpx;
  375. }
  376. .content-text1 {
  377. font-size: 23rpx;
  378. background: linear-gradient(90deg, #FFB908 0%, #DC7A11 100%);
  379. -webkit-background-clip: text;
  380. background-clip: text;
  381. color: transparent;
  382. }
  383. .content-text2 {
  384. font-size: 23rpx;
  385. background: linear-gradient(90deg, #93B0FF 0%, #1B4EFF 100%);
  386. -webkit-background-clip: text;
  387. background-clip: text;
  388. color: transparent;
  389. }
  390. .content-text3 {
  391. font-size: 23rpx;
  392. background: linear-gradient(90deg, #F4D600 0%, #FF9100 100%);
  393. -webkit-background-clip: text;
  394. background-clip: text;
  395. color: transparent;
  396. }
  397. .phone-info {
  398. font-size: 21rpx;
  399. padding-top: 10rpx;
  400. }
  401. .phone-info text {
  402. margin-right: 14rpx;
  403. }
  404. .phone-info image {
  405. width: 27rpx;
  406. height: 27rpx;
  407. vertical-align: middle;
  408. }
  409. .profile-link {
  410. margin-top: 20rpx;
  411. font-size: 23rpx;
  412. font-weight: 600;
  413. line-height: 21rpx;
  414. text-align: right;
  415. }
  416. .profile-link img {
  417. width: 24rpx;
  418. height: 24rpx;
  419. vertical-align: middle;
  420. margin-left: 12rpx;
  421. }
  422. .grid-container {
  423. display: flex;
  424. flex-wrap: wrap;
  425. gap: 0;
  426. /* 改用 margin 控制间距 */
  427. padding: 20rpx;
  428. /* 父容器内边距 */
  429. box-sizing: border-box;
  430. /* 包含 padding 在宽度内 */
  431. }
  432. .grid-item {
  433. width: 25%;
  434. /* 直接 25% 无需 calc */
  435. display: flex;
  436. flex-direction: column;
  437. align-items: center;
  438. margin-bottom: 30rpx;
  439. /* 行间距 */
  440. padding: 0 10rpx;
  441. /* 左右间隙(替代 gap) */
  442. box-sizing: border-box;
  443. /* 关键 */
  444. }
  445. .grid-img {
  446. width: 58rpx;
  447. height: 58rpx;
  448. margin-bottom: 8rpx;
  449. }
  450. .grid-text {
  451. font-size: 24rpx;
  452. color: #333;
  453. }
  454. .item-features {
  455. background: #FFFFFF;
  456. border-radius: 23rpx;
  457. margin: 0rpx 20rpx;
  458. }
  459. .item-features-title {
  460. padding: 20rpx;
  461. font-weight: 600;
  462. font-size: 27rpx;
  463. color: #2E261E;
  464. line-height: 38rpx;
  465. }
  466. .go-img {
  467. background: linear-gradient(135deg, #FED0A7 0%, #FFF3E2 52%, #FAEDD3 100%);
  468. border-radius: 8rpx;
  469. padding: 20rpx;
  470. box-shadow: 0 0 0 2rpx rgba(255, 220, 135, 1);
  471. display: flex;
  472. align-items: center;
  473. justify-content: center;
  474. margin-top: 20rpx;
  475. }
  476. .order-box {
  477. background-color: #fff;
  478. border-radius: 14rpx;
  479. padding: 30rpx 16rpx;
  480. position: relative;
  481. z-index: 11;
  482. margin: 20rpx;
  483. .order-hd {
  484. justify-content: space-between;
  485. font-size: 30rpx;
  486. color: #282828;
  487. margin-bottom: 40rpx;
  488. padding: 0 16rpx;
  489. .left {
  490. color: #282828;
  491. font-size: 30rpx;
  492. font-weight: 600;
  493. }
  494. .right {
  495. align-items: center;
  496. color: #666666;
  497. font-size: 26rpx;
  498. .icon-xiangyou {
  499. margin-left: 5rpx;
  500. font-size: 24rpx;
  501. }
  502. }
  503. }
  504. .order-bd {
  505. display: flex;
  506. justify-content: space-between;
  507. padding: 0;
  508. .order-item {
  509. display: flex;
  510. flex-direction: column;
  511. justify-content: center;
  512. align-items: center;
  513. .pic {
  514. position: relative;
  515. text-align: center;
  516. image {
  517. width: 48rpx;
  518. height: 48rpx;
  519. }
  520. }
  521. .txt {
  522. margin-top: 15rpx;
  523. font-size: 26rpx;
  524. color: #454545;
  525. }
  526. .pic_status {
  527. color: $bg-color-primary;
  528. }
  529. }
  530. }
  531. }
  532. </style>