import {url} from '../../request' const { checkLogin } = require('../../utils/logcheck'); Page({ data: { }, onLoad(options){ checkLogin(); const id = options.id this.setData({ id:id }) }, name(e){ this.setData({ name:e.detail.value }) console.log(e.detail.value); }, phone(e){ this.setData({ phone:e.detail.value }) console.log(e.detail.value); }, submit(){ const that = this wx.getStorage({ key: "logmessage", success(res) { const userinfo = res.data.Authorization wx.request({ url: url + '/promoCodeApply/apply', method: 'POST', data: { "salespersonName": that.data.name, "salespersonPhone": that.data.phone, "projectId": that.data.id }, header: { 'content-type': 'application/json', 'Authorization': userinfo }, success(res) { console.log('提交成功', res); if(res.data.code==1){ wx.showToast({ title: res.data.message, icon: 'sucess', duration: 2000 }) wx.navigateBack({ delta: 1 }) }else{ wx.showToast({ title: res.data.message, icon: 'error', duration: 2000 }) } }, fail(err) { console.error('请求失败', err); } }); } }) }, })