192 lines
3.6 KiB
JavaScript
192 lines
3.6 KiB
JavaScript
// pages/welfareImg/welfare_tj/welfare_tj.js
|
||
const app = getApp();
|
||
Page({
|
||
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
bgImg: app.globalData.bgImg,
|
||
name: '',
|
||
phone: '',
|
||
gsmc: '',
|
||
time: '',
|
||
cont: '',
|
||
|
||
date: '',
|
||
dataNow: '',
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad: function (options) {
|
||
var date = new Date();
|
||
this.setData({
|
||
dataNow: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
|
||
})
|
||
console.log(this.data.dataNow)
|
||
},
|
||
|
||
bindDateChange: function (e) {
|
||
console.log('picker发送选择改变,携带值为', e.detail.value)
|
||
this.setData({
|
||
date: e.detail.value
|
||
})
|
||
},
|
||
|
||
//申请提现
|
||
cash: function () {
|
||
let name = this.data.name;
|
||
let phone = this.data.phone;
|
||
let cont = this.data.cont;
|
||
let gsmc = this.data.gsmc;
|
||
let time = this.data.date;
|
||
if (name == "") {
|
||
wx.showToast({
|
||
title: '请填写姓名~',
|
||
icon: 'none',
|
||
})
|
||
return
|
||
}
|
||
if (phone == "" || phone.length != 11) {
|
||
wx.showToast({
|
||
title: '请填写正确手机号~',
|
||
icon: 'none',
|
||
})
|
||
return
|
||
}
|
||
if (gsmc == "") {
|
||
wx.showToast({
|
||
title: '请填写公司名称~',
|
||
icon: 'none',
|
||
})
|
||
return
|
||
}
|
||
if (time == "") {
|
||
wx.showToast({
|
||
title: '请选择要货时间~',
|
||
icon: 'none',
|
||
})
|
||
return
|
||
}
|
||
if (cont == "") {
|
||
wx.showToast({
|
||
title: '请填写定制内容~',
|
||
icon: 'none',
|
||
})
|
||
return
|
||
}
|
||
wx.showLoading({
|
||
title: '提交中..',
|
||
mask: true,
|
||
})
|
||
wx.request({
|
||
url: app.globalData.ip + '/wisdommining/api/banner/addWelfareCustom',
|
||
method: 'POST',
|
||
data: {
|
||
joinPhone: phone,
|
||
joinName: name,
|
||
joinContent: cont,
|
||
joinCompanyName: gsmc,
|
||
joinTime: time,
|
||
|
||
},
|
||
success: res => {
|
||
console.log(res)
|
||
wx.hideLoading()
|
||
if (res.data.code == 1) {
|
||
wx.showModal({
|
||
title: '申请成功!',
|
||
content: "稍后工作人员就会处理您的申请信息,请耐心等待",
|
||
showCancel: false,
|
||
success(res) {
|
||
if (res.confirm) {
|
||
wx.navigateBack()
|
||
}
|
||
}
|
||
})
|
||
} else {
|
||
wx.showModal({
|
||
title: '申请失败!',
|
||
content: res.data.message,
|
||
showCancel: false,
|
||
})
|
||
}
|
||
}, fail: f => {
|
||
wx.hideLoading()
|
||
wx.showToast({
|
||
title: '请求异常,请稍后重试~',
|
||
icon: "none",
|
||
})
|
||
}
|
||
})
|
||
},
|
||
|
||
name: function (e) {
|
||
this.setData({
|
||
name: e.detail.value
|
||
})
|
||
},
|
||
phone: function (e) {
|
||
this.setData({
|
||
phone: e.detail.value
|
||
})
|
||
},
|
||
gsmc: function (e) {
|
||
this.setData({
|
||
gsmc: e.detail.value
|
||
})
|
||
},
|
||
time: function (e) {
|
||
this.setData({
|
||
time: e.detail.value
|
||
})
|
||
},
|
||
cont: function (e) {
|
||
this.setData({
|
||
cont: e.detail.value
|
||
})
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面隐藏
|
||
*/
|
||
onHide: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面卸载
|
||
*/
|
||
onUnload: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面相关事件处理函数--监听用户下拉动作
|
||
*/
|
||
onPullDownRefresh: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面上拉触底事件的处理函数
|
||
*/
|
||
onReachBottom: function () {
|
||
|
||
},
|
||
}) |