mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-25 14:17:54 +08:00
优化代码
This commit is contained in:
parent
806399994f
commit
498ef8f947
@ -34,6 +34,30 @@
|
||||
<input v-model="addCarInfo.carColor" type="text" placeholder="必填,请填写车颜色,如白色" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">车牌类型</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="custom-select" v-model="addCarInfo.carNumType">
|
||||
<option selected disabled value="">必填,请选择车牌类型</option>
|
||||
<option value="H">月租车</option>
|
||||
<option value="S">出售车辆</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-show = "addCarInfo.carNumType == 'H'">
|
||||
<label class="col-sm-2 col-form-label">起租时间</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addCarInfo.startTime" type="text" placeholder="必填,请填写起租时间"
|
||||
class="form-control startTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-show = "addCarInfo.carNumType == 'H'">
|
||||
<label class="col-sm-2 col-form-label">结租时间</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addCarInfo.endTime" type="text" placeholder="必填,请填写结租时间"
|
||||
class="form-control endTime">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">备注</label>
|
||||
|
||||
@ -15,7 +15,10 @@
|
||||
carBrand:'',
|
||||
carType:'',
|
||||
carColor:'',
|
||||
carRemark:""
|
||||
carRemark:"",
|
||||
startTime:'',
|
||||
endTime:'',
|
||||
carNumType:''
|
||||
},
|
||||
carTypes:[
|
||||
{
|
||||
@ -59,6 +62,8 @@
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
|
||||
vc.component._initDateInfo();
|
||||
},
|
||||
_initEvent:function(){
|
||||
vc.on('addCar', 'onIndex', function(_index){
|
||||
@ -103,6 +108,20 @@
|
||||
errInfo:"车类型不能为空"
|
||||
}
|
||||
],
|
||||
'addCarInfo.startTime':[
|
||||
{
|
||||
limit:"required",
|
||||
param:"",
|
||||
errInfo:"起租时间不能为空"
|
||||
}
|
||||
],
|
||||
'addCarInfo.endTime':[
|
||||
{
|
||||
limit:"required",
|
||||
param:"",
|
||||
errInfo:"结租时间不能为空"
|
||||
}
|
||||
],
|
||||
'addCarInfo.carColor':[
|
||||
{
|
||||
limit:"required",
|
||||
@ -118,12 +137,57 @@
|
||||
});
|
||||
},
|
||||
saveAddCarInfo:function(){
|
||||
let _carNumType = $that.addCarInfo.carNumType;
|
||||
if(_carNumType == 'S'){
|
||||
$that.addCarInfo.startTime = vc.dateFormat(new Date().getTime());
|
||||
$that.addCarInfo.endTime = '2037-01-01 00:00:00';
|
||||
}
|
||||
|
||||
if(vc.component.addCarValidate()){
|
||||
//侦听回传
|
||||
vc.emit($props.callBackComponent,$props.callBackFunction, vc.component.addCarInfo);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
},
|
||||
_initDateInfo: function () {
|
||||
vc.component.addCarInfo.startTime = vc.dateFormat(new Date().getTime());
|
||||
$('.startTime').datetimepicker({
|
||||
language: 'zh-CN',
|
||||
fontAwesome: 'fa',
|
||||
format: 'yyyy-mm-dd hh:ii:ss',
|
||||
initTime: true,
|
||||
initialDate: new Date(),
|
||||
autoClose: 1,
|
||||
todayBtn: true
|
||||
|
||||
});
|
||||
$('.startTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
var value = $(".startTime").val();
|
||||
vc.component.addCarInfo.startTime = value;
|
||||
});
|
||||
$('.endTime').datetimepicker({
|
||||
language: 'zh-CN',
|
||||
fontAwesome: 'fa',
|
||||
format: 'yyyy-mm-dd hh:ii:ss',
|
||||
initTime: true,
|
||||
initialDate: new Date(),
|
||||
autoClose: 1,
|
||||
todayBtn: true
|
||||
});
|
||||
$('.endTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
var value = $(".endTime").val();
|
||||
var start=Date.parse(new Date(vc.component.addCarInfo.startTime))
|
||||
var end = Date.parse(new Date(value))
|
||||
if(start-end>=0){
|
||||
vc.toast("结租时间必须大于起租时间")
|
||||
$(".endTime").val('')
|
||||
}else{
|
||||
vc.component.addCarInfo.endTime = value;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -19,34 +19,25 @@
|
||||
callBackFunction="notify"
|
||||
></vc:create>
|
||||
</div>
|
||||
<div v-if="hireParkingSpaceInfo.index == 2">
|
||||
<div v-show="hireParkingSpaceInfo.index == 2">
|
||||
<vc:create path="property/addCar"
|
||||
callBackComponent="hireParkingSpace"
|
||||
callBackFunction="notify"
|
||||
>
|
||||
|
||||
</vc:create>
|
||||
</div>
|
||||
|
||||
<div v-if="hireParkingSpaceInfo.index == 3">
|
||||
<vc:create path="property/hireParkingSpaceFee"
|
||||
callBackComponent="hireParkingSpace"
|
||||
callBackFunction="notify"
|
||||
></vc:create>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10"></div>
|
||||
<div class="col-md-2 " style="margin-bottom:10px; text-align:right">
|
||||
<button type="button" class="btn btn-secondary" v-on:click="_prevStep()">上一步</button>
|
||||
<button v-if="hireParkingSpaceInfo.index != 3" type="button" class="btn btn-primary"
|
||||
<button v-if="hireParkingSpaceInfo.index != 2" type="button" class="btn btn-primary"
|
||||
style="margin-left:10px;"
|
||||
v-on:click="_nextStep()">下一步
|
||||
</button>
|
||||
<button v-if="hireParkingSpaceInfo.index == 3" type="button" class="btn btn-primary"
|
||||
<button v-if="hireParkingSpaceInfo.index == 2" type="button" class="btn btn-primary"
|
||||
style="margin-left:10px;"
|
||||
v-on:click="_finishStep()">出租
|
||||
v-on:click="_finishStep()">提交
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
vc.component.hireParkingSpaceInfo.$step.step({
|
||||
index: 0,
|
||||
time: 500,
|
||||
title: ["选择车位","业主信息","车辆信息","收费信息"]
|
||||
title: ["选择车位","业主信息","车辆信息"]
|
||||
});
|
||||
vc.component.hireParkingSpaceInfo.index = vc.component.hireParkingSpaceInfo.$step.getIndex();
|
||||
},
|
||||
@ -81,18 +81,17 @@
|
||||
data:vc.component.hireParkingSpaceInfo.infos
|
||||
}
|
||||
|
||||
vc.http.post(
|
||||
'hireParkingSpace',
|
||||
'sell',
|
||||
vc.http.apiPost(
|
||||
'owner.saveOwnerCars',
|
||||
JSON.stringify(param),
|
||||
{
|
||||
emulateJSON:true
|
||||
},
|
||||
function(json,res){
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if(res.status == 200){
|
||||
vc.toast("请记得收费哦!");
|
||||
//关闭model
|
||||
vc.jumpToPage("/admin.html#/pages/property/listOwner?" + vc.objToGetParam(JSON.parse(json)));
|
||||
vc.jumpToPage("/admin.html#/pages/property/listOwnerCar");
|
||||
return ;
|
||||
}
|
||||
vc.toast(json);
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-primary btn-sm"
|
||||
v-on:click="_openAddParkingSpaceModal(-1)">
|
||||
v-on:click="_addOwnerCar()">
|
||||
<i class="fa fa-plus"></i>
|
||||
添加
|
||||
</button>
|
||||
|
||||
@ -58,8 +58,8 @@
|
||||
);
|
||||
|
||||
},
|
||||
_openToHireParkingSpaceModel:function(_parkingSpace){ //出租
|
||||
vc.jumpToPage('/admin.html#/pages/property/hireParkingSpace?'+vc.objToGetParam(_parkingSpace));
|
||||
_addOwnerCar:function(){ //出租
|
||||
vc.jumpToPage('/admin.html#/pages/property/hireParkingSpace');
|
||||
},
|
||||
_queryMethod: function () {
|
||||
$that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
|
||||
@ -116,14 +116,14 @@
|
||||
{{parkingSpace.area}}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group" v-if="parkingSpace.state =='F'">
|
||||
<!-- <div class="btn-group" v-if="parkingSpace.state =='F'">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openToHireParkingSpaceModel(parkingSpace)">出租</button>
|
||||
</div>
|
||||
<div class="btn-group" v-if="parkingSpace.state =='F'">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openToSellParkingSpaceModel(parkingSpace)">出售</button>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openEditParkingSpaceModel(parkingSpace)">修改</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user