车位申请提交

This commit is contained in:
曾成 2020-09-25 11:26:19 +08:00
parent 49644f24f1
commit 9a3019f0ad
2 changed files with 185 additions and 34 deletions

View File

@ -153,6 +153,8 @@ const queryRentingPool= baseUrl + 'app/renting/queryRentingPool'; //查询房源
const queryParkingSpaces= baseUrl + 'app/parkingSpace.queryParkingSpaces'; //查询空闲车位
const saveOwnerCar= baseUrl + 'app/owner.saveOwnerCar'; //申请车位接口
/**
@ -241,5 +243,6 @@ module.exports = {
changeStaffPwd:changeStaffPwd,
changeOwnerPhone:changeOwnerPhone,
queryRentingPool:queryRentingPool,
queryParkingSpaces:queryParkingSpaces
queryParkingSpaces:queryParkingSpaces,
saveOwnerCar:saveOwnerCar
};

View File

@ -10,56 +10,64 @@
</view>
<view class="cu-form-group">
<view class="title">车牌号</view>
<input v-model="builtUpArea" style="text-align:right"></input>
<input v-model="carNum" style="text-align:right"></input>
</view>
<view class="cu-form-group">
<view class="title">品牌</view>
<input v-model="apartment" style="text-align:right"></input>
<input v-model="carBrand" style="text-align:right"></input>
</view>
<view class="cu-form-group">
<view class="title">颜色</view>
<input v-model="layer" style="text-align:right"></input>
<input v-model="carColor" style="text-align:right"></input>
</view>
<view class="cu-form-group">
<view class="title">类型</view>
<picker bindchange="PickerChange" :value="index" :range="parkingSpaces" @change="">
<view class="title">车辆类型</view>
<picker bindchange="PickerChange" :value="index" :range="carTypes" @change="chooseCarTypes">
<view class="picker">
{{parkingSpacesName?parkingSpacesName:'请选择'}}
{{carTypeName?carTypeName:'请选择'}}
</view>
</picker>
</view>
<view class="cu-form-group">
<view class="title">租用类型</view>
<picker bindchange="PickerChange" :value="index" :range="rentTypes" @change="chooseRentTypes">
<view class="picker">
{{rentTypeName?rentTypeName:'请选择'}}
</view>
</picker>
</view>
<view class="cu-form-group" v-if="rentTypeCode == 'S'">
<view class="title">起租日期</view>
<picker mode="date" :value="date" start="2015-09-01" end="2020-09-01" @change="DateChange">
<picker mode="date" :value="startDate" @change="startDateChange">
<view class="picker">
{{date}}
{{startDate}}
</view>
</picker>
</view>
<view class="cu-form-group">
<view class="cu-form-group" v-if="rentTypeCode == 'S'">
<view class="title">结组日期</view>
<picker mode="date" :value="endDate" @change="DateChange">
<picker mode="date" :value="endDate" @change="endDateChange">
<view class="picker">
{{date}}
{{endDate}}
</view>
</picker>
</view>
<view class="cu-form-group align-start">
<view class="title">备注信息</view>
<textarea maxlength="-1" :disabled="modalName!=null" @input="textareaBInput" placeholder="请输入备注信息"></textarea>
<textarea maxlength="-1" v-model="remark" placeholder="请输入备注信息"></textarea>
</view>
<view class="button_up_blank"></view>
<view class="flex flex-direction">
<button class="cu-btn bg-green margin-tb-sm lg">提交</button>
<button @click="submitApply()" class="cu-btn bg-green margin-tb-sm lg">提交</button>
</view>
</view>
@ -70,19 +78,39 @@
const constant = context.constant;
import {getCurCommunity} from '../../api/community/communityApi.js'
import {getProperty} from '../../api/property/propertyApi.js'
export default {
data() {
return {
//
carNum:'',
carBrand:'',
carColor:'',
remark:'',
psId: '',
startDate: '2020-01-01',
endDate: '2020-01-01',
ownerId:'',
storeId:'',
userId:'',
parkingSpaces: [],
//id
parkingSpaceIds: [],
parkingSpacesName: '',
psId:'',
carTypes:['月租车','出售车辆'],
date: '2020-01-01',
endDate:'2020-01-01',
//
carTypes: ['家用小汽车', '客车', '货车'],
carTypeCodes: ['9901', '9902', '9903'],
carTypeCode: '',
carTypeName: '',
rentTypes: ['出售车辆', '月租车'],
rentTypeCodes: ['H', 'S'],
rentTypeCode: '',
rentTypeName: '',
page: 1,
row: 20,
};
@ -91,8 +119,15 @@
let _this = this;
context.getOwner(function(_owner) {
_this.communityId = _owner.communityId;
_this.ownerId = _owner.memberId;
_this.userId = _owner.userId;
_this.listParkingSpace();
});
let param = {
"communityId":_this.communityId
}
getProperty().then(function(res){
_this.storeId = res.storeId
});
},
@ -129,9 +164,122 @@
this.psId = this.parkingSpaceIds[checkInIndex];
this.parkingSpacesName = this.parkingSpaces[checkInIndex];
},
DateChange(e) {
this.date = e.detail.value
endDateChange: function(e) {
this.endate = e.detail.value
},
//
chooseCarTypes: function(e) {
let index = e.target.value;
this.carTypeCode = this.carTypeCodes[index];
this.carTypeName = this.carTypes[index];
},
chooseRentTypes: function(e) {
let index = e.target.value;
this.rentTypeCode = this.rentTypeCodes[index];
this.rentTypeName = this.rentTypes[index];
},
startDateChange: function(e) {
this.startDate = e.detail.value
},
submitApply:function(){
let obj = {
"psId": this.psId,
"carNum": this.carNum,
"carBrand": this.carBrand,
"carColor": this.carColor,
"remark": this.remark,
"startTime": this.startDate,
"endTime": this.endDate,
"carType":this.carTypeCode,
"carNumType":this.rentTypeCode,
"communityId":this.communityId,
"ownerId":this.ownerId,
"storeId":this.storeId,
"userId":this.userId
};
let msg = "";
if (obj.psId == "") {
msg = "请选择空闲车位";
} else if (obj.carNum == "") {
msg = "请填写车牌号";
} else if (obj.carBrand == "") {
msg = "请填写车辆品牌";
} else if (obj.carColor == "") {
msg = "请填写车辆颜色";
}else if(obj.carType == ""){
msg = "请选择车辆类型";
}else if(obj.carNumType == ''){
msg = "请选择租用类型";
}
if(obj.rentTypeCode == 'S'){
if(obj.startTime == '2020-01-01'){
msg = "请选择租用开始日期";
}
if(obj.endTime == '2020-01-01'){
msg = "请选择租用结束日期";
}
}
if(obj.rentTypeCode == 'H'){
obj.startTime = '';
obj.endTime = '';
}
if(msg != ""){
wx.showToast({
title: msg,
icon: 'none',
duration: 2000
});
return;
}
context.request({
url: constant.url.saveOwnerCar,
header: context.getHeaders(),
method: "POST",
data: obj,
success: function(res) {
let _json = res.data;
if (_json.code == 0) {
wx.showToast({
title: "提交成功",
icon: 'none',
duration: 2000
})
uni.navigateBack({})
// wx.redirectTo({
// url: '/pages/complaintList/complaintList',
// });
return;
}
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
});
}
});
}
}
};
</script>