| | |
| | | data: { |
| | | name: '', |
| | | phone: '', |
| | | city: '', |
| | | |
| | | showAreaList: false, |
| | | areaList: [], |
| | | addr: {}, |
| | | fieldNames: { |
| | | text: 'name', |
| | | value: 'id', |
| | | children: 'children', |
| | | }, |
| | | cascaderValue: '', |
| | | |
| | | DESIGN_BANNER: '', |
| | |
| | | onSubmit() { |
| | | const { |
| | | name, |
| | | phone |
| | | phone, |
| | | addr |
| | | } = this.data |
| | | if (!name) return wx.showToast({ |
| | | title: '请输入姓名', |
| | |
| | | title: '请输入联系电话', |
| | | icon: 'none' |
| | | }) |
| | | if (phone.length !== 11) return wx.showToast({ |
| | | title: '请输入正确的联系电话', |
| | | icon: 'none' |
| | | }) |
| | | if (!addr.areaCode || !addr.cityCode) return wx.showToast({ |
| | | title: '请选择城市', |
| | | icon: 'none' |
| | | }) |
| | | saveFreeCustomizationApply({ |
| | | name, |
| | | phone |
| | | phone, |
| | | ...addr |
| | | }).then(res => { |
| | | wx.showToast({ |
| | | title: '报名成功' |
| | | }) |
| | | |
| | | wx.switchTab({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | }) |
| | | }, |
| | | // 显示切换城市弹窗 |
| | | // 显示城市弹窗 |
| | | chooseCity () { |
| | | this.setData({ showAreaList: !this.data.showAreaList }) |
| | | console.log('chooseCity', chooseCity); |
| | | console.log('chooseCity', this.data.showAreaList); |
| | | }, |
| | | // 切换城市 |
| | | confirmChange(e) { |
| | | let { |
| | | values |
| | | } = e.detail |
| | | let region = [] |
| | | for (let i in values) { |
| | | region.push(values[i].name) |
| | | onFinish(e) { |
| | | const { selectedOptions, value } = e.detail; |
| | | const addr = { |
| | | provinceCode: selectedOptions[0].id, |
| | | provinceName: selectedOptions[0].name, |
| | | cityCode: selectedOptions[1].id, |
| | | cityName: selectedOptions[1].name, |
| | | areaCode: selectedOptions[2].id, |
| | | areaName: selectedOptions[2].name, |
| | | } |
| | | this.setData({ |
| | | region, |
| | | cityCode: values[1].code |
| | | }) |
| | | this.getShopList() |
| | | this.chooseCity() |
| | | this.setData({ addr, showAreaList: false }) |
| | | console.log('selectedOptions', addr); |
| | | }, |
| | | onFinish() { |
| | | |
| | | positionChange (e) { |
| | | console.log(e.detail.value) |
| | | const names = e.detail.value |
| | | const codes = e.detail.code |
| | | let addr = { |
| | | provinceCode: codes[0] + '00', |
| | | provinceName: names[0], |
| | | cityCode: codes[1] + '00', |
| | | cityName: names[1], |
| | | areaCode: codes[2] + '00', |
| | | areaName: names[2], |
| | | } |
| | | this.setData({ addr }) |
| | | }, |
| | | bindRegionChange(e) { |
| | | console.log('picker发送选择改变,携带值为', e.detail.value) |
| | | const temp = e.detail.value |
| | | this.setData({ |
| | | region: e.detail.value |
| | | }) |
| | | }, |
| | | onClose() { |
| | | this.setData({ showAreaList: false }) |