// pages/recruit/referto/referto.js Page({ /** * 页面的初始数据 */ data: { enrollData : '', paySuccess : false, experienceId: '', typesArr : [], typesIndex : 0, refertoStatus: false, checkStatus : false, // 市级选择 cityArr : [], cityId : 0, cityIndex : 0, // 区域选择 regiArr : [], regiId : 0, regiIndex : 0 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ experienceId: options.id }) // 编辑报名前置接口 this.eitInfo(options.id); }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 申请前置接口 */ eitInfo(id) { wx.$api.recruit.Edit(id).then(res => { let typeValue = res.data.types.findIndex(val=> val.experience_type_id == res.data.enroll.experience_type.experience_type_id), cityValue = res.data.areas.findIndex(val=> val.city_id == res.data.enroll.experience_area.city_id) this.setData({ enrollData: res.data.enroll, typesIndex: typeValue, cityIndex : cityValue, typesArr : res.data.types, cityArr : res.data.areas, }) }).catch(err => {}) }, /** * 市级下拉筛选 */ cityDrop(e) { let city = this.data.cityArr, index = e.detail.value, citycode = city[index].city_id if (index != this.data.cityIndex) { this.setData({ cityIndex : index, cityId : citycode }) } }, /** * 体验内容筛选 */ tasteDrop(e) { let newIndex = e.detail.value this.setData({ typesIndex : newIndex }) }, /** * 提交表单 */ siteform(e) { let value = e.detail.value let data = { name : value.name, address : value.address, experience_type_id : this.data.typesArr[this.data.typesIndex].experience_type_id } this.setData({ disabled: true }) wx.$api.recruit.EditPut(this.data.enrollData.experience_area_enroll_id,data).then(res => { this.setData({ checkStatus: true }) }).catch(() =>{ this.setData({ disabled: false }) }) }, /** * 关闭弹框,跳转首页 */ refertoTap() { this.setData({ refertoStatus: false }) wx.switchTab({ url: '/pages/recruit/index' }) }, /** * 申请体验官成功后,弹出 */ checkTap() { this.setData({ checkStatus: false }) wx.switchTab({ url: '/pages/recruit/index' }) } })