mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-27 08:29:59 +08:00
224 lines
7.2 KiB
JavaScript
224 lines
7.2 KiB
JavaScript
(function(vc){
|
|
|
|
vc.extends({
|
|
propTypes: {
|
|
callBackListener:vc.propTypes.string, //父组件名称
|
|
callBackFunction:vc.propTypes.string //父组件监听方法
|
|
},
|
|
data:{
|
|
addChargeMonthOrderInfo:{
|
|
orderId:'',
|
|
cardId:'',
|
|
personName:'',
|
|
personTel:'',
|
|
communityId:'',
|
|
primeRate:'',
|
|
receivableAmount:'',
|
|
receivedAmount:'',
|
|
startTime:'',
|
|
endTime:'',
|
|
remark:'',
|
|
|
|
}
|
|
},
|
|
_initMethod:function(){
|
|
|
|
},
|
|
_initEvent:function(){
|
|
vc.on('addChargeMonthOrder','openAddChargeMonthOrderModal',function(){
|
|
$('#addChargeMonthOrderModel').modal('show');
|
|
});
|
|
},
|
|
methods:{
|
|
addChargeMonthOrderValidate(){
|
|
return vc.validate.validate({
|
|
addChargeMonthOrderInfo:vc.component.addChargeMonthOrderInfo
|
|
},{
|
|
'addChargeMonthOrderInfo.cardId':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"卡ID不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"30",
|
|
errInfo:"卡ID不能超过30"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.personName':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"充电人不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"64",
|
|
errInfo:"充电人不能超过64"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.personTel':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"充电电话不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"11",
|
|
errInfo:"充电电话不能超过11"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.communityId':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"小区ID不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"30",
|
|
errInfo:"小区ID不能超过30"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.primeRate':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"支付方式不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"10",
|
|
errInfo:"支付方式不能超过10"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.receivableAmount':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"应收金额不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"10",
|
|
errInfo:"应收金额不能超过10位"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.receivedAmount':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"实收金额不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"10",
|
|
errInfo:"实收金额不能超过10位"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.startTime':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"费用开始时间不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"30",
|
|
errInfo:"费用开始时间不能超过30位"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.endTime':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"费用结束时间不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"30",
|
|
errInfo:"费用结束时间不能超过30位"
|
|
},
|
|
],
|
|
'addChargeMonthOrderInfo.remark':[
|
|
{
|
|
limit:"required",
|
|
param:"",
|
|
errInfo:"备注'不能为空"
|
|
},
|
|
{
|
|
limit:"maxLength",
|
|
param:"512",
|
|
errInfo:"备注不能超过512"
|
|
},
|
|
],
|
|
|
|
|
|
|
|
|
|
});
|
|
},
|
|
saveChargeMonthOrderInfo:function(){
|
|
if(!vc.component.addChargeMonthOrderValidate()){
|
|
vc.toast(vc.validate.errInfo);
|
|
|
|
return ;
|
|
}
|
|
|
|
vc.component.addChargeMonthOrderInfo.communityId = vc.getCurrentCommunity().communityId;
|
|
//不提交数据将数据 回调给侦听处理
|
|
if(vc.notNull($props.callBackListener)){
|
|
vc.emit($props.callBackListener,$props.callBackFunction,vc.component.addChargeMonthOrderInfo);
|
|
$('#addChargeMonthOrderModel').modal('hide');
|
|
return ;
|
|
}
|
|
|
|
vc.http.apiPost(
|
|
'chargeMonthOrder.saveChargeMonthOrder',
|
|
JSON.stringify(vc.component.addChargeMonthOrderInfo),
|
|
{
|
|
emulateJSON:true
|
|
},
|
|
function(json,res){
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
let _json = JSON.parse(json);
|
|
if (_json.code == 0) {
|
|
//关闭model
|
|
$('#addChargeMonthOrderModel').modal('hide');
|
|
vc.component.clearAddChargeMonthOrderInfo();
|
|
vc.emit('chargeMonthOrderManage','listChargeMonthOrder',{});
|
|
|
|
return ;
|
|
}
|
|
vc.message(_json.msg);
|
|
|
|
},
|
|
function(errInfo,error){
|
|
console.log('请求失败处理');
|
|
|
|
vc.message(errInfo);
|
|
|
|
});
|
|
},
|
|
clearAddChargeMonthOrderInfo:function(){
|
|
vc.component.addChargeMonthOrderInfo = {
|
|
cardId:'',
|
|
personName:'',
|
|
personTel:'',
|
|
communityId:'',
|
|
primeRate:'',
|
|
receivableAmount:'',
|
|
receivedAmount:'',
|
|
startTime:'',
|
|
endTime:'',
|
|
remark:'',
|
|
|
|
};
|
|
}
|
|
}
|
|
});
|
|
|
|
})(window.vc);
|