优化代码

This commit is contained in:
Your Name 2023-03-19 02:19:04 +08:00
parent 10eed0917a
commit 6a76ee8e81
4 changed files with 27 additions and 12 deletions

View File

@ -29,22 +29,27 @@
data() {
return {
account:{},
communityId:''
};
},
created() {
this.loadOwnerAccount();
},
methods: {
loadOwnerAccount: function() {
loadOwnerAccount: function(_communityId) {
this.communityId = _communityId;
let _that = this;
context.getOwner(function(_ownerInfo) {
if (_ownerInfo) {
if(!_that.communityId){
_that.communityId = _ownerInfo.communityId
}
queryOwnerAccount({
page: 1,
row: 20,
idCard: _ownerInfo.idCard,
link: _ownerInfo.link,
communityId: _ownerInfo.communityId,
communityId: _communityId,
acctType:'2003'
}).then((data) => {
if (!data) {
@ -58,7 +63,7 @@
},
_toPrestoreAccount:function(){
uni.navigateTo({
url:'/pages/account/preStoreAccount'
url:'/pages/account/preStoreAccount?communityId='+this.communityId
})
}
}

View File

@ -59,10 +59,12 @@
return {
account:{},
amount:'',
appId:''
appId:'',
communityId:'',
}
},
onLoad(options) {
this.communityId = options.communityId;
this.loadOwnerAccount();
// #ifdef MP-WEIXIN
let accountInfo = uni.getAccountInfoSync();
@ -77,12 +79,15 @@
let _that = this;
context.getOwner(function(_ownerInfo) {
if (_ownerInfo) {
if(!_that.communityId){
_that.communityId = _ownerInfo.communityId;
}
queryOwnerAccount({
page: 1,
row: 20,
idCard: _ownerInfo.idCard,
link: _ownerInfo.link,
communityId: _ownerInfo.communityId
communityId: _that.communityId
}).then((data) => {
if (!data) {
_that.account = {};

View File

@ -10,11 +10,14 @@
</view>
<view class="suc-b">
<view class="suc-b-1">收费规则: 按时间收费(最小1小时)</view>
<view class="suc-b-1">充电价格: {{durationPrice}}/小时, 1小时起</view>
<view class="suc-b-1">规则说明:</view>
<view class="suc-b-2">1充电时间不满1小时按1小时结算</view>
<view class="suc-b-2">2充电自满最长充电时间为10小时</view>
<view class="suc-b-1">收费规则: 按时间收费(最小1小时);</view>
<view class="suc-b-1">充电价格: </view>
<view class="suc-b-2" v-for="(item,index) in fees" :key="index">
{{index+1}}{{item.minEnergyPrice}}~{{item.maxEnergyPrice}}功率,{{item.durationPrice}}/小时;
</view>
<view class="suc-b-1 margin-top">规则说明:</view>
<view class="suc-b-2">1充电时间不满1小时按1小时结算;</view>
<view class="suc-b-2">2充电自满最长充电时间为10小时;</view>
</view>
<view class="plat-btn-black"></view>
@ -44,6 +47,7 @@
machineName: '',
durationPrice: '',
couponIds:'',
fees:[]
}
},
@ -68,12 +72,13 @@
_that.machineCode = _data.data[0].machineCode;
_that.machineName = _data.data[0].machineName;
_that.durationPrice = _data.data[0].durationPrice;
_that.fees = _data.data[0].fees;
})
},
_toChargeConfirm:function(){
startCharge({
communityId:getCommunityId(),
communityId:this.communityId,
machineId:this.machineId,
portId:this.portId,
duration:this.duration,

View File

@ -106,7 +106,7 @@
},
onShow: function(options) {
this._dealChargeCoupons();
this.$refs.accRef.loadOwnerAccount();
this.$refs.accRef.loadOwnerAccount(this.communityId);
},
methods: {
_loadChargeMachines: function() {