/** 添加费用明细 **/ (function (vc) { var $that = {}; vc.extends({ data: { costDetailInfo: { flowCode: '', date: '', communityName: '', communityCode: '', projectContent: '', managementAmount: '', managementStamped: '1', committeeAmount: '', appraisalAmount: '', committeeStamped: '1', approvalDepartment: '', fundTypeLevel1: '', fundTypeLevel2: '', buildingType: '1', maintenanceType: '', fundType: 'repair', fundSystemType: 'out', ownerScope: [], buildingScope: [] }, ownerScopeOptions: [ '机动车停车库(位)', '小区道路', '交通附属设施', '非机动车车库(相朋)', '小区公共照明', '锅炉', '排水、排污设施', '消防系统', '安防设施', '公共景观绿化', '健身、游乐设施', '小区宣传、标识', '强电', '弱电', '通信设施', '公共用房', '平屋面', '楼栋外立面', '供电设施', '暖通系统', '供水系统', '通用设施(配件)' ], ownerScopeDropdownOpen: false, buildingScopeOptions: [ '机动车停车库(位)', '交通附属设施', '小区道路', '公共景观绿化', '非机动车车库(棚)', '锅炉', '排水、排污设施', '消防系统', '安防设施', '健身、游乐设施', '小区宣传、标识', '强电', '弱电', '通信设施', '公共用房', '平屋面', '太阳能设施', '坡屋面', '结构', '楼栋外立面', '楼幢入口', '楼幢公共', '楼道设施', '供电设施', '暖通系统', '供水系统', '通用设施(配件)', '法院强制执行' ], buildingScopeDropdownOpen: false }, _initMethod: function () { $that = vc.component; if (!$that.costDetailInfo) { $that.costDetailInfo = {}; } if (!$that.costDetailInfo.ownerScope || !Array.isArray($that.costDetailInfo.ownerScope)) { $that.costDetailInfo.ownerScope = []; } if (!$that.costDetailInfo.buildingScope || !Array.isArray($that.costDetailInfo.buildingScope)) { $that.costDetailInfo.buildingScope = []; } if (!$that.ownerScopeOptions || !Array.isArray($that.ownerScopeOptions)) { $that.ownerScopeOptions = [ '机动车停车库(位)', '小区道路', '交通附属设施', '非机动车车库(相朋)', '小区公共照明', '锅炉', '排水、排污设施', '消防系统', '安防设施', '公共景观绿化', '健身、游乐设施', '小区宣传、标识', '强电', '弱电', '通信设施', '公共用房', '平屋面', '楼栋外立面', '供电设施', '暖通系统', '供水系统', '通用设施(配件)' ]; } if ($that.ownerScopeDropdownOpen === undefined) { $that.ownerScopeDropdownOpen = false; } if (!$that.buildingScopeOptions || !Array.isArray($that.buildingScopeOptions)) { $that.buildingScopeOptions = [ '机动车停车库(位)', '交通附属设施', '小区道路', '公共景观绿化', '非机动车车库(棚)', '锅炉', '排水、排污设施', '消防系统', '安防设施', '健身、游乐设施', '小区宣传、标识', '强电', '弱电', '通信设施', '公共用房', '平屋面', '太阳能设施', '坡屋面', '结构', '楼栋外立面', '楼幢入口', '楼幢公共', '楼道设施', '供电设施', '暖通系统', '供水系统', '通用设施(配件)', '法院强制执行' ]; } if ($that.buildingScopeDropdownOpen === undefined) { $that.buildingScopeDropdownOpen = false; } var clickHandler = function (e) { if (!e.target.closest('.multi-select-wrapper')) { if ($that && $that.ownerScopeDropdownOpen !== undefined) { $that.ownerScopeDropdownOpen = false; } if ($that && $that.buildingScopeDropdownOpen !== undefined) { $that.buildingScopeDropdownOpen = false; } } }; setTimeout(function () { document.addEventListener('click', clickHandler); }, 100); }, methods: { toggleOwnerScopeDropdown: function () { if ($that && $that.ownerScopeDropdownOpen !== undefined) { $that.ownerScopeDropdownOpen = !$that.ownerScopeDropdownOpen; } }, toggleOwnerScopeOption: function (option) { if (!$that || !$that.costDetailInfo || !$that.costDetailInfo.ownerScope) { return; } var index = $that.costDetailInfo.ownerScope.indexOf(option); if (index === -1) { $that.costDetailInfo.ownerScope.push(option); } else { $that.costDetailInfo.ownerScope.splice(index, 1); } }, removeOwnerScopeItem: function (index) { if ($that && $that.costDetailInfo && $that.costDetailInfo.ownerScope) { $that.costDetailInfo.ownerScope.splice(index, 1); } }, toggleBuildingScopeDropdown: function () { if ($that && $that.buildingScopeDropdownOpen !== undefined) { $that.buildingScopeDropdownOpen = !$that.buildingScopeDropdownOpen; } }, toggleBuildingScopeOption: function (option) { if (!$that || !$that.costDetailInfo || !$that.costDetailInfo.buildingScope) { return; } var index = $that.costDetailInfo.buildingScope.indexOf(option); if (index === -1) { $that.costDetailInfo.buildingScope.push(option); } else { $that.costDetailInfo.buildingScope.splice(index, 1); } }, removeBuildingScopeItem: function (index) { if ($that && $that.costDetailInfo && $that.costDetailInfo.buildingScope) { $that.costDetailInfo.buildingScope.splice(index, 1); } }, _saveCostDetail: function () { if (!$that.costDetailInfo.flowCode) { vc.toast('请输入流转编码'); return; } if (!$that.costDetailInfo.date) { vc.toast('请选择日期'); return; } if (!$that.costDetailInfo.communityName) { vc.toast('请输入小区名称'); return; } if (!$that.costDetailInfo.communityCode) { vc.toast('请输入小区编码'); return; } var fundTypeLevel1 = ''; if ($that.costDetailInfo.fundType === 'repair') { fundTypeLevel1 = '维修资金'; } else if ($that.costDetailInfo.fundType === 'public') { fundTypeLevel1 = '公共收益'; } var fundTypeLevel2 = ''; var buildingOrAll = ''; if ($that.costDetailInfo.fundType === 'repair') { fundTypeLevel2 = ($that.costDetailInfo.ownerScope && $that.costDetailInfo.ownerScope.length > 0) ? $that.costDetailInfo.ownerScope.join(',') : ''; buildingOrAll = ($that.costDetailInfo.buildingScope && $that.costDetailInfo.buildingScope.length > 0) ? $that.costDetailInfo.buildingScope.join(',') : ''; } else if ($that.costDetailInfo.fundType === 'public') { if ($that.costDetailInfo.fundSystemType === 'out') { fundTypeLevel2 = '系统外'; } else if ($that.costDetailInfo.fundSystemType === 'in') { fundTypeLevel2 = '系统内'; } buildingOrAll = ''; } else { buildingOrAll = ''; } var saveData = { flowNumber: $that.costDetailInfo.flowCode, date: $that.costDetailInfo.date, projectName: $that.costDetailInfo.communityName, projectCode: $that.costDetailInfo.communityCode, projectContent: $that.costDetailInfo.projectContent, managementOfficeAmount: parseFloat($that.costDetailInfo.managementAmount) || 0, managementOfficeSeal: $that.costDetailInfo.managementStamped === '1' ? '是' : '否', ownersCommitteeAmount: parseFloat($that.costDetailInfo.committeeAmount) || 0, auditAmount: parseFloat($that.costDetailInfo.appraisalAmount) || 0, ownersCommitteeSeal: $that.costDetailInfo.committeeStamped === '1' ? '是' : '否', reportDepartment: $that.costDetailInfo.approvalDepartment || '', fundTypeLevel1: fundTypeLevel1, fundTypeLevel2: fundTypeLevel2, maintenanceType: $that.costDetailInfo.maintenanceType || '', communityId: vc.getCurrentCommunity().communityId }; if ($that.costDetailInfo.fundType === 'repair') { saveData.buildingOrAll = buildingOrAll; } if (saveData.date) { var dateParts = saveData.date.split('-'); if (dateParts.length >= 2) { saveData.year = parseInt(dateParts[0]); saveData.month = parseInt(dateParts[1]); if (dateParts.length >= 3) { saveData.day = parseInt(dateParts[2]); } } } vc.http.apiPost('/maintenancePayment/saveMaintenancePayment', JSON.stringify(saveData), { emulateJSON: true }, function (json, res) { try { var _json = JSON.parse(json); if (_json.code === 0 || _json.code === '0') { vc.toast('保存成功'); setTimeout(function () { vc.goBack(); }, 1000); } else { vc.toast(_json.msg || '保存失败'); } } catch (e) { console.error('保存响应解析失败:', e); vc.toast('保存失败'); } }, function (errInfo, error) { console.error('保存请求失败:', errInfo, error); vc.toast('保存失败,请检查网络连接'); } ); }, _cancel: function () { vc.goBack(); } } }); })(window.vc);