123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <template>
- <view>
- <u-navbar title="充电订单"></u-navbar>
-
- <view class="record">
- <view class="recordTime oldTextjp2" oldstyle="font-size: 18px;" @click="show = true">
- <u-picker mode="time" v-model="show" :params="params" @confirm="confirmTime" @cancel="cancelTime"></u-picker>
- <p>{{month}}月</p>
- <u-icon name="arrow-down-s-fill" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
- </view>
- <view class="carNone" v-if="chargeList.length == 0">
- <img src="static/img/暂无数据-缺省页.png" alt="">
- <p class="oldTextjp" oldstyle="font-size: 20px;">暂无充电订单</p>
- </view>
- <view class="recordList" v-if="chargeList.length > 0">
- <view class="recordList-item" v-for="(item,index) in chargeList" :key="item.id" @click="gotoUrl('pages/record/details?id=' + item.id)">
- <view class="recordList-name">
- <h4 class="oldTextjp" oldstyle="font-size: 20px;">{{item.stationName}}/{{item.deviceNo}}</h4>
- <span class="state1" :style="{color : textColor(item),fontSize: textFontSize()}">{{item.statusText}}</span>
- </view>
- <view class="recordList-row">
- <p :style="elderStatus ? 'font-size: 14px' : ''">开始时间:{{item.status == '0' || item.status == '4' ? '暂未开始' : item.createTime}}</p>
- </view>
- <view class="recordList-row">
- <p :style="elderStatus ? 'font-size: 14px' : ''">充电电量:{{item.electricQuantity != null ? item.electricQuantity : '0.000'}}度</p>
- </view>
- <view class="recordList-row">
- <p :style="elderStatus ? 'font-size: 14px' : ''">充电时长:{{item.chargingMinute != null ? item.chargingMinute+'分钟' : '00分00秒'}}</p>
- <h4 class="oldTextjp2" oldstyle="font-size: 28px;">{{item.actualFee != null ? item.actualFee : '0.00'}}元</h4>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import * as API from '@/apis/index.js'
-
- export default {
- data() {
- return {
- params: {
- year: true,
- month: true,
- day: false,
- hour: false,
- minute: false,
- second: false,
- timestamp: true,
- },
- show: false,
- month: '',
- startDate: '',
- endDate: '',
- chargeList: [],
- pageIndex: 1,
- recordsTotal: 0,
- elderStatus: false,
- }
- },
- onReady() {
- var date = new Date();
- this.month = date.getMonth() + 1;
-
- var year = date.getFullYear();
- var day = new Date(year, this.month, 0).getDate();
- var monthN = this.month;
- if(monthN >= 1 && monthN <= 9) {
- monthN = "0" + monthN;
- }
-
- this.startDate = year + '-' + monthN + '-' + '01';
- this.endDate = year + '-' + monthN + '-' + day;
-
- this.getChargeList();
-
- if (this.carhelp.getPersonInfo()) {
- if(this.carhelp.get("getElderModeClass") == "长辈模式") {
- this.elderStatus = true;
- } else {
- this.elderStatus = false;
- }
- }
- },
- onReachBottom() {
- if (this.chargeList.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- methods: {
- myLoadmore() {
- this.pageIndex += 1;
- this.getChargeList()
- },
- textColor(item) {
- switch (item.status) {
- case '1':
- return '#00B962'
- break;
- case '2':
- return '#666666'
- break;
- case '4':
- return '#8161FF'
- break;
- }
- },
- textFontSize() {
- if(this.elderStatus) {
- return '20px'
- }
- },
- confirmTime(params) {
- if(params.month.slice(0,1) == '0') {
- this.month = params.month.slice(1);
- } else {
- this.month = params.month;
- }
-
- this.startDate = params.year + '-' + params.month + '-' + '01';
- var day = new Date(params.year, params.month, 0).getDate();
- this.endDate = params.year + '-' + params.month + '-' + day;
- this.getChargeList(true);
- this.show = false;
- },
- cancelTime() {
- this.show = false;
- },
- getChargeList(bl) {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- if (bl) {
- this.chargeList = [];
- this.pageIndex = 1;
- }
- API.chargingRecordData({
- pageIndex: this.pageIndex,
- startDate: this.startDate,
- endDate: this.endDate
- }).then((res) => {
- uni.hideLoading();
-
- this.chargeList = [
- ...this.chargeList,
- ...res.data.data
- ];
- this.recordsTotal = res.data.recordsTotal;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .carNone{
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- img{
- width: 100%;
- height: 100%;
- }
- p{
- margin-top: -60px;
- }
- }
- .recordTime{
- height: 44px;
- background-color: #fff;
- border-bottom: 1px solid #F2F2F2;
- display: flex;
- align-items: center;
- padding: 0 16px;
- p{
- margin-right: 4px;
- }
- }
- .recordList{
- background-color: #fff;
- }
- .recordList-item{
- background-color: #fff;
- border-bottom: 1px solid #ededed;
- margin-left: 16px;
- padding: 16px 16px 16px 0;
- .recordList-name{
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12px;
- h4{
- font-weight: normal;
- font-size: 15px;
- overflow: hidden;
- width: 75%;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .state1{
- color:#8161FF;
- }
- .state2{
- color:#00B962;
- }
- .state3{
- color:#666666;
- }
- }
- .recordList-row{
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 8px;
- p{
- font-size: 12px;
- color:#888;
- }
- h4{
- font-size: 16px;
- }
- }
- }
- </style>
|