优化代码

This commit is contained in:
wuxw 2023-11-03 15:08:52 +08:00
parent 1ca6624963
commit f98e75f82b
4 changed files with 534 additions and 26 deletions

View File

@ -0,0 +1,207 @@
<div class="animated fadeInRight ecommerce">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>
<vc:i18n name="查询条件" namespace="parkingFeeLedger"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-2">
<select class="form-control-md form-control input-s-sm inline" v-model="parkingFeeLedgerInfo.conditions.communityId" @change="_changCommunity()">
<option disabled selected value="">{{vc.i18n('请选择小区','parkingFeeLedger')}}</option>
<option v-for="(item,index) in parkingFeeLedgerInfo.communitys" :key="index"
v-bind:value="item.communityId">
{{item.name}}
</option>
</select>
</div>
<div class="col-sm-2">
<div class="form-group">
<input size="16" type="text" :placeholder="vc.i18n('请选择缴费开始时间','parkingFeeLedger')"
v-model="parkingFeeLedgerInfo.conditions.startTime"
class="form-control form_datetime start_time">
</div>
</div>
<div class="col-sm-2">
<div class="form-group">
<input size="16" type="text" :placeholder="vc.i18n('请选择缴费结束时间','parkingFeeLedger')"
v-model="parkingFeeLedgerInfo.conditions.endTime"
class="form-control form_datetime end_time">
</div>
</div>
<div class="col-sm-2">
<input size="16" type="text" :placeholder="vc.i18n('请填写车位 停车场-停车位','parkingFeeLedger')"
v-model="parkingFeeLedgerInfo.conditions.parkingName" class="form-control">
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-md" v-on:click="_queryPayFeeMethod()">
<vc:i18n name="查询" namespace="parkingFeeLedger"></vc:i18n>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>
<vc:i18n name="车位费台账" namespace="parkingFeeLedger"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
<!-- <button type="button" class="btn btn-primary btn-sm" v-on:click="_exportExcel()">
<i class="fa fa-plus"></i>
<span>
<vc:i18n name="导出" namespace="parkingFeeLedger"></vc:i18n>
</span>
</button> -->
</div>
</div>
<div class="ibox-content">
<div class="hc-table-div" :style="{'width':_computeTableDivWidth()}">
<table class="table table-bordered" data-page-size="15">
<thead>
<tr>
<th class="text-center" rowspan="2">
<vc:i18n name="物业公司" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="小区名称" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="业主名称" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="性别" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="电话号码" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="车位编号" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="交付时间" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="车位状态" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="月车位费" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" rowspan="2">
<vc:i18n name="最后缴费时间" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" colspan="6">
<vc:i18n name="当期车位费" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center" colspan="6" v-for="month in 12">
{{new Date().getFullYear()}}年{{month}}月
</th>
</tr>
<tr>
<th class="text-center">
<vc:i18n name="年累饱和应收总金额" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="实收总金额" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="减免总金额" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="欠费总金额" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="收费率" namespace="parkingFeeLedger"></vc:i18n>
</th>
<th class="text-center">
<vc:i18n name="欠费原因" namespace="parkingFeeLedger"></vc:i18n>
</th>
<template v-for="month in 12">
<th class="text-center">
账单编号
</th>
<th class="text-center">
应收金额
</th>
<th class="text-center">
实收金额
</th>
<th class="text-center">
减免金额
</th>
<th class="text-center">
欠费金额
</th>
<th class="text-center">
缴费状态
</th>
</template>
</tr>
</thead>
<tbody>
<tr v-for="payFee in parkingFeeLedgerInfo.payFees">
<td class="text-center">{{payFee.storeName}}</td>
<td class="text-center">{{payFee.communityName}}</td>
<td class="text-center">{{payFee.ownerName}}</td>
<td class="text-center">{{payFee.sex==0?'女':'男'}}</td>
<td class="text-center">{{payFee.link}}</td>
<td class="text-center">{{payFee.parkingName}}</td>
<td class="text-center">{{payFee.bingTime}}</td>
<td class="text-center">{{payFee.state}}</td>
<td class="text-center">{{payFee.squarePrice || '-'}}</td>
<td class="text-center">{{payFee.squarePrice || '-'}}</td>
<td class="text-center">{{payFee.receivableAmount || 0}}</td>
<td class="text-center">{{payFee.receivedAmount || 0}}</td>
<td class="text-center" v-if="payFee.oweAmount != 0">{{payFee.receivableAmount-payFee.receivedAmount || '0'}}</td>
<td class="text-center" v-else>0</td>
<td class="text-center">{{payFee.oweAmount}}</td>
<td class="text-center" v-if="payFee.oweAmount != 0">{{payFee.receivedAmount/(payFee.receivableAmount-(payFee.receivableAmount-payFee.receivedAmount)) * 100 || '0'}}%</td>
<td class="text-center" v-else>{{(payFee.receivedAmount/(payFee.receivableAmount) * 100).toFixed(2) || '0'}}%</td>
<td class="text-center"></td>
<template v-for="month in 12">
<th class="text-center">
{{_getPayFeeDetailCode(payFee,month)}}
</th>
<th class="text-center">
{{_getReceivableAmount(payFee,month)}}
</th>
<th class="text-center">
{{_getReceivedAmount(payFee,month)}}
</th>
<th class="text-center">
{{_getDiscountAmount(payFee,month)}}
</th>
<th class="text-center">
{{_getOweFeeAmount(payFee,month)}}
</th>
<th class="text-center">
</th>
</template>
</tr>
</tbody>
</table>
</div>
<!-- 分页 -->
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-8 text-center">
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,174 @@
/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
parkingFeeLedgerInfo: {
payFees: [],
communitys:[],
total: 0,
records: 1,
conditions: {
communityId: '',
payObjType: '',
startTime: '',
endTime: '',
primeRate: '',
roomName: ''
}
}
},
_initMethod: function () {
$that._listPropertyFeeLedger(1,DEFAULT_ROWS);
$that._loadLedgerCommunitys();
vc.initDate('start_time',function(_value){
$that.parkingFeeLedgerInfo.conditions.startTime = _value;
});
vc.initDate('end_time',function(_value){
$that.parkingFeeLedgerInfo.conditions.endTime = _value;
});
},
_initEvent: function () {
vc.on('pagination', 'page_event', function (_currentPage) {
$that._listPropertyFeeLedger(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listPropertyFeeLedger: function (_page, _rows) {
let param = {
params: {
page:_page,
row:_rows
}
};
//发送get请求
vc.http.apiGet('/admin.getParkingFeeSummary',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.parkingFeeLedgerInfo.total = _json.total;
$that.parkingFeeLedgerInfo.records = Math.ceil(_json.total / _rows);
$that.parkingFeeLedgerInfo.payFees = _json.data;
vc.emit('pagination', 'init', {
total: $that.parkingFeeLedgerInfo.records,
dataCount: $that.parkingFeeLedgerInfo.total,
currentPage: _page,
// dataCount: $that.parkingFeeLedgerInfo.total
});
},
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_computeTableDivWidth: function () {
let mainWidth = document.getElementsByTagName('body')[0].clientWidth - document.getElementById('menu-nav').offsetWidth;
//let treeWidth = document.getElementsByClassName('room-floor-unit-tree')[0].offsetWidth;
mainWidth = mainWidth - 20 - 15 - 20;
//document.getElementsByClassName('hc-table-div')[0].style.width=mainWidth+'px';
return mainWidth + 'px';
},
//查询
_queryPayFeeMethod: function () {
$that._listPropertyFeeLedger(DEFAULT_PAGE, DEFAULT_ROWS);
},
_getPayFeeDetailCode:function(_fee,month){
let _monthData = _fee.monthData;
let _receiptCode = "无";
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_receiptCode = _item.receiptCode;
}
});
if(!_receiptCode || _receiptCode == '-1'){
_receiptCode = "无";
}
return _receiptCode;
},
_getReceivableAmount:function(_fee,month){
let _monthData = _fee.monthData;
let _amount = 0.0;
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_amount = _item.receivableAmount;
}
});
return _amount
},
_getReceivedAmount:function(_fee,month){
let _monthData = _fee.monthData;
let _amount = 0.0;
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_amount = _item.receivedAmount;
}
});
return _amount
},
_getDiscountAmount:function(_fee,month){
let _amount = "0.0";
if(_fee.oweAmount == 0){
return _amount;
}
_amount = $that._getReceivableAmount(_fee,month) - $that._getReceivedAmount(_fee,month);
return _amount.toFixed(2)
},
_getOweFeeAmount:function(_fee,month){
let _monthData = _fee.monthData;
let _amount = 0.0;
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_amount = _item.oweAmount;
}
});
return _amount
},
_loadLedgerCommunitys: function () {
let param = {
params: {
_uid: '123mlkdinkldldijdhuudjdjkkd',
page: 1,
row: 100,
}
};
vc.http.apiGet('/community.listCommunitys',
param,
function (json, res) {
if (res.status == 200) {
let _data = JSON.parse(json);
$that.parkingFeeLedgerInfo.communitys = _data.communitys;
}
}, function () {
console.log('请求失败处理');
}
);
},
_changCommunity: function () {
$that._listPropertyFeeLedger(1,DEFAULT_ROWS);
},
//导出
_exportExcel: function () {
vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=reportPayFeeManage&' + vc.objToGetParam($that.parkingFeeLedgerInfo.conditions));
},
}
});
})(window.vc);

