index.vue 16 KB

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