加入 开门记录和充电桩 订单功能

This commit is contained in:
Your Name 2023-09-15 16:41:12 +08:00
parent 2c193c9d80
commit cfc93a0095
5 changed files with 255 additions and 1 deletions

View File

@ -49,3 +49,52 @@ export function listMachineRecords(_that,_data){
})
});
}
/**
* 查询充电桩
* @param {Object} _that 上下文对象
* @param {Object} _data 请求报文
*/
export function listChargeMachine(_that,_data){
return new Promise(function(reslove,reject){
_that.context.get({
url: url.listChargeMachine,
data:_data,
success: function(res) {
reslove(res.data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
})
});
}
/**
* 查询充电桩订单
* @param {Object} _that 上下文对象
* @param {Object} _data 请求报文
*/
export function listChargeMachineOrder(_that,_data){
return new Promise(function(reslove,reject){
_that.context.get({
url: url.listChargeMachineOrder,
data:_data,
success: function(res) {
reslove(res.data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
})
});
}

View File

@ -208,6 +208,10 @@ export default {
//todo 设备相关
listMachines: baseUrl+"app/machine.listMachines",
listMachineRecords: baseUrl+"app/machineRecord.listMachineRecords",
listChargeMachine: baseUrl+"app/chargeMachine.listChargeMachine",
listChargeMachineOrder: baseUrl+"app/chargeMachine.listChargeMachineOrder",
//todo 车辆相关

View File

@ -721,6 +721,15 @@
}
}
,{
"path" : "pages/report/chargeMachineOrder",
"style" :
{
"navigationBarTitleText": "充电桩订单",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "white",

View File

@ -0,0 +1,185 @@
<template>
<view>
<view class="q-query flex justify-start flex-wrap">
<view class="q-item">
<input type="text" class="q-input" placeholder="输入用户名称" v-model="personName"></input>
</view>
<view class="q-item">
<picker bindchange="PickerChange" :value="machineIndex" :range-key="'machineName'" :range="machines"
@change="machineChange">
<view class="picker">
{{machineIndex==-1 ? "请选择充电桩" : machines[machineIndex].machineName}}
</view>
</picker>
</view>
<view class="q-item-btn">
<button class="cu-btn line-blue round q-input" @click="_loadChargeMachineOrder">搜索</button>
</view>
</view>
<view class="margin-top" v-if="orders.length > 0">
<view class="bg-white margin-bottom padding-sm margin-sm radius-sm" v-for="(item,index) in orders"
:key="index">
<view class="apply-title flex justify-between">
<view>
<text class="text-bold">{{item.personName}}/{{item.personTel}}</text>
</view>
<view class="flex justify-start">
<!-- <button class="cu-btn round sm line-black margin-left-sm"
@tap="_toApplyDetail(item)">详情</button> -->
{{item.orderId}}
</view>
</view>
<view class="apply-content flex justify-start flex-wrap">
<view class="item">
<text>充电桩:</text>
<text>{{item.machineName}}>{{item.machineCode}}</text>
</view>
<view class="item">
<text>插座:</text>
<text>{{item.portCode}}</text>
</view>
<view class="item">
<text>充电小时:</text>
<text>{{item.chargeHours}}</text>
</view>
<view class="item">
<text>小时电价:</text>
<text>{{item.durationPrice}}</text>
</view>
<view class="item">
<text>充电量:</text>
<text>{{item.energy}}</text>
</view>
<view class="item">
<text>扣款金额:</text>
<text>{{item.amount}}</text>
</view>
<view class="item">
<text>开始时间:</text>
<text>{{item.startTime}}</text>
</view>
<view class="item">
<text>结束时间:</text>
<text>{{item.endTime}}</text>
</view>
<view class="item">
<text>状态:</text>
<text>{{item.stateName}}</text>
</view>
<view class="item">
<text>备注:</text>
<text>{{item.remark}}</text>
</view>
</view>
</view>
</view>
<view v-else>
<no-data-page></no-data-page>
</view>
</view>
</template>
<script>
import noDataPage from '../../components/no-data-page/no-data-page.vue'
import {listChargeMachine,listChargeMachineOrder} from '../../api/machine/machineApi.js';
export default {
data() {
return {
personName:'',
machines:[],
machineIndex:-1,
machineId:'',
orders:[]
}
},
onLoad() {
this._loadChargeMachine();
this._loadChargeMachineOrder();
},
components:{
noDataPage
},
methods: {
_loadChargeMachineOrder:function(){
let _that =this;
listChargeMachineOrder(this,{
machineId:this.machineId,
communityId:this.getCommunityId(),
page:1,
row:100,
personName:this.personName
}).then(_data=>{
_that.orders = _data.data;
})
},
_loadChargeMachine:function(){
let _that =this;
listChargeMachine(this,{
communityId:this.getCommunityId(),
page:1,
row:100,
}).then(_data=>{
_that.machines = _data.machines;
})
},
machineChange: function(e) {
this.machineIndex = e.target.value //
let selected = this.machines[this.machineIndex] //
if(!selected){
return;
}
this.machineId = selected.machineId; //id
},
}
}
</script>
<style lang="scss">
.q-query {
background-color: #FFF;
padding: 15upx;
.q-item {
width: 30%;
margin-left: 15upx;
padding: 10upx 15upx;
border-radius: 15upx;
background-color: #f1f1f1;
.q-input {
height: 40upx;
}
margin-bottom: 15upx;
}
.q-item-btn {
width: 30%;
margin-left: 15upx;
.q-input {
height: 60upx;
}
}
}
.apply-title {
height: 60upx;
line-height: 50upx;
border-bottom: 1upx solid #F1F1F1;
}
.apply-content {
.item {
width: 50%;
margin-top: 20upx;
}
}
.radius-sm {
border-radius: 16upx;
}
</style>

View File

@ -55,10 +55,14 @@
</view>
</view>
</view>
<view v-else>
<no-data-page></no-data-page>
</view>
</view>
</template>
<script>
import noDataPage from '../../components/no-data-page/no-data-page.vue'
import {listMachines,listMachineRecords} from '../../api/machine/machineApi.js';
export default {
data() {
@ -72,7 +76,10 @@
},
onLoad() {
this._loadAccessControl();
//this._loadOpenDoorLog();
this._loadOpenDoorLog();
},
components:{
noDataPage
},
methods: {
_loadOpenDoorLog:function(){