mine.vue 9.7 KB

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