View File

@ -12,6 +12,15 @@
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-2">
<select class="form-control-md form-control input-s-sm inline" v-model="propertyFeeLedgerInfo.conditions.communityId" @change="_changCommunity()">
<option disabled selected value="">{{vc.i18n('请选择小区','propertyFeeLedger')}}</option>
<option v-for="(item,index) in propertyFeeLedgerInfo.communitys" :key="index"
v-bind:value="item.communityId">
{{item.name}}
</option>
</select>
</div>
<div class="col-sm-2">
<div class="form-group">
<input size="16" type="text" :placeholder="vc.i18n('请选择缴费开始时间','propertyFeeLedger')"
@ -27,8 +36,8 @@
</div>
</div>
<div class="col-sm-2">
<input size="16" type="text" :placeholder="vc.i18n('请填写员工姓名','propertyFeeLedger')"
v-model="propertyFeeLedgerInfo.conditions.userName" class="form-control">
<input size="16" type="text" :placeholder="vc.i18n('请填写房号 楼栋-单元-房号','propertyFeeLedger')"
v-model="propertyFeeLedgerInfo.conditions.roomName" class="form-control">
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-md" v-on:click="_queryPayFeeMethod()">
@ -48,12 +57,12 @@
<vc:i18n name="物业费台账" namespace="propertyFeeLedger"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_exportExcel()">
<!-- <button type="button" class="btn btn-primary btn-sm" v-on:click="_exportExcel()">
<i class="fa fa-plus"></i>
<span>
<vc:i18n name="导出" namespace="propertyFeeLedger"></vc:i18n>
</span>
</button>
</button> -->
</div>
</div>
<div class="ibox-content">
@ -147,23 +156,46 @@
</thead>
<tbody>
<tr v-for="payFee in propertyFeeLedgerInfo.payFees">
<td class="text-center">{{payFee.feeTypeCdName}}</td>
<td class="text-center">{{payFee.feeName}}</td>
<td class="text-center">{{payFee.payObjName}}</td>
<td class="text-center">{{payFee.detailId}}</td>
<td class="text-center">{{payFee.primeRate}}</td>
<td class="text-center">{{payFee.cycles}}</td>
<td class="text-center">{{payFee.receivableAmount}}</td>
<td class="text-center">{{payFee.receivedAmount}}</td>
<td class="text-center">{{payFee.userName}}</td>
<td class="text-center">{{payFee.createTime}}</td>
<td class="text-center">
<button class="btn btn-link btn-xs" v-on:click="_detailFee(payFee)">
<span>
<vc:i18n name="详情" namespace="propertyFeeLedger"></vc:i18n>
</span>
</button>
</td>
<td class="text-center">{{payFee.storeName}}</td>
<td class="text-center">{{payFee.communityName}}</td>
<td class="text-center">{{payFee.ownerName}}</td>
<td class="text-center">{{payFee.sex==0?'女':'男'}}</td>
<td class="text-center">{{payFee.link}}</td>
<td class="text-center">{{payFee.roomName}}</td>
<td class="text-center">{{payFee.bingTime}}</td>
<td class="text-center">{{payFee.state}}</td>
<td class="text-center">{{payFee.builtUpArea}}</td>
<td class="text-center">{{payFee.squarePrice}}</td>
<td class="text-center">{{(parseFloat(payFee.builtUpArea) * parseFloat(payFee.squarePrice)).toFixed(2)}}</td>
<td class="text-center">{{payFee.squarePrice}}</td>
<td class="text-center">{{payFee.receivableAmount || 0}}</td>
<td class="text-center">{{payFee.receivedAmount || 0}}</td>
<td class="text-center" v-if="payFee.oweAmount != 0">{{payFee.receivableAmount-payFee.receivedAmount || '0'}}</td>
<td class="text-center" v-else>0</td>
<td class="text-center">{{payFee.oweAmount}}</td>
<td class="text-center" v-if="payFee.oweAmount != 0">{{payFee.receivedAmount/(payFee.receivableAmount-(payFee.receivableAmount-payFee.receivedAmount)) * 100 || '0'}}%</td>
<td class="text-center" v-else>{{(payFee.receivedAmount/(payFee.receivableAmount) * 100).toFixed(2) || '0'}}%</td>
<td class="text-center"></td>
<template v-for="month in 12">
<th class="text-center">
{{_getPayFeeDetailCode(payFee,month)}}
</th>
<th class="text-center">
{{_getReceivableAmount(payFee,month)}}
</th>
<th class="text-center">
{{_getReceivedAmount(payFee,month)}}
</th>
<th class="text-center">
{{_getDiscountAmount(payFee,month)}}
</th>
<th class="text-center">
{{_getOweFeeAmount(payFee,month)}}
</th>
<th class="text-center">
</th>
</template>
</tr>
</tbody>
</table>

