You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.0 KiB
110 lines
2.0 KiB
4 years ago
|
// pages/activity/signIn/index.js
|
||
|
const app = getApp();
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
activityId : '',
|
||
|
num:'2'
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
this.setData({activityId:options.id})
|
||
|
},
|
||
|
toConfirm(e){
|
||
|
console.log(e)
|
||
|
const values = e.detail.value
|
||
|
let name = values.name,
|
||
|
phone = values.phone,
|
||
|
code = values.code,
|
||
|
WeChat = values.WeChat,
|
||
|
num = values.num;
|
||
|
if(name == '' || phone == '' || code == ''){
|
||
|
wx.showToast({
|
||
|
title: '带*项为必填项,请检查后重新提交!',
|
||
|
icon:'none'
|
||
|
})
|
||
|
return
|
||
|
} else if(!/^1(3|4|5|7|8)\d{9}$/.test(phone)){
|
||
|
wx.showToast({
|
||
|
title: '请填写正确手机号',
|
||
|
icon:'none'
|
||
|
})
|
||
|
return
|
||
|
} else if(num == ''){
|
||
|
num = 1
|
||
|
}
|
||
|
app.http('post','activity/joinActivity',{activiyId:this.data.activityId,name:name,phone:phone,num:num}).then((res)=>{
|
||
|
console.log(res)
|
||
|
if(res.data.success){
|
||
|
let payInfo = encodeURIComponent(JSON.stringify(res.data.data));
|
||
|
wx.navigateTo({
|
||
|
url: './confirm/index?payInfo='+payInfo,
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
inpChange(e){
|
||
|
console.log(e)
|
||
|
let num = e.detail.value;
|
||
|
if(num <= 0){
|
||
|
num = 1
|
||
|
} else if(num > 2){
|
||
|
num = 2
|
||
|
}
|
||
|
this.setData({num})
|
||
|
},
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage: function () {
|
||
|
|
||
|
}
|
||
|
})
|