qingcheng-xiaochengxu/pages/woyaojiedan/woyaojiedan.js
2025-05-15 09:40:36 +08:00

66 lines
1.4 KiB
JavaScript

import {url} from '../../request'
Page({
data: {
},
onLoad(options){
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
})
}else{
wx.showToast({
title: res.data.message,
icon: 'error',
duration: 2000
})
}
},
fail(err) {
console.error('请求失败', err);
}
});
}
})
},
})