优化加入充电桩 订单功能

This commit is contained in:
Your Name 2023-03-17 00:08:32 +08:00
parent 02b9145bb7
commit 1cbd51eccc
7 changed files with 265 additions and 1 deletions

View File

@ -0,0 +1,70 @@
<template>
<view>
<view class="cu-list menu">
<view class="cu-item arrow" @click="_toPrestoreAccount()">
<view class="content padding-tb-sm">
<view>
<text class="cuIcon-rechargefill text-green margin-right-xs"></text> {{account.acctTypeName}}
</view>
<view class="text-gray text-sm">
<text class="cuIcon-right margin-right-xs"></text>余额: {{account.amount}}
</view>
</view>
<view class="action">
去充值
</view>
</view>
</view>
</view>
</template>
<script>
// pages/account/myAccount.js
import context from '../../lib/java110/Java110Context.js';
import {
queryOwnerAccount
} from '../../api/user/userApi.js'
export default {
name: "account",
data() {
return {
account:{},
};
},
created() {
this.loadOwnerAccount();
},
methods: {
loadOwnerAccount: function() {
let _that = this;
context.getOwner(function(_ownerInfo) {
if (_ownerInfo) {
queryOwnerAccount({
page: 1,
row: 20,
idCard: _ownerInfo.idCard,
link: _ownerInfo.link,
communityId: _ownerInfo.communityId,
acctType:'2003'
}).then((data) => {
if (!data) {
_that.account = {};
return;
}
_that.account = data[0];
})
}
});
},
_toPrestoreAccount:function(){
uni.navigateTo({
url:'/pages/account/preStoreAccount'
})
}
}
}
</script>
<style>
</style>

View File

@ -120,6 +120,10 @@
name: '放行记录',
src: this.imgUrl+'/h5/images/serve/my8.png',
href: '/pages/itemRelease/myItemReleaseList'
},{
name: '充电订单',
src: this.imgUrl+'/h5/images/serve/11.png',
href: '/pages/machine/chargeMachineOrders'
},
]
};

View File

