mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
225 lines
9.4 KiB
JavaScript
225 lines
9.4 KiB
JavaScript
(function (vc) {
|
|
|
|
vc.extends({
|
|
data: {
|
|
roomCreateFeeAddInfo: {
|
|
feeTypeCds: [],
|
|
feeConfigs: [],
|
|
locationTypeCd: '',
|
|
locationObjId: '',
|
|
floorId: '',
|
|
floorNum: '',
|
|
floorName: '',
|
|
unitId: '',
|
|
unitName: '',
|
|
roomId: '',
|
|
feeTypeCd: '',
|
|
configId: '',
|
|
roomState: ['2001'],
|
|
isMore: false,
|
|
locationTypeCdName: '',
|
|
startTime: vc.dateTimeFormat(new Date().getTime())
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
|
|
vc.component.roomCreateFeeAddInfo.feeTypeCds = _data;
|
|
});
|
|
|
|
vc.initDateTime('roomCreateFeeStartTime',function(_value){
|
|
$that.roomCreateFeeAddInfo.startTime = _value;
|
|
})
|
|
|
|
},
|
|
_initEvent: function () {
|
|
vc.on('roomCreateFeeAdd', 'openRoomCreateFeeAddModal',
|
|
function (_room) {
|
|
vc.component.roomCreateFeeAddInfo.isMore = _room.isMore;
|
|
if (!_room.isMore) {
|
|
vc.component.roomCreateFeeAddInfo.locationTypeCd = '5008';
|
|
vc.component.roomCreateFeeAddInfo.locationObjId = _room.room.roomId;
|
|
$that.roomCreateFeeAddInfo.roomState.push('2003');
|
|
$that.roomCreateFeeAddInfo.roomState.push('2004');
|
|
$that.roomCreateFeeAddInfo.roomState.push('2005');
|
|
var room = _room.room;
|
|
vc.component.roomCreateFeeAddInfo.locationTypeCdName = room.floorNum + '号楼' + room.unitNum + '单元' + room.roomNum + '室(' + room.ownerName + ')';
|
|
}
|
|
$('#roomCreateFeeAddModel').modal('show');
|
|
|
|
});
|
|
|
|
vc.on("roomCreateFeeAdd", "notify", function (_param) {
|
|
if (_param.hasOwnProperty("floorId")) {
|
|
vc.component.roomCreateFeeAddInfo.floorId = _param.floorId;
|
|
}
|
|
|
|
if (_param.hasOwnProperty("unitId")) {
|
|
vc.component.roomCreateFeeAddInfo.unitId = _param.unitId;
|
|
}
|
|
|
|
if (_param.hasOwnProperty("roomId")) {
|
|
vc.component.roomCreateFeeAddInfo.roomId = _param.roomId;
|
|
}
|
|
});
|
|
},
|
|
methods: {
|
|
|
|
roomCreateFeeAddValidate() {
|
|
return vc.validate.validate({
|
|
roomCreateFeeAddInfo: vc.component.roomCreateFeeAddInfo
|
|
},
|
|
{
|
|
'roomCreateFeeAddInfo.locationTypeCd': [{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "收费范围不能为空"
|
|
},
|
|
{
|
|
limit: "num",
|
|
param: "",
|
|
errInfo: "收费范围格式错误"
|
|
},
|
|
],
|
|
'roomCreateFeeAddInfo.locationObjId': [{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "收费对象不能为空"
|
|
}
|
|
],
|
|
'roomCreateFeeAddInfo.feeTypeCd': [{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "费用类型不能为空"
|
|
}
|
|
],
|
|
'roomCreateFeeAddInfo.configId': [{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "费用项目不能为空"
|
|
}
|
|
],
|
|
'roomCreateFeeAddInfo.roomState': [{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "房屋状态不能为空"
|
|
}
|
|
],
|
|
'roomCreateFeeAddInfo.startTime': [{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "计费起始时间不能为空"
|
|
},
|
|
{
|
|
limit: "datetime",
|
|
param: "",
|
|
errInfo: "计费起始时间格式错误 YYYY-MM-DD hh:mm:ss"
|
|
}]
|
|
});
|
|
},
|
|
saveRoomCreateFeeInfo: function () {
|
|
|
|
vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
|
|
if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '1000') { //大门时直接写 小区ID
|
|
vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.communityId;
|
|
} else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '2000') {
|
|
vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.unitId;
|
|
} else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '3000') {
|
|
vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.roomId;
|
|
} else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '4000') {
|
|
vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.floorId;
|
|
} else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '5008') {
|
|
} else {
|
|
vc.toast("收费范围错误");
|
|
return;
|
|
}
|
|
|
|
if (!vc.component.roomCreateFeeAddValidate()) {
|
|
vc.toast(vc.validate.errInfo);
|
|
return;
|
|
}
|
|
|
|
vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
|
|
let _roomCreateFeeAddInfo = JSON.parse(JSON.stringify(vc.component.roomCreateFeeAddInfo));
|
|
if (_roomCreateFeeAddInfo.locationTypeCd == '5008') {
|
|
_roomCreateFeeAddInfo.locationTypeCd = '3000';
|
|
}
|
|
|
|
_roomCreateFeeAddInfo.roomState = _roomCreateFeeAddInfo.roomState.join(',');
|
|
|
|
vc.http.post('roomCreateFeeAdd', 'save',
|
|
JSON.stringify(_roomCreateFeeAddInfo), {
|
|
emulateJSON: true
|
|
},
|
|
function (json, res) {
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
if (res.status == 200) {
|
|
//关闭model
|
|
var _json = JSON.parse(json);
|
|
$('#roomCreateFeeAddModel').modal('hide');
|
|
vc.component.clearAddFeeConfigInfo();
|
|
vc.toast("创建收费成功,总共[" + _json.totalRoom + "]房屋,成功[" + _json.successRoom + "],失败[" + _json.errorRoom + "]", 8000);
|
|
vc.emit('listRoomFee', 'notify', {});
|
|
return;
|
|
}
|
|
vc.toast(json);
|
|
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
|
|
vc.toast(errInfo);
|
|
|
|
});
|
|
},
|
|
clearAddFeeConfigInfo: function () {
|
|
var _feeTypeCds = vc.component.roomCreateFeeAddInfo.feeTypeCds;
|
|
vc.component.roomCreateFeeAddInfo = {
|
|
feeConfigs: [],
|
|
locationTypeCd: '',
|
|
locationObjId: '',
|
|
floorId: '',
|
|
floorNum: '',
|
|
floorName: '',
|
|
unitId: '',
|
|
unitName: '',
|
|
roomId: '',
|
|
feeTypeCd: '',
|
|
configId: '',
|
|
billType: '',
|
|
roomState: ['2001'],
|
|
isMore: false,
|
|
locationTypeCdName: '',
|
|
startTime: vc.dateTimeFormat(new Date().getTime())
|
|
};
|
|
|
|
vc.component.roomCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
|
|
},
|
|
_changeFeeTypeCdX: function (_feeTypeCd) {
|
|
|
|
$that.roomCreateFeeAddInfo.configId = '';
|
|
|
|
var param = {
|
|
params: {
|
|
page: 1,
|
|
row: 20,
|
|
communityId: vc.getCurrentCommunity().communityId,
|
|
feeTypeCd: _feeTypeCd,
|
|
isDefault: 'F',
|
|
valid: '1'
|
|
}
|
|
};
|
|
|
|
//发送get请求
|
|
vc.http.get('roomCreateFeeAdd', 'list', param,
|
|
function (json, res) {
|
|
var _feeConfigManageInfo = JSON.parse(json);
|
|
vc.component.roomCreateFeeAddInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
})(window.vc); |