mine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  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="mine" />
  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: 'chat',
  156. // page: '/pages_home/pages/qualifications/index'
  157. // },
  158. {
  159. name: '帮助与客服',
  160. iconName: 'kefu-ermai',
  161. },
  162. {
  163. name: '用户端',
  164. iconName: 'account',
  165. operate: () => {
  166. uni.reLaunch({
  167. url: '/pages/UserSelection'
  168. });
  169. }
  170. },
  171. ]);
  172. const userList = ref([
  173. {
  174. name: '钱包',
  175. iconName: 'rmb-circle',
  176. page: '/pages_mine/pages/wallet/index'
  177. },
  178. {
  179. name: '浏览记录',
  180. iconName: 'eye',
  181. },
  182. {
  183. name: '收藏',
  184. iconName: 'star',
  185. },
  186. {
  187. name: '评论',
  188. iconName: 'edit-pen',
  189. },
  190. {
  191. name: '地址',
  192. iconName: 'map',
  193. page: '/pages_mine/pages/selectAddress/index'
  194. },
  195. {
  196. name: '帮助与客服',
  197. iconName: 'kefu-ermai',
  198. },
  199. {
  200. name: '志愿者',
  201. iconName: 'account',
  202. operate: () => {
  203. uni.reLaunch({
  204. url: '/pages/UserSelection'
  205. });
  206. }
  207. }
  208. ]);
  209. const onClick = (record) => {
  210. console.log('record', record, record.page);
  211. if (record.page) {
  212. uni.navigateTo({
  213. url: record.page
  214. })
  215. }
  216. if (record.operate) {
  217. record.operate()
  218. }
  219. if (record.switchPage && record.value) {
  220. const app = getApp();
  221. app.globalData.switchTabParams = {
  222. tabKey: record.value
  223. };
  224. // JS跳转
  225. uni.switchTab({
  226. url: record.switchPage
  227. });
  228. return;
  229. }
  230. }
  231. const getDetails = async () => {
  232. try {
  233. // const res = await getVolunteerAccount();
  234. // console.log('res',res);
  235. } catch (error) {
  236. console.log('error', error);
  237. }
  238. }
  239. const handLsetTing = () => {
  240. uni.navigateTo({
  241. url: '/pages_mine/pages/setupUser/index'
  242. })
  243. }
  244. const geUserInfo = () => {
  245. console.log(store.state, '>>>>99');
  246. store.dispatch('GetInfo').then((res) => {
  247. userInfo.value = store.state.user
  248. });
  249. }
  250. onShow(() => {
  251. geUserInfo();
  252. init();
  253. })
  254. const init = async () => {
  255. try {
  256. // uni.hideLoading();
  257. uni.showLoading({
  258. title: '数据加载中...'
  259. });
  260. if (userType === 2) {
  261. const res1 = await getVolunteerAccountInfo();
  262. const res2 = await volunteerOrderStatistics();
  263. data.value = {
  264. ...res1.data,
  265. ...res2.data
  266. }
  267. console.log(11, res1, res2, data.value);
  268. }
  269. } catch (error) {
  270. console.log('error', error);
  271. uni.showToast({
  272. title: error.msg,
  273. icon: 'error',
  274. });
  275. } finally {
  276. uni.hideLoading();
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. .mine-container {
  282. position: fixed;
  283. left: 0;
  284. top: 0;
  285. right: 0;
  286. bottom: 150rpx;
  287. background: rgba(245, 245, 245, 1);
  288. overflow-y: auto;
  289. .mine-header {
  290. padding: 36rpx 44rpx;
  291. background: #fff;
  292. display: flex;
  293. .header-info {
  294. display: flex;
  295. // flex-direction: column;
  296. align-items: center;
  297. justify-content: space-between;
  298. margin-left: 36rpx;
  299. flex: 1;
  300. .info-name {
  301. font-size: 36rpx;
  302. font-weight: 400;
  303. line-height: 54rpx;
  304. color: rgba(51, 51, 51, 1);
  305. }
  306. .info-id {
  307. font-size: 28rpx;
  308. font-weight: 400;
  309. letter-spacing: 0rpx;
  310. line-height: 42rpx;
  311. color: rgba(153, 153, 153, 1);
  312. }
  313. .info-edit {
  314. font-size: 24rpx;
  315. font-weight: 400;
  316. letter-spacing: 0rpx;
  317. line-height: 36rpx;
  318. color: #3366ff;
  319. }
  320. }
  321. }
  322. .list-box {
  323. padding: 16rpx 40rpx;
  324. .price-card {
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. .price-item {
  329. display: flex;
  330. align-items: center;
  331. flex-direction: column;
  332. .price-name {
  333. font-size: 28rpx;
  334. font-weight: 400;
  335. line-height: 42rpx;
  336. color: rgba(102, 102, 102, 1);
  337. }
  338. .price-data {
  339. font-size: 48rpx;
  340. font-weight: 400;
  341. line-height: 72rpx;
  342. color: rgba(51, 51, 51, 1);
  343. }
  344. .grid-min-price {
  345. font-size: 24rpx;
  346. font-weight: 400;
  347. line-height: 36rpx;
  348. color: rgba(153, 153, 153, 1);
  349. }
  350. }
  351. }
  352. .service-img {
  353. width: 60rpx;
  354. height: 60rpx;
  355. margin-bottom: 10rpx;
  356. }
  357. .service-list {
  358. padding-bottom: 12px;
  359. }
  360. .grid-text {
  361. font-size: 14px;
  362. color: #909399;
  363. padding: 10rpx 0 20rpx 0rpx;
  364. /* #ifndef APP-PLUS */
  365. box-sizing: border-box;
  366. /* #endif */
  367. }
  368. .grid-box {
  369. display: flex;
  370. align-items: center;
  371. justify-content: center;
  372. flex-direction: column;
  373. position: relative;
  374. .item-badge {
  375. position: absolute;
  376. }
  377. }
  378. .price-box {
  379. display: flex;
  380. align-content: center;
  381. justify-content: space-between;
  382. // padding: 12px;
  383. .price-item {
  384. width: 50%;
  385. padding: 12px;
  386. display: flex;
  387. flex-direction: column;
  388. align-items: center;
  389. justify-content: center;
  390. .price-name {
  391. font-size: 28rpx;
  392. font-weight: 400;
  393. line-height: 42rpx;
  394. color: rgba(102, 102, 102, 1);
  395. }
  396. .price-data {
  397. font-size: 48rpx;
  398. font-weight: 400;
  399. line-height: 72rpx;
  400. color: rgba(51, 51, 51, 1);
  401. }
  402. .grid-min-price {
  403. font-size: 24rpx;
  404. font-weight: 400;
  405. line-height: 36rpx;
  406. color: rgba(153, 153, 153, 1);
  407. }
  408. }
  409. }
  410. .status-card {
  411. display: grid;
  412. grid-template-columns: repeat(3, 1fr);
  413. gap: 48rpx;
  414. /* 网格项之间的间距 */
  415. .status-card-item {
  416. display: flex;
  417. align-items: center;
  418. justify-content: center;
  419. flex-direction: column;
  420. .grid-img-box {
  421. padding: 35rpx;
  422. border-radius: 50%;
  423. background: rgba(249, 250, 251, 1);
  424. display: flex;
  425. align-items: center;
  426. justify-content: center;
  427. margin-bottom: 12rpx;
  428. }
  429. .grid-text {
  430. font-size: 28rpx;
  431. font-weight: 400;
  432. line-height: 42rpx;
  433. color: rgba(51, 51, 51, 1);
  434. }
  435. }
  436. }
  437. .count-card {
  438. .count-list {
  439. display: grid;
  440. grid-template-columns: repeat(4, 1fr);
  441. /* 3 列,每列等宽 */
  442. gap: 32rpx;
  443. /* 网格项之间的间距 */
  444. .count-item {
  445. display: flex;
  446. flex-direction: column;
  447. align-items: center;
  448. justify-content: center;
  449. .count-item-text {
  450. font-size: 28rpx;
  451. font-weight: 400;
  452. line-height: 42rpx;
  453. color: rgba(102, 102, 102, 1);
  454. }
  455. }
  456. }
  457. }
  458. .rate-card {
  459. .rate-list {
  460. display: flex;
  461. align-items: center;
  462. .rate-box {
  463. display: flex;
  464. flex-direction: column;
  465. align-items: center;
  466. .rate-count {
  467. font-size: 64rpx;
  468. font-weight: 400;
  469. line-height: 96rpx;
  470. color: rgba(51, 51, 51, 1);
  471. }
  472. .rate-text {
  473. font-size: 28rpx;
  474. font-weight: 400;
  475. line-height: 42rpx;
  476. color: rgba(102, 102, 102, 1);
  477. }
  478. }
  479. }
  480. }
  481. }
  482. }
  483. .mine-card {
  484. border-radius: 24rpx;
  485. background: rgba(255, 255, 255, 1);
  486. 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);
  487. margin-bottom: 16rpx;
  488. padding: 40rpx;
  489. }
  490. .count-title {
  491. font-size: 32rpx;
  492. font-weight: 400;
  493. line-height: 48rpx;
  494. color: rgba(51, 51, 51, 1);
  495. margin-bottom: 8rpx;
  496. }
  497. .status-card2 {
  498. margin-top: 24rpx;
  499. padding: 30rpx 30rpx;
  500. background-color: #fff;
  501. .status-card-item2{
  502. // height: 88rpx;
  503. width: 100%;
  504. display: flex;
  505. align-items: center;
  506. justify-content: space-between;
  507. .status-card2-left {
  508. display: flex;
  509. align-items: center;
  510. .grid-img-box {
  511. margin-right: 12rpx;
  512. }
  513. }
  514. }
  515. }
  516. </style>