View File

@ -8,6 +8,7 @@
data: {
propertyFeeLedgerInfo: {
payFees: [],
communitys:[],
total: 0,
records: 1,
conditions: {
@ -16,16 +17,24 @@
startTime: '',
endTime: '',
primeRate: '',
userName: ''
roomName: ''
}
}
},
_initMethod: function () {
$that._listPropertyFeeLedger(1,DEFAULT_ROWS);
$that._loadLedgerCommunitys();
vc.initDate('start_time',function(_value){
$that.propertyFeeLedgerInfo.conditions.startTime = _value;
});
vc.initDate('end_time',function(_value){
$that.propertyFeeLedgerInfo.conditions.endTime = _value;
});
},
_initEvent: function () {
vc.on('pagination', 'page_event', function (_currentPage) {
$that._listpayFees(_currentPage, DEFAULT_ROWS);
$that._listPropertyFeeLedger(_currentPage, DEFAULT_ROWS);
});
},
methods: {
@ -38,7 +47,7 @@
}
};
//发送get请求
vc.http.apiGet('',
vc.http.apiGet('/admin.getPropertyFeeSummary',
param,
function (json, res) {
let _json = JSON.parse(json);
@ -67,7 +76,93 @@
},
//查询
_queryPayFeeMethod: function () {
$that._listpayFees(DEFAULT_PAGE, DEFAULT_ROWS);
$that._listPropertyFeeLedger(DEFAULT_PAGE, DEFAULT_ROWS);
},
_getPayFeeDetailCode:function(_fee,month){
let _monthData = _fee.monthData;
let _receiptCode = "无";
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_receiptCode = _item.receiptCode;
}
});
if(!_receiptCode || _receiptCode == '-1'){
_receiptCode = "无";
}
return _receiptCode;
},
_getReceivableAmount:function(_fee,month){
let _monthData = _fee.monthData;
let _amount = 0.0;
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_amount = _item.receivableAmount;
}
});
return _amount
},
_getReceivedAmount:function(_fee,month){
let _monthData = _fee.monthData;
let _amount = 0.0;
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_amount = _item.receivedAmount;
}
});
return _amount
},
_getDiscountAmount:function(_fee,month){
let _amount = "0.0";
if(_fee.oweAmount == 0){
return _amount;
}
_amount = $that._getReceivableAmount(_fee,month) - $that._getReceivedAmount(_fee,month);
return _amount.toFixed(2)
},
_getOweFeeAmount:function(_fee,month){
let _monthData = _fee.monthData;
let _amount = 0.0;
_monthData.forEach(_item => {
let _curMonthTime = new Date(_item.curMonthTime);
if(month == (_curMonthTime.getMonth()+1)){
_amount = _item.oweAmount;
}
});
return _amount
},
_loadLedgerCommunitys: function () {
let param = {
params: {
_uid: '123mlkdinkldldijdhuudjdjkkd',
page: 1,
row: 100,
}
};
vc.http.apiGet('/community.listCommunitys',
param,
function (json, res) {
if (res.status == 200) {
let _data = JSON.parse(json);
$that.propertyFeeLedgerInfo.communitys = _data.communitys;
}
}, function () {
console.log('请求失败处理');
}
);
},
_changCommunity: function () {
$that._listPropertyFeeLedger(1,DEFAULT_ROWS);
},
//导出