mine.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. <template>
  2. <view class="mine-container" :style="{ height: `${windowHeight}px` }">
  3. <view class="mine-top-bgc"></view>
  4. <view class="mine-box">
  5. <view class="mine-user">
  6. <view class="user-name-box">
  7. <view class="user-avatar">
  8. <up-avatar :src="userInfo.avatar" shape="square"></up-avatar>
  9. </view>
  10. <view class="user-name">{{ userInfo.nickName }}</view>
  11. <view class="grid-box" v-for="(listItem, listIndex) in setTing" :key="listIndex">
  12. <!-- <up-badge :isDot="true" type="success" class="item-badge"></up-badge> -->
  13. <up-icon :customStyle="{ paddingTop: 20 + 'rpx' }" :name="listItem.iconName" :size="22"
  14. @click="handLsetTing"></up-icon>
  15. <text class="grid-text">{{ listItem.name }}</text>
  16. </view>
  17. </view>
  18. <up-divider></up-divider>
  19. <view class="service-list">
  20. <up-grid :border="false" col="4">
  21. <up-grid-item v-for="(listItem, listIndex) in serviceList" :key="listIndex"
  22. @click="onClick(listItem)">
  23. <view class="grid-box">
  24. <!-- <up-badge :isDot="true" type="success" class="item-badge"></up-badge> -->
  25. <up-icon :customStyle="{ paddingTop: 20 + 'rpx' }" :name="listItem.iconName"
  26. :size="22"></up-icon>
  27. <text class="grid-text">{{ listItem.name }}</text>
  28. </view>
  29. </up-grid-item>
  30. </up-grid>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="list-box">
  35. <view class="mine-card price-card" v-if="userType == 2">
  36. <view v-for="(item, index) in priceList" :key="item.key" class="price-item"
  37. :style="{ alignItems: index === 0 ? 'flex-start' : 'flex-end' }">
  38. <view class="price-name flex-center"> {{ item.name }} </view>
  39. <view class="price-data flex-center">
  40. {{ index === 0 ? '¥' : '' }}<up-count-to :startVal="0" :endVal="data[item.key]"
  41. :decimals="item.decimals"></up-count-to>
  42. </view>
  43. <text class="grid-min-price" v-if="item.key === 'balance'">待入账 ¥{{ data[item.key] }}</text>
  44. </view>
  45. </view>
  46. <!-- 志愿者 -->
  47. <view class="mine-card status-card" v-if="userType == 2">
  48. <view class="status-card-item" v-for="(listItem, listIndex) in adminList" :key="listIndex"
  49. @click="onClick(listItem)">
  50. <view class="grid-img-box">
  51. <img :src="listItem.iconName" alt="" style="width: 52rpx;height: 52rpx;">
  52. </view>
  53. <text class="grid-text">{{ listItem.name }}</text>
  54. </view>
  55. </view>
  56. <!-- 用户端 -->
  57. <view class="mine-card status-card" v-if="userType == 1">
  58. <view class="status-card-item" v-for="(listItem, listIndex) in userList" :key="listIndex"
  59. @click="onClick(listItem)">
  60. <view class="grid-img-box">
  61. <!-- <img :src="listItem.iconName" alt="" style="width: 52rpx;height: 52rpx;"> -->
  62. <up-icon :name="listItem.iconName" :size="22"></up-icon>
  63. </view>
  64. <text class="grid-text">{{ listItem.name }}</text>
  65. </view>
  66. </view>
  67. <view class="mine-card count-card" v-if="userType == 2">
  68. <view class="count-title">订单统计</view>
  69. <view class="count-list">
  70. <view class="count-item" v-for="(item, index) in orderList" :key="index">
  71. <up-count-to :startVal="0" :endVal="data[item.key]"></up-count-to>
  72. <text class="count-item-text">{{ item.name }}</text>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="mine-card rate-card" v-if="userType == 2">
  77. <view class="count-title">好评率</view>
  78. <view class="rate-list">
  79. <view class="rate-box">
  80. <label class="rate-count">{{ rateValue }}</label>
  81. <text class="rate-text">优秀</text>
  82. </view>
  83. <up-rate v-model="rateValue" active-color="rgba(255, 87, 4, 1)" inactive-color="#b2b2b2" gutter="20"
  84. readonly></up-rate>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <script setup>
  91. import {
  92. onMounted,
  93. ref
  94. } from 'vue';
  95. import {
  96. getVolunteerAccount
  97. } from '@/api/volunteer.js'
  98. import {
  99. onLoad,
  100. onShow
  101. } from '@dcloudio/uni-app';
  102. import store from "@/store"
  103. const userType = uni.getStorageSync('userType') //读取本地存储
  104. // 用户/志愿者 识别标识
  105. const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
  106. const userInfo = ref({});
  107. const setTing = ref(
  108. [{
  109. iconName: 'setting-fill',
  110. value: 1,
  111. }, ]);
  112. const serviceList = ref(
  113. [{
  114. name: '待服务',
  115. iconName: 'clock',
  116. page: '/pages/classify',
  117. value: 1
  118. },
  119. {
  120. name: '进行中',
  121. iconName: 'car',
  122. page: '/pages/classify',
  123. value: 2
  124. },
  125. {
  126. name: '已完成',
  127. iconName: 'car-fill',
  128. page: '/pages/classify',
  129. value: 3
  130. },
  131. {
  132. name: '差评申述',
  133. iconName: 'edit-pen',
  134. page: '/pages_mine/pages/bad/index'
  135. },
  136. {
  137. name: '钱包',
  138. iconName: 'rmb-circle',
  139. page: '/pages_mine/pages/wallet/index'
  140. },
  141. {
  142. name: '帮助与客服',
  143. iconName: 'kefu-ermai',
  144. },
  145. {
  146. name: '服务地址',
  147. iconName: 'map',
  148. page: '/pages_mine/pages/serviceInforMation/index'
  149. },
  150. ]);
  151. const serviceList2 = ref([{
  152. name: '待服务',
  153. iconName: 'clock',
  154. page: '/pages/classify',
  155. value: 1
  156. },
  157. {
  158. name: '进行中',
  159. iconName: 'car',
  160. page: '/pages/classify',
  161. value: 2
  162. },
  163. {
  164. name: '已完成',
  165. iconName: 'car-fill',
  166. page: '/pages/classify',
  167. value: 3
  168. },
  169. {
  170. name: '评论',
  171. iconName: 'edit-pen',
  172. // page: '/pages/myCenter/bad'
  173. },
  174. {
  175. name: '钱包',
  176. iconName: 'rmb-circle',
  177. page: '/pages_mine/pages/wallet/index'
  178. },
  179. {
  180. name: '帮助与客服',
  181. iconName: 'kefu-ermai',
  182. },
  183. {
  184. name: '浏览记录',
  185. iconName: 'eye',
  186. page: '/pages_mine/pages/wallet/index'
  187. },
  188. {
  189. name: '收藏',
  190. iconName: 'star',
  191. },
  192. ]);
  193. const priceList = [{
  194. name: '余额',
  195. key: 'balance',
  196. decimals: 2
  197. },
  198. {
  199. name: '订单总数',
  200. key: 'orderCount',
  201. decimals: 0
  202. }
  203. ]
  204. const orderList = ref([{
  205. name: '预约单',
  206. key: 'orderCount'
  207. },
  208. {
  209. name: '进行单',
  210. key: 'orderCount'
  211. },
  212. {
  213. name: '完成单',
  214. key: 'orderCount'
  215. },
  216. {
  217. name: '取消单',
  218. key: 'orderCount'
  219. }
  220. ]);
  221. const avatarSrc = ref('/static/my/客服.png');
  222. const data = ref({
  223. balance: 0.0,
  224. orderCount: 0,
  225. });
  226. const rateValue = ref(3);
  227. const onClick = (record) => {
  228. console.log('record', record, record.page);
  229. if (record.page && record.value) {
  230. const app = getApp();
  231. app.globalData.switchTabParams = {
  232. tabKey: record.value
  233. };
  234. // JS跳转
  235. uni.switchTab({
  236. url: record.page
  237. });
  238. return;
  239. }
  240. if (record.page) {
  241. uni.navigateTo({
  242. url: record.page
  243. });
  244. }
  245. onMounted(getDetails)
  246. }
  247. const getDetails = async () => {
  248. try {
  249. // const res = await getVolunteerAccount();
  250. // console.log('res',res);
  251. } catch (error) {
  252. console.log('error', error);
  253. }
  254. }
  255. const geUserInfo = () => {
  256. console.log(store.state, '>>>>99');
  257. userInfo.value = store.state.user
  258. }
  259. // 设置
  260. const handLsetTing = () => {
  261. console.log('123')
  262. uni.navigateTo({
  263. url: '/pages_mine/pages/setupUser/index'
  264. })
  265. }
  266. onShow(() => {
  267. geUserInfo();
  268. })
  269. </script>
  270. <style lang="scss" scoped>
  271. .mine-card {
  272. border-radius: 8px;
  273. background: rgba(255, 255, 255, 1);
  274. padding: 12px;
  275. margin-bottom: 12px;
  276. }
  277. .mine-container {
  278. position: fixed;
  279. top: 0px;
  280. left: 0px;
  281. right: 0px;
  282. bottom: 0px;
  283. background: rgba(245, 245, 245, 1);
  284. .mine-top-bgc {
  285. height: 120px;
  286. background: linear-gradient(180deg, rgba(255, 219, 171, 1) 0%, rgba(242, 151, 99, 1) 100%);
  287. }
  288. .mine-box {
  289. position: absolute;
  290. top: 40px;
  291. left: 12px;
  292. right: 12px;
  293. bottom: 0px;
  294. overflow-y: auto;
  295. .mine-user {
  296. border-radius: 8px;
  297. background: rgba(255, 255, 255, 1);
  298. margin-bottom: 12px;
  299. .user-name-box {
  300. display: flex;
  301. justify-content: space-between;
  302. align-items: center;
  303. padding: 12px 12px 0;
  304. .user-avatar {}
  305. .user-name {
  306. font-size: 18px;
  307. font-weight: 700;
  308. line-height: 21.09px;
  309. color: rgba(51, 51, 51, 1);
  310. margin-left: 12px;
  311. }
  312. }
  313. }
  314. }
  315. .service-img {
  316. width: 60rpx;
  317. height: 60rpx;
  318. margin-bottom: 10rpx;
  319. }
  320. }
  321. .list-box {
  322. padding: 16rpx 40rpx;
  323. .grid-box {
  324. display: flex;
  325. align-items: center;
  326. justify-content: space-between;
  327. .price-item {
  328. display: flex;
  329. align-items: center;
  330. flex-direction: column;
  331. .user-name-box {
  332. display: flex;
  333. flex-direction: column;
  334. align-items: center;
  335. justify-content: center;
  336. padding: 12px 12px 0;
  337. .user-avatar {}
  338. .user-name {
  339. font-size: 18px;
  340. font-weight: 700;
  341. line-height: 21.09px;
  342. color: rgba(51, 51, 51, 1);
  343. margin-left: 12px;
  344. }
  345. }
  346. }
  347. }
  348. .service-img {
  349. width: 60rpx;
  350. height: 60rpx;
  351. margin-bottom: 10rpx;
  352. }
  353. .service-list {
  354. padding-bottom: 12px;
  355. }
  356. .grid-text {
  357. font-size: 14px;
  358. color: #909399;
  359. padding: 10rpx 0 20rpx 0rpx;
  360. /* #ifndef APP-PLUS */
  361. box-sizing: border-box;
  362. /* #endif */
  363. }
  364. .grid-box {
  365. display: flex;
  366. align-items: center;
  367. justify-content: center;
  368. flex-direction: column;
  369. position: relative;
  370. .item-badge {
  371. position: absolute;
  372. }
  373. }
  374. .price-box {
  375. display: flex;
  376. align-content: center;
  377. justify-content: space-between;
  378. // padding: 12px;
  379. .price-item {
  380. width: 50%;
  381. padding: 12px;
  382. display: flex;
  383. flex-direction: column;
  384. align-items: center;
  385. justify-content: center;
  386. .user-name-box {
  387. display: flex;
  388. flex-direction: column;
  389. align-items: center;
  390. justify-content: center;
  391. padding: 12px 12px 0;
  392. .user-avatar {}
  393. .user-name {
  394. font-size: 18px;
  395. font-weight: 700;
  396. line-height: 21.09px;
  397. color: rgba(51, 51, 51, 1);
  398. margin-left: 12px;
  399. }
  400. }
  401. }
  402. }
  403. .service-img {
  404. width: 60rpx;
  405. height: 60rpx;
  406. margin-bottom: 10rpx;
  407. }
  408. .service-list {
  409. padding-bottom: 12px;
  410. }
  411. .grid-text {
  412. font-size: 14px;
  413. color: #909399;
  414. padding: 10rpx 0 20rpx 0rpx;
  415. /* #ifndef APP-PLUS */
  416. box-sizing: border-box;
  417. /* #endif */
  418. }
  419. .grid-box {
  420. display: flex;
  421. align-items: center;
  422. justify-content: center;
  423. flex-direction: column;
  424. position: relative;
  425. .item-badge {
  426. position: absolute;
  427. }
  428. }
  429. .price-box {
  430. display: flex;
  431. align-content: center;
  432. justify-content: space-between;
  433. // padding: 12px;
  434. .price-item {
  435. width: 50%;
  436. padding: 12px;
  437. display: flex;
  438. flex-direction: column;
  439. align-items: center;
  440. justify-content: center;
  441. .price-name {
  442. font-size: 28rpx;
  443. font-weight: 400;
  444. line-height: 42rpx;
  445. color: rgba(102, 102, 102, 1);
  446. }
  447. .price-data {
  448. font-size: 48rpx;
  449. font-weight: 400;
  450. line-height: 72rpx;
  451. color: rgba(51, 51, 51, 1);
  452. }
  453. .grid-min-price {
  454. font-size: 24rpx;
  455. font-weight: 400;
  456. line-height: 36rpx;
  457. color: rgba(153, 153, 153, 1);
  458. }
  459. }
  460. .service-list {
  461. padding-bottom: 12px;
  462. }
  463. .grid-text {
  464. font-size: 14px;
  465. color: #909399;
  466. padding: 10rpx 0 20rpx 0rpx;
  467. /* #ifndef APP-PLUS */
  468. box-sizing: border-box;
  469. /* #endif */
  470. }
  471. .grid-box {
  472. display: flex;
  473. align-items: center;
  474. justify-content: center;
  475. flex-direction: column;
  476. position: relative;
  477. .item-badge {
  478. position: absolute;
  479. }
  480. }
  481. .price-box {
  482. display: flex;
  483. align-content: center;
  484. justify-content: space-between;
  485. // padding: 12px;
  486. .price-item {
  487. width: 50%;
  488. padding: 12px;
  489. .price-name {
  490. font-size: 16px;
  491. font-weight: 700;
  492. line-height: 23.17px;
  493. color: rgba(51, 51, 51, 1);
  494. margin-bottom: 12px;
  495. }
  496. .price-data {
  497. font-size: 20px;
  498. font-weight: 700;
  499. line-height: 23.44px;
  500. color: rgba(51, 51, 51, 1);
  501. }
  502. .grid-min-price {
  503. font-size: 12px;
  504. font-weight: 500;
  505. line-height: 17.38px;
  506. color: rgba(153, 153, 153, 1);
  507. margin-top: 4px;
  508. }
  509. }
  510. .price-item:first-child {
  511. border-right: 1px solid #dcdfe6;
  512. }
  513. }
  514. }
  515. .rate-box {
  516. display: flex;
  517. align-items: center;
  518. justify-content: space-between;
  519. .rate-left {
  520. font-size: 14px;
  521. font-weight: 500;
  522. letter-spacing: 0px;
  523. line-height: 20.27px;
  524. color: rgba(0, 0, 0, 1);
  525. display: flex;
  526. align-items: center;
  527. justify-content: left;
  528. flex: 1;
  529. }
  530. .rate-rigth {
  531. font-size: 14px;
  532. font-weight: 500;
  533. letter-spacing: 0px;
  534. line-height: 20.27px;
  535. color: rgba(0, 0, 0, 1);
  536. .rate-count {
  537. color: rgba(237, 123, 47, 1);
  538. }
  539. }
  540. }
  541. .count-card {
  542. .count-list {
  543. display: grid;
  544. grid-template-columns: repeat(4, 1fr);
  545. /* 3 列,每列等宽 */
  546. gap: 32rpx;
  547. /* 网格项之间的间距 */
  548. .count-item {
  549. display: flex;
  550. flex-direction: column;
  551. align-items: center;
  552. justify-content: center;
  553. .count-item-text {
  554. font-size: 28rpx;
  555. font-weight: 400;
  556. line-height: 42rpx;
  557. color: rgba(102, 102, 102, 1);
  558. }
  559. }
  560. }
  561. }
  562. .rate-card {
  563. .rate-list {
  564. display: flex;
  565. align-items: center;
  566. .rate-box {
  567. display: flex;
  568. flex-direction: column;
  569. align-items: center;
  570. .rate-count {
  571. font-size: 64rpx;
  572. font-weight: 400;
  573. line-height: 96rpx;
  574. color: rgba(51, 51, 51, 1);
  575. }
  576. .rate-text {
  577. font-size: 28rpx;
  578. font-weight: 400;
  579. line-height: 42rpx;
  580. color: rgba(102, 102, 102, 1);
  581. }
  582. }
  583. }
  584. }
  585. }
  586. </style>