/** 入驻小区 **/ (function (vc) { var DEFAULT_PAGE = 1; var DEFAULT_ROWS = 20; vc.extends({ data: { payFeeUserAccountInfo: { accountList: [], feeId: '', ownerId: '', communityId: vc.getCurrentCommunity().communityId, quanAccount: false, selectAccountIds: [], integralAmount: '', cashAmount: '', couponAmount: '' } }, _initMethod: function () { }, _initEvent: function () { vc.on('payFeeUserAccount', 'computeFeeUserAmount', function (_param) { $that.payFeeUserAccountInfo.selectAccountIds = []; vc.copyObject(_param, $that.payFeeUserAccountInfo); $that._listUserAccount(DEFAULT_PAGE, DEFAULT_ROWS); }); vc.on('payFeeUserAccount', 'refresh', function () { $that._listUserAccount(DEFAULT_PAGE, DEFAULT_ROWS); }); vc.on('payFeeUserAccount', 'refreshAndChoose', function () { $that.payFeeUserAccountInfo.accountList = []; $that.payFeeUserAccountInfo.selectAccountIds = []; $that._listUserAccount(DEFAULT_PAGE, DEFAULT_ROWS); setTimeout(function () { let accountList = $that.payFeeUserAccountInfo.accountList; let _selectAccountIds = $that.payFeeUserAccountInfo.selectAccountIds; if (!accountList || accountList.length < 1) { return; } accountList.forEach(disItem => { if (disItem.acctType == '2003') { _selectAccountIds.push(disItem.acctId); } }) }, 2000); }); vc.on('payFeeUserAccount', 'clear', function () { $that.payFeeUserAccountInfo.accountList = []; $that.payFeeUserAccountInfo.selectAccountIds = []; }); }, methods: { _queryPayFeeUserAccount: function () { $that._listUserAccount(DEFAULT_PAGE, DEFAULT_ROWS); }, _listUserAccount: function (_page, _rows) { let param = { params: { page: DEFAULT_PAGE, row: DEFAULT_ROWS, feeId: $that.payFeeUserAccountInfo.feeId, ownerId: $that.payFeeUserAccountInfo.ownerId, communityId: $that.payFeeUserAccountInfo.communityId, } }; //发送get请求 vc.http.apiGet('/account.queryCommunityOwnerAccount', param, function (json, res) { let _json = JSON.parse(json); if (_json.data.length < 1) { //vc.toast('当前没有可用账户'); return; } //账户余额 $that.payFeeUserAccountInfo.accountList = _json.data; }, function (errInfo, error) { console.log('请求失败处理'); } ); }, // 预存 _openAddUserAmountModal: function (_userAccount) { window.open('/#/pages/owner/ownerDetail?ownerId=' + _userAccount.objId + "¤tTab=ownerDetailAccount") }, checkAllAccount: function (e) { var checkObj = document.querySelectorAll('.checkAccountItem'); // 获取所有checkbox项 if (e.target.checked) { // 判定全选checkbox的勾选状态 for (var i = 0; i < checkObj.length; i++) { if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中 let _value = checkObj[i].value; $that.payFeeUserAccountInfo.selectAccountIds.push(_value); } } } else { // 如果是去掉全选则清空checkbox选项绑定数组 $that.payFeeUserAccountInfo.selectAccountIds = []; } }, _computeFeeUserAmount: function (_acctId) { let _totalUserAmount = 0.0; let _selectAccount = []; $that.payFeeUserAccountInfo.accountList.forEach(disItem => { if (_acctId == disItem.acctId && disItem.amount != 0) { _totalUserAmount += parseFloat(disItem.amount); _selectAccount.push(disItem); $that.payFeeUserAccountInfo.cashAmount = disItem.amount; } }); vc.emit('payFeeOrder', 'changeUserAmountPrice', { totalUserAmount: _totalUserAmount, accountList: $that.payFeeUserAccountInfo.accountList, integralAmount: 0, cashAmount: $that.payFeeUserAccountInfo.cashAmount, couponAmount: 0, selectAccount: _selectAccount }); vc.emit('batchPayFeeOrder', 'changeUserAmountPrice', { totalUserAmount: _totalUserAmount, accountList: $that.payFeeUserAccountInfo.accountList, integralAmount: 0, cashAmount: $that.payFeeUserAccountInfo.cashAmount, couponAmount: 0, selectAccount: _selectAccount }) } } }); })(window.vc);