综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

useCarList.vue 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-06-18 15:39:56
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-06-19 11:26:48
  6. -->
  7. <template>
  8. <view class="container">
  9. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  10. :up="upOption" :fixed="false" :top="10" style="padding: 30rpx;">
  11. <view v-for="item, index in useCarList" :key="'car' + index" class="modern-card">
  12. <view class="modern-card-header">
  13. <view class="modern-card-title">
  14. <view class="car-status" :class="'status-' + item.carUsage">{{ getStatusText(item.carUsage) }}</view>
  15. </view>
  16. </view>
  17. <view class="modern-card-body">
  18. <view class="avatar-section">
  19. <view class="avatar">
  20. <text>{{ item.applierUser ? item.applierUser.nickName[0] : '无' }}</text>
  21. </view>
  22. <view>
  23. <text class="applier-name">{{ item.applierUser ? item.applierUser.nickName : '无' }}</text>
  24. <text class="dept-name">{{ item.dept ? item.dept.deptName : '无' }}</text>
  25. </view>
  26. </view>
  27. <view class="info-row">
  28. <text class="info-label">用车时间:</text>
  29. <text class="info-value">{{ item.beginDate + ' 至 ' + item.endDate }}</text>
  30. </view>
  31. <view class="info-row">
  32. <text class="info-label">用车事由:</text>
  33. <text class="info-value">{{ item.applyReason }}</text>
  34. </view>
  35. <view class="info-row" v-if="item.carUsage == '0'">
  36. <text class="info-label">项目编号:</text>
  37. <text class="info-value">{{ item.project ? item.project.projectNumber : '无' }}</text>
  38. </view>
  39. <view class="info-row" v-if="item.carUsage == '0'">
  40. <text class="info-label">项目名称:</text>
  41. <text class="info-value">{{ item.project ? item.project.projectName : '无' }}</text>
  42. </view>
  43. </view>
  44. </view>
  45. </mescroll-uni>
  46. </view>
  47. </template>
  48. <script>
  49. import { listCarApproval } from "@/api/oa/car/carApproval";
  50. export default {
  51. data() {
  52. return {
  53. carId: '',
  54. licensePlate: '',
  55. useCarList: [],
  56. mescroll: null,
  57. queryParams: {
  58. pageNum: 1,
  59. pageSize: 20
  60. },
  61. downOption: {
  62. auto: true,
  63. textOutOffset: '下拉刷新',
  64. textLoading: '加载中...'
  65. },
  66. upOption: {
  67. auto: false,
  68. page: { num: 1, size: 20 },
  69. noMoreSize: 5,
  70. empty: { tip: '暂无借款数据' },
  71. textNoMore: '~ 没有更多数据了 ~'
  72. },
  73. }
  74. },
  75. onLoad(options) {
  76. this.carId = options.carId;
  77. this.licensePlate = options.licensePlate;
  78. uni.setNavigationBarTitle({
  79. title: this.licensePlate + '派车记录'
  80. })
  81. uni.startPullDownRefresh();
  82. },
  83. methods: {
  84. // 加载数据
  85. async loadData() {
  86. try {
  87. let res = null;
  88. res = await listCarApproval({ carId: this.carId, cars: this.carId, ...this.queryParams })
  89. return { data: res.rows, total: res.total }
  90. } catch (error) {
  91. console.error(error);
  92. return { data: [] };
  93. }
  94. },
  95. mescrollInit(mescroll) {
  96. this.mescroll = mescroll;
  97. },
  98. async downCallback() {
  99. this.useCarList = []; // 清空列表
  100. this.queryParams.pageNum = 1
  101. const res = await this.loadData()
  102. if (res.error) {
  103. this.mescroll.endErr();
  104. } else {
  105. this.useCarList = res.data;
  106. this.mescroll.endSuccess(res.data.length, res.total);
  107. }
  108. uni.stopPullDownRefresh();
  109. },
  110. async upCallback(page) {
  111. this.queryParams.pageNum = page.num
  112. const res = await this.loadData()
  113. if (res.error) {
  114. this.mescroll.endErr();
  115. } else {
  116. this.useCarList = this.useCarList.concat(res.data);
  117. this.mescroll.endSuccess(res.data.length, res.total);
  118. }
  119. },
  120. getStatusText(status) {
  121. switch (status) {
  122. case '0':
  123. return '项目用车';
  124. case '1':
  125. return '非项目用车';
  126. case '2':
  127. return '工会用车';
  128. case '3':
  129. return '党委用车';
  130. case '4':
  131. return '团委用车';
  132. }
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .container {
  139. padding: 20rpx;
  140. background-color: #f5f5f5;
  141. height: 100vh;
  142. display: flex;
  143. flex-direction: column;
  144. }
  145. .modern-card {
  146. background: #fff;
  147. border-radius: 18rpx;
  148. margin-bottom: 32rpx;
  149. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.08);
  150. overflow: hidden;
  151. transition: box-shadow 0.2s;
  152. border: 1rpx solid #f0f0f0;
  153. }
  154. .modern-card-header {
  155. display: flex;
  156. justify-content: space-between;
  157. align-items: center;
  158. background: linear-gradient(90deg, #e0e7ff 0%, #f8fafc 100%);
  159. padding: 24rpx 28rpx 16rpx 28rpx;
  160. }
  161. .modern-card-title {
  162. display: flex;
  163. flex-direction: column;
  164. }
  165. .car-plate {
  166. font-size: 32rpx;
  167. color: #22223b;
  168. font-weight: bold;
  169. margin-bottom: 8rpx;
  170. }
  171. .car-status {
  172. font-size: 24rpx;
  173. font-weight: 500;
  174. padding: 4rpx 16rpx;
  175. border-radius: 8rpx;
  176. display: inline-block;
  177. width: fit-content;
  178. }
  179. .status-0 {
  180. background: #fef3c7;
  181. color: #d97706;
  182. }
  183. /* 已派出 */
  184. .status-1 {
  185. background: #d4f3e9;
  186. color: #10b981;
  187. }
  188. /* 可使用 */
  189. .status-4 {
  190. background: #fee2e2;
  191. color: #ef4444;
  192. }
  193. /* 已报废 */
  194. .status-3 {
  195. background: #dbeafe;
  196. color: #3b82f6;
  197. }
  198. /* 已还车 */
  199. .modern-card-body {
  200. padding: 20rpx 28rpx 24rpx 28rpx;
  201. }
  202. .avatar-section {
  203. display: flex;
  204. align-items: center;
  205. margin-bottom: 18rpx;
  206. }
  207. .avatar {
  208. width: 56rpx;
  209. height: 56rpx;
  210. border-radius: 50%;
  211. background: #a5b4fc;
  212. color: #fff;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. font-size: 28rpx;
  217. font-weight: bold;
  218. margin-right: 18rpx;
  219. }
  220. .applier-name {
  221. font-size: 28rpx;
  222. color: #22223b;
  223. font-weight: 500;
  224. }
  225. .dept-name {
  226. font-size: 24rpx;
  227. color: #64748b;
  228. margin-left: 8rpx;
  229. }
  230. .info-row {
  231. display: flex;
  232. margin-bottom: 10rpx;
  233. }
  234. .info-label {
  235. color: #64748b;
  236. font-size: 24rpx;
  237. min-width: 120rpx;
  238. }
  239. .info-value {
  240. color: #22223b;
  241. font-size: 24rpx;
  242. flex: 1;
  243. word-break: break-all;
  244. }
  245. .amount-highlight-detail {
  246. background: #fef3c7;
  247. color: #d97706;
  248. font-size: 28rpx;
  249. font-weight: bold;
  250. border-radius: 10rpx;
  251. padding: 4rpx 18rpx;
  252. margin-left: 8rpx;
  253. }
  254. .manager-amount-highlight-detail {
  255. background: #d4f3e9;
  256. color: #10b981;
  257. font-size: 28rpx;
  258. font-weight: bold;
  259. border-radius: 10rpx;
  260. padding: 4rpx 18rpx;
  261. margin-left: 8rpx;
  262. }
  263. .modern-card-footer {
  264. display: flex;
  265. justify-content: flex-end;
  266. gap: 20rpx;
  267. padding: 16rpx 28rpx 20rpx 28rpx;
  268. border-top: 1px solid #f0f0f0;
  269. background: #fafbfc;
  270. }
  271. .footer-btn {
  272. font-size: 26rpx;
  273. border-radius: 8rpx;
  274. border: none;
  275. outline: none;
  276. background: #e0e7ff;
  277. color: #3b3b4f;
  278. }
  279. .detail-btn {
  280. background: #6366f1;
  281. color: #fff;
  282. }
  283. .detail-btn2 {
  284. background: #f4c542;
  285. color: #fff;
  286. }
  287. </style>