mine.vue 11 KB

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