优化代码

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