mine.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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 data = ref({
  89. balance: 0.0,
  90. orderCount: 0,
  91. });
  92. const userType = uni.getStorageSync('userType') //读取本地存储
  93. const adminList = ref(
  94. [{
  95. name: '待服务',
  96. iconName: '/static/serverImg/mine/icon1.png',
  97. page: '/pages/classify',
  98. value: 1
  99. },
  100. {
  101. name: '进行中',
  102. iconName: '/static/serverImg/mine/icon2.png',
  103. page: '/pages/classify',
  104. value: 2
  105. },
  106. {
  107. name: '已完成',
  108. iconName: '/static/serverImg/mine/icon3.png',
  109. page: '/pages/classify',
  110. value: 3
  111. },
  112. {
  113. name: '差评申述',
  114. iconName: '/static/serverImg/mine/icon4.png',
  115. page: '/pages_mine/pages/bad/index'
  116. },
  117. {
  118. name: '钱包',
  119. iconName: '/static/serverImg/mine/icon5.png',
  120. page: '/pages_mine/pages/wallet/index'
  121. },
  122. {
  123. name: '帮助与客服',
  124. iconName: '/static/serverImg/mine/icon6.png',
  125. },
  126. {
  127. name: '用户端',
  128. iconName: '/static/serverImg/mine/icon6.png',
  129. },
  130. ]);
  131. const userList = ref(
  132. [{
  133. name: '待服务',
  134. iconName: 'clock',
  135. page: '/pages/classify',
  136. value: 1
  137. },
  138. {
  139. name: '进行中',
  140. iconName: 'car',
  141. page: '/pages/classify',
  142. value: 2
  143. },
  144. {
  145. name: '已完成',
  146. iconName: 'car-fill',
  147. page: '/pages/classify',
  148. value: 3
  149. },
  150. {
  151. name: '评论',
  152. iconName: 'edit-pen',
  153. },
  154. {
  155. name: '钱包',
  156. iconName: 'rmb-circle',
  157. page: '/pages_mine/pages/wallet/index'
  158. },
  159. {
  160. name: '浏览记录',
  161. iconName: 'eye',
  162. },
  163. {
  164. name: '收藏',
  165. iconName: 'star',
  166. },
  167. {
  168. name: '帮助与客服',
  169. iconName: 'kefu-ermai',
  170. },
  171. {
  172. name: '地址',
  173. iconName: 'kefu-ermai',
  174. },
  175. {
  176. name: '志愿者',
  177. iconName: 'kefu-ermai',
  178. },
  179. ]);
  180. const rateValue = ref(3);
  181. const orderList = ref([{
  182. name: '预约单',
  183. key: 'orderCount'
  184. },
  185. {
  186. name: '进行单',
  187. key: 'orderCount'
  188. },
  189. {
  190. name: '完成单',
  191. key: 'orderCount'
  192. },
  193. {
  194. name: '取消单',
  195. key: 'orderCount'
  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. if (record.page) {
  212. uni.navigateTo({
  213. url: record.page
  214. });
  215. }
  216. }
  217. const geUserInfo = () => {
  218. console.log(store.state, '>>>>99');
  219. userInfo.value = store.state.user
  220. }
  221. onShow(() => {
  222. geUserInfo();
  223. })
  224. </script>
  225. <style lang="scss" scoped>
  226. .mine-container {
  227. position: fixed;
  228. left: 0;
  229. top: 0;
  230. right: 0;
  231. bottom: 0;
  232. background: rgba(245, 245, 245, 1);
  233. overflow-y: auto;
  234. .mine-header {
  235. padding: 42rpx 44rpx;
  236. background: #fff;
  237. display: flex;
  238. .header-info {
  239. display: flex;
  240. flex-direction: column;
  241. margin-left: 36rpx;
  242. .info-name {
  243. font-size: 36rpx;
  244. font-weight: 400;
  245. line-height: 54rpx;
  246. color: rgba(51, 51, 51, 1);
  247. }
  248. .info-id {
  249. font-size: 28rpx;
  250. font-weight: 400;
  251. letter-spacing: 0rpx;
  252. line-height: 42rpx;
  253. color: rgba(153, 153, 153, 1);
  254. }
  255. .info-edit {
  256. font-size: 24rpx;
  257. font-weight: 400;
  258. letter-spacing: 0rpx;
  259. line-height: 36rpx;
  260. color: rgba(102, 102, 102, 1);
  261. }
  262. }
  263. }
  264. .list-box {
  265. padding: 16rpx 40rpx;
  266. .price-card {
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. .price-item {
  271. display: flex;
  272. align-items: center;
  273. flex-direction: column;
  274. .price-name {
  275. font-size: 28rpx;
  276. font-weight: 400;
  277. line-height: 42rpx;
  278. color: rgba(102, 102, 102, 1);
  279. }
  280. .price-data {
  281. font-size: 48rpx;
  282. font-weight: 400;
  283. line-height: 72rpx;
  284. color: rgba(51, 51, 51, 1);
  285. }
  286. .grid-min-price {
  287. font-size: 24rpx;
  288. font-weight: 400;
  289. line-height: 36rpx;
  290. color: rgba(153, 153, 153, 1);
  291. }
  292. }
  293. }
  294. .status-card {
  295. display: grid;
  296. grid-template-columns: repeat(3, 1fr);
  297. gap: 48rpx;
  298. /* 网格项之间的间距 */
  299. .status-card-item {
  300. display: flex;
  301. align-items: center;
  302. justify-content: center;
  303. flex-direction: column;
  304. .grid-img-box {
  305. padding: 35rpx;
  306. border-radius: 50%;
  307. background: rgba(249, 250, 251, 1);
  308. display: flex;
  309. align-items: center;
  310. justify-content: center;
  311. margin-bottom: 18rpx;
  312. }
  313. .grid-text {
  314. font-size: 28rpx;
  315. font-weight: 400;
  316. line-height: 42rpx;
  317. color: rgba(51, 51, 51, 1);
  318. }
  319. }
  320. }
  321. .count-card {
  322. .count-list {
  323. display: grid;
  324. grid-template-columns: repeat(4, 1fr);
  325. /* 3 列,每列等宽 */
  326. gap: 32rpx;
  327. /* 网格项之间的间距 */
  328. .count-item {
  329. display: flex;
  330. flex-direction: column;
  331. align-items: center;
  332. justify-content: center;
  333. .count-item-text {
  334. font-size: 28rpx;
  335. font-weight: 400;
  336. line-height: 42rpx;
  337. color: rgba(102, 102, 102, 1);
  338. }
  339. }
  340. }
  341. }
  342. .rate-card {
  343. .rate-list {
  344. display: flex;
  345. align-items: center;
  346. .rate-box {
  347. display: flex;
  348. flex-direction: column;
  349. align-items: center;
  350. .rate-count {
  351. font-size: 64rpx;
  352. font-weight: 400;
  353. line-height: 96rpx;
  354. color: rgba(51, 51, 51, 1);
  355. }
  356. .rate-text {
  357. font-size: 28rpx;
  358. font-weight: 400;
  359. line-height: 42rpx;
  360. color: rgba(102, 102, 102, 1);
  361. }
  362. }
  363. }
  364. }
  365. }
  366. }
  367. .mine-card {
  368. border-radius: 24rpx;
  369. background: rgba(255, 255, 255, 1);
  370. 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);
  371. margin-bottom: 16rpx;
  372. padding: 40rpx;
  373. }
  374. .count-title {
  375. font-size: 32rpx;
  376. font-weight: 400;
  377. line-height: 48rpx;
  378. color: rgba(51, 51, 51, 1);
  379. margin-bottom: 32rpx;
  380. }
  381. </style>