mine.vue 8.6 KB

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