Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

etcFlowingWater.vue 15KB

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