|
...
|
...
|
@@ -22,6 +22,7 @@ Page({ |
|
|
|
},
|
|
|
|
defImage:'http://qn.colorcun.com/manager-invitation/wx/upload2.jpg',
|
|
|
|
tpl:{},
|
|
|
|
timeStr:'',
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -34,9 +35,29 @@ Page({ |
|
|
|
this.pickerData=TP.pickerData();
|
|
|
|
let pd=TP.pickerData();
|
|
|
|
pd[2]=pd[2][this.data.pickerValue[1]];
|
|
|
|
|
|
|
|
this.initData(options)
|
|
|
|
this.setData({
|
|
|
|
pickerData:pd,
|
|
|
|
tpl:this.tpl,
|
|
|
|
options:options,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
initData(options){
|
|
|
|
if(options.rid){
|
|
|
|
|
|
|
|
App.Invitation.Detail({id:options.rid}).then(res=>{
|
|
|
|
this.setData({
|
|
|
|
form:{
|
|
|
|
sid:res.data.seller_name,
|
|
|
|
name:res.data.seller_name,
|
|
|
|
room:res.data.room_name,
|
|
|
|
addr:res.data.seller_address,
|
|
|
|
sid:res.data.sid,
|
|
|
|
time:res.data.arrival_time,
|
|
|
|
image:res.data.image_url,
|
|
|
|
},
|
|
|
|
timeStr:util.unixtoTime(res.data.arrival_time,'MM-DD 星期WW HH:II')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
App.Invitation.GetSellerList({
|
|
|
|
openid:getApp().openid
|
|
...
|
...
|
@@ -60,13 +81,7 @@ Page({ |
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
pickerData:pd,
|
|
|
|
tpl:this.tpl,
|
|
|
|
options:options,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
...
|
...
|
@@ -128,7 +143,7 @@ Page({ |
|
|
|
let flag=false;
|
|
|
|
if(
|
|
|
|
form.name
|
|
|
|
&& this.data.pickerValue[0]>-1
|
|
|
|
&& (this.data.pickerValue[0]>-1 || form.time>0)
|
|
|
|
&& form.room
|
|
|
|
&& form.addr
|
|
|
|
&& (!this.tpl.hasImage || (this.tpl.hasImage && form.image))//带图模板
|
|
...
|
...
|
@@ -151,11 +166,15 @@ Page({ |
|
|
|
this.checkHasSubmit()
|
|
|
|
},
|
|
|
|
getTimeStr(){
|
|
|
|
let d=new Date();
|
|
|
|
let y=d.getFullYear();
|
|
|
|
let md=this.data.pickerData[0][this.data.pickerValue[0]].substr(0,5);
|
|
|
|
let t=this.data.pickerData[2][this.data.pickerValue[2]];
|
|
|
|
return util.timetouUnix(y+'-'+md+' '+t+':00');
|
|
|
|
if(this.data.pickerValue[0]>-1){
|
|
|
|
let d=new Date();
|
|
|
|
let y=d.getFullYear();
|
|
|
|
let md=this.data.pickerData[0][this.data.pickerValue[0]].substr(0,5);
|
|
|
|
let t=this.data.pickerData[2][this.data.pickerValue[2]];
|
|
|
|
return util.timetouUnix(y+'-'+md+' '+t+':00');
|
|
|
|
}else{
|
|
|
|
return this.data.form.time;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
submit(){
|
|
|
|
if(!this.checkHasSubmit()){
|
|
...
|
...
|
@@ -174,6 +193,9 @@ Page({ |
|
|
|
if(opt.rid){
|
|
|
|
param.id=opt.rid
|
|
|
|
}
|
|
|
|
if(this.data.form.image){
|
|
|
|
param.image_url=this.data.form.image
|
|
|
|
}
|
|
|
|
App.Invitation.SetInvitationInfo(param).then(res=>{
|
|
|
|
wx.redirectTo({
|
|
|
|
url:util.http_build_query({
|
|
...
|
...
|
@@ -203,6 +225,7 @@ Page({ |
|
|
|
console.log('upres',upres)
|
|
|
|
if(upres.ret==200){
|
|
|
|
util.toast('图片上传完成','none')
|
|
|
|
this.checkHasSubmit()
|
|
|
|
this.setData({
|
|
|
|
[`form.image`]:upres.data,
|
|
|
|
})
|
...
|
...
|
|