...
|
...
|
@@ -15,6 +15,10 @@ Page({ |
|
|
token: "",
|
|
|
// 分享人的ID
|
|
|
shareId:"",
|
|
|
// 防连点
|
|
|
isClick:false,
|
|
|
// 是否已预约
|
|
|
isConfirm:true
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -23,7 +27,7 @@ Page({ |
|
|
onLoad: function(options) {
|
|
|
this.setData({
|
|
|
token: wx.getStorageSync("token"),
|
|
|
shareId:options.id
|
|
|
shareId:options.id
|
|
|
})
|
|
|
// 获取服务介绍详情
|
|
|
this.getServeiceDetail();
|
...
|
...
|
@@ -61,41 +65,70 @@ Page({ |
|
|
submit() {
|
|
|
// 判断是否登录
|
|
|
let t = this;
|
|
|
if (t.data.token) {
|
|
|
if (t.data.region.length > 0 && t.data.name && t.data.phone && t.data.address) {
|
|
|
let url = "/api/user/freeBook";
|
|
|
let params = {
|
|
|
user_name: t.data.name,
|
|
|
mobile: t.data.phone,
|
|
|
address: t.data.address,
|
|
|
province: t.data.region[0],
|
|
|
city: t.data.region[1],
|
|
|
district: t.data.region[2]
|
|
|
};
|
|
|
app.post(url, params,"post")
|
|
|
.then(res => {
|
|
|
wx.showToast({
|
|
|
title: '预约成功',
|
|
|
icon:"success",
|
|
|
duration:1500,
|
|
|
if(!t.data.isClick){
|
|
|
t.setData({
|
|
|
isClick:true
|
|
|
})
|
|
|
if (t.data.token) {
|
|
|
if (t.data.region.length > 0 && t.data.name && t.data.phone && t.data.address) {
|
|
|
setTimeout(function(){
|
|
|
t.setData({
|
|
|
isClick:false
|
|
|
})
|
|
|
},1500)
|
|
|
let url = "/api/user/freeBook";
|
|
|
let params = {
|
|
|
user_name: t.data.name,
|
|
|
mobile: t.data.phone,
|
|
|
address: t.data.address,
|
|
|
province: t.data.region[0],
|
|
|
city: t.data.region[1],
|
|
|
district: t.data.region[2]
|
|
|
};
|
|
|
app.post(url, params, "post")
|
|
|
.then(res => {
|
|
|
console.log(res)
|
|
|
wx.showToast({
|
|
|
title: '预约成功',
|
|
|
icon: "success",
|
|
|
duration: 1500,
|
|
|
})
|
|
|
t.setData({
|
|
|
isClick: false,
|
|
|
isConfirm:false
|
|
|
})
|
|
|
// 分享
|
|
|
setTimeout(function () {
|
|
|
if(t.data.shareId){
|
|
|
t.showShare()
|
|
|
}else{
|
|
|
wx.navigateBack({
|
|
|
delta:1
|
|
|
})
|
|
|
}
|
|
|
|
|
|
}, 1500)
|
|
|
})
|
|
|
// 分享
|
|
|
setTimeout(function(){
|
|
|
this.showShare()
|
|
|
},1500)
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: '请输入完整信息',
|
|
|
icon: "none"
|
|
|
})
|
|
|
t.setData({
|
|
|
isClick:false
|
|
|
})
|
|
|
}
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: '请输入完整信息',
|
|
|
icon: "none"
|
|
|
t.setData({
|
|
|
isClick: false
|
|
|
})
|
|
|
// 未登录
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/star/star',
|
|
|
})
|
|
|
}
|
|
|
}else{
|
|
|
// 未登录
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/star/star',
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
...
|
...
|
@@ -107,8 +140,8 @@ Page({ |
|
|
};
|
|
|
app.post(url,params,"post")
|
|
|
.then(res=>{
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/homeindex/homeindex',
|
|
|
wx.navigateBack({
|
|
|
delta: 1
|
|
|
})
|
|
|
})
|
|
|
},
|
...
|
...
|
|