| | |
| | | |
| | | /** |
| | | 添加费用明细 |
| | | **/ |
| | | (function (vc) { |
| | | var $that = {}; |
| | | vc.extends({ |
| | | data: { |
| | | fundType: 'repair', // 默认选中维修资金 |
| | | fundSystemType: 'out' // 默认选中系统外 |
| | | costDetailInfo: { |
| | | flowCode: '', |
| | | date: '', |
| | | communityName: '', |
| | | communityCode: '', |
| | | projectContent: '', |
| | | managementAmount: '', |
| | | managementStamped: '1', |
| | | committeeAmount: '', |
| | | appraisalAmount: '', |
| | | committeeStamped: '1', |
| | | approvalDepartment: '', |
| | | fundTypeLevel1: '', |
| | | fundTypeLevel2: '', |
| | | buildingType: '1', |
| | | maintenanceType: '', |
| | | fundType: 'repair', // 默认选中维修资金 |
| | | fundSystemType: 'out' // 默认选中系统外 |
| | | } |
| | | }, |
| | | _initMethod: function () { |
| | | $that = vc.component; |
| | | }, |
| | | methods: { |
| | | _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 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: $that.costDetailInfo.fundType === 'repair' ? '维修资金' : '公共收益', |
| | | fundTypeLevel2: $that.costDetailInfo.fundType === 'public' ? ($that.costDetailInfo.fundSystemType === 'out' ? '系统外' : '系统内') : '', |
| | | buildingOrAll: $that.costDetailInfo.buildingType === '全体' ? '全体' : ($that.costDetailInfo.buildingType || '1'), |
| | | maintenanceType: $that.costDetailInfo.maintenanceType || '', |
| | | communityId: vc.getCurrentCommunity().communityId |
| | | }; |
| | | |
| | | // 解析日期 |
| | | 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); |