diff --git a/public/components/property/carCreateFeeAdd/carCreateFeeAdd.js b/public/components/property/carCreateFeeAdd/carCreateFeeAdd.js index e49821b24..d14dc89a9 100755 --- a/public/components/property/carCreateFeeAdd/carCreateFeeAdd.js +++ b/public/components/property/carCreateFeeAdd/carCreateFeeAdd.js @@ -1,4 +1,4 @@ -(function (vc) { +(function(vc) { vc.extends({ data: { carCreateFeeAddInfo: { @@ -19,16 +19,16 @@ endTime: '' } }, - _initMethod: function () { + _initMethod: function() { vc.component._initCarCreateFeeAddDateInfo(); - vc.getDict('pay_fee_config', "fee_type_cd", function (_data) { + vc.getDict('pay_fee_config', "fee_type_cd", function(_data) { vc.component.carCreateFeeAddInfo.feeTypeCds = _data; }); vc.component._loadParkingAreas(); }, - _initEvent: function () { + _initEvent: function() { vc.on('carCreateFeeAdd', 'openCarCreateFeeAddModal', - function (_param) { + function(_param) { vc.component.carCreateFeeAddInfo.isMore = _param.isMore; if (!_param.isMore) { vc.component.carCreateFeeAddInfo.locationTypeCd = '2000'; @@ -38,18 +38,18 @@ } $('#carCreateFeeAddModel').modal('show'); }); - vc.on("carCreateFeeAdd", "notify", function (param) { + vc.on("carCreateFeeAdd", "notify", function(param) { $that.carCreateFeeAddInfo.paId = param.paId; }) }, methods: { - _initCarCreateFeeAddDateInfo: function () { + _initCarCreateFeeAddDateInfo: function() { - vc.initDate('carCreateFeeStartTime', function (_startTime) { + vc.initDate('carCreateFeeStartTime', function(_startTime) { console.log(_startTime) $that.carCreateFeeAddInfo.startTime = _startTime; }); - vc.initDate('carCreateFeeEndTime', function (_endTime) { + vc.initDate('carCreateFeeEndTime', function(_endTime) { $that.carCreateFeeAddInfo.endTime = _endTime; let start = Date.parse(new Date($that.carCreateFeeAddInfo.startTime)) let end = Date.parse(new Date($that.carCreateFeeAddInfo.endTime)) @@ -68,9 +68,8 @@ carCreateFeeAddValidate() { return vc.validate.validate({ carCreateFeeAddInfo: vc.component.carCreateFeeAddInfo - }, - { - 'carCreateFeeAddInfo.locationTypeCd': [{ + }, { + 'carCreateFeeAddInfo.locationTypeCd': [{ limit: "required", param: "", errInfo: "收费范围不能为空" @@ -80,32 +79,28 @@ param: "", errInfo: "收费范围格式错误" }, - ], - 'carCreateFeeAddInfo.locationObjId': [{ - limit: "required", - param: "", - errInfo: "收费对象不能为空" - } - ], - 'carCreateFeeAddInfo.feeTypeCd': [{ - limit: "required", - param: "", - errInfo: "费用类型不能为空" - } - ], - 'carCreateFeeAddInfo.configId': [{ - limit: "required", - param: "", - errInfo: "费用项目不能为空" - } - ], - 'carCreateFeeAddInfo.carState': [{ - limit: "required", - param: "", - errInfo: "出账类型不能为空" - } - ], - 'carCreateFeeAddInfo.startTime': [{ + ], + 'carCreateFeeAddInfo.locationObjId': [{ + limit: "required", + param: "", + errInfo: "收费对象不能为空" + }], + 'carCreateFeeAddInfo.feeTypeCd': [{ + limit: "required", + param: "", + errInfo: "费用类型不能为空" + }], + 'carCreateFeeAddInfo.configId': [{ + limit: "required", + param: "", + errInfo: "费用项目不能为空" + }], + 'carCreateFeeAddInfo.carState': [{ + limit: "required", + param: "", + errInfo: "出账类型不能为空" + }], + 'carCreateFeeAddInfo.startTime': [{ limit: "required", param: "", errInfo: "计费起始时间不能为空" @@ -114,10 +109,11 @@ limit: "datetime", param: "", errInfo: "计费起始时间格式错误 YYYY-MM-DD hh:mm:ss" - }] - }); + } + ] + }); }, - saveCarCreateFeeInfo: function () { + saveCarCreateFeeInfo: function() { vc.component.carCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId; if (vc.component.carCreateFeeAddInfo.locationTypeCd == '1000') { // 小区ID vc.component.carCreateFeeAddInfo.locationObjId = vc.component.carCreateFeeAddInfo.communityId; @@ -134,12 +130,11 @@ return; } vc.component.carCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId; - vc.http.post('parkingSpaceCreateFeeAdd', - 'save', + vc.http.apiPost('fee.saveParkingSpaceCreateFee', JSON.stringify(vc.component.carCreateFeeAddInfo), { - emulateJSON: true - }, - function (json, res) { + emulateJSON: true + }, + function(json, res) { if (res.status == 200) { //关闭model var _json = JSON.parse(json); @@ -147,17 +142,21 @@ vc.component.clearAddFeeConfigInfo(); vc.emit('listParkingSpaceFee', 'notify', {}); vc.emit('simplifyCarFee', 'notify', {}); + if (_json.hasOwnProperty('code') && _json.code != 0) { + vc.toast(_json.msg); + return; + } vc.toast("创建收费成功,总共[" + _json.totalCar + "]车位,成功[" + _json.successCar + "],失败[" + _json.errorCar + "]", 8000); return; } vc.toast(json); }, - function (errInfo, error) { + function(errInfo, error) { console.log('请求失败处理'); vc.toast(errInfo); }); }, - clearAddFeeConfigInfo: function () { + clearAddFeeConfigInfo: function() { var _feeTypeCds = vc.component.carCreateFeeAddInfo.feeTypeCds; var _parkingAreas = vc.component.carCreateFeeAddInfo.parkingAreas; vc.component.carCreateFeeAddInfo = { @@ -181,7 +180,7 @@ vc.component.carCreateFeeAddInfo.feeTypeCds = _feeTypeCds; vc.component.carCreateFeeAddInfo.parkingAreas = _parkingAreas; }, - _changeCarFeeTypeCd: function (_feeTypeCd) { + _changeCarFeeTypeCd: function(_feeTypeCd) { var param = { params: { page: 1, @@ -194,15 +193,15 @@ }; //发送get请求 vc.http.get('parkingSpaceCreateFeeAdd', 'list', param, - function (json, res) { + function(json, res) { var _feeConfigManageInfo = JSON.parse(json); vc.component.carCreateFeeAddInfo.feeConfigs = _feeConfigManageInfo.feeConfigs; }, - function (errInfo, error) { + function(errInfo, error) { console.log('请求失败处理'); }); }, - _loadParkingAreas: function (_feeTypeCd) { + _loadParkingAreas: function(_feeTypeCd) { var param = { params: { page: 1, @@ -212,13 +211,13 @@ }; //发送get请求 vc.http.get('parkingSpaceCreateFeeAdd', 'listParkingArea', param, - function (json, res) { + function(json, res) { if (res.status == 200) { var _parkingAreaInfo = JSON.parse(json); vc.component.carCreateFeeAddInfo.parkingAreas = _parkingAreaInfo.parkingAreas; } }, - function (errInfo, error) { + function(errInfo, error) { console.log('请求失败处理'); }); }, diff --git a/public/components/property/roomCreateFeeAdd/roomCreateFeeAdd.js b/public/components/property/roomCreateFeeAdd/roomCreateFeeAdd.js index 49d0955fa..8a6dc913d 100755 --- a/public/components/property/roomCreateFeeAdd/roomCreateFeeAdd.js +++ b/public/components/property/roomCreateFeeAdd/roomCreateFeeAdd.js @@ -167,7 +167,7 @@ _roomCreateFeeAddInfo.locationTypeCd = '3000'; } _roomCreateFeeAddInfo.roomState = _roomCreateFeeAddInfo.roomState.join(','); - vc.http.post('roomCreateFeeAdd', 'save', + vc.http.apiPost('/fee.saveRoomCreateFee', JSON.stringify(_roomCreateFeeAddInfo), { emulateJSON: true }, @@ -178,9 +178,13 @@ var _json = JSON.parse(json); $('#roomCreateFeeAddModel').modal('hide'); $that.clearAddFeeConfigInfo(); - vc.toast("创建收费成功,总共[" + _json.totalRoom + "]房屋,成功[" + _json.successRoom + "],失败[" + _json.errorRoom + "]", 8000); vc.emit('listRoomFee', 'notify', {}); vc.emit('simplifyRoomFee', 'notify', {}); + if (_json.hasOwnProperty('code') && _json.code != 0) { + vc.toast(_json.msg); + return; + } + vc.toast("创建收费成功,总共[" + _json.totalRoom + "]房屋,成功[" + _json.successRoom + "],失败[" + _json.errorRoom + "]", 8000); return; } vc.toast(json);