mine.vue 7.5 KB

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