|
@@ -22,6 +22,7 @@ Page({ |
|
@@ -22,6 +22,7 @@ Page({ |
|
22
|
},
|
22
|
},
|
|
23
|
defImage:'http://qn.colorcun.com/manager-invitation/wx/upload2.jpg',
|
23
|
defImage:'http://qn.colorcun.com/manager-invitation/wx/upload2.jpg',
|
|
24
|
tpl:{},
|
24
|
tpl:{},
|
|
|
|
25
|
+ timeStr:'',
|
|
25
|
},
|
26
|
},
|
|
26
|
|
27
|
|
|
27
|
/**
|
28
|
/**
|
|
@@ -34,9 +35,29 @@ Page({ |
|
@@ -34,9 +35,29 @@ Page({ |
|
34
|
this.pickerData=TP.pickerData();
|
35
|
this.pickerData=TP.pickerData();
|
|
35
|
let pd=TP.pickerData();
|
36
|
let pd=TP.pickerData();
|
|
36
|
pd[2]=pd[2][this.data.pickerValue[1]];
|
37
|
pd[2]=pd[2][this.data.pickerValue[1]];
|
|
37
|
-
|
38
|
+ this.initData(options)
|
|
|
|
39
|
+ this.setData({
|
|
|
|
40
|
+ pickerData:pd,
|
|
|
|
41
|
+ tpl:this.tpl,
|
|
|
|
42
|
+ options:options,
|
|
|
|
43
|
+ })
|
|
|
|
44
|
+ },
|
|
|
|
45
|
+ initData(options){
|
|
38
|
if(options.rid){
|
46
|
if(options.rid){
|
|
39
|
-
|
47
|
+ App.Invitation.Detail({id:options.rid}).then(res=>{
|
|
|
|
48
|
+ this.setData({
|
|
|
|
49
|
+ form:{
|
|
|
|
50
|
+ sid:res.data.seller_name,
|
|
|
|
51
|
+ name:res.data.seller_name,
|
|
|
|
52
|
+ room:res.data.room_name,
|
|
|
|
53
|
+ addr:res.data.seller_address,
|
|
|
|
54
|
+ sid:res.data.sid,
|
|
|
|
55
|
+ time:res.data.arrival_time,
|
|
|
|
56
|
+ image:res.data.image_url,
|
|
|
|
57
|
+ },
|
|
|
|
58
|
+ timeStr:util.unixtoTime(res.data.arrival_time,'MM-DD 星期WW HH:II')
|
|
|
|
59
|
+ })
|
|
|
|
60
|
+ })
|
|
40
|
}else{
|
61
|
}else{
|
|
41
|
App.Invitation.GetSellerList({
|
62
|
App.Invitation.GetSellerList({
|
|
42
|
openid:getApp().openid
|
63
|
openid:getApp().openid
|
|
@@ -60,13 +81,7 @@ Page({ |
|
@@ -60,13 +81,7 @@ Page({ |
|
60
|
}
|
81
|
}
|
|
61
|
})
|
82
|
})
|
|
62
|
}
|
83
|
}
|
|
63
|
- this.setData({
|
|
|
|
64
|
- pickerData:pd,
|
|
|
|
65
|
- tpl:this.tpl,
|
|
|
|
66
|
- options:options,
|
|
|
|
67
|
- })
|
|
|
|
68
|
},
|
84
|
},
|
|
69
|
-
|
|
|
|
70
|
/**
|
85
|
/**
|
|
71
|
* 生命周期函数--监听页面初次渲染完成
|
86
|
* 生命周期函数--监听页面初次渲染完成
|
|
72
|
*/
|
87
|
*/
|
|
@@ -128,7 +143,7 @@ Page({ |
|
@@ -128,7 +143,7 @@ Page({ |
|
128
|
let flag=false;
|
143
|
let flag=false;
|
|
129
|
if(
|
144
|
if(
|
|
130
|
form.name
|
145
|
form.name
|
|
131
|
- && this.data.pickerValue[0]>-1
|
146
|
+ && (this.data.pickerValue[0]>-1 || form.time>0)
|
|
132
|
&& form.room
|
147
|
&& form.room
|
|
133
|
&& form.addr
|
148
|
&& form.addr
|
|
134
|
&& (!this.tpl.hasImage || (this.tpl.hasImage && form.image))//带图模板
|
149
|
&& (!this.tpl.hasImage || (this.tpl.hasImage && form.image))//带图模板
|
|
@@ -151,11 +166,15 @@ Page({ |
|
@@ -151,11 +166,15 @@ Page({ |
|
151
|
this.checkHasSubmit()
|
166
|
this.checkHasSubmit()
|
|
152
|
},
|
167
|
},
|
|
153
|
getTimeStr(){
|
168
|
getTimeStr(){
|
|
154
|
- let d=new Date();
|
|
|
|
155
|
- let y=d.getFullYear();
|
|
|
|
156
|
- let md=this.data.pickerData[0][this.data.pickerValue[0]].substr(0,5);
|
|
|
|
157
|
- let t=this.data.pickerData[2][this.data.pickerValue[2]];
|
|
|
|
158
|
- return util.timetouUnix(y+'-'+md+' '+t+':00');
|
169
|
+ if(this.data.pickerValue[0]>-1){
|
|
|
|
170
|
+ let d=new Date();
|
|
|
|
171
|
+ let y=d.getFullYear();
|
|
|
|
172
|
+ let md=this.data.pickerData[0][this.data.pickerValue[0]].substr(0,5);
|
|
|
|
173
|
+ let t=this.data.pickerData[2][this.data.pickerValue[2]];
|
|
|
|
174
|
+ return util.timetouUnix(y+'-'+md+' '+t+':00');
|
|
|
|
175
|
+ }else{
|
|
|
|
176
|
+ return this.data.form.time;
|
|
|
|
177
|
+ }
|
|
159
|
},
|
178
|
},
|
|
160
|
submit(){
|
179
|
submit(){
|
|
161
|
if(!this.checkHasSubmit()){
|
180
|
if(!this.checkHasSubmit()){
|
|
@@ -174,6 +193,9 @@ Page({ |
|
@@ -174,6 +193,9 @@ Page({ |
|
174
|
if(opt.rid){
|
193
|
if(opt.rid){
|
|
175
|
param.id=opt.rid
|
194
|
param.id=opt.rid
|
|
176
|
}
|
195
|
}
|
|
|
|
196
|
+ if(this.data.form.image){
|
|
|
|
197
|
+ param.image_url=this.data.form.image
|
|
|
|
198
|
+ }
|
|
177
|
App.Invitation.SetInvitationInfo(param).then(res=>{
|
199
|
App.Invitation.SetInvitationInfo(param).then(res=>{
|
|
178
|
wx.redirectTo({
|
200
|
wx.redirectTo({
|
|
179
|
url:util.http_build_query({
|
201
|
url:util.http_build_query({
|
|
@@ -203,6 +225,7 @@ Page({ |
|
@@ -203,6 +225,7 @@ Page({ |
|
203
|
console.log('upres',upres)
|
225
|
console.log('upres',upres)
|
|
204
|
if(upres.ret==200){
|
226
|
if(upres.ret==200){
|
|
205
|
util.toast('图片上传完成','none')
|
227
|
util.toast('图片上传完成','none')
|
|
|
|
228
|
+ this.checkHasSubmit()
|
|
206
|
this.setData({
|
229
|
this.setData({
|
|
207
|
[`form.image`]:upres.data,
|
230
|
[`form.image`]:upres.data,
|
|
208
|
})
|
231
|
})
|