index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  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. <!-- 商家管理 -->
  92. <view class="item-features" v-if="isLogin && isEmployee">
  93. <view class="item-features-title">店铺管理</view>
  94. <view class="list-box">
  95. <view class="item" @click="toggle('bottom')">
  96. <image :src="urlDomain+'crmebimage/presets/adminImg/sjgl.png'"></image>
  97. <text>商家管理</text>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  106. let app = getApp();
  107. import {
  108. userCenterInfo,
  109. copyrightImageApi
  110. } from '@/api/user.js';
  111. import Cache from '@/utils/cache';
  112. import {
  113. orderNum
  114. } from '@/api/order.js';
  115. import {
  116. toLogin
  117. } from '@/libs/login.js';
  118. import {
  119. mapGetters
  120. } from "vuex";
  121. import {
  122. BACK_URL
  123. } from '@/config/cache';
  124. import animationType from '@/utils/animationType.js'
  125. export default {
  126. computed: mapGetters(['isLogin','merchantEmployeeList', 'isEmployee', 'selectMerId']),
  127. data() {
  128. return {
  129. statusBarHeight: app.globalData.statusBarHeight,
  130. navigationBarHeight: 0,
  131. userInfo: {},
  132. urlDomain: this.$Cache.get("imgHost"),
  133. orderMenu: [{
  134. img: 'icon-daifukuan',
  135. title: '待付款',
  136. url: '/pages/goods/order_list/index?status=0',
  137. num: 0
  138. },
  139. {
  140. img: 'icon-daifahuo',
  141. title: '待发货',
  142. url: '/pages/goods/order_list/index?status=1',
  143. num: 0
  144. },
  145. {
  146. img: 'icon-daihexiao',
  147. title: '待核销',
  148. url: '/pages/goods/order_list/index?status=3',
  149. num: 0
  150. },
  151. {
  152. img: 'icon-daishouhuo',
  153. title: '待收货',
  154. url: '/pages/goods/order_list/index?status=4',
  155. num: 0
  156. },
  157. {
  158. img: 'icon-daipingjia',
  159. title: '待评价',
  160. url: '/pages/goods/evaluation_list/index',
  161. num: 0
  162. },
  163. {
  164. img: 'icon-a-shouhoutuikuan',
  165. title: '售后/退款',
  166. url: '/pages/goods/user_return_list/index',
  167. num: 0
  168. },
  169. ],
  170. featuresList: [{
  171. id: 1,
  172. icon: '/static/img/ic-express.png',
  173. text: '我的快递',
  174. url: '/pages/substitute_fast_mail/my_fast_mail/index'
  175. },
  176. {
  177. id: 2,
  178. icon: '/static/img/ic-address.png',
  179. text: '通用地址',
  180. url: '/pages/address/user_address_list/index'
  181. },
  182. {
  183. id: 3,
  184. icon: '/static/img/ic-comments.png',
  185. text: '我的评论',
  186. url: ''
  187. },
  188. {
  189. id: 4,
  190. icon: '/static/img/ic-collection.png',
  191. text: '我的收藏',
  192. url: '/pages/goods/user_goods_collection/index'
  193. },
  194. {
  195. id: 5,
  196. icon: '/static/img/ic-buy.png',
  197. text: '我的团购',
  198. url: ''
  199. },
  200. {
  201. id: 6,
  202. icon: '/static/img/ic-vouchers.png',
  203. text: '我的卡券',
  204. url: '/pages/users/user_coupon/index'
  205. },
  206. {
  207. id: 7,
  208. icon: '/static/img/ic-distribution.png',
  209. text: '我的分销',
  210. url: '/pages/users/user_spread_user/index'
  211. },
  212. {
  213. id: 8,
  214. icon: '/static/img/ic-friend.png',
  215. text: '邀请好友',
  216. url: ''
  217. },
  218. {
  219. id: 9,
  220. icon: '/static/img/ic-feedback.png',
  221. text: '帮助反馈',
  222. url: ''
  223. },
  224. {
  225. id: 10,
  226. icon: '/static/img/ic-security-settings.png',
  227. text: '安全设置',
  228. url: '/pages/users/user_setting/index'
  229. }
  230. ],
  231. }
  232. },
  233. onLoad(options) {
  234. let that = this;
  235. //首页数据加载
  236. // this.getIndexConfig();
  237. // #ifdef MP-WEIXIN
  238. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  239. const custom = wx.getMenuButtonBoundingClientRect()
  240. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  241. this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  242. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  243. // #endif
  244. },
  245. onShow: function() {
  246. if (this.isLogin) {
  247. this.getUserCenterInfo();
  248. this.getOrderData();
  249. this.getMerchantList();
  250. }
  251. },
  252. methods: {
  253. toggle(type) {
  254. if (this.merchantEmployeeList.length == 1) {
  255. merchantActive(this.merchantEmployeeList[0].merId).then(res => {
  256. this.$store.commit('SetSelectMerId', this.merchantEmployeeList[0].merId);
  257. this.$store.commit('SetSelectMerchantRole', this.merchantEmployeeList[0].role);
  258. this.$store.commit('SET_MANAGER_TOKEN', {
  259. managerToken: res.data.token
  260. });
  261. Cache.set('electrPrintingSwitch', res.data.electrPrintingSwitch);
  262. uni.navigateTo({
  263. url: '/pages/admin/work/index'
  264. })
  265. return
  266. })
  267. return
  268. }
  269. if (this.selectMerId) {
  270. uni.navigateTo({
  271. url: '/pages/admin/work/index'
  272. })
  273. } else {
  274. this.type = type
  275. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  276. this.$refs.popup.open(type)
  277. }
  278. },
  279. getOrderData() {
  280. let that = this;
  281. orderNum().then(res => {
  282. that.orderMenu.forEach((item, index) => {
  283. switch (item.title) {
  284. case '待付款':
  285. item.num = res.data.awaitPayCount
  286. break
  287. case '待发货':
  288. item.num = res.data.awaitShippedCount
  289. break
  290. case '待收货':
  291. item.num = res.data.receiptCount
  292. break
  293. case '待核销':
  294. item.num = res.data.verificationCount
  295. break
  296. case '待评价':
  297. item.num = res.data.awaitReplyCount
  298. break
  299. default:
  300. item.num = res.data.refundCount
  301. }
  302. })
  303. that.$set(that, 'orderMenu', that.orderMenu);
  304. })
  305. },
  306. /**
  307. *
  308. * 获取个人中心详情
  309. */
  310. getUserCenterInfo: function() {
  311. userCenterInfo().then(res => {
  312. let data = res.data;
  313. this.userInfo = data;
  314. console.log(this, UserInfo)
  315. // this.showSkeleton = false;
  316. }).catch(err => {
  317. // this.showSkeleton = false;
  318. });
  319. },
  320. //获取商户列表
  321. getMerchantList() {
  322. let that = this
  323. MerchantBelongListApi().then(res => {
  324. if (this.selectMerId) {
  325. let flag = res.data.find(item => item.merId === this.selectMerId);
  326. !flag && that.$store.commit('CLEAR_SELECTMERID');
  327. }
  328. this.$store.commit("SetMerchantEmployeeList", res.data);
  329. })
  330. },
  331. menusTap(url) {
  332. if (!this.isLogin) {
  333. this.openAuto();
  334. } else {
  335. if (url === '') return
  336. this.$util.navigateTo(url);
  337. }
  338. },
  339. // 打开授权
  340. openAuto() {
  341. Cache.set(BACK_URL, '')
  342. toLogin();
  343. },
  344. // 跳转骑手
  345. menusRider(url, falg) {
  346. if (!this.isLogin) {
  347. this.openAuto();
  348. } else {
  349. if (url === '') return
  350. falg ? uni.reLaunch({
  351. url: url
  352. }) : this.$util.navigateTo(url)
  353. }
  354. },
  355. // 编辑页面
  356. goEdit() {
  357. if (this.isLogin == false) {
  358. this.openAuto();
  359. } else {
  360. uni.navigateTo({
  361. animationType: animationType.type,
  362. animationDuration: animationType.duration,
  363. url: '/pages/users/user_info/index'
  364. })
  365. }
  366. },
  367. },
  368. }
  369. </script>
  370. <style lang="scss" scoped>
  371. .order-nav {
  372. font-weight: 500;
  373. font-size: 35rpx;
  374. color: #FFFFFF;
  375. background-color: #FF6702;
  376. text-align: center;
  377. }
  378. .item-settled {
  379. background: linear-gradient(135deg, #FED0A7 0%, #FFF3E2 52%, #FAEDD3 100%);
  380. border-radius: 8rpx;
  381. padding: 20rpx;
  382. box-shadow: 0 0 0 2rpx rgba(255, 220, 135, 1);
  383. position: relative;
  384. // top: -90rpx;
  385. margin: 0 20rpx;
  386. display: flex;
  387. align-items: center;
  388. }
  389. .item-settled::after {
  390. content: "";
  391. position: absolute;
  392. top: -2rpx;
  393. left: -2rpx;
  394. right: -2rpx;
  395. bottom: -2rpx;
  396. background: linear-gradient(200deg, rgba(255, 220, 135, 1), rgba(255, 172, 33, 1), rgba(255, 201, 24, 1));
  397. border-radius: 10rpx;
  398. z-index: -1;
  399. pointer-events: none;
  400. }
  401. .card {
  402. position: relative;
  403. display: flex;
  404. /* 启用flex布局 */
  405. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  406. padding: 40rpx 30rpx 120rpx 30rpx;
  407. box-sizing: border-box;
  408. background: linear-gradient(225deg, #ECF3FE 0%, #FEFEFE 100%);
  409. border-radius: 23rpx;
  410. top: -20rpx;
  411. }
  412. .card-left {
  413. position: relative;
  414. }
  415. .card-right {
  416. flex: 1;
  417. }
  418. .avatar {
  419. position: absolute;
  420. top: -80rpx;
  421. left: 0;
  422. width: 131rpx;
  423. height: 131rpx;
  424. background-color: #D8D8D8;
  425. border: 4rpx solid #FFFFFF;
  426. border-radius: 50%;
  427. object-fit: cover;
  428. }
  429. .username {
  430. margin-top: 70rpx;
  431. color: #141414;
  432. font-size: 35rpx;
  433. font-weight: bold;
  434. }
  435. .code {
  436. width: 31rpx;
  437. height: 31rpx;
  438. margin-left: 20rpx;
  439. }
  440. .card-content {
  441. display: flex;
  442. justify-content: space-between;
  443. }
  444. .content-item {
  445. display: flex;
  446. flex-direction: column;
  447. align-items: center;
  448. width: 33%;
  449. }
  450. .content-icon {
  451. width: 70rpx;
  452. height: 70rpx;
  453. margin-bottom: 15rpx;
  454. }
  455. .content-text1 {
  456. font-size: 23rpx;
  457. background: linear-gradient(90deg, #FFB908 0%, #DC7A11 100%);
  458. -webkit-background-clip: text;
  459. background-clip: text;
  460. color: transparent;
  461. }
  462. .content-text2 {
  463. font-size: 23rpx;
  464. background: linear-gradient(90deg, #93B0FF 0%, #1B4EFF 100%);
  465. -webkit-background-clip: text;
  466. background-clip: text;
  467. color: transparent;
  468. }
  469. .content-text3 {
  470. font-size: 23rpx;
  471. background: linear-gradient(90deg, #F4D600 0%, #FF9100 100%);
  472. -webkit-background-clip: text;
  473. background-clip: text;
  474. color: transparent;
  475. }
  476. .phone-info {
  477. font-size: 21rpx;
  478. padding-top: 10rpx;
  479. }
  480. .phone-info text {
  481. margin-right: 14rpx;
  482. }
  483. .phone-info image {
  484. width: 27rpx;
  485. height: 27rpx;
  486. vertical-align: middle;
  487. }
  488. .profile-link {
  489. margin-top: 20rpx;
  490. font-size: 23rpx;
  491. font-weight: 600;
  492. line-height: 21rpx;
  493. text-align: right;
  494. }
  495. .profile-link img {
  496. width: 24rpx;
  497. height: 24rpx;
  498. vertical-align: middle;
  499. margin-left: 12rpx;
  500. }
  501. .grid-container {
  502. display: flex;
  503. flex-wrap: wrap;
  504. gap: 0;
  505. /* 改用 margin 控制间距 */
  506. padding: 20rpx;
  507. /* 父容器内边距 */
  508. box-sizing: border-box;
  509. /* 包含 padding 在宽度内 */
  510. }
  511. .grid-item {
  512. width: 25%;
  513. /* 直接 25% 无需 calc */
  514. display: flex;
  515. flex-direction: column;
  516. align-items: center;
  517. margin-bottom: 30rpx;
  518. /* 行间距 */
  519. padding: 0 10rpx;
  520. /* 左右间隙(替代 gap) */
  521. box-sizing: border-box;
  522. /* 关键 */
  523. }
  524. .grid-img {
  525. width: 58rpx;
  526. height: 58rpx;
  527. margin-bottom: 8rpx;
  528. }
  529. .grid-text {
  530. font-size: 24rpx;
  531. color: #333;
  532. }
  533. .item-features {
  534. background: #FFFFFF;
  535. border-radius: 23rpx;
  536. margin: 0rpx 20rpx;
  537. }
  538. .item-features-title {
  539. padding: 20rpx;
  540. font-weight: 600;
  541. font-size: 27rpx;
  542. color: #2E261E;
  543. line-height: 38rpx;
  544. }
  545. .go-img {
  546. background: linear-gradient(135deg, #FED0A7 0%, #FFF3E2 52%, #FAEDD3 100%);
  547. border-radius: 8rpx;
  548. padding: 20rpx;
  549. box-shadow: 0 0 0 2rpx rgba(255, 220, 135, 1);
  550. display: flex;
  551. align-items: center;
  552. justify-content: center;
  553. margin-top: 20rpx;
  554. }
  555. .order-box {
  556. background-color: #fff;
  557. border-radius: 14rpx;
  558. padding: 30rpx 16rpx;
  559. position: relative;
  560. z-index: 11;
  561. margin: 20rpx;
  562. .order-hd {
  563. justify-content: space-between;
  564. font-size: 30rpx;
  565. color: #282828;
  566. margin-bottom: 40rpx;
  567. padding: 0 16rpx;
  568. .left {
  569. color: #282828;
  570. font-size: 30rpx;
  571. font-weight: 600;
  572. }
  573. .right {
  574. align-items: center;
  575. color: #666666;
  576. font-size: 26rpx;
  577. .icon-xiangyou {
  578. margin-left: 5rpx;
  579. font-size: 24rpx;
  580. }
  581. }
  582. }
  583. .order-bd {
  584. display: flex;
  585. justify-content: space-between;
  586. padding: 0;
  587. .order-item {
  588. display: flex;
  589. flex-direction: column;
  590. justify-content: center;
  591. align-items: center;
  592. .pic {
  593. position: relative;
  594. text-align: center;
  595. image {
  596. width: 48rpx;
  597. height: 48rpx;
  598. }
  599. .order-status-num {
  600. min-width: 13rpx;
  601. background-color: #fff;
  602. color: $bg-color-primary;
  603. border-radius: 15px;
  604. position: absolute;
  605. right: -14rpx;
  606. top: -15rpx;
  607. font-size: 20rpx;
  608. padding: 0 8rpx;
  609. border: 2rpx solid $bg-color-primary;
  610. }
  611. }
  612. .txt {
  613. margin-top: 15rpx;
  614. font-size: 26rpx;
  615. color: #454545;
  616. }
  617. .pic_status {
  618. color: $bg-color-primary;
  619. }
  620. }
  621. }
  622. }
  623. </style>