diff --git a/public/components/fee/deleteInvoiceApply/deleteInvoiceApply.js b/public/components/fee/deleteInvoiceApply/deleteInvoiceApply.js index cdcdbc475..3f548a167 100644 --- a/public/components/fee/deleteInvoiceApply/deleteInvoiceApply.js +++ b/public/components/fee/deleteInvoiceApply/deleteInvoiceApply.js @@ -12,17 +12,17 @@ _initEvent:function(){ vc.on('deleteInvoiceApply','openDeleteInvoiceApplyModal',function(_params){ - vc.component.deleteInvoiceApplyInfo = _params; + $that.deleteInvoiceApplyInfo = _params; $('#deleteInvoiceApplyModel').modal('show'); }); }, methods:{ deleteInvoiceApply:function(){ - vc.component.deleteInvoiceApplyInfo.communityId=vc.getCurrentCommunity().communityId; + $that.deleteInvoiceApplyInfo.communityId=vc.getCurrentCommunity().communityId; vc.http.apiPost( - 'invoiceApply.deleteInvoiceApply', - JSON.stringify(vc.component.deleteInvoiceApplyInfo), + '/invoice.deleteInvoiceApply', + JSON.stringify($that.deleteInvoiceApplyInfo), { emulateJSON:true }, @@ -32,14 +32,14 @@ if (_json.code == 0) { //关闭model $('#deleteInvoiceApplyModel').modal('hide'); - vc.emit('invoiceApplyManage','listInvoiceApply',{}); + vc.emit('invoiceApply','listInvoiceApply',{}); return ; } - vc.message(_json.msg); + vc.toast(_json.msg); }, function(errInfo,error){ console.log('请求失败处理'); - vc.message(json); + vc.toast(json); }); }, @@ -49,4 +49,4 @@ } }); -})(window.vc,window.vc.component); +})(window.vc,window.$that); diff --git a/public/components/owner/ownerDetailAccountReceipt/ownerDetailAccountReceipt.js b/public/components/owner/ownerDetailAccountReceipt/ownerDetailAccountReceipt.js index 5d50d6f60..36eb16754 100644 --- a/public/components/owner/ownerDetailAccountReceipt/ownerDetailAccountReceipt.js +++ b/public/components/owner/ownerDetailAccountReceipt/ownerDetailAccountReceipt.js @@ -39,7 +39,7 @@ }); vc.on('ownerDetailAccountReceipt', 'paginationPlus', 'page_event', function(_currentPage) { - vc.component._listOwnerDetailAccountReceipt(_currentPage, DEFAULT_ROWS); + $that._listOwnerDetailAccountReceipt(_currentPage, DEFAULT_ROWS); }); }, methods: { @@ -58,13 +58,13 @@ vc.http.apiGet('/receipt.listAccountReceipt', param, function(json, res) { - var _feeReceiptManageInfo = JSON.parse(json); - vc.component.ownerDetailAccountReceiptInfo.total = _feeReceiptManageInfo.total; - vc.component.ownerDetailAccountReceiptInfo.records = _feeReceiptManageInfo.records; - vc.component.ownerDetailAccountReceiptInfo.feeReceipts = _feeReceiptManageInfo.data; + let _json = JSON.parse(json); + $that.ownerDetailAccountReceiptInfo.total = _json.total; + $that.ownerDetailAccountReceiptInfo.records = _json.records; + $that.ownerDetailAccountReceiptInfo.feeReceipts = _json.data; vc.emit('ownerDetailAccountReceipt', 'paginationPlus', 'init', { - total: vc.component.ownerDetailAccountReceiptInfo.records, - dataCount: vc.component.ownerDetailAccountReceiptInfo.total, + total: $that.ownerDetailAccountReceiptInfo.records, + dataCount: $that.ownerDetailAccountReceiptInfo.total, currentPage: _page }); }, @@ -74,7 +74,7 @@ ); }, _queryFeeAccountReceiptMethod: function() { - vc.component._listOwnerDetailAccountReceipt(DEFAULT_PAGE, DEFAULT_ROWS); + $that._listOwnerDetailAccountReceipt(DEFAULT_PAGE, DEFAULT_ROWS); }, _printFeeAccountReceipt: function(_receipt) { if ($that.ownerDetailAccountReceiptInfo.selectReceipts.length < 1) { @@ -109,11 +109,11 @@ if (e.target.checked) { // 判定全选checkbox的勾选状态 for (var i = 0; i < checkObj.length; i++) { if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中 - vc.component.ownerDetailAccountReceiptInfo.selectReceipts.push(checkObj[i].value); + $that.ownerDetailAccountReceiptInfo.selectReceipts.push(checkObj[i].value); } } } else { // 如果是去掉全选则清空checkbox选项绑定数组 - vc.component.ownerDetailAccountReceiptInfo.selectReceipts = []; + $that.ownerDetailAccountReceiptInfo.selectReceipts = []; } } } diff --git a/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.html b/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.html index edcf48b2f..162611cf3 100644 --- a/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.html +++ b/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.html @@ -68,7 +68,7 @@
- @@ -248,7 +248,7 @@
-
diff --git a/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.js b/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.js index 2f4f6ea07..0d568d752 100644 --- a/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.js +++ b/public/pages/fee/ownerApplyInvoice/ownerApplyInvoice.js @@ -2,6 +2,7 @@ vc.extends({ data: { ownerApplyInvoiceInfo: { + oiId:'', ownerId: '', ownerName: '', invoiceType: '', @@ -10,9 +11,9 @@ invoiceNum: '', detailIds: [], feeDetails: [], - invoiceFlag:'FEE', - arIds:[], - acctDetails:[] + invoiceFlag: 'FEE', + arIds: [], + acctDetails: [] } }, watch: { @@ -44,10 +45,15 @@ _initEvent: function () { vc.on('ownerApplyInvoice', 'chooseOwnerInvoice', function (_owner) { vc.copyObject(_owner, $that.ownerApplyInvoiceInfo); - $that._loadFeeDetails(); + $that.ownerApplyInvoiceInfo.arIds = []; + $that.ownerApplyInvoiceInfo.detailIds = []; + if ($that.ownerApplyInvoiceInfo.invoiceFlag == 'FEE') { + $that._loadFeeDetails(); + } else { + $that._loadAcctDetails(); + } + }); - - }, methods: { @@ -64,7 +70,6 @@ ownerId: $that.ownerApplyInvoiceInfo.ownerId, } }; - $that.ownerApplyInvoiceInfo.detailIds = []; //发送get请求 @@ -100,6 +105,116 @@ $that.ownerApplyInvoiceInfo.detailIds = []; } }, + _loadAcctDetails: function () { + let param = { + params: { + page: 1, + row: 50, + communityId: vc.getCurrentCommunity().communityId, + ownerId: $that.ownerApplyInvoiceInfo.ownerId, + } + }; + $that.ownerApplyInvoiceInfo.arIds = []; + //发送get请求 + vc.http.apiGet('/receipt.listAccountReceipt', + param, + function (json) { + let _json = JSON.parse(json); + $that.ownerApplyInvoiceInfo.acctDetails = _json.data; + if (_json.data && _json.data.length > 0) { + setTimeout(function () { + _json.data.forEach(_acct => { + $that.ownerApplyInvoiceInfo.arIds.push(_acct.arId); + }); + }, 1000) + } + + }, + function () { + console.log('请求失败处理'); + } + ); + }, + checkAllAcct: function (e) { + let checkObj = document.querySelectorAll('.checkItemAcct'); // 获取所有checkbox项 + if (e.target.checked) { // 判定全选checkbox的勾选状态 + for (let i = 0; i < checkObj.length; i++) { + if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中 + $that.ownerApplyInvoiceInfo.arIds.push(checkObj[i].value); + } + } + } else { // 如果是去掉全选则清空checkbox选项绑定数组 + $that.ownerApplyInvoiceInfo.arIds = []; + } + }, + + _changeInvoiceFlag: function () { + let _ownerId = $that.ownerApplyInvoiceInfo.ownerId; + $that.ownerApplyInvoiceInfo.arIds = []; + $that.ownerApplyInvoiceInfo.detailIds = []; + if (!_ownerId) { + return; + } + if ($that.ownerApplyInvoiceInfo.invoiceFlag == 'FEE') { + $that._loadFeeDetails(); + } else { + $that._loadAcctDetails(); + } + }, + _ownerApplySubmit: function () { + let _arIds = $that.ownerApplyInvoiceInfo.arIds; + let _detailIds = $that.ownerApplyInvoiceInfo.detailIds; + if ($that.ownerApplyInvoiceInfo.invoiceFlag == 'FEE' && !_detailIds) { + vc.toast('未选择已缴费费用'); + return; + } + + if ($that.ownerApplyInvoiceInfo.invoiceFlag == 'ACCT' && !_arIds) { + vc.toast('未选择账户预存'); + return; + } + + let _that = $that.ownerApplyInvoiceInfo; + + let _data = { + invoiceAddress:_that.invoiceAddress, + invoiceFlag:_that.invoiceFlag, + invoiceName: _that.invoiceName, + invoiceNum:_that.invoiceNum, + invoiceType:_that.invoiceType, + ownerId:_that.ownerId, + ownerName:_that.ownerName, + oiId:_that.oiId, + detailIds:_detailIds, + arIds:_arIds, + communityId:vc.getCurrentCommunity().communityId, + } + + vc.http.apiPost( + '/invoice.saveInvoiceApply', + JSON.stringify(_data), + { + emulateJSON: true + }, + function (json, res) { + let _json = JSON.parse(json); + if (_json.code == 0) { + //关闭model + vc.goBack(); + + return; + } + vc.toast(_json.msg); + + }, + function (errInfo, error) { + console.log('请求失败处理'); + + vc.toast(errInfo); + + }); + } + } }); })(window.vc); \ No newline at end of file