mine.vue 9.8 KB

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