体验官修改
This commit is contained in:
@@ -6,22 +6,28 @@ Page({
|
||||
*/
|
||||
data: {
|
||||
notice : '', //地区提示
|
||||
areaData : '', //地区数据
|
||||
paySuccess : false,
|
||||
experienceId: '',
|
||||
typesArr : [],
|
||||
typesIndex : 0,
|
||||
refertoStatus: false,
|
||||
checkStatus : false,
|
||||
|
||||
// 省份选择
|
||||
areasArr : [],
|
||||
areaId : 0,
|
||||
areaIndex : 0,
|
||||
|
||||
// 市级选择
|
||||
cityArr : [],
|
||||
cityId : 0,
|
||||
cityIndex : 0,
|
||||
|
||||
|
||||
// 区域选择
|
||||
regiArr : [],
|
||||
regiId : 0,
|
||||
regiIndex : 0
|
||||
regiIndex : 0,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -33,47 +39,77 @@ Page({
|
||||
})
|
||||
// 获取申请前置接口
|
||||
this.recruitInfo(options.id);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取省市区列表
|
||||
this.createInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
* 省市区列表
|
||||
*/
|
||||
onShow() { },
|
||||
createInfo() {
|
||||
wx.$api.site.create().then(res => {
|
||||
let areas = res.data,
|
||||
areaIndex = this.data.areaIndex
|
||||
|
||||
/**
|
||||
* 申请前置接口
|
||||
*/
|
||||
recruitInfo(id) {
|
||||
wx.$api.recruit.Enroll(id, {
|
||||
experience_area_id: getApp().globalData.experienceAreaId
|
||||
}).then(res => {
|
||||
let areas = [
|
||||
{
|
||||
city: "请选择城市",
|
||||
city_id: null,
|
||||
experience_area_id: null,
|
||||
surplus: null
|
||||
}
|
||||
]
|
||||
this.setData({
|
||||
notice : res.data.experience_notice,
|
||||
typesArr : [{experience_type_id: null, name: "请选择体验内容"}, ...res.data.types],
|
||||
cityArr : [...areas, ...res.data.areas],
|
||||
paySuccess : false
|
||||
})
|
||||
areasArr : areas,
|
||||
areaId : areas[areaIndex].id,
|
||||
|
||||
// 获取区级列表
|
||||
this.regilist(res.data.areas[this.data.cityIndex].city_id)
|
||||
})
|
||||
this.citylist(areas[areaIndex].id)
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 所在省份-下拉
|
||||
*/
|
||||
areasChange(e) {
|
||||
let area = this.data.areasArr,
|
||||
index = e.detail.value,
|
||||
atcode = area[index].id
|
||||
if (index != this.data.areaIndex) {
|
||||
this.setData({
|
||||
areaIndex : index,
|
||||
areaId : atcode
|
||||
})
|
||||
// 获取市级列表
|
||||
this.citylist(atcode)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 市级列表
|
||||
*/
|
||||
citylist(cityId) {
|
||||
wx.$api.site.create({
|
||||
parent_id: cityId
|
||||
}).then(res=>{
|
||||
let cityArr = res.data
|
||||
this.setData({
|
||||
cityId : cityArr[0].id,
|
||||
cityIndex : 0,
|
||||
cityArr : cityArr
|
||||
})
|
||||
|
||||
// 获取区级列表
|
||||
this.regilist(cityArr[0].id)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 市级下拉筛选
|
||||
*/
|
||||
cityDrop(e) {
|
||||
let city = this.data.cityArr,
|
||||
index = e.detail.value,
|
||||
citycode = city[index].city_id
|
||||
citycode = city[index].id
|
||||
if (index != this.data.cityIndex) {
|
||||
this.setData({
|
||||
cityIndex : index,
|
||||
@@ -84,7 +120,7 @@ Page({
|
||||
this.regilist(citycode)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 区列表
|
||||
*/
|
||||
@@ -93,8 +129,8 @@ Page({
|
||||
parent_id: areaId
|
||||
}).then(res=>{
|
||||
this.setData({
|
||||
regiArr : [{id: null, name: "请选择区域", parent_id: null}, ...res.data],
|
||||
regiId : null,
|
||||
regiArr : res.data,
|
||||
regiId : res.data[0].id,
|
||||
regiIndex : 0
|
||||
})
|
||||
})
|
||||
@@ -111,6 +147,22 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 申请前置接口
|
||||
*/
|
||||
recruitInfo(id) {
|
||||
wx.$api.recruit.Enroll(id, {
|
||||
experience_area_id: getApp().globalData.experienceAreaId
|
||||
}).then(res => {
|
||||
this.setData({
|
||||
areaData : res.data.areas,
|
||||
notice : res.data.experience_notice,
|
||||
typesArr : [{experience_type_id: null, name: "请选择体验内容"}, ...res.data.types],
|
||||
paySuccess : false
|
||||
})
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 体验内容筛选
|
||||
*/
|
||||
@@ -127,10 +179,7 @@ Page({
|
||||
siteform(e) {
|
||||
let value = e.detail.value
|
||||
let errMsg = ''
|
||||
// if(this.data.regiId === null) errMsg = "请选择区域"
|
||||
if(this.data.cityId === null || this.data.cityArr[this.data.cityIndex].experience_area_id === null) errMsg = "请选择城市"
|
||||
if(this.data.typesArr[this.data.typesIndex].experience_type_id === null) errMsg = "请选择体验内容"
|
||||
|
||||
if(errMsg != ''){
|
||||
wx.showToast({
|
||||
title: errMsg,
|
||||
@@ -138,16 +187,19 @@ Page({
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let data = {
|
||||
name : value.name,
|
||||
address : value.address,
|
||||
province_id : this.data.areaId,
|
||||
city_id : this.data.cityId,
|
||||
// district_id : this.data.regiId,
|
||||
district_id : this.data.regiId,
|
||||
experience_id : this.data.experienceId,
|
||||
experience_area_id : this.data.cityArr[this.data.cityIndex].experience_area_id,
|
||||
experience_area_id : this.data.areaData.experience_area_id,
|
||||
experience_type_id : this.data.typesArr[this.data.typesIndex].experience_type_id,
|
||||
invite : getApp().globalData.inviteText
|
||||
}
|
||||
console.log(data)
|
||||
this.setData({
|
||||
disabled: true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user