123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667 |
- <template>
- <view class="wrapper">
- <!-- 背景颜色充满屏 -->
- <view class="bg-color"></view>
- <!-- 补卡额订单列表-->
- <view class="item last">
- <text>选择卡号:</text>
- <picker bindchange="changeCardId" :value="state.index" :range="state.cardIdRange">
- <view class="picker">
- {{state.cardIdRange[state.index]}}
- </view>
- </picker>
- <!-- <uni-data-select style="whith:360rpx;font-size: 26rpx;" v-model="state.cardId" :localdata="state.cardIdRange"
- @change="changeCardId" :clear="false"></uni-data-select> -->
- </view>
- <view class="search-time">
- <view class="search-time-box">
- <view class="show-info">
- <view class="show-text">
- <picker class="picker date" mode="date" :value="dataTime.startDate" @change="bindDateStart">
- <text class="date-text text-val">{{dataTime.startDate?dataTime.startDate:'开始时间'}}</text>
- </picker>
- <text class="line"></text>
- <picker class="picker date" mode="date" :value="dataTime.endDate" @change="bindDateEnd">
- <text class="date-text text-val">{{dataTime.endDate?dataTime.endDate:'结束时间'}}</text>
- </picker>
- </view>
- <u-icon name="calendar" :custom-style="{color:'#999999', size: '28rpx'}"></u-icon>
- </view>
- </view>
- <view class="time-btn" @click="search(1)">查询</view>
- </view>
- <view class="total-num" v-if="state.list.length > 0">
- <text>金额合计:{{state.aggregateAmount/100}}</text>
- <text class="total-space">通行次数: {{state.passTotal}}</text>
- <view class="btn btn-download" @click="doDownload">下载报表</view>
- </view>
- <view class="list-wrap" v-if="state.list.length >0">
- <view v-for="item in state.list" :key="item.listNo"
- :class="item.status === 3 ? ' card-info finished' : 'card-info'">
- <view class="info-wrap">
- <view class="info-left">
- <!-- <view class="info-left-text">
- <text class="label">单号:</text>
- <text class="val">{{item.listNo}}</text>
- </view> -->
- <view>
- <text class="label">卡号:</text>
- <text class="val">{{item.cardId}}</text>
- </view>
- </view>
- <view class="info-right">
- <view class="price-label">
- 交易金额
- </view>
- <view class="price-val">
- <text>¥</text>
- <text class="price-val-text">{{item.fee/100}}</text>
- </view>
- </view>
- </view>
- <view class="card-text-wrap">
- <view class="text-box">
- <text class="name-text">{{item.enStationName}}</text>
- <text
- class="time-text">{{item.enTime.substring(item.enTime.length -8 ,item.enTime.length-3)}}</text>
- <text class="date-text">{{item.enTime.substring(0,10)}}</text>
- </view>
- <view class="arrow-wrap">
- <text class="arrow-text">{{item.vehiclePlate}}</text>
- <image class="d-img" :src="`${$imgUrl}order/arrowCard.png`"></image>
- </view>
- <view class="text-box">
- <text class="name-text">{{item.exStationName}}</text>
- <text
- class="time-text">{{item.exTime.substring(item.exTime.length -8 ,item.exTime.length-3)}}</text>
- <text class="date-text">{{item.exTime.substring(0,10)}}</text>
- </view>
- </view>
- <!-- <view class="btn-wrap">
- <view>
- <text v-if="item.status === 2" class="status-wrap">审核进度:<text
- class="status-text">审核中</text></text>
- <text v-if="item.status === 3" class="status-wrap">审核进度:<text>已完成</text></text>
- </view>
- <view class="btn-1 btn" v-if="item.status === 1" @click="toApply(item)">补卡额申请</view>
- <view class="btn-1 btn" v-if="item.status === 2" @click="toView(item)">查看进度</view>
- <view class="btn-1 btn" v-if="item.status === 3" @click="toEvaluate(item)">去评价</view>
- </view> -->
- </view>
- <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view>
- </view>
- <view class="blank" v-else>
- <view class="text-center">暂无数据</view>
- </view>
- </view>
- </template>
-
- <script setup>
- import {
- reactive,
- ref
- } from "vue";
- import {
- request, requestNew
- } from "@/utils/network/request.js";
-
- import {
- stringToJson
- } from "@/utils/network/encryption.js";
- import {
- passBillCount,
- downloadBills,
- passbill,cardList
- } from "@/utils/network/api.js";
- import {
- onLoad,
- onReachBottom
- } from '@dcloudio/uni-app'
- import {
- downloadFileURL
- } from '@/datas/fileURL.js'
- import {
- msg,
- } from "@/utils/utils";
- const dataTime = reactive({
- startDate: "开始时间",
- endDate: "结束时间"
- })
-
- const state = reactive({
- list: [],
- cardId: null,
- cardIdRange:[],
- passTotal: 0,
- parkTotal: 0,
- aggregateAmount: 0,
- pageSize: 10, //每页数据量
- pageNo: 1, // 当前页
- flags: false,
- handleDate: "", //月结单选择时间
- vehicleId: "",
- index:0
- })
- onLoad((option) => {
- state.cardId = option.cardId;
- state.handleDate = option.handleDate;
- state.vehicleId = option.vehicleId;
- console.log("月结单111", state.handleDate)
- if (state.handleDate) {
- // "2024-04-25"
- let deadLine = getDaysInMonth(state.handleDate.substring(0, 4), state.handleDate.substring(4, 6))
- dataTime.startDate = state.handleDate.substring(0, 4) + "-" + state.handleDate.substring(4, 6) + "-" +
- "01"
- dataTime.endDate = state.handleDate.substring(0, 4) + "-" + state.handleDate.substring(4, 6) + "-" +
- deadLine
-
- console.log("月结单", dataTime.startDate, state.handleDate != "")
- search(1)
- }
- getCardList(option.vehicleId)
- })
- const changeCardId = (e) => {
- state.cardId = e
- console.log(e)
- }
- const getCardList = (vehicleId) => {
- var data = {
- vehicleId: vehicleId
- };
- const options = {
- type: 2,
- data: data,
- method: "POST",
- showLoading: true,
- };
- request(cardList, options).then((res) => {
- console.log("152", stringToJson(res.bizContent))
- let result = stringToJson(res.bizContent);
- for (var k = 0; k < result.data.length; k++) {
- state.cardIdRange.push(result.data[k]['cardId'])
- }
- console.log(result.data);
- })
- }
- function getDaysInMonth(year, month) {
- var date = new Date();
- date.setFullYear(year);
- date.setMonth(month);
- date.setDate(0);
- return date.getDate();
- }
- // 触底加载
- onReachBottom(() => {
- if (state.list.length < state.pageNo * 10) return state.flags = true
- console.log("触底了")
- state.pageNo++
- search(2)
- })
- const search = (val) => {
- if (dataTime.startDate == "开始时间") {
- msg('请选择开始时间');
- return;
- }
- if (dataTime.endDate == "结束时间") {
- msg('请选择结束时间');
- return;
- }
- if (val == 1) {
- state.pageNo = 1
- }
- if (state.pageNo == 1 && state.list.length > 0) {
- state.list = []
- }
- const options = {
- type: 2,
- data: {
- cardId: state.cardId,
- beforeDate: dataTime.startDate == "开始时间" ? "" : dataTime.startDate,
- afterDate: dataTime.endDate == "结束时间" ? "" : dataTime.endDate,
- pageNo: state.pageNo,
- pageSize: state.pageSize,
- },
- method: "POST",
- showLoading: true,
- };
- requestNew(passbill, options).then((res) => {
- console.log(res);
- state.list = [...state.list, ...res.result]
- getPpassBillCount()
- })
-
- }
- const getPpassBillCount = () => {
- const options = {
- type: 2,
- data: {
- cardId: state.cardId,
- starDate: dataTime.startDate == "开始时间" ? "" : dataTime.startDate,
- endDate: dataTime.endDate == "结束时间" ? "" : dataTime.endDate,
- },
- method: "POST",
- showLoading: true,
- };
- request(passBillCount, options).then((res) => {
- let result = stringToJson(res.bizContent)
- state.aggregateAmount = result.aggregateAmount ? result.aggregateAmount : 0
- state.passTotal = result.passTotal ? result.passTotal : 0
- state.parkTotal = result.parkTotal ? result.parkTotal : 0
- console.log(result);
- })
- }
-
- // 展示日历
- const bindDateStart = (e) => {
- console.log(e);
- dataTime.startDate = e.detail.value
- }
- // 展示日历
- const bindDateEnd = (e) => {
- console.log(e);
- dataTime.endDate = e.detail.value
- // show.value = true
- }
-
- // 补卡申请
- const toApply = (item) => {
- uni.navigateTo({
- url: ""
- });
- }
- // 去评价
- const toEvaluate = (item) => {
- uni.navigateTo({
- url: ""
- });
- }
- // 查看进度
- const toView = (item) => {
- uni.navigateTo({
- url: ""
- });
- }
-
- //下载按钮事件
- const doDownload = () => {
- const options = {
- type: 2,
- data: {
- cardId: state.cardId,
- beforeDate: dataTime.startDate == "开始时间" ? "" : dataTime.startDate,
- afterDate: dataTime.endDate == "结束时间" ? "" : dataTime.endDate,
- vehiclePlate: state.vehicleId.split('_')[0],
- vehiclePlateColor: state.vehicleId.split('_')[1]
- },
- method: "POST",
- showLoading: true,
- };
- request(downloadBills, options).then((res) => {
- let result = stringToJson(res.bizContent)
- console.log("downloadFileURL", downloadFileURL + result.ossFilePath);
- download(downloadFileURL + result.ossFilePath)
- })
- }
-
- //下载文件
- const download = (attachLink) => {
- let that = this
- uni.downloadFile({
- url: attachLink, //下载地址,后端接口获取的链接
- success: (data) => {
- console.log(data.tempFilePath)
- console.log(JSON.stringify(data))
- if (data.statusCode === 200) {
- uni.saveFile({ //文件保存到本地
- tempFilePath: data.tempFilePath, //临时路径
- success: function(res) {
- console.log("下载成功" + res.savedFilePath)
- console.log(JSON.stringify(res))
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '文件已保存!',
- duration: 3000,
- });
- uni.openDocument({
- //fileType: 'docx',
- showMenu: true, //关键点,可以转发到微信
- filePath: res.savedFilePath,
- success: function(res) {
- console.log('打开文档成功');
- }
- });
- }
- });
- }
- },
- fail: (err) => {
- console.log(err);
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '失败请重新下载',
- });
- },
- });
- }
- </script>
-
- <style lang="scss" scoped>
- .u-btn--primary {
- background: #00B38B;
- }
-
- .blank {
- font-size: 30rpx;
- text-align: center;
- }
-
- .bg-color {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: #EEF7F7;
- z-index: -1;
- }
-
- .search-box {
- margin: 30rpx 30rpx 20rpx 30rpx;
- height: 72rpx;
- height: 81rpx;
- background: #FFFFFF;
- border: 1px solid #DCDCDC;
- border-radius: 40rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: border-box;
- }
-
- .picker {
- flex: 1;
- }
-
- .search-time-box {
- flex: 1;
- }
-
- .search-box .icon {
- width: 48rpx;
- height: 48rpx;
- margin: 0 20rpx;
- }
-
- .search-box .search {
- flex: 1;
- margin-right: 20rpx;
- height: 100%;
- padding: 0 10rpx;
- font-size: 28rpx;
- color: #00b38b;
- }
-
- .scroll-view {
- white-space: nowrap;
- position: sticky;
- top: 0;
- background: #ffffff;
- box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
- }
-
- .search-time {
- display: flex;
- margin: 20rpx 30rpx 48rpx 30rpx;
-
- .time-btn {
- width: 130rpx;
- height: 80rpx;
- background: #00B38B;
- border-radius: 40rpx;
- color: #FFFFFF;
- font-size: 32rpx;
- line-height: 80rpx;
- text-align: center;
- margin-left: 19rpx;
- }
-
- .show-info {
- height: 80rpx;
- padding: 0 31rpx;
- background: #FFFFFF;
- border: 1px solid #DCDCDC;
- border-radius: 40rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .show-text {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- text-align: center;
- }
-
- .date-text {
- color: #999999;
- font-size: 28rpx;
- }
-
- .text-val {
- color: #333
- }
-
- .line {
- width: 25rpx;
- height: 1rpx;
- background: #999999;
- margin: 0 24rpx;
- }
- }
- }
-
- .total-num {
- font-size: 30rpx;
- color: #999999;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
-
- // .total-space {
- // margin-left: 41rpx;
- // }
- }
-
- .btn-download {
- padding: 0 20rpx;
- border: 1px solid #00B38B;
- height: 60rpx;
- line-height: 60rpx;
- border-radius: 30rpx;
- font-size: 28rpx;
- color: #00B38B;
- }
-
- .list-wrap {
- margin: 30rpx;
- padding-bottom: 20rpx;
- }
-
- .card-info {
- background: #FFFFFF;
- box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
- border-radius: 20rpx;
- margin-bottom: 30rpx;
- padding: 30rpx 20rpx 10rpx 20rpx;
-
- .info-wrap {
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid #dcdcdc;
- padding-bottom: 30rpx;
-
- .info-left-text {
- margin-bottom: 15rpx;
- }
-
- .label {
- color: #999999;
- font-size: 26rpx;
- font-weight: 400;
- }
-
- .val {
- color: #333333;
- font-size: 26rpx;
- font-weight: 400;
- }
-
- .price-label {
- color: #999999;
- font-size: 24rpx;
- font-weight: 400;
- margin-bottom: 22rpx;
- text-align: center;
- }
-
- .price-val-text {
- font-size: 32rpx;
- font-weight: 700;
- color: #333333;
- margin-left: 9rpx;
- }
-
- .price-val {
- font-size: 26rpx;
- color: #333333;
- }
-
- }
-
- .card-text-wrap {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin: 38rpx 0 46rpx 0;
-
- .text-box {
- display: flex;
- flex-direction: column;
- align-items: center;
-
- .name-text {
- font-size: 30rpx;
- font-weight: 400;
- color: #333333;
- }
-
- .time-text {
- font-size: 30rpx;
- color: #333333;
- font-weight: 400;
- margin-top: 8rpx;
- }
-
- .date-text {
- font-size: 24rpx;
- color: #999999;
- font-weight: 400;
- margin-top: 8rpx;
- }
- }
-
- .arrow-wrap {
- display: flex;
- flex-direction: column;
- align-items: center;
-
- .d-img {
- width: 186rpx;
- height: 12rpx;
- }
-
- .arrow-text {
- color: #666666;
- font-size: 26rpx;
- }
- }
- }
-
- .btn-wrap {
- margin-top: 30rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .status-wrap {
- color: #999999;
- font-size: 26rpx;
- margin-right: 23rpx;
- }
-
- .status-text {
- color: #00B38B;
- }
-
- .btn {
- background: #FFFFFF;
- border: 1px solid #00B38B;
- border-radius: 30rpx;
- line-height: 61rpx;
- text-align: center;
- color: #00B38B;
- font-size: 26rpx;
- }
-
- .btn-1 {
- width: 171rpx;
- height: 61rpx;
- }
-
- .btn-2 {
- width: 141rpx;
- height: 61rpx;
- }
-
- .btn-3 {
- width: 121rpx;
- height: 61rpx;
- }
- }
- }
-
- .finished .info-wrap,
- .finished .card-text-wrap {
-
- .price-val,
- .price-val-text,
- .val,
- .text-box .time-text,
- .text-box .name-text,
- .arrow-wrap .arrow-text {
- color: #999999;
- }
- }
-
- .bottom-line {
- text-align: center;
- margin: 30rpx 0;
- }
- .item {
- display: flex;
- font-size: 30rpx;
- margin: 20rpx 0 0 20rpx;
- align-items: center;
- background-color: white;
- width:95%;
- padding: 20rpx;
- box-sizing: border-box;
- }
- ::deep .last .uni-stat__select {
- width: 360rpx !important;
- }
- </style>
|