优化代码

This commit is contained in:
wuxw 2023-11-07 02:01:29 +08:00
parent 28d532ed6c
commit 447570d3c3

View File

@ -1,7 +1,7 @@
/** /**
入驻小区 入驻小区
**/ **/
(function (vc) { (function (vc) {
var DEFAULT_PAGE = 1; var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10; var DEFAULT_ROWS = 10;
vc.extends({ vc.extends({
@ -50,7 +50,7 @@
$that._listSimplifyRoomFee(DEFAULT_PAGE, DEFAULT_ROWS); $that._listSimplifyRoomFee(DEFAULT_PAGE, DEFAULT_ROWS);
}); });
vc.on('simplifyRoomFee', 'paginationPlus', 'page_event', vc.on('simplifyRoomFee', 'paginationPlus', 'page_event',
function (_currentPage) { function(_currentPage) {
$that._listSimplifyRoomFee(_currentPage, DEFAULT_ROWS); $that._listSimplifyRoomFee(_currentPage, DEFAULT_ROWS);
}); });
}, },
@ -91,13 +91,11 @@
$that.simplifyRoomFeeInfo.total = _feeConfigInfo.total; $that.simplifyRoomFeeInfo.total = _feeConfigInfo.total;
$that.simplifyRoomFeeInfo.records = _feeConfigInfo.records; $that.simplifyRoomFeeInfo.records = _feeConfigInfo.records;
let _totalAmount = 0.0; let _totalAmount = 0.0;
if (_totalAmount && _totalAmount.length > 0) {
_feeConfigInfo.fees.forEach(item => { _feeConfigInfo.fees.forEach(item => {
_totalAmount += parseFloat(item.amountOwed); _totalAmount += parseFloat(item.amountOwed);
}) })
$that.simplifyRoomFeeInfo.totalAmount = _totalAmount.toFixed(2); $that.simplifyRoomFeeInfo.totalAmount = _totalAmount.toFixed(2);
$that.simplifyRoomFeeInfo.fees = _feeConfigInfo.fees.sort($that._roomFeeCompare); $that.simplifyRoomFeeInfo.fees = _feeConfigInfo.fees.sort($that._roomFeeCompare);
}
vc.emit('simplifyRoomFee', 'paginationPlus', 'init', { vc.emit('simplifyRoomFee', 'paginationPlus', 'init', {
total: $that.simplifyRoomFeeInfo.records, total: $that.simplifyRoomFeeInfo.records,
dataCount: $that.simplifyRoomFeeInfo.total, dataCount: $that.simplifyRoomFeeInfo.total,
@ -123,6 +121,7 @@
_toOwnerPayFee: function () { _toOwnerPayFee: function () {
vc.jumpToPage('/#/pages/property/owePayFeeOrder?payObjId=' + $that.simplifyRoomFeeInfo.roomId + "&payObjType=3333&roomName=" + $that.simplifyRoomFeeInfo.roomName); vc.jumpToPage('/#/pages/property/owePayFeeOrder?payObjId=' + $that.simplifyRoomFeeInfo.roomId + "&payObjType=3333&roomName=" + $that.simplifyRoomFeeInfo.roomName);
}, },
_openRoomCreateFeeAddModal: function () { _openRoomCreateFeeAddModal: function () {
$that.simplifyRoomFeeInfo.ownerName = $that.simplifyRoomFeeInfo.name; $that.simplifyRoomFeeInfo.ownerName = $that.simplifyRoomFeeInfo.name;
vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal', { vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal', {
@ -140,7 +139,6 @@
}, },
_getAttrValue: function (_attrs, _specCd) { _getAttrValue: function (_attrs, _specCd) {
let _value = ""; let _value = "";
if (_attrs && _attrs.length > 0) {
_attrs.forEach(item => { _attrs.forEach(item => {
if (item.specCd == _specCd) { if (item.specCd == _specCd) {
_value = item.value; _value = item.value;
@ -148,7 +146,6 @@
} }
}); });
return _value; return _value;
}
}, },
_getDeadlineTime: function (_fee) { _getDeadlineTime: function (_fee) {
if (_fee.amountOwed == 0 && _fee.endTime == _fee.deadlineTime) { if (_fee.amountOwed == 0 && _fee.endTime == _fee.deadlineTime) {
@ -278,20 +275,20 @@
_openBatchPayRoomFeeModal: function () { _openBatchPayRoomFeeModal: function () {
vc.jumpToPage('/#/pages/property/batchPayFeeOrder?ownerId=' + $that.simplifyRoomFeeInfo.ownerId + "&payerObjType=3333") vc.jumpToPage('/#/pages/property/batchPayFeeOrder?ownerId=' + $that.simplifyRoomFeeInfo.ownerId + "&payerObjType=3333")
}, },
_openMonthPayRoomFeeModal: function () { _openMonthPayRoomFeeModal: function() {
vc.jumpToPage('/#/pages/property/payFeeMonthOrder?payerObjId=' + vc.jumpToPage('/#/pages/property/payFeeMonthOrder?payerObjId=' +
$that.simplifyRoomFeeInfo.roomId + $that.simplifyRoomFeeInfo.roomId +
"&payerObjType=3333"); "&payerObjType=3333");
}, },
_openRoomCreateFeeComboModal: function () { _openRoomCreateFeeComboModal: function() {
vc.jumpToPage('/#/pages/property/createFeeByCombo?payerObjId=' + vc.jumpToPage('/#/pages/property/createFeeByCombo?payerObjId=' +
$that.simplifyRoomFeeInfo.roomId + $that.simplifyRoomFeeInfo.roomId +
"&payerObjName=" + $that.simplifyRoomFeeInfo.roomName + "&payerObjType=3333") "&payerObjName=" + $that.simplifyRoomFeeInfo.roomName + "&payerObjType=3333")
}, },
_openPrestoreAccountModal: function () { _openPrestoreAccountModal: function() {
window.open('/#/pages/owner/ownerDetail?ownerId=' + $that.simplifyRoomFeeInfo.ownerId + "&currentTab=ownerDetailAccount") window.open('/#/pages/owner/ownerDetail?ownerId=' + $that.simplifyRoomFeeInfo.ownerId + "&currentTab=ownerDetailAccount")
}, },
_viewRoomFeeConfig: function (_fee) { _viewRoomFeeConfig: function(_fee) {
let param = { let param = {
params: { params: {
page: 1, page: 1,
@ -320,6 +317,7 @@
"公式": _feeConfig.computingFormulaName, "公式": _feeConfig.computingFormulaName,
"计费单价": _feeConfig.computingFormula == '2002' ? '-' : _feeConfig.squarePrice, "计费单价": _feeConfig.computingFormula == '2002' ? '-' : _feeConfig.squarePrice,
"附加/固定费用": _feeConfig.additionalAmount, "附加/固定费用": _feeConfig.additionalAmount,
} }
}) })
}, },
@ -327,6 +325,7 @@
console.log('请求失败处理'); console.log('请求失败处理');
} }
); );
}, },
_viewRoomFee: function (_fee) { _viewRoomFee: function (_fee) {
let _data = { let _data = {
@ -349,14 +348,14 @@
data: _data data: _data
}); });
}, },
_changeSimplifyRoomShowFlag: function () { _changeSimplifyRoomShowFlag: function() {
if ($that.simplifyRoomFeeInfo.showFlag == 'MONTH') { if ($that.simplifyRoomFeeInfo.showFlag == 'MONTH') {
$that._listSimplifyRoomMonthFee(DEFAULT_PAGE, DEFAULT_ROWS) $that._listSimplifyRoomMonthFee(DEFAULT_PAGE, DEFAULT_ROWS)
} else { } else {
$that._listSimplifyRoomFee(DEFAULT_PAGE, DEFAULT_ROWS); $that._listSimplifyRoomFee(DEFAULT_PAGE, DEFAULT_ROWS);
} }
}, },
_listSimplifyRoomMonthFee: function (_page, _row) { _listSimplifyRoomMonthFee: function(_page, _row) {
let param = { let param = {
params: { params: {
page: 1, page: 1,
@ -378,7 +377,7 @@
//发送get请求 //发送get请求
vc.http.apiGet('/fee.listMonthFee', vc.http.apiGet('/fee.listMonthFee',
param, param,
function (json) { function(json) {
let _feeConfigInfo = JSON.parse(json); let _feeConfigInfo = JSON.parse(json);
$that.simplifyRoomFeeInfo.total = _feeConfigInfo.total; $that.simplifyRoomFeeInfo.total = _feeConfigInfo.total;
$that.simplifyRoomFeeInfo.records = _feeConfigInfo.records; $that.simplifyRoomFeeInfo.records = _feeConfigInfo.records;
@ -389,7 +388,7 @@
$that.simplifyRoomFeeInfo.totalAmount = _totalAmount.toFixed(2); $that.simplifyRoomFeeInfo.totalAmount = _totalAmount.toFixed(2);
$that.simplifyRoomFeeInfo.monthFees = _feeConfigInfo.data; $that.simplifyRoomFeeInfo.monthFees = _feeConfigInfo.data;
}, },
function () { function() {
console.log('请求失败处理'); console.log('请求失败处理');
} }
); );