From 9a3019f0ad7cad3c4409111b3da65b4c52623ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=88=90?= <121184950@qq.com> Date: Fri, 25 Sep 2020 11:26:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E4=BD=8D=E7=94=B3=E8=AF=B7=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- constant/UrlConstant.js | 5 +- pages/applyparking/applyparking.vue | 214 +++++++++++++++++++++++----- 2 files changed, 185 insertions(+), 34 deletions(-) diff --git a/constant/UrlConstant.js b/constant/UrlConstant.js index cf510e5..80363d0 100644 --- a/constant/UrlConstant.js +++ b/constant/UrlConstant.js @@ -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 }; diff --git a/pages/applyparking/applyparking.vue b/pages/applyparking/applyparking.vue index 6c0b098..5693d80 100644 --- a/pages/applyparking/applyparking.vue +++ b/pages/applyparking/applyparking.vue @@ -10,56 +10,64 @@ 车牌号 - + 品牌 - + 颜色 - + - + - 类型 - + 车辆类型 + - {{parkingSpacesName?parkingSpacesName:'请选择'}} + {{carTypeName?carTypeName:'请选择'}} - + + + 租用类型 + + + {{rentTypeName?rentTypeName:'请选择'}} + + + + + 起租日期 - + - {{date}} + {{startDate}} - - + + 结组日期 - + - {{date}} + {{endDate}} - + 备注信息 - + - - - + @@ -69,20 +77,40 @@ const context = require("../../context/Java110Context.js"); 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', + parkingSpaceIds: [], + parkingSpacesName: '', + + //车辆类型 + carTypes: ['家用小汽车', '客车', '货车'], + carTypeCodes: ['9901', '9902', '9903'], + carTypeCode: '', + carTypeName: '', + + rentTypes: ['出售车辆', '月租车'], + rentTypeCodes: ['H', 'S'], + rentTypeCode: '', + rentTypeName: '', + + page: 1, row: 20, }; @@ -91,10 +119,17 @@ 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 + }); + }, methods: { listParkingSpace: function() { @@ -106,7 +141,7 @@ "page": this.page, "row": this.row, "communityId": this.communityId, - "state":'F' + "state": 'F' }, success: (res) => { let arr = res.data.parkingSpaces; @@ -124,14 +159,127 @@ } }); }, - choosePickerSpace:function(e){ + choosePickerSpace: function(e) { let checkInIndex = e.target.value; 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 + }); + } + }); + + + + + } } };