小程序
小游戏
企业微信
微信支付
扫描小程序码分享
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
废话少说,放码过来!
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
上代码
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
废话少说,放码过来!
// 这行代码位置不能放在获取手机号下面
let that = this
if(e.currentTarget.dataset.type !== '2'){
if (!(this.data.phone.length > 9 && this.data.name.length > 0) ){
this.submitAlert()//简单的提示
}else{
that.tijiaoDetail(e)
}
}else{
that.tijiaoDetail(e)
}
},
tijiaoDetail(e){
let that = this
this.setData({
client_type: 2
})
if (!that.data.showPhone) {
this.setData({
phoneshow: true
})
return;
}
var phone = this.data.phone;
var name = this.data.name || null;
var txt = e.currentTarget.dataset.txt || '';
var data = {
building_id: this.data.building_id,
appoint_id: this.data.id,
merchant_id: this.data.merchant_id,
title: this.data.title,
phone: phone,
type: 2,
clue_type: +e.currentTarget.dataset.type
}
if (name) {
data.name = name;
}
// 提交预约
wx.request({
url: app.gData.http2 + '/v1/ytf/wxapp/active_appoint',
data: data,
method: 'post',
header: {
'y-wxapp-jwt': wx.getStorageSync('token')
},
success: (res) => {
if (res.data.error_no == 0) { //预约成功
this.setData({
yuyueshow: true,
});
wx.showToast({
title: txt || res.data.error_msg,
icon: 'success',
time: 1500,
})
} else { // 预约失败
wx.showToast({
title: res.data.error_msg,
icon: 'success',
time: 1500,
})
}
},
fail(err) {}
})
},
上代码
// 这行代码位置不能放在获取手机号下面
let that = this
if(e.currentTarget.dataset.type !== '2'){
if (!(this.data.phone.length > 9 && this.data.name.length > 0) ){
this.submitAlert()//简单的提示
}else{
that.tijiaoDetail(e)
}
}else{
that.tijiaoDetail(e)
}
},
tijiaoDetail(e){
let that = this
this.setData({
client_type: 2
})
if (!that.data.showPhone) {
this.setData({
phoneshow: true
})
return;
}
var phone = this.data.phone;
var name = this.data.name || null;
var txt = e.currentTarget.dataset.txt || '';
var data = {
building_id: this.data.building_id,
appoint_id: this.data.id,
merchant_id: this.data.merchant_id,
title: this.data.title,
phone: phone,
type: 2,
clue_type: +e.currentTarget.dataset.type
}
if (name) {
data.name = name;
}
// 提交预约
wx.request({
url: app.gData.http2 + '/v1/ytf/wxapp/active_appoint',
data: data,
method: 'post',
header: {
'y-wxapp-jwt': wx.getStorageSync('token')
},
success: (res) => {
if (res.data.error_no == 0) { //预约成功
this.setData({
yuyueshow: true,
});
wx.showToast({
title: txt || res.data.error_msg,
icon: 'success',
time: 1500,
})
} else { // 预约失败
wx.showToast({
title: res.data.error_msg,
icon: 'success',
time: 1500,
})
}
},
fail(err) {}
})
},
上代码
// 这行代码位置不能放在获取手机号下面
let that = this
if(e.currentTarget.dataset.type !== '2'){
if (!(this.data.phone.length > 9 && this.data.name.length > 0) ){
this.submitAlert()//简单的提示
}else{
that.tijiaoDetail(e)
}
}else{
that.tijiaoDetail(e)
}
},
tijiaoDetail(e){
let that = this
this.setData({
client_type: 2
})
if (!that.data.showPhone) {
this.setData({
phoneshow: true
})
return;
}
var phone = this.data.phone;
var name = this.data.name || null;
var txt = e.currentTarget.dataset.txt || '';
var data = {
building_id: this.data.building_id,
appoint_id: this.data.id,
merchant_id: this.data.merchant_id,
title: this.data.title,
phone: phone,
type: 2,
clue_type: +e.currentTarget.dataset.type
}
if (name) {
data.name = name;
}
// 提交预约
wx.request({
url: app.gData.http2 + '/v1/ytf/wxapp/active_appoint',
data: data,
method: 'post',
header: {
'y-wxapp-jwt': wx.getStorageSync('token')
},
success: (res) => {
if (res.data.error_no == 0) { //预约成功
this.setData({
yuyueshow: true,
});
wx.showToast({
title: txt || res.data.error_msg,
icon: 'success',
time: 1500,
})
} else { // 预约失败
wx.showToast({
title: res.data.error_msg,
icon: 'success',
time: 1500,
})
}
},
fail(err) {}
})
},