Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

etcFlowingWater.vue 15KB

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