123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view>
- <u-navbar title="充电记录">
- </u-navbar>
- <view class="chargeScreen">
- <view class="chargeScreen-item">
- <p>
- <picker mode="date" :value="startDate" :end="endDate" @change="bindDateChange0">
- <view class="uni-input">{{startDate}}</view>
- </picker>
- </p>
- <u-icon name="arrow-down-fill" color="#999" size="24"></u-icon>
- </view>
- <span>至</span>
- <view class="chargeScreen-item">
- <p>
- <picker mode="date" :value="endDate" :start="startDate" @change="bindDateChange1">
- <view class="uni-input">{{endDate}}</view>
- </picker>
-
- </p>
- <u-icon name="arrow-down-fill" color="#999" size="24"></u-icon>
- </view>
- </view>
- <view style="text-align: center;margin-top: 100px" v-if="!list.length">
-
- <img src="@/assets/img/blankpage.png">
- <p>暂无充电记录</p>
- </view>
- <view class="chargeList">
- <view v-for="(item ,index) in list" :key="item.id"
- @click="gotoUrl('pages/charge/chargeDetails?id='+item.id)"
- class="chargeList-item"
- >
- <view class="chargeList-text">
- <p>{{item.createTime}}</p>
- <h4>{{item.deviceName}} 通道:{{item.channelNo}}</h4>
- </view>
- <span>{{isnull(item.actualFee!=null?item.actualFee:item.estimateFee)}}元</span>
- </view>
-
- </view>
- </view>
- </template>
- <script>
- import * as API from '@/apis/index.js'
- import {parseUnixTime,beforeTimeStamp} from '@/utils/index.js'
-
- export default {
- data() {
- return {
- form:{
-
- },
- startDate:'',
- endDate:'',
- pageIndex: 1,
- recordsTotal: 0,
- list: [],
- }
- },
- onReachBottom() {
- if (this.list.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- methods: {
- isnull(str){
- if(!str){
- return 0
- }else{
- return str
- }
- },
- bindDateChange0: function(e) {
- this.startDate= e.target.value
-
-
- this.getList(true)
- },
- bindDateChange1: function(e) {
- this.endDate= e.target.value
-
- this.getList(true)
- },
- myLoadmore() {
-
- this.pageIndex += 1;
- this.getList()
- },
- getList(bl) {
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- if (bl) {
- this.list = [];
- this.pageIndex = 1;
- }
- var data = {
- startDate:this.startDate,
- endDate:this.endDate,
- pageIndex: this.pageIndex
- };
- API.chargingRecordData(data).then((res) => {
-
- this.list = [
- ...this.list,
- ...res.data.data
- ];
- this.recordsTotal = res.data.recordsTotal
- uni.hideLoading()
-
- }).catch(error => {
- uni.showToast({
-
- title: error
- })
- })
- },
- onReady() {
- this.startDate=parseUnixTime(beforeTimeStamp(5),"{y}-{m}-{d}")
- this.endDate=parseUnixTime(new Date(),"{y}-{m}-{d}")
-
- this.getList()
-
- }
- }
- }
- </script>
- <style>
- page{
- background-color: #f7f7f7;
- }
- </style>
- <style lang="scss" scoped>
- .chargeScreen{
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 10px 0;
- background-color: #fff;
- span{
- color:#777;
- }
- }
- .chargeScreen-item{
- display: flex;
- align-items: center;
- flex: 1;
- justify-content: center;
- p{
- color:#777;
- margin-right: 5px;
- }
- }
- .chargeList{
- margin-top: 10px;
- }
- .chargeList-item{
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 15px;
- background-color: #fff;
- border-bottom: 1px solid #f7f7f7;
- h4{
- font-weight: normal;
- color:#999;
- margin-top: 3px;
- font-size: 12px;
- }
- span{
- font-size: 20px;
- color:#1677FF;
- font-weight: bold;
- }
- }
- </style>
|