优化代码

This commit is contained in:
java110 2021-12-17 16:19:41 +08:00
parent 39e83da261
commit 3f4ad33b38

View File

@ -1,4 +1,4 @@
(function (vc) {
(function(vc) {
vc.extends({
data: {
@ -19,7 +19,7 @@
},
printFlag: '0'
},
_initMethod: function () {
_initMethod: function() {
//vc.component._initPrintPurchaseApplyDateInfo();
$that.printPayFeeInfo.receiptId = vc.getParam('receiptId');
@ -34,15 +34,15 @@
$that._loadPrintSpec();
},
_initEvent: function () {
_initEvent: function() {
},
methods: {
_initPayFee: function () {
_initPayFee: function() {
},
_loadReceipt: function () {
_loadReceipt: function() {
var param = {
params: {
@ -57,7 +57,7 @@
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceipt',
param,
function (json, res) {
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceipt = _feeReceiptManageInfo.data;
let _amount = 0;
@ -74,12 +74,13 @@
$that._loadReceiptDetail();
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadReceiptDetail: function () {
_loadReceiptDetail: function() {
var param = {
params: {
@ -94,7 +95,7 @@
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceiptDetail',
param,
function (json, res) {
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
_feeReceiptDetails.forEach(item => {
@ -108,12 +109,13 @@
$that.printPayFeeInfo.fees = _feeReceiptDetails;
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadPrintSpec: function () {
_loadPrintSpec: function() {
var param = {
params: {
page: 1,
@ -126,7 +128,7 @@
//发送get请求
vc.http.apiGet('/feePrintSpec/queryFeePrintSpec',
param,
function (json, res) {
function(json, res) {
var _json = JSON.parse(json);
var _data = _json.data;
if (_data.length > 0) {
@ -136,34 +138,35 @@
$that.printPayFeeInfo.communityName = _data[0].printName;
}
}
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_computeSumArea: function () {
_computeSumArea: function() {
let _sum = 0.00;
$that.printPayFeeInfo.fees.forEach(item => {
if (item.area && vc.isNumber(item.area)) {
_sum += parseFloat(item.area);
}
})
return _sum;
return _sum.toFixed(2);
},
_printPurchaseApplyDiv: function () {
_printPurchaseApplyDiv: function() {
$that.printFlag = '1';
console.log('console.log($that.printFlag);', $that.printFlag);
document.getElementById("print-btn").style.display = "none";//隐藏
document.getElementById("print-btn").style.display = "none"; //隐藏
window.print();
//$that.printFlag = false;
window.opener = null;
window.close();
},
_closePage: function () {
_closePage: function() {
window.opener = null;
window.close();
}