Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <view class="wrapper">
  3. <!-- 背景颜色充满屏 -->
  4. <view class="bg-color"></view>
  5. <!-- 补卡额订单列表-->
  6. <view class="search-time">
  7. <view class="search-time-box">
  8. <view class="show-info">
  9. <view class="show-text">
  10. <picker class="picker date" mode="date" :value="dataTime.startDate" @change="bindDateStart">
  11. <text class="date-text text-val">{{dataTime.startDate?dataTime.startDate:'开始时间'}}</text>
  12. </picker>
  13. <text class="line"></text>
  14. <picker class="picker date" mode="date" :value="dataTime.endDate" @change="bindDateEnd">
  15. <text class="date-text text-val">{{dataTime.endDate?dataTime.endDate:'结束时间'}}</text>
  16. </picker>
  17. </view>
  18. <u-icon name="calendar" :custom-style="{color:'#999999', size: '28rpx'}"></u-icon>
  19. </view>
  20. </view>
  21. <view class="time-btn" @click="search(1)">查询</view>
  22. </view>
  23. <view class="total-num" v-if="state.list.length > 0">
  24. <text>金额合计:{{state.aggregateAmount/100}}</text>
  25. <text class="total-space">通行次数: {{state.passTotal}}</text>
  26. <view class="btn btn-download" @click="doDownload">下载报表</view>
  27. </view>
  28. <view class="list-wrap" v-if="state.list.length >0">
  29. <view v-for="item in state.list" :key="item.listNo"
  30. :class="item.status === 3 ? ' card-info finished' : 'card-info'">
  31. <view class="info-wrap">
  32. <view class="info-left">
  33. <view class="info-left-text">
  34. <text class="label">单号:</text>
  35. <text class="val">{{item.listNo}}</text>
  36. </view>
  37. <view>
  38. <text class="label">卡号:</text>
  39. <text class="val">{{item.cardId}}</text>
  40. </view>
  41. </view>
  42. <view class="info-right">
  43. <view class="price-label">
  44. 交易金额
  45. </view>
  46. <view class="price-val">
  47. <text>¥</text>
  48. <text class="price-val-text">{{item.fee/100}}</text>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="card-text-wrap">
  53. <view class="text-box">
  54. <text class="name-text">{{item.enName}}</text>
  55. <text
  56. class="time-text">{{item.enTime.substring(item.enTime.length -8 ,item.enTime.length-3)}}</text>
  57. <text class="date-text">{{item.enTime.substring(0,10)}}</text>
  58. </view>
  59. <view class="arrow-wrap">
  60. <text class="arrow-text">{{item.vehiclePlate}}</text>
  61. <image class="d-img" :src="`${$imgUrl}order/arrowCard.png`"></image>
  62. </view>
  63. <view class="text-box">
  64. <text class="name-text">{{item.exName}}</text>
  65. <text
  66. class="time-text">{{item.exTime.substring(item.exTime.length -8 ,item.exTime.length-3)}}</text>
  67. <text class="date-text">{{item.exTime.substring(0,10)}}</text>
  68. </view>
  69. </view>
  70. <view class="btn-wrap">
  71. <view>
  72. <text v-if="item.status === 2" class="status-wrap">审核进度:<text
  73. class="status-text">审核中</text></text>
  74. <text v-if="item.status === 3" class="status-wrap">审核进度:<text>已完成</text></text>
  75. </view>
  76. <view class="btn-1 btn" v-if="item.status === 1" @click="toApply(item)">补卡额申请</view>
  77. <view class="btn-1 btn" v-if="item.status === 2" @click="toView(item)">查看进度</view>
  78. <view class="btn-1 btn" v-if="item.status === 3" @click="toEvaluate(item)">去评价</view>
  79. </view>
  80. </view>
  81. <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view>
  82. </view>
  83. <view class="blank" v-else>
  84. <view class="text-center">暂无数据</view>
  85. </view>
  86. </view>
  87. </template>
  88. <script setup>
  89. import {
  90. reactive,
  91. ref
  92. } from "vue";
  93. import {
  94. request
  95. } from "@/utils/network/request.js";
  96. import {
  97. stringToJson
  98. } from "@/utils/network/encryption.js";
  99. import {
  100. orderDetail,
  101. passBills,
  102. passBillCount,
  103. downloadBills,
  104. } from "@/utils/network/api.js";
  105. import {
  106. onLoad,
  107. onReachBottom
  108. } from '@dcloudio/uni-app'
  109. import {
  110. downloadFileURL
  111. } from '@/datas/fileURL.js'
  112. import {
  113. msg,
  114. } from "@/utils/utils";
  115. const dataTime = reactive({
  116. startDate: "开始时间",
  117. endDate: "结束时间"
  118. })
  119. const state = reactive({
  120. list: [],
  121. cardId: null,
  122. passTotal: 0,
  123. parkTotal: 0,
  124. aggregateAmount: 0,
  125. pageSize: 10, //每页数据量
  126. pageNo: 1, // 当前页
  127. flags: false,
  128. handleDate: "", //月结单选择时间
  129. vehicleId: ""
  130. })
  131. onLoad((option) => {
  132. state.cardId = option.cardId;
  133. state.handleDate = option.handleDate;
  134. state.vehicleId = option.vehicleId;
  135. console.log("月结单111", state.handleDate)
  136. if (state.handleDate != "undefined") {
  137. // "2024-04-25"
  138. let deadLine = getDaysInMonth(state.handleDate.substring(0, 4), state.handleDate.substring(4, 6))
  139. dataTime.startDate = state.handleDate.substring(0, 4) + "-" + state.handleDate.substring(4, 6) + "-" +
  140. "01"
  141. dataTime.endDate = state.handleDate.substring(0, 4) + "-" + state.handleDate.substring(4, 6) + "-" +
  142. deadLine
  143. console.log("月结单", dataTime.startDate, state.handleDate != "")
  144. search(1)
  145. }
  146. })
  147. function getDaysInMonth(year, month) {
  148. var date = new Date();
  149. date.setFullYear(year);
  150. date.setMonth(month);
  151. date.setDate(0);
  152. return date.getDate();
  153. }
  154. // 触底加载
  155. onReachBottom(() => {
  156. if (state.list.length < state.pageNo * 10) return state.flags = true
  157. console.log("触底了")
  158. state.pageNo++
  159. search(2)
  160. })
  161. const search = (val) => {
  162. if (dataTime.startDate == "开始时间") {
  163. msg('请选择开始时间');
  164. return;
  165. }
  166. if (dataTime.endDate == "结束时间") {
  167. msg('请选择结束时间');
  168. return;
  169. }
  170. getPpassBillCount()
  171. if (val == 1) {
  172. state.pageNo = 1
  173. }
  174. if (state.pageNo == 1 && state.list.length > 0) {
  175. state.list = []
  176. }
  177. const options = {
  178. type: 2,
  179. data: {
  180. cardId: state.cardId,
  181. beforeDate: dataTime.startDate,
  182. afterDate: dataTime.endDate,
  183. pageNo: state.pageNo,
  184. pageSize: state.pageSize,
  185. },
  186. method: "POST",
  187. showLoading: true,
  188. };
  189. request(passBills, options).then((res) => {
  190. console.log(res);
  191. let result = stringToJson(res.bizContent)
  192. console.log(result);
  193. state.list = [...state.list, ...stringToJson(res.bizContent).data]
  194. console.log(result.data);
  195. })
  196. }
  197. const getPpassBillCount = () => {
  198. const options = {
  199. type: 2,
  200. data: {
  201. cardId: state.cardId,
  202. starDate: dataTime.startDate,
  203. endDate: dataTime.endDate,
  204. },
  205. method: "POST",
  206. showLoading: true,
  207. };
  208. request(passBillCount, options).then((res) => {
  209. let result = stringToJson(res.bizContent)
  210. state.aggregateAmount = result.aggregateAmount ? result.aggregateAmount : 0
  211. state.passTotal = result.passTotal ? result.passTotal : 0
  212. state.parkTotal = result.parkTotal ? result.parkTotal : 0
  213. console.log(result);
  214. })
  215. }
  216. // 展示日历
  217. const bindDateStart = (e) => {
  218. console.log(e);
  219. // show.value = true
  220. dataTime.startDate = e.detail.value
  221. }
  222. // 展示日历
  223. const bindDateEnd = (e) => {
  224. console.log(e);
  225. dataTime.endDate = e.detail.value
  226. // show.value = true
  227. }
  228. // 补卡申请
  229. const toApply = (item) => {
  230. uni.navigateTo({
  231. // url: `/subpackage/orders/cardAmount?id=${item.id}`
  232. url: ""
  233. });
  234. }
  235. // 去评价
  236. const toEvaluate = (item) => {
  237. uni.navigateTo({
  238. // url: `/subpackage/orders/order-evaluate?id=${item.id}`
  239. url: ""
  240. });
  241. }
  242. // 查看进度
  243. const toView = (item) => {
  244. uni.navigateTo({
  245. // url: `/subpackage/orders/cardAmountDetail?id=${item.id}`
  246. url: ""
  247. });
  248. }
  249. //下载按钮事件
  250. const doDownload = () => {
  251. const options = {
  252. type: 2,
  253. data: {
  254. cardId: state.cardId,
  255. beforeDate: dataTime.startDate,
  256. afterDate: dataTime.endDate,
  257. vehiclePlate: state.vehicleId.split('_')[0],
  258. vehiclePlateColor: state.vehicleId.split('_')[1]
  259. },
  260. method: "POST",
  261. showLoading: true,
  262. };
  263. request(downloadBills, options).then((res) => {
  264. let result = stringToJson(res.bizContent)
  265. console.log("downloadFileURL", downloadFileURL + result.ossFilePath);
  266. download(downloadFileURL + result.ossFilePath)
  267. })
  268. }
  269. //下载文件
  270. const download = (attachLink) => {
  271. let that = this
  272. uni.downloadFile({
  273. url: attachLink, //下载地址,后端接口获取的链接
  274. success: (data) => {
  275. console.log(data.tempFilePath)
  276. console.log(JSON.stringify(data))
  277. if (data.statusCode === 200) {
  278. uni.saveFile({ //文件保存到本地
  279. tempFilePath: data.tempFilePath, //临时路径
  280. success: function(res) {
  281. console.log("下载成功" + res.savedFilePath)
  282. console.log(JSON.stringify(res))
  283. uni.showToast({
  284. icon: 'none',
  285. mask: true,
  286. title: '文件已保存!',
  287. duration: 3000,
  288. });
  289. uni.openDocument({
  290. //fileType: 'docx',
  291. showMenu: true, //关键点,可以转发到微信
  292. filePath: res.savedFilePath,
  293. success: function(res) {
  294. console.log('打开文档成功');
  295. }
  296. });
  297. }
  298. });
  299. }
  300. },
  301. fail: (err) => {
  302. console.log(err);
  303. uni.showToast({
  304. icon: 'none',
  305. mask: true,
  306. title: '失败请重新下载',
  307. });
  308. },
  309. });
  310. }
  311. </script>
  312. <style lang="scss" scoped>
  313. .u-btn--primary {
  314. background: #00B38B;
  315. }
  316. .blank {
  317. font-size: 30rpx;
  318. text-align: center;
  319. }
  320. .bg-color {
  321. position: fixed;
  322. top: 0;
  323. left: 0;
  324. right: 0;
  325. bottom: 0;
  326. background: #EEF7F7;
  327. z-index: -1;
  328. }
  329. .search-box {
  330. margin: 30rpx 30rpx 20rpx 30rpx;
  331. height: 72rpx;
  332. height: 81rpx;
  333. background: #FFFFFF;
  334. border: 1px solid #DCDCDC;
  335. border-radius: 40rpx;
  336. display: flex;
  337. justify-content: center;
  338. align-items: center;
  339. box-sizing: border-box;
  340. }
  341. .picker {
  342. flex: 1;
  343. }
  344. .search-time-box {
  345. flex: 1;
  346. }
  347. .search-box .icon {
  348. width: 48rpx;
  349. height: 48rpx;
  350. margin: 0 20rpx;
  351. }
  352. .search-box .search {
  353. flex: 1;
  354. margin-right: 20rpx;
  355. height: 100%;
  356. padding: 0 10rpx;
  357. font-size: 28rpx;
  358. color: #00b38b;
  359. }
  360. .scroll-view {
  361. white-space: nowrap;
  362. position: sticky;
  363. top: 0;
  364. background: #ffffff;
  365. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  366. }
  367. .search-time {
  368. display: flex;
  369. margin: 20rpx 30rpx 48rpx 30rpx;
  370. .time-btn {
  371. width: 130rpx;
  372. height: 80rpx;
  373. background: #00B38B;
  374. border-radius: 40rpx;
  375. color: #FFFFFF;
  376. font-size: 32rpx;
  377. line-height: 80rpx;
  378. text-align: center;
  379. margin-left: 19rpx;
  380. }
  381. .show-info {
  382. height: 80rpx;
  383. padding: 0 31rpx;
  384. background: #FFFFFF;
  385. border: 1px solid #DCDCDC;
  386. border-radius: 40rpx;
  387. display: flex;
  388. justify-content: space-between;
  389. align-items: center;
  390. .show-text {
  391. display: flex;
  392. align-items: center;
  393. justify-content: center;
  394. width: 100%;
  395. text-align: center;
  396. }
  397. .date-text {
  398. color: #999999;
  399. font-size: 28rpx;
  400. }
  401. .text-val {
  402. color: #333
  403. }
  404. .line {
  405. width: 25rpx;
  406. height: 1rpx;
  407. background: #999999;
  408. margin: 0 24rpx;
  409. }
  410. }
  411. }
  412. .total-num {
  413. font-size: 30rpx;
  414. color: #999999;
  415. display: flex;
  416. justify-content: space-evenly;
  417. align-items: center;
  418. // .total-space {
  419. // margin-left: 41rpx;
  420. // }
  421. }
  422. .btn-download {
  423. padding: 0 20rpx;
  424. border: 1px solid #00B38B;
  425. height: 60rpx;
  426. line-height: 60rpx;
  427. border-radius: 30rpx;
  428. font-size: 28rpx;
  429. color: #00B38B;
  430. }
  431. .list-wrap {
  432. margin: 30rpx;
  433. padding-bottom: 20rpx;
  434. }
  435. .card-info {
  436. background: #FFFFFF;
  437. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  438. border-radius: 20rpx;
  439. margin-bottom: 30rpx;
  440. padding: 30rpx 20rpx 10rpx 20rpx;
  441. .info-wrap {
  442. display: flex;
  443. justify-content: space-between;
  444. align-items: center;
  445. border-bottom: 1px solid #dcdcdc;
  446. padding-bottom: 30rpx;
  447. .info-left-text {
  448. margin-bottom: 15rpx;
  449. }
  450. .label {
  451. color: #999999;
  452. font-size: 26rpx;
  453. font-weight: 400;
  454. }
  455. .val {
  456. color: #333333;
  457. font-size: 26rpx;
  458. font-weight: 400;
  459. }
  460. .price-label {
  461. color: #999999;
  462. font-size: 24rpx;
  463. font-weight: 400;
  464. margin-bottom: 22rpx;
  465. text-align: center;
  466. }
  467. .price-val-text {
  468. font-size: 32rpx;
  469. font-weight: 700;
  470. color: #333333;
  471. margin-left: 9rpx;
  472. }
  473. .price-val {
  474. font-size: 26rpx;
  475. color: #333333;
  476. }
  477. }
  478. .card-text-wrap {
  479. display: flex;
  480. justify-content: space-between;
  481. align-items: center;
  482. margin: 38rpx 0 46rpx 0;
  483. .text-box {
  484. display: flex;
  485. flex-direction: column;
  486. align-items: center;
  487. .name-text {
  488. font-size: 30rpx;
  489. font-weight: 400;
  490. color: #333333;
  491. }
  492. .time-text {
  493. font-size: 30rpx;
  494. color: #333333;
  495. font-weight: 400;
  496. margin-top: 8rpx;
  497. }
  498. .date-text {
  499. font-size: 24rpx;
  500. color: #999999;
  501. font-weight: 400;
  502. margin-top: 8rpx;
  503. }
  504. }
  505. .arrow-wrap {
  506. display: flex;
  507. flex-direction: column;
  508. align-items: center;
  509. .d-img {
  510. width: 186rpx;
  511. height: 12rpx;
  512. }
  513. .arrow-text {
  514. color: #666666;
  515. font-size: 26rpx;
  516. }
  517. }
  518. }
  519. .btn-wrap {
  520. margin-top: 30rpx;
  521. display: flex;
  522. justify-content: space-between;
  523. align-items: center;
  524. .status-wrap {
  525. color: #999999;
  526. font-size: 26rpx;
  527. margin-right: 23rpx;
  528. }
  529. .status-text {
  530. color: #00B38B;
  531. }
  532. .btn {
  533. background: #FFFFFF;
  534. border: 1px solid #00B38B;
  535. border-radius: 30rpx;
  536. line-height: 61rpx;
  537. text-align: center;
  538. color: #00B38B;
  539. font-size: 26rpx;
  540. }
  541. .btn-1 {
  542. width: 171rpx;
  543. height: 61rpx;
  544. }
  545. .btn-2 {
  546. width: 141rpx;
  547. height: 61rpx;
  548. }
  549. .btn-3 {
  550. width: 121rpx;
  551. height: 61rpx;
  552. }
  553. }
  554. }
  555. .finished .info-wrap,
  556. .finished .card-text-wrap {
  557. .price-val,
  558. .price-val-text,
  559. .val,
  560. .text-box .time-text,
  561. .text-box .name-text,
  562. .arrow-wrap .arrow-text {
  563. color: #999999;
  564. }
  565. }
  566. .bottom-line {
  567. text-align: center;
  568. margin: 30rpx 0;
  569. }
  570. </style>