const WxParse = require('../../wxParse/wxParse.js') const $ = global new $.Page({ onLoad(options) { if (!options.id) { return $.wx.showToast({ title: '找不到对应id' }); } $.request(`server_info/${options.id}`, 'GET', {}).then((res) => { var article = res.data && res.data.content || ''; const fields = res.data.fields || []; const options = []; WxParse.wxParse('article', 'html', article, this, 5); for (let item of fields) { const group = item.input_group; options.push(group[0].value || ''); } this.setData({ banner: res.data.photo || '', fields, options }); }); }, bookServer() { const { name, phone, address, notes } = this.data; if (!name || !phone || !address) { return $.wx.showToast({ title: '请把信息填写完整' }); } if (!this._isPhone(phone)) { return $.wx.showToast({ title: '请输入正确的手机号码' }); } $.wx.showToast({ title: '加载中' }, 'loading'); $.request('housekeeper_order/store', 'POST', { contents: '保洁服务', people_num: '1-2人', notes, server_time: '白天', address, rest: '晚上', area: '60-120平', contact: name, phone }).then((res) => { $.wx.hideToast('loading'); $.router.goto({ path: '/pages/order/index', type: $.ROUTER_TYPE.SWITCH_TAB }); }); }, radioChange(e) { const { index } = e.currentTarget.dataset || 0; const { value } = e.detail; const { options } = this.data; options[index] = value; this.setData({ options }); } })