@ -829,6 +829,15 @@
}
}
,{
"path" : "pages/machine/chargeMachineOrders",
"style" :
{
"navigationBarTitleText": "充电订单",
"enablePullDownRefresh": false
}
}
],
"tabBar": {
"color": "#272636",

View File

@ -94,6 +94,13 @@
});
},
_payWxApp: function(_data) {
if(!this.amount){
uni.showToast({
icon:'none',
title:'未填写金额'
});
return ;
}
let _receivedAmount = this.amount;
let _tradeType = 'APP';
payFeeApp(this,{
@ -107,6 +114,13 @@
},
onPayFee: function() {
if(!this.amount){
uni.showToast({
icon:'none',
title:'未填写金额'
});
return ;
}
let _receivedAmount = this.amount;
let _tradeType = 'JSAPI';
@ -136,4 +150,19 @@
.button_up_blank {
height: 40rpx;
}
.cu-btn.lgplus {
padding: 0 20px;
font-size: 18px;
height: 100upx;
}
.cu-btn.sharp {
border-radius: 0upx;
}
.line-height {
line-height: 100upx;
}
</style>

View File

@ -10,6 +10,14 @@
{{startTime || 0}}
</view>
</view>
<view class="cu-item " v-if="state == '2002'">
<view class="content">
<text class="text-grey">结束时间</text>
</view>
<view class="action">
{{endTime || 0}}
</view>
</view>
<view class="cu-item ">
<view class="content">
<text class="text-grey">充电时间</text>
@ -18,6 +26,14 @@
{{chargeHours || 0}}
</view>
</view>
<view class="cu-item ">
<view class="content">
<text class="text-grey">充电桩</text>
</view>
<view class="action">
{{machineName || 0}}
</view>
</view>
<view class="cu-item ">
<view class="content">
<text class="text-grey">充电插槽</text>
@ -68,7 +84,9 @@
machineId:'',
portId:'',
startTime: '',
endTime:'',
chargeHours: '',
machineName:'',
portName: '',
durationPrice: '',
state: '',
@ -91,12 +109,15 @@
_that.machineId = _data[0].machineId;
_that.portId= _data[0].portId;
_that.startTime= _data[0].startTime;
_that.endTime= _data[0].endTime;
if(parseInt(_data[0].chargeHours) == 999){
_that.chargeHours = '充满自停';
}else{
_that.chargeHours = parseInt(_data[0].chargeHours)+"小时";
}
_that.portName= _data[0].portName;
_that.machineName= _data[0].machineName;
_that.durationPrice= _data[0].durationPrice;
_that.state= _data[0].state;
_that.stateName= _data[0].stateName;

View File

@ -0,0 +1,123 @@
<template>
<view class="tab-container bg-white">
<view class="cu-list menu">
<view class="cu-item arrow" v-if="orders.length > 0" v-for="(item, key) in orders" :key="key" :data-item="item" @click="toDetail(item)">
<view class="content padding-tb-sm">
<view>
<text class="cuIcon-homefill text-green margin-right-xs"></text>{{item.machineName}}-{{item.portName}}</view>
<view class="text-gray text-sm">
<text class="cuIcon-right margin-right-xs"></text> 订单{{item.orderId}}</view>
</view>
<view class="action">
{{item.stateName}}
</view>
</view>
<view class="cu-item" v-if="orders.length === 0">
<view class="content">
<text class="cuIcon-warn text-green"></text>
<text class="text-grey">暂无充电记录</text>
</view>
<view class="action">
</view>
</view>
</view>
</view>
</template>
<script>
import context from '../../lib/java110/Java110Context.js';
import noDataPage from '@/components/no-data-page/no-data-page.vue';
import {
getChargeMachineOrder
} from '../../api/machine/machineApi.js';
import {getCurOwner} from '../../api/owner/ownerApi.js'
import {
getCommunityId
} from '../../api/community/communityApi.js'
export default {
data() {
return {
orders:[],
personTel:''
}
},
components: {
noDataPage
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
context.onLoad(options);
let _that = this;
getCurOwner().then(_owner=>{
_that.personTel = _owner.link;
_that._loadChargeMachineOrder();
})
},
methods: {
_loadChargeMachineOrder:function(){
let _that = this;
getChargeMachineOrder({
communityId:getCommunityId(),
page:1,
row:15,
personTel:this.personTel
}).then(_data =>{
_that.orders = _data;
})
},
toDetail:function(_order){
uni.navigateTo({
url:'/pages/machine/chargeMachineOrder?orderId='+_order.orderId
})
}
}
}
</script>
<style>
.tab-container {
/*border: 1px solid black;*/
margin-top: 30rpx;
}
.tab-item {
padding: 20rpx 30rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.tab-item-hover {
background-color: #e6e6e6;
}
.tab-icon {
width: 30rpx;
height: 30rpx;
}
.tab-text {
display: inline-block;
margin-left: 10rpx;
color: #1e1e1e;
}
.tab-arrow {
display: inline-block;
width: 20rpx;
height: 20rpx;
border: 1px solid #cdcdcd;
border-left: none;
border-bottom: none;
transform: rotate(45deg);
}
.border-bottom .icon{
font-size: 38rpx;
line-height: 38rpx;
}
</style>

View File

@ -28,7 +28,7 @@
</view>
</view>
<view class="cu-list menu margin-top" @click="_selectCoupons" v-if="curHours.duration && curPort.portId">
<view class="cu-list menu margin-sm" @click="_selectCoupons" v-if="curHours.duration && curPort.portId">
<view class="cu-item arrow">
<view class="content padding-tb-sm">
<view>
@ -39,6 +39,9 @@
<view v-else>{{couponCount+ '' }}</view>
</view>
</view>
<view class="margin-sm">
<account ref="accRef"></account>
</view>
<view class="plat-btn-black"></view>
<view class="cu-bar btn-group" style="margin-top: 30px;">
@ -55,6 +58,7 @@
getChargeMachinePort
} from '../../api/machine/machineApi.js';
import context from '../../lib/java110/Java110Context.js';
import account from '@/components/account/account.vue';
export default {
data() {
return {
@ -90,6 +94,9 @@
}]
}
},
components:{
account,
},
onLoad(options) {
context.onLoad(options);
this.machineId = options.machineId;
@ -99,6 +106,7 @@
},
onShow: function(options) {
this._dealChargeCoupons();
this.$refs.accRef.loadOwnerAccount();
},
methods: {
_loadChargeMachines: function() {