From 2747358e0d6051456b9a868c5fb03cc2dd1d8bf6 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 16 Jan 2023 13:07:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/itemRelease/itemReleaseApi.js | 30 +++ constant/url.js | 1 + pages.json | 9 + pages/itemRelease/addItemReleaseResource.vue | 22 ++ pages/itemRelease/itemRelease.vue | 245 +++++-------------- 5 files changed, 120 insertions(+), 187 deletions(-) create mode 100644 api/itemRelease/itemReleaseApi.js create mode 100644 pages/itemRelease/addItemReleaseResource.vue diff --git a/api/itemRelease/itemReleaseApi.js b/api/itemRelease/itemReleaseApi.js new file mode 100644 index 0000000..ed88a67 --- /dev/null +++ b/api/itemRelease/itemReleaseApi.js @@ -0,0 +1,30 @@ +import { + requestNoAuth,request +} from '../../lib/java110/java110Request.js'; +import + url + from '../../constant/url.js'; + + + export function getItemReleaseType(dataObj) { + return new Promise( + (resolve, reject) => { + request({ + url: url.listItemReleaseType, + method: "GET", + data: dataObj, + //动态数据 + success: function(res) { + if (res.data.code == 0) { + let _data = res.data.data; + resolve(_data); + return ; + } + reject('未包含数据'); + }, + fail: function(e) { + reject(e); + } + }); + }) + } \ No newline at end of file diff --git a/constant/url.js b/constant/url.js index 85ece7c..e7de5bc 100755 --- a/constant/url.js +++ b/constant/url.js @@ -188,6 +188,7 @@ export default { listProductGroup: baseUrl + "app/productGroup.listProductGroup", listRegisterProtocol: baseUrl + "app/system.listRegisterProtocol", queryCurrentOwner: baseUrl + "app/owner.queryCurrentOwner", + listItemReleaseType: baseUrl+"app/itemRelease.listItemReleaseType", NEED_NOT_LOGIN_PAGE: [ 'pages/login/login', diff --git a/pages.json b/pages.json index b83dafc..9ef2fd0 100755 --- a/pages.json +++ b/pages.json @@ -730,6 +730,15 @@ } } + ,{ + "path" : "pages/itemRelease/addItemReleaseResource", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } ], "tabBar": { "color": "#272636", diff --git a/pages/itemRelease/addItemReleaseResource.vue b/pages/itemRelease/addItemReleaseResource.vue new file mode 100644 index 0000000..8183fd0 --- /dev/null +++ b/pages/itemRelease/addItemReleaseResource.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/itemRelease/itemRelease.vue b/pages/itemRelease/itemRelease.vue index b9b5ca4..6c267e5 100644 --- a/pages/itemRelease/itemRelease.vue +++ b/pages/itemRelease/itemRelease.vue @@ -2,28 +2,36 @@ 基础信息 - 报修类型 - + 放行类型 + - {{repairTypes.length==0 ? "请选择" : repairTypes[repairTypeIndex].repairTypeName}} + {{itemReleaseTypes.length==0 ? "请选择" : itemReleaseTypes[typeId].typeName}} - - 收费标准 - + + 申请单位 + - 报修人 - + 申请人 + 手机号 - + + + + 身份证 + + + + 车牌号 + - 预约日期 + 通行日期 {{bindDate}} @@ -31,23 +39,20 @@ - 预约时间 + 通行时间 {{bindTime}} - - + + 放行物品 + 请添加 + + + - - 相关图片 - - - - @@ -62,7 +67,10 @@ import { checkPhoneNumber, checkStrLength - } from '../../lib/java110/utils/StringUtil.js' + } from '../../lib/java110/utils/StringUtil.js'; + + import {getItemReleaseType} from '../../api/itemRelease/itemReleaseApi.js'; + import {getCurOwner} from '../../api/owner/ownerApi.js'; import context from '../../lib/java110/Java110Context.js' const constant = context.constant; const factory = context.factory; @@ -74,6 +82,8 @@ export default { data() { return { + bindDate: '请选择', + bindTime: '请选择', typeId: '', applyCompany: '', applyPerson: '', @@ -85,6 +95,7 @@ carNum: '', remark: '', itemReleaseTypes: [], + typeIndex:0, communityId:'', todayDate:'', todayDateTime:'', @@ -106,58 +117,22 @@ onLoad: function(options) { let that = this; context.onLoad(options); - context.getRooms().then(res => { - that.userId = res.data.owner.userId; - that.applyCompany = res.data.owner.appUserName; - that.applyPerson = that.userName; - that.applyTel = res.data.owner.link; - that.communityId = res.data.owner.communityId; + getCurOwner().then(_data=>{ + that.userId = _data.userId; + that.applyCompany = _data.appUserName; + that.applyPerson = _data.appUserName; + that.applyTel = _data.link; + that.communityId = _data.communityId; + }).then(()=>{ + //加载报修类型 + that._loadTypes(); }); - //加载报修类型 - this._loadRepairTypes(); + this.todayDate = formatDate(new Date()); this.todayDateTime = formatHourAndMin(new Date()) }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() {}, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - let _floor = uni.getStorageSync("_selectFloor"); - - if (_floor != null && _floor != undefined && _floor != '') { - this.floorNum = _floor.floorNum + "栋"; - this.floorId = _floor.floorId; - } - - let _unit = uni.getStorageSync("_selectUnit"); - if (_unit != null && _unit != undefined && _unit != '') { - this.unitNum = _unit.unitNum + "单元"; - this.unitId = _unit.unitId; - } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() {}, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - //清理楼栋和单元 - uni.removeStorageSync('_selectFloor'); - uni.removeStorageSync('_unitFloor'); - - }, - /** * 页面相关事件处理函数--监听用户下拉动作 */ @@ -173,14 +148,6 @@ */ onShareAppMessage: function() {}, methods: { - sendImagesData: function(e) { - this.photos = []; - if (e.length > 0) { - e.forEach((img) => { - this.photos.push(img.fileId); - }) - } - }, formatter(type, value) { if (type === 'year') { return `${value}年`; @@ -191,11 +158,7 @@ } return value; }, - - submitRepair: function(e) { - - let obj = { "repairName": this.bindRepairName, "repairType": this.repairType, @@ -226,13 +189,6 @@ obj.repairObjId = this.roomId; obj.repairObjName = this.roomName; } - - // let _photos = this.photos; - // _photos.forEach(function(_item) { - // obj.photos.push({ - // "photo": _item - // }); - // }); // 预约时间校验 let oppoTime = Date.parse(new Date(obj.appointmentTime.replace(/-/g, '/'))), now = Date.parse(new Date()); @@ -258,7 +214,6 @@ } else if (obj.repairObjId == '') { msg = "请选择报修位置"; } - if (msg != "") { wx.showToast({ title: msg, @@ -300,51 +255,17 @@ } }, - afterRead: function(event) { - const { - file - } = event.detail; - - let _that = this; - - const { - photoList = [] - } = this; - photoList.push(file); - this.photoList = photoList; - - factory.base64.urlTobase64(file.path).then(function(_baseInfo) { - _that.photos.push(_baseInfo); - }); - }, - roomChange: function(e) { - this.roomId = this.roomIdArr[e.detail.value]; - this.roomName = this.roomCloums[e.detail.value]; - }, - repairScopeChange: function(e) { - this.repairScopeIndex = e.target.value //取其下标 - let selected = this.repairScopes[this.repairScopeIndex] //获取选中的数组 - this.repairObjType = selected.id //选中的id - this._loadRepairTypes(); - }, repairChange: function(e) { this.typeName = this.columns[e.detail.value]; this.typeId = this.repairIdAttr[e.detail.value]; }, repairTypeChange: function(e) { - this.repairTypeIndex = e.target.value //取其下标 - let selected = this.repairTypes[this.repairTypeIndex] //获取选中的数组 + this.typeIndex = e.target.value //取其下标 + let selected = this.itemReleaseTypes[this.typeIndex] //获取选中的数组 if (selected == undefined) { return; } - this.repairType = selected.repairType //选中的id - let _payFeeFlag = selected.payFeeFlag; - - if (_payFeeFlag == 'T') { - this.priceScope = selected.priceScope; - } else { - this.priceScope = ''; - } + this.typeId = selected.typeId //选中的id }, dateChange: function(e) { @@ -358,69 +279,19 @@ timeChange: function(e) { this.bindTime = e.detail.value; }, - chooseFloor: function(e) { - context.navigateTo({ - url: '/pages/selectFloor/selectFloor' - }); - }, - chooseUnit: function(e) { - if (this.floorId == null || this.floorId == '') { - uni.showToast({ - title: "请先选择楼栋" - }); - return; - } - context.navigateTo({ - url: '/pages/selectUnit/selectUnit?floorId=' + this.floorId - }); - }, - _loadRepairTypes: function() { - let _communityInfo = context.getCurrentCommunity(); + _loadTypes: function() { let _that = this; - // 公共区域标识 - let publicArea = _that.repairObjType == '004' ? 'F' : 'T'; - // 默认选择第一个 - _that.repairTypeIndex = 0; - let dataObj = { - page: 1, - row: 50, - communityId: _communityInfo.communityId, - publicArea: publicArea - }; - uni.request({ - url: constant.url.listRepairSettings, - header: context.getHeaders(), - method: "GET", - data: dataObj, - //动态数据 - success: function(res) { - let _json = res.data; - if (_json.code == 0 && _json.data.length > 0) { - _that.repairTypes = _json.data; - - let selected = _that.repairTypes[_that.repairTypeIndex] //获取选中的数组 - _that.repairType = selected.repairType //选中的id - let _payFeeFlag = selected.payFeeFlag; - - if (_payFeeFlag == 'T') { - _that.priceScope = selected.priceScope; - } else { - _that.priceScope = ''; - } - } else { - uni.showToast({ - icon: "none", - title: "未配置报修设置" - }) - } - }, - fail: function(e) { - wx.showToast({ - title: "服务器异常了", - icon: 'none', - duration: 2000 - }); - } + getItemReleaseType({ + page:1, + row:100, + communityId:this.communityId + }).then(_data=>{ + _that.itemReleaseTypes = _data; + }) + }, + _addRes:function(){ + uni.navigateTo({ + url:'/pages/itemRelease/addItemReleaseResource' }); }