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 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  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.enStationName}}</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.exStationName}}</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. if (val == 1) {
  171. state.pageNo = 1
  172. }
  173. if (state.pageNo == 1 && state.list.length > 0) {
  174. state.list = []
  175. }
  176. const options = {
  177. type: 2,
  178. data: {
  179. cardId: state.cardId,
  180. beforeDate: dataTime.startDate == "开始时间" ? "" : dataTime.startDate,
  181. afterDate: dataTime.endDate == "结束时间" ? "" : dataTime.endDate,
  182. pageNo: state.pageNo,
  183. pageSize: state.pageSize,
  184. },
  185. method: "POST",
  186. showLoading: true,
  187. };
  188. request(passBills, options).then((res) => {
  189. console.log(res);
  190. let result = stringToJson(res.bizContent)
  191. console.log(result);
  192. state.list = [...state.list, ...stringToJson(res.bizContent).data]
  193. console.log(result.data);
  194. getPpassBillCount()
  195. })
  196. }
  197. const getPpassBillCount = () => {
  198. const options = {
  199. type: 2,
  200. data: {
  201. cardId: state.cardId,
  202. starDate: dataTime.startDate == "开始时间" ? "" : dataTime.startDate,
  203. endDate: dataTime.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. dataTime.startDate = e.detail.value
  220. }
  221. // 展示日历
  222. const bindDateEnd = (e) => {
  223. console.log(e);
  224. dataTime.endDate = e.detail.value
  225. // show.value = true
  226. }
  227. // 补卡申请
  228. const toApply = (item) => {
  229. uni.navigateTo({
  230. // url: `/subpackage/orders/cardAmount?id=${item.id}`
  231. url: ""
  232. });
  233. }
  234. // 去评价
  235. const toEvaluate = (item) => {
  236. uni.navigateTo({
  237. // url: `/subpackage/orders/order-evaluate?id=${item.id}`
  238. url: ""
  239. });
  240. }
  241. // 查看进度
  242. const toView = (item) => {
  243. uni.navigateTo({
  244. // url: `/subpackage/orders/cardAmountDetail?id=${item.id}`
  245. url: ""
  246. });
  247. }
  248. //下载按钮事件
  249. const doDownload = () => {
  250. const options = {
  251. type: 2,
  252. data: {
  253. cardId: state.cardId,
  254. beforeDate: dataTime.startDate == "开始时间" ? "" : dataTime.startDate,
  255. afterDate: dataTime.endDate == "结束时间" ? "" : dataTime.endDate,
  256. vehiclePlate: state.vehicleId.split('_')[0],
  257. vehiclePlateColor: state.vehicleId.split('_')[1]
  258. },
  259. method: "POST",
  260. showLoading: true,
  261. };
  262. request(downloadBills, options).then((res) => {
  263. let result = stringToJson(res.bizContent)
  264. console.log("downloadFileURL", downloadFileURL + result.ossFilePath);
  265. download(downloadFileURL + result.ossFilePath)
  266. })
  267. }
  268. //下载文件
  269. const download = (attachLink) => {
  270. let that = this
  271. uni.downloadFile({
  272. url: attachLink, //下载地址,后端接口获取的链接
  273. success: (data) => {
  274. console.log(data.tempFilePath)
  275. console.log(JSON.stringify(data))
  276. if (data.statusCode === 200) {
  277. uni.saveFile({ //文件保存到本地
  278. tempFilePath: data.tempFilePath, //临时路径
  279. success: function(res) {
  280. console.log("下载成功" + res.savedFilePath)
  281. console.log(JSON.stringify(res))
  282. uni.showToast({
  283. icon: 'none',
  284. mask: true,
  285. title: '文件已保存!',
  286. duration: 3000,
  287. });
  288. uni.openDocument({
  289. //fileType: 'docx',
  290. showMenu: true, //关键点,可以转发到微信
  291. filePath: res.savedFilePath,
  292. success: function(res) {
  293. console.log('打开文档成功');
  294. }
  295. });
  296. }
  297. });
  298. }
  299. },
  300. fail: (err) => {
  301. console.log(err);
  302. uni.showToast({
  303. icon: 'none',
  304. mask: true,
  305. title: '失败请重新下载',
  306. });
  307. },
  308. });
  309. }
  310. </script>
  311. <style lang="scss" scoped>
  312. .u-btn--primary {
  313. background: #00B38B;
  314. }
  315. .blank {
  316. font-size: 30rpx;
  317. text-align: center;
  318. }
  319. .bg-color {
  320. position: fixed;
  321. top: 0;
  322. left: 0;
  323. right: 0;
  324. bottom: 0;
  325. background: #EEF7F7;
  326. z-index: -1;
  327. }
  328. .search-box {
  329. margin: 30rpx 30rpx 20rpx 30rpx;
  330. height: 72rpx;
  331. height: 81rpx;
  332. background: #FFFFFF;
  333. border: 1px solid #DCDCDC;
  334. border-radius: 40rpx;
  335. display: flex;
  336. justify-content: center;
  337. align-items: center;
  338. box-sizing: border-box;
  339. }
  340. .picker {
  341. flex: 1;
  342. }
  343. .search-time-box {
  344. flex: 1;
  345. }
  346. .search-box .icon {
  347. width: 48rpx;
  348. height: 48rpx;
  349. margin: 0 20rpx;
  350. }
  351. .search-box .search {
  352. flex: 1;
  353. margin-right: 20rpx;
  354. height: 100%;
  355. padding: 0 10rpx;
  356. font-size: 28rpx;
  357. color: #00b38b;
  358. }
  359. .scroll-view {
  360. white-space: nowrap;
  361. position: sticky;
  362. top: 0;
  363. background: #ffffff;
  364. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  365. }
  366. .search-time {
  367. display: flex;
  368. margin: 20rpx 30rpx 48rpx 30rpx;
  369. .time-btn {
  370. width: 130rpx;
  371. height: 80rpx;
  372. background: #00B38B;
  373. border-radius: 40rpx;
  374. color: #FFFFFF;
  375. font-size: 32rpx;
  376. line-height: 80rpx;
  377. text-align: center;
  378. margin-left: 19rpx;
  379. }
  380. .show-info {
  381. height: 80rpx;
  382. padding: 0 31rpx;
  383. background: #FFFFFF;
  384. border: 1px solid #DCDCDC;
  385. border-radius: 40rpx;
  386. display: flex;
  387. justify-content: space-between;
  388. align-items: center;
  389. .show-text {
  390. display: flex;
  391. align-items: center;
  392. justify-content: center;
  393. width: 100%;
  394. text-align: center;
  395. }
  396. .date-text {
  397. color: #999999;
  398. font-size: 28rpx;
  399. }
  400. .text-val {
  401. color: #333
  402. }
  403. .line {
  404. width: 25rpx;
  405. height: 1rpx;
  406. background: #999999;
  407. margin: 0 24rpx;
  408. }
  409. }
  410. }
  411. .total-num {
  412. font-size: 30rpx;
  413. color: #999999;
  414. display: flex;
  415. justify-content: space-evenly;
  416. align-items: center;
  417. // .total-space {
  418. // margin-left: 41rpx;
  419. // }
  420. }
  421. .btn-download {
  422. padding: 0 20rpx;
  423. border: 1px solid #00B38B;
  424. height: 60rpx;
  425. line-height: 60rpx;
  426. border-radius: 30rpx;
  427. font-size: 28rpx;
  428. color: #00B38B;
  429. }
  430. .list-wrap {
  431. margin: 30rpx;
  432. padding-bottom: 20rpx;
  433. }
  434. .card-info {
  435. background: #FFFFFF;
  436. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  437. border-radius: 20rpx;
  438. margin-bottom: 30rpx;
  439. padding: 30rpx 20rpx 10rpx 20rpx;
  440. .info-wrap {
  441. display: flex;
  442. justify-content: space-between;
  443. align-items: center;
  444. border-bottom: 1px solid #dcdcdc;
  445. padding-bottom: 30rpx;
  446. .info-left-text {
  447. margin-bottom: 15rpx;
  448. }
  449. .label {
  450. color: #999999;
  451. font-size: 26rpx;
  452. font-weight: 400;
  453. }
  454. .val {
  455. color: #333333;
  456. font-size: 26rpx;
  457. font-weight: 400;
  458. }
  459. .price-label {
  460. color: #999999;
  461. font-size: 24rpx;
  462. font-weight: 400;
  463. margin-bottom: 22rpx;
  464. text-align: center;
  465. }
  466. .price-val-text {
  467. font-size: 32rpx;
  468. font-weight: 700;
  469. color: #333333;
  470. margin-left: 9rpx;
  471. }
  472. .price-val {
  473. font-size: 26rpx;
  474. color: #333333;
  475. }
  476. }
  477. .card-text-wrap {
  478. display: flex;
  479. justify-content: space-between;
  480. align-items: center;
  481. margin: 38rpx 0 46rpx 0;
  482. .text-box {
  483. display: flex;
  484. flex-direction: column;
  485. align-items: center;
  486. .name-text {
  487. font-size: 30rpx;
  488. font-weight: 400;
  489. color: #333333;
  490. }
  491. .time-text {
  492. font-size: 30rpx;
  493. color: #333333;
  494. font-weight: 400;
  495. margin-top: 8rpx;
  496. }
  497. .date-text {
  498. font-size: 24rpx;
  499. color: #999999;
  500. font-weight: 400;
  501. margin-top: 8rpx;
  502. }
  503. }
  504. .arrow-wrap {
  505. display: flex;
  506. flex-direction: column;
  507. align-items: center;
  508. .d-img {
  509. width: 186rpx;
  510. height: 12rpx;
  511. }
  512. .arrow-text {
  513. color: #666666;
  514. font-size: 26rpx;
  515. }
  516. }
  517. }
  518. .btn-wrap {
  519. margin-top: 30rpx;
  520. display: flex;
  521. justify-content: space-between;
  522. align-items: center;
  523. .status-wrap {
  524. color: #999999;
  525. font-size: 26rpx;
  526. margin-right: 23rpx;
  527. }
  528. .status-text {
  529. color: #00B38B;
  530. }
  531. .btn {
  532. background: #FFFFFF;
  533. border: 1px solid #00B38B;
  534. border-radius: 30rpx;
  535. line-height: 61rpx;
  536. text-align: center;
  537. color: #00B38B;
  538. font-size: 26rpx;
  539. }
  540. .btn-1 {
  541. width: 171rpx;
  542. height: 61rpx;
  543. }
  544. .btn-2 {
  545. width: 141rpx;
  546. height: 61rpx;
  547. }
  548. .btn-3 {
  549. width: 121rpx;
  550. height: 61rpx;
  551. }
  552. }
  553. }
  554. .finished .info-wrap,
  555. .finished .card-text-wrap {
  556. .price-val,
  557. .price-val-text,
  558. .val,
  559. .text-box .time-text,
  560. .text-box .name-text,
  561. .arrow-wrap .arrow-text {
  562. color: #999999;
  563. }
  564. }
  565. .bottom-line {
  566. text-align: center;
  567. margin: 30rpx 0;
  568. }
  569. </style>