| | |
| | | // pages/design/design.js |
| | | import { |
| | | getDictData, |
| | | saveFreeCustomizationApply |
| | | } from '../../api/index' |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | data: { |
| | | name: '', |
| | | phone: '', |
| | | city: '' |
| | | city: '', |
| | | |
| | | showAreaList: false, |
| | | areaList: [], |
| | | DESIGN_BANNER: '', |
| | | WechatIMG558: '', |
| | | }, |
| | | onLoad(options) { |
| | | |
| | | this.initData() |
| | | }, |
| | | |
| | | onSubmit() { |
| | | console.log('dd', this.data.name); |
| | | console.log('dd', this.data.phone); |
| | | }, |
| | | selAddress() { |
| | | console.log('点击了'); |
| | | wx.chooseLocation({ |
| | | type: 'wgs84', |
| | | success: (res)=> { |
| | | this.setData({ |
| | | city: res.name |
| | | const { |
| | | name, |
| | | phone |
| | | } = this.data |
| | | if (!name) return wx.showToast({ |
| | | title: '请输入姓名', |
| | | icon: 'none' |
| | | }) |
| | | console.log('res', res); |
| | | if (!phone) return wx.showToast({ |
| | | title: '请输入联系电话', |
| | | icon: 'none' |
| | | }) |
| | | saveFreeCustomizationApply({ |
| | | name, |
| | | phone |
| | | }).then(res => { |
| | | wx.showToast({ |
| | | title: '报名成功' |
| | | }) |
| | | |
| | | }) |
| | | }, |
| | | // 显示切换城市弹窗 |
| | | chooseCity () { |
| | | this.setData({ showAreaList: !this.data.showAreaList }) |
| | | }, |
| | | // 切换城市 |
| | | confirmChange(e) { |
| | | let { |
| | | values |
| | | } = e.detail |
| | | let region = [] |
| | | for (let i in values) { |
| | | region.push(values[i].name) |
| | | } |
| | | this.setData({ |
| | | region, |
| | | cityCode: values[1].code |
| | | }) |
| | | this.getShopList() |
| | | this.chooseCity() |
| | | }, |
| | | initData() { |
| | | getDictData({ |
| | | code: 'WEIXIN_DEFAULT_IMGS', |
| | | label: 'DESIGN_BANNER' |
| | | }).then(res => { |
| | | this.setData({ |
| | | DESIGN_BANNER: res.data.code |
| | | }) |
| | | }) |
| | | getDictData({ |
| | | code: 'WEIXIN_DEFAULT_IMGS', |
| | | label: 'WechatIMG558' |
| | | }).then(res => { |
| | | this.setData({ |
| | | WechatIMG558: res.data.code |
| | | }) |
| | | }) |
| | | }, |
| | | onReady() { |