综合办公系统
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view class="container">
  3. <uv-tabs :list="tabList" @click="clickTab"></uv-tabs>
  4. <view style="padding-top: 20rpx;">
  5. <uv-input placeholder="请输入车牌号" shape="circle" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399"
  6. @confirm="handleSearchCar"></uv-input>
  7. </view>
  8. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  9. :up="upOption" :fixed="false" :top="10" style="padding: 30rpx;">
  10. <view>
  11. <view v-for="item, index in carList" :key="'car' + index" class="modern-card">
  12. <view class="modern-card-header">
  13. <view class="modern-card-title">
  14. <text class="car-plate">{{ item.licensePlate }}</text>
  15. </view>
  16. <view class="car-status" :class="'status-' + item.status">{{ getStatusText(item.status) }}</view>
  17. </view>
  18. <view class="modern-card-body">
  19. <view class="avatar-section">
  20. <view class="avatar">
  21. <text>{{ item.driverUser ? item.driverUser.nickName[0] : '无' }}</text>
  22. </view>
  23. <view>
  24. <text class="applier-name">{{ item.driverUser ? item.driverUser.nickName : '无' }}</text>
  25. <text class="dept-name">驾驶员</text>
  26. </view>
  27. </view>
  28. <view class="info-row">
  29. <text class="info-label">品牌:</text>
  30. <text class="info-value">{{ item.brand }}</text>
  31. </view>
  32. <view class="info-row">
  33. <text class="info-label">购置时间:</text>
  34. <text class="info-value">{{ item.acquisitionTime }}</text>
  35. </view>
  36. <view class="info-row">
  37. <text class="info-label">是否为租车:</text>
  38. <text class="info-value">{{ item.isRent == "0" ? '否' : '是' }}</text>
  39. </view>
  40. <view class="info-row">
  41. <text class="info-label">油耗(km):</text>
  42. <text>{{ item.fuel }}元</text>
  43. </view>
  44. <view class="info-row">
  45. <text class="info-label">保险(天):</text>
  46. <text>{{ item.insurance }}元</text>
  47. </view>
  48. <view class="info-row">
  49. <text class="info-label">维修(天):</text>
  50. <text>{{ item.maintenance }}元</text>
  51. </view>
  52. <view class="info-row">
  53. <text class="info-label">单日成本:</text>
  54. <text class="manager-amount-highlight-detail">¥{{ item.dayCost }}</text>
  55. </view>
  56. </view>
  57. <view class="modern-card-footer">
  58. <button class="footer-btn detail-btn" @click="showExpenseList(item)">维保记录</button>
  59. <button class="footer-btn detail-btn2" @click="showUseCarList(item)">派出记录</button>
  60. </view>
  61. </view>
  62. </view>
  63. </mescroll-uni>
  64. <uv-popup ref="expensePopup" mode="bottom">
  65. <view class="popup-detail-list" @touchmove.stop>
  66. <view class="popup-close-btn" @click="$refs.expensePopup.close()">×</view>
  67. <view class="popup-detail-title">维保记录</view>
  68. <view v-for="item, index in expenseList" :key="'c' + index" class="popup-detail-item"
  69. v-if="expenseList.length > 0">
  70. <view class="popup-detail-main">
  71. <view class="popup-detail-row">
  72. <text class="popup-detail-label">负责人:</text>
  73. <text class="popup-detail-value">{{ item.user ? item.user.nickName : '' }}</text>
  74. </view>
  75. <view class="popup-detail-row">
  76. <text class="popup-detail-label">费用类型:</text>
  77. <text class="popup-detail-value">{{ item.expenseType }}</text>
  78. </view>
  79. <view class="popup-detail-row">
  80. <text class="popup-detail-label">费用金额:</text>
  81. <text class="popup-detail-value">{{ item.expense }}</text>
  82. </view>
  83. <view class="popup-detail-row">
  84. <text class="popup-detail-label">发生日期:</text>
  85. <text class="popup-detail-value">{{ item.occurDate }}</text>
  86. </view>
  87. <view class="popup-detail-row">
  88. <text class="popup-detail-label">备注:</text>
  89. <text class="popup-detail-value">{{ item.remark }}</text>
  90. </view>
  91. </view>
  92. </view>
  93. <view v-else>
  94. <view class="popup-detail-empty">暂无维保记录</view>
  95. </view>
  96. </view>
  97. </uv-popup>
  98. </view>
  99. </template>
  100. <script>
  101. import { listCar, getCar, delCar, addCar, updateCar } from "@/api/oa/car/car";
  102. import { listDeviceExpense, getDeviceExpense, delDeviceExpense, addDeviceExpense, updateDeviceExpense } from "@/api/oa/device/deviceExpense";
  103. import MescrollMixin from '@/uni_modules/mescroll/components/mescroll-uni/mescroll-mixins.js';
  104. export default {
  105. mixins: [MescrollMixin],
  106. data() {
  107. return {
  108. tabList: [{
  109. name: '可使用',
  110. value: '1'
  111. }, {
  112. name: '已派出',
  113. value: '0'
  114. }, {
  115. name: '已还车',
  116. value: '3'
  117. }, {
  118. name: '已报废',
  119. value: '4'
  120. }],
  121. selectedTab: '可使用',
  122. carList: [],
  123. expenseList: [],
  124. queryParams: {
  125. pageNum: 1,
  126. pageSize: 50,
  127. licensePlate: null,
  128. driver: null,
  129. status: '1'
  130. },
  131. mescroll: null,
  132. downOption: {
  133. auto: true,
  134. textOutOffset: '下拉刷新',
  135. textLoading: '加载中...'
  136. },
  137. upOption: {
  138. auto: false,
  139. page: { num: 1, size: 50 },
  140. noMoreSize: 5,
  141. empty: { tip: '暂无借款数据' },
  142. textNoMore: '~ 没有更多数据了 ~'
  143. },
  144. }
  145. },
  146. onLoad: function (options) {
  147. uni.startPullDownRefresh();
  148. },
  149. methods: {
  150. handleSearchCar(e) {
  151. this.queryParams.licensePlate = e;
  152. uni.startPullDownRefresh();
  153. },
  154. clickTab(obj) {
  155. let index = obj.index;
  156. this.selectedTab = this.tabList[index].name;
  157. this.queryParams.status = this.tabList[index].value;
  158. uni.startPullDownRefresh();
  159. },
  160. // 加载数据
  161. async loadData() {
  162. try {
  163. let res = null;
  164. res = await listCar(this.queryParams)
  165. return { data: res.rows, total: res.total }
  166. } catch (error) {
  167. console.error(error);
  168. return { data: [] };
  169. }
  170. },
  171. mescrollInit(mescroll) {
  172. this.mescroll = mescroll;
  173. },
  174. async downCallback() {
  175. this.carList = []; // 清空列表
  176. this.queryParams.pageNum = 1
  177. const res = await this.loadData()
  178. if (res.error) {
  179. this.mescroll.endErr();
  180. } else {
  181. this.carList = res.data;
  182. this.mescroll.endSuccess(res.data.length, res.total);
  183. }
  184. uni.stopPullDownRefresh();
  185. },
  186. async upCallback(page) {
  187. this.queryParams.pageNum = page.num
  188. const res = await this.loadData()
  189. if (res.error) {
  190. this.mescroll.endErr();
  191. } else {
  192. this.carList = this.carList.concat(res.data);
  193. this.mescroll.endSuccess(res.data.length, res.total);
  194. }
  195. },
  196. getStatusText(status) {
  197. switch (status) {
  198. case '0': return '已派出';
  199. case '1': return '可使用';
  200. case '4': return '已报废';
  201. case '3': return '已还车';
  202. default: return '未知';
  203. }
  204. },
  205. showExpenseList(item) {
  206. listDeviceExpense({ carId: item.carId, pageNum: 1, pageSize: 100 }).then(res => {
  207. this.expenseList = res.rows;
  208. this.$refs.expensePopup.open();
  209. })
  210. },
  211. showUseCarList(item) {
  212. uni.navigateTo({
  213. url: `/pages/oa/car/useCarList?carId=${item.carId}&licensePlate=${item.licensePlate}`
  214. })
  215. }
  216. }
  217. }
  218. </script>
  219. <style lang="scss" scoped>
  220. .container {
  221. padding: 20rpx;
  222. background-color: #f5f5f5;
  223. height: 100vh;
  224. display: flex;
  225. flex-direction: column;
  226. }
  227. .modern-card {
  228. background: #fff;
  229. border-radius: 18rpx;
  230. margin-bottom: 32rpx;
  231. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.08);
  232. overflow: hidden;
  233. transition: box-shadow 0.2s;
  234. border: 1rpx solid #f0f0f0;
  235. }
  236. .modern-card-header {
  237. display: flex;
  238. justify-content: space-between;
  239. align-items: center;
  240. background: linear-gradient(90deg, #e0e7ff 0%, #f8fafc 100%);
  241. padding: 24rpx 28rpx 16rpx 28rpx;
  242. }
  243. .modern-card-title {
  244. display: flex;
  245. flex-direction: column;
  246. }
  247. .car-plate {
  248. font-size: 32rpx;
  249. color: #22223b;
  250. font-weight: bold;
  251. margin-bottom: 8rpx;
  252. }
  253. .car-status {
  254. font-size: 24rpx;
  255. font-weight: 500;
  256. padding: 4rpx 16rpx;
  257. border-radius: 8rpx;
  258. display: inline-block;
  259. width: fit-content;
  260. }
  261. .status-0 {
  262. background: #fef3c7;
  263. color: #d97706;
  264. }
  265. /* 已派出 */
  266. .status-1 {
  267. background: #d4f3e9;
  268. color: #10b981;
  269. }
  270. /* 可使用 */
  271. .status-4 {
  272. background: #fee2e2;
  273. color: #ef4444;
  274. }
  275. /* 已报废 */
  276. .status-3 {
  277. background: #dbeafe;
  278. color: #3b82f6;
  279. }
  280. /* 已还车 */
  281. .modern-card-body {
  282. padding: 20rpx 28rpx 24rpx 28rpx;
  283. }
  284. .avatar-section {
  285. display: flex;
  286. align-items: center;
  287. margin-bottom: 18rpx;
  288. }
  289. .avatar {
  290. width: 56rpx;
  291. height: 56rpx;
  292. border-radius: 50%;
  293. background: #a5b4fc;
  294. color: #fff;
  295. display: flex;
  296. align-items: center;
  297. justify-content: center;
  298. font-size: 28rpx;
  299. font-weight: bold;
  300. margin-right: 18rpx;
  301. }
  302. .applier-name {
  303. font-size: 28rpx;
  304. color: #22223b;
  305. font-weight: 500;
  306. }
  307. .dept-name {
  308. font-size: 24rpx;
  309. color: #64748b;
  310. margin-left: 8rpx;
  311. }
  312. .info-row {
  313. display: flex;
  314. margin-bottom: 10rpx;
  315. }
  316. .info-label {
  317. color: #64748b;
  318. font-size: 24rpx;
  319. min-width: 120rpx;
  320. }
  321. .info-value {
  322. color: #22223b;
  323. font-size: 24rpx;
  324. flex: 1;
  325. word-break: break-all;
  326. }
  327. .amount-highlight-detail {
  328. background: #fef3c7;
  329. color: #d97706;
  330. font-size: 28rpx;
  331. font-weight: bold;
  332. border-radius: 10rpx;
  333. padding: 4rpx 18rpx;
  334. margin-left: 8rpx;
  335. }
  336. .manager-amount-highlight-detail {
  337. background: #d4f3e9;
  338. color: #10b981;
  339. font-size: 28rpx;
  340. font-weight: bold;
  341. border-radius: 10rpx;
  342. padding: 4rpx 18rpx;
  343. margin-left: 8rpx;
  344. }
  345. .modern-card-footer {
  346. display: flex;
  347. justify-content: flex-end;
  348. gap: 20rpx;
  349. padding: 16rpx 28rpx 20rpx 28rpx;
  350. border-top: 1px solid #f0f0f0;
  351. background: #fafbfc;
  352. }
  353. .footer-btn {
  354. font-size: 26rpx;
  355. border-radius: 8rpx;
  356. border: none;
  357. outline: none;
  358. background: #e0e7ff;
  359. color: #3b3b4f;
  360. }
  361. .detail-btn {
  362. background: #6366f1;
  363. color: #fff;
  364. }
  365. .detail-btn2 {
  366. background: #f4c542;
  367. color: #fff;
  368. }
  369. .popup-detail-list {
  370. padding: 32rpx 24rpx 48rpx 24rpx;
  371. background: #fff;
  372. border-radius: 24rpx 24rpx 0 0;
  373. min-height: 300rpx;
  374. max-height: 70vh;
  375. overflow-y: auto;
  376. position: relative;
  377. }
  378. .popup-detail-title {
  379. font-size: 32rpx;
  380. font-weight: bold;
  381. color: #22223b;
  382. margin-bottom: 24rpx;
  383. text-align: center;
  384. }
  385. .popup-detail-item {
  386. display: flex;
  387. align-items: flex-start;
  388. background: #f7f8fa;
  389. border-radius: 12rpx;
  390. margin-bottom: 18rpx;
  391. padding: 18rpx 16rpx;
  392. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  393. }
  394. .popup-detail-index {
  395. width: 44rpx;
  396. height: 44rpx;
  397. background: #6366f1;
  398. color: #fff;
  399. border-radius: 50%;
  400. display: flex;
  401. align-items: center;
  402. justify-content: center;
  403. font-size: 24rpx;
  404. font-weight: bold;
  405. margin-right: 18rpx;
  406. }
  407. .popup-detail-main {
  408. flex: 1;
  409. }
  410. .popup-detail-row {
  411. display: flex;
  412. align-items: center;
  413. margin-bottom: 8rpx;
  414. }
  415. .popup-detail-label {
  416. color: #64748b;
  417. font-size: 24rpx;
  418. min-width: 120rpx;
  419. }
  420. .popup-detail-value {
  421. color: #22223b;
  422. font-size: 24rpx;
  423. }
  424. .popup-detail-amount {
  425. color: #d97706;
  426. font-size: 28rpx;
  427. font-weight: bold;
  428. margin-left: 8rpx;
  429. }
  430. .popup-detail-manager-amount {
  431. color: #10b981;
  432. font-size: 28rpx;
  433. font-weight: bold;
  434. margin-left: 8rpx;
  435. }
  436. .popup-close-btn {
  437. position: absolute;
  438. right: 24rpx;
  439. top: 18rpx;
  440. font-size: 40rpx;
  441. color: #999;
  442. z-index: 10;
  443. cursor: pointer;
  444. line-height: 1;
  445. }
  446. </style>