const api = require('../../../utils/api.js'); const login = require('../../../utils/index.js'); Page({ /** * 页面的初始数据 */ data: { img:[], index: 0, tabindex: 0, codeType: ['身份证', '士官证', '港澳台居住证'], sbCodeIndex:0, lxCodeIndex:0, mask: false, imgList:[], image:[], dis: false, disabled:true, items: [ { name: 'pickUp', value: '自取',checked: 'true' }, { name: 'post', value: '邮寄' }, ], textaddress:true }, blur:function(e){ this.setData({ youjiaddress: e.detail.value, textaddress: true }) }, addresstext:function(e){ this.setData({ textaddress:false }) }, scroll:function(e){ console.log(e) }, kindToggle: function (e) { let that = this if (that.data.expand ===e.currentTarget.dataset.value){ that.setData({ dis: false, expand: e.currentTarget.dataset.value, }) that.data.expand='' }else{ that.setData({ dis: true, expand: e.currentTarget.dataset.value, }) } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that=this that.data.flag=options.flag if(options.search){ that.data.search = options.search } wx.request({ url: api.guide, data: { unid:options.unid,userId:wx.getStorageSync('userId')}, success(res){ let levelList=[] for (var i = 0; i < res.data.data.preService.preServiceMaterialList.length;i++){ if (res.data.data.preService.preServiceMaterialList[i].importLevel=='2'){ that.data.image.push('') levelList.push(res.data.data.preService.preServiceMaterialList[i]) } } res.data.data.preService.preServiceMaterialList=levelList that.setData({ server:res.data.data, search: options.search == 1 ? true:false }) } }) var query = wx.createSelectorQuery(); query.select('.tab').boundingClientRect(); query.select('.flxed-bottom').boundingClientRect(); query.exec(function (res) { that.data.topHeight = res[0].height that.data.flexHeight = res[1].height wx.getSystemInfo({ success: function (res) { that.data.oldHeight = res.windowHeight - that.data.topHeight - that.data.flexHeight that.setData({ clientHeight: res.windowHeight - that.data.topHeight - that.data.flexHeight }); } }) }) }, //提交表单 formData:function(e){ let that=this if (!that.setInput()){ wx.showToast({ title: '请完善表单信息', icon:'none' }) return false; } for(let i=0;i0){ that.data.server.preService.preServiceMaterialList[e.target.dataset.index].isSet = 1 }else{ that.data.server.preService.preServiceMaterialList[e.target.dataset.index].isSet = 0 } that.setData({ image: that.data.img, ['server.preService.preServiceMaterialList']: that.data.server.preService.preServiceMaterialList }) }, applyname: function (e) { e.detail.value ? this.data.applyname = true : false this.setData({ applyname: e.detail.value }) }, applyCardnumber: function (e) { e.detail.value ? this.data.applyCardnumber = true : false this.setData({ applyCardnumber: e.detail.value }) }, contactman:function(e){ e.detail.value?this.data.contactman=true:false this.setData({ contactman: e.detail.value }) }, contactmanCardnumber:function(e){ e.detail.value ? this.data.contactmanCardnumber = true : false this.setData({ contactmanCardnumber: e.detail.value }) }, telphone:function(e){ e.detail.value ? this.data.telphone = true : false this.setData({ telphone: e.detail.value }) }, postcode:function(e){ this.setData({ postcode: e.detail.value }) }, address:function(e){ this.setData({ address: e.detail.value }) }, remark: function (e) { this.setData({ remark: e.detail.value }) }, setInput(){ if (this.data.contactman && this.data.contactmanCardnumber && this.data.telphone){ return true }else{ return false } }, //切换自取、邮寄 radioChange: function (e) { this.data.mode=e.detail.value if (e.detail.value=='pickUp'){ this.setData({ modeInput: false, ['items[0].checked']: true }) } else if (e.detail.value =='post'){ this.setData({ modeInput: true, ['items[1].checked']:true }) } }, // 打开遮罩层 mask: function () { let that = this; that.setData({ mask: true }) }, // 关闭遮罩层 clear: function () { let that = this; that.setData({ mask: false }) }, // 确认申报 submit: function () { wx.navigateTo({ url: '../success/success', }) }, // 申报人证件类型 bindSbCodeChange: function (e) { this.setData({ codeIndex: e.detail.value }) }, // 联系人证件类型 bindLxCodeChange: function (e) { this.setData({ lxCodeIndex: e.detail.value }) }, // tab切换 tab: function (e) { let that = this if (that.setInput()) { that.setData({ index: e.currentTarget.dataset.index, current_index: e.currentTarget.dataset.index, setInput: true }) } else { that.setData({ index: e.currentTarget.dataset.index, current_index: e.currentTarget.dataset.index, setInput: false }) } if(e.currentTarget.dataset.index==3){ var query = wx.createSelectorQuery(); query.select('.tab').boundingClientRect(); query.select('.flxed-bottom1').boundingClientRect(); query.exec(function (res) { that.data.topHeight = res[0].height that.data.flexHeight = res[1].height wx.getSystemInfo({ success: function (res) { that.setData({ clientHeight: res.windowHeight - that.data.topHeight - that.data.flexHeight }); } }) }) }else{ that.setData({ clientHeight:that.data.oldHeight }) } }, change: function (e) { var that=this if (that.setInput()) { that.setData({ index: e.detail.current, setInput: true }) } else { that.setData({ index: e.detail.current, setInput: false }) } }, // 下一步 next: function () { let that = this that.setData({ index: that.data.index + 1, current_index: that.data.index + 1 }) }, // 上一步 up: function () { let that = this that.setData({ index: that.data.index - 1, current_index: that.data.index - 1 }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })