From a727f90eaff2b01ce45d22b8db36ec57f4cce0ff Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 2 Jan 2020 23:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=AE=8C=E6=88=90=E9=92=A5?= =?UTF-8?q?=E5=8C=99=E7=94=B3=E8=AF=B7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- constant/UrlConstant.js | 7 +- .../applicationKeyUser/applicationKeyUser.js | 25 ++++++- .../viewApplicationKeyUser.js | 75 ++++++++++++++++++- .../viewApplicationKeyUser.wxml | 14 +--- 5 files changed, 106 insertions(+), 18 deletions(-) diff --git a/app.json b/app.json index b57c0e3..8023b6b 100644 --- a/app.json +++ b/app.json @@ -75,8 +75,7 @@ "van-uploader": "lib/uploader/index", "van-row": "lib/row/index", "van-col": "lib/col/index", - "van-datetime-picker": "lib/datetime-picker/index", - "van-image": "lib/image/index" + "van-datetime-picker": "lib/datetime-picker/index" }, "sitemapLocation": "sitemap.json" diff --git a/constant/UrlConstant.js b/constant/UrlConstant.js index 4700529..47b2446 100644 --- a/constant/UrlConstant.js +++ b/constant/UrlConstant.js @@ -39,8 +39,12 @@ const queryAppUserBindingOwner = baseUrl + 'app/owner.listAppUserBindingOwners'; //查询业主门禁 const listOwnerMachines = baseUrl + 'app/owner.listOwnerMachines'; +// 申请钥匙 const applyApplicationKey = baseUrl +"app/applicationKey.applyApplicationKey"; +//查询钥匙 +const listApplicationKeys = baseUrl +"applicationKey.listApplicationKeys"; + module.exports = { baseUrl: baseUrl, @@ -56,5 +60,6 @@ module.exports = { listComplaints: listComplaints, appUserUnBindingOwner: appUserUnBindingOwner, listOwnerMachines: listOwnerMachines, - applyApplicationKey: applyApplicationKey + applyApplicationKey: applyApplicationKey, + listApplicationKeys: listApplicationKeys }; \ No newline at end of file diff --git a/pages/applicationKeyUser/applicationKeyUser.js b/pages/applicationKeyUser/applicationKeyUser.js index 0d68bd4..1710d99 100644 --- a/pages/applicationKeyUser/applicationKeyUser.js +++ b/pages/applicationKeyUser/applicationKeyUser.js @@ -3,6 +3,7 @@ const context = require('../../context/Java110Context.js'); const util = context.util; const factory = context.factory; +const constant = context.constant; Page({ @@ -234,9 +235,17 @@ Page({ startTime: this.data.startTime, endTime: this.data.endTime, tel: this.data.tel, - photos: this.data.photos, - msgCode: this.data.msgCode + photos: [], + msgCode: this.data.msgCode, + communityId: this.data.communityId, + machineIds:[], + typeFlag:'1100102' }; + let _photos = this.data.photos; + _photos.forEach(function (_item) { + _objData.photos.push({ "photo": _item }); + }); + let msg = ''; if(_objData.name == ''){ msg = '请填写名称'; @@ -271,6 +280,10 @@ Page({ msg = "请填写验证码" } + if (this.data.locations == null || this.data.locations.length <1){ + msg = "没有设备可申请钥匙"; + } + if(msg != ''){ wx.showToast({ title: msg, @@ -279,6 +292,12 @@ Page({ }); return ; } + + this.data.locations.forEach(function(_item){ + _objData.machineIds.push({"machineId":_item.machineId}); + }); + + console.log(_objData); @@ -292,7 +311,7 @@ Page({ if(res.resultCode == 200){ //成功情况下跳转 wx.redirectTo({ - url: "/pages/viewApplicationKeyUser/viewApplicationKeyUser" + url: "/pages/viewApplicationKeyUser/viewApplicationKeyUser?idCard=" + _objData.idCard }); return ; } diff --git a/pages/viewApplicationKeyUser/viewApplicationKeyUser.js b/pages/viewApplicationKeyUser/viewApplicationKeyUser.js index 02bb3af..1471bfc 100644 --- a/pages/viewApplicationKeyUser/viewApplicationKeyUser.js +++ b/pages/viewApplicationKeyUser/viewApplicationKeyUser.js @@ -22,20 +22,26 @@ Page({ desc: '' } ], + active:0, + applicationKeyId:'', name:'', age:0, sex:'', typeCdName:'', idCard:'', - expiry:'', + startTime:null, + endTime: null, tel:'', - photoList:[] + stateName:'' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + this.setData({ + idCard: options.idCard + }); }, @@ -86,5 +92,70 @@ Page({ */ onShareAppMessage: function () { + }, + + loadApplicationKey:function(){ + + let _that = this; + let _objData = { + page : 1, + row : 1, + idCard : this.data.idCard + } + context.request({ + url: constant.url.listApplicationKeys, + header: context.getHeaders(), + method: "GET", + data: _objData, //动态数据 + success: function (res) { + console.log(res); + if (res.resultCode == 200) { + //成功情况下跳转 + let _applicationKeys = res.data.applicationKeys; + if (_applicationKeys.length == 0){ + wx.showToast({ + title: "未查询到钥匙", + icon: 'none', + duration: 2000 + }); + return ; + } + + let _applicationKey = _applicationKeys[0]; + let _active = '0'; + if (_applicationKey.state == '10001'){ + _active = '2'; + } else if (_applicationKey.state == '10002') { + _active = '2'; + }else{ + _active = '1'; + } + _that.setData({ + applicationKeyId: _applicationKey.applicationKeyId, + name: _applicationKey.name, + age: _applicationKey.age, + sex: _applicationKey.sex, + typeCdName: _applicationKey.typeCd, + idCard: _applicationKey.idCard, + startTime: _applicationKey.startTime, + endTime: _applicationKey.endTime, + tel: _applicationKey.tel, + active: _active, + stateName: stateName + }); + + + + + } + }, + fail: function (e) { + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }) + } + }); } }) \ No newline at end of file diff --git a/pages/viewApplicationKeyUser/viewApplicationKeyUser.wxml b/pages/viewApplicationKeyUser/viewApplicationKeyUser.wxml index d4960a4..1930711 100644 --- a/pages/viewApplicationKeyUser/viewApplicationKeyUser.wxml +++ b/pages/viewApplicationKeyUser/viewApplicationKeyUser.wxml @@ -5,6 +5,8 @@ /> 业主信息 + + @@ -14,17 +16,9 @@ - + + - 证件照片 - - - - - 身份证正反面 - - -