mine.vue 9.3 KB

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