Commit 9bcb5dbe499324052d370fa2bf264ea64f4cebfa

Authored by wangfan
2 parents 3b508006 64d4b2ed

Merge remote-tracking branch 'remotes/origin/timespace'

# Conflicts:
#	pages/book/b_addnew.js
#	project.config.json
@@ -3,286 +3,364 @@ import util from '../../utils/util'; @@ -3,286 +3,364 @@ import util from '../../utils/util';
3 import comm from '../../utils/bookCommon'; 3 import comm from '../../utils/bookCommon';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
6 -Page({  
7 - /**  
8 - * 页面的初始数据  
9 - */  
10 - data: {  
11 - dateStr:[],  
12 - form:{ 6 +const formTpl={
  7 + rid:'',
  8 + date:0,
  9 + time:0,
  10 + pnum_str:'1-4',
  11 + tabid:0,
13 12
14 - date:0,  
15 - time:0,  
16 - pnum_str:'1-4',  
17 - tabid:0, 13 + rname:'',
  14 + phone:'',
  15 + sex:1,
  16 + cusdem:'',
18 17
19 - rname:'',  
20 - phone:'',  
21 - sex:1,  
22 - cusdem:'', 18 + tid:[],
23 19
24 - tid:[], 20 +}
  21 +Page({
25 22
26 - },  
27 - tables:[],  
28 - grand:[  
29 - {  
30 - sex:1,  
31 - grand_title:'先生',  
32 - isselect:true  
33 - },  
34 - {  
35 - sex:2,  
36 - grand_title:'女士',  
37 - isselect:false  
38 - }  
39 - ],  
40 - buttonhide:true, 23 + /**
  24 + * 页面的初始数据
  25 + */
  26 + data: {
  27 + dateStr:[],
  28 + form:JSON.parse(JSON.stringify(formTpl)),
  29 + tables:[],
  30 + grand:[
  31 + {
  32 + sex:1,
  33 + grand_title:'先生',
  34 + isselect:true
  35 + },
  36 + {
  37 + sex:2,
  38 + grand_title:'女士',
  39 + isselect:false
  40 + }
  41 + ],
  42 + buttonhide:true,
41 43
42 - calendarMaskLoad:false,  
43 - calendarMask:false,  
44 - dayStyle:[  
45 - { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },  
46 - { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }  
47 - ],  
48 - }, 44 + calendarMaskLoad:false,
  45 + calendarMask:false,
  46 + dayStyle:[
  47 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
  48 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
  49 + ],
  50 + },
49 tablesAll:[], 51 tablesAll:[],
50 - /**  
51 - * 生命周期函数--监听页面加载  
52 - */  
53 - onLoad: function (options) {  
54 - this.setDateStr();  
55 - this.sellerid=util.cache('sellerid');  
56 - this.getTables()  
57 - }, 52 + /**
  53 + * 生命周期函数--监听页面加载
  54 + */
  55 + onLoad: function (options) {
  56 + this.setDateStr();
  57 + this.sellerid=util.cache('sellerid');
  58 + let timePickerArray= await comm.getDayTimeSpace();
  59 + this.setData({
  60 + timePickerArray: timePickerArray,
  61 + })
  62 + if(options.id>0){
  63 + this.initModify(options.id);
  64 + }
  65 + },
58 /** 66 /**
59 * 67 *
60 - * @param d 68 + * @param d
61 * 69 *
62 */ 70 */
63 - setDateStr(d=new Date()/1000){  
64 - let dateStr=[  
65 - util.unixtoTime(d,'MM-DD `DAY/周WW`'),  
66 - util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'),  
67 - ];  
68 - this.setData({  
69 - dateStr:dateStr,  
70 - })  
71 - }, 71 + async setDateStr(d=new Date()/1000){
  72 + let dateStr=[
  73 + util.unixtoTime(d,'MM-DD `DAY/周WW`'),
  74 + util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'),
  75 + ];
  76 + let form=this.data.form;
  77 + form.time=await comm.getTimeSpaceIndex(d);
  78 + let obj={
  79 + dateStr:dateStr,
  80 + form:form,
  81 + };
  82 + this.setData(obj)
  83 + return obj;
72 84
73 - /**  
74 - * 生命周期函数--监听页面初次渲染完成  
75 - */  
76 - onReady: function () { 85 + },
77 86
78 - }, 87 + /**
  88 + * 生命周期函数--监听页面初次渲染完成
  89 + */
  90 + onReady: function () {
79 91
80 - /**  
81 - * 生命周期函数--监听页面显示  
82 - */  
83 - onShow: function () {  
84 - setTimeout(()=>{  
85 - this.setData({  
86 - calendarMaskLoad:true,  
87 - })  
88 - },1000);  
89 - this.conditionInfo() 92 + },
90 93
91 - }, 94 + /**
  95 + * 生命周期函数--监听页面显示
  96 + */
  97 + onShow: function () {
  98 + this.getTables();
  99 + setTimeout(()=>{
  100 + this.setData({
  101 + calendarMaskLoad:true,
  102 + })
  103 + },1000);
  104 + this.conditionInfo()
  105 + },
92 106
93 - /**  
94 - * 生命周期函数--监听页面隐藏  
95 - */  
96 - onHide: function () { 107 + /**
  108 + * 生命周期函数--监听页面隐藏
  109 + */
  110 + onHide: function () {
97 111
98 - }, 112 + },
99 113
100 - /**  
101 - * 生命周期函数--监听页面卸载  
102 - */  
103 - onUnload: function () { 114 + /**
  115 + * 生命周期函数--监听页面卸载
  116 + */
  117 + onUnload: function () {
104 118
105 - }, 119 + },
106 120
107 - /**  
108 - * 页面相关事件处理函数--监听用户下拉动作  
109 - */  
110 - onPullDownRefresh: function () { 121 + /**
  122 + * 页面相关事件处理函数--监听用户下拉动作
  123 + */
  124 + onPullDownRefresh: function () {
111 125
112 - }, 126 + },
113 127
114 - /**  
115 - * 页面上拉触底事件的处理函数  
116 - */  
117 - onReachBottom: function () { 128 + /**
  129 + * 页面上拉触底事件的处理函数
  130 + */
  131 + onReachBottom: function () {
118 132
119 - }, 133 + },
120 134
121 - /**  
122 - * 用户点击右上角分享  
123 - */  
124 - onShareAppMessage: function () { 135 + /**
  136 + * 用户点击右上角分享
  137 + */
  138 + onShareAppMessage: function () {
125 139
126 - }, 140 + },
127 selectedValue(e){ 141 selectedValue(e){
128 - //console.log(e);  
129 - let key=util.attr(e,'key'); 142 + //console.log(e);
  143 + let key=util.attr(e,'key');
130 let val; 144 let val;
131 - if(e.type=='input'){  
132 - val=util.val(e);  
133 - if(e.currentTarget.dataset.key=='phone'){  
134 - var that=this;  
135 - if(e.detail.value!='' && e.detail.value.length>=3) {  
136 - App.Reserve.GetReserveUser({keywords:e.detail.value}).then(function(json){  
137 - if(json.ret==200 && json.data.length>0){  
138 - that.setData({  
139 - searchlist:json.data  
140 - })  
141 - }else{  
142 - that.setData({  
143 - searchlist:null  
144 - })  
145 - }  
146 - })  
147 - }else{  
148 - this.setData({  
149 - searchlist:null  
150 - })  
151 - }  
152 - }  
153 - }else{  
154 - val=util.attr(e,'value');  
155 - } 145 + if(e.type=='input'){
  146 + val=util.val(e);
  147 + if(e.currentTarget.dataset.key=='phone'){
  148 + var that=this;
  149 + if(e.detail.value!='' && e.detail.value.length>=3) {
  150 + App.Reserve.GetReserveUser({keywords:e.detail.value}).then(function(json){
  151 + if(json.ret==200 && json.data.length>0){
  152 + that.setData({
  153 + searchlist:json.data
  154 + })
  155 + }else{
  156 + that.setData({
  157 + searchlist:null
  158 + })
  159 + }
  160 + })
  161 + }else{
  162 + this.setData({
  163 + searchlist:null
  164 + })
  165 + }
  166 + }
  167 + }else{
  168 + val=util.attr(e,'value');
  169 + }
156 170
157 - let form=this.data.form;  
158 - let sobj={};  
159 - if(key=='tid'){  
160 - let ts=this.data.tables;  
161 - if(ts[val].isselect){  
162 - ts[val].isselect=false;  
163 - form.tid.remove(ts[val].id);  
164 - }else{  
165 - ts[val].isselect=true;  
166 - form.tid.push(ts[val].id);  
167 - }  
168 - sobj.tables=ts;  
169 - }else{  
170 - form[key]=val;  
171 - }  
172 - //console.log(e.type,key,val,form); 171 + let form=this.data.form;
  172 + let sobj={};
  173 + if(key=='tid'){
  174 + let ts=this.data.tables;
  175 + if(ts[val].isselect){
  176 + ts[val].isselect=false;
  177 + form.tid.remove(ts[val].id);
  178 + }else{
  179 + ts[val].isselect=true;
  180 + form.tid.push(ts[val].id);
  181 + }
  182 + sobj.tables=ts;
  183 + }else{
  184 + form[key]=val;
  185 + }
  186 + //console.log(e.type,key,val,form);
173 sobj.form=form; 187 sobj.form=form;
174 sobj.buttonhide=true; 188 sobj.buttonhide=true;
175 - if(form.tid.length>0 && form.rname.length>0){  
176 - sobj.buttonhide=false;  
177 - }  
178 - this.setData(sobj) 189 + if(form.tid.length>0 && form.rname.length>0){
  190 + sobj.buttonhide=false;
  191 + }
  192 + this.setData(sobj)
179 193
180 - if('date,time,pnum_str,tabid'.indexOf(key)>-1){  
181 - this.getTables();  
182 - } 194 + if('date,time,pnum_str,tabid'.indexOf(key)>-1){
  195 + this.getTables();
  196 + }
183 }, 197 },
184 async getTables(){ 198 async getTables(){
185 - let form=this.data.form;  
186 - try{  
187 - let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);  
188 - console.log('rdate',this.data.dateStr[this.data.form.date],rdate);  
189 - App.Reserve.GetTableList({  
190 - sid:this.sellerid,  
191 - pnum_str:form.pnum_str,  
192 - rdate:rdate,  
193 - tid:form.tabid,  
194 - }).then(res=>{  
195 - let tables=[];  
196 - res.data.forEach(p=>{  
197 - if(tables.length>=3) return true;  
198 - p.list.forEach(t=>{  
199 - if(tables.length>=3) return true;  
200 - tables.push(t);  
201 - })  
202 - })  
203 - this.tablesAll=res.data; 199 + let form=this.data.form;
  200 + try{
  201 + let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
  202 + console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
  203 + App.Reserve.GetTableList({
  204 + sid:this.sellerid,
  205 + pnum_str:form.pnum_str,
  206 + rdate:rdate,
  207 + tid:form.tabid,
  208 + }).then(res=>{
  209 + let tables=[];
  210 + res.data.forEach(p=>{
  211 + if(tables.length>=3) return true;
  212 + p.list.forEach(t=>{
  213 + if(tables.length>=3) return true;
  214 + tables.push(t);
  215 + })
  216 + })
  217 + this.tablesAll=res.data;
  218 + this.setData({
  219 + tables:tables
  220 + })
  221 + })
  222 + }catch (e){
  223 + this.setData({
  224 + tables:[]
  225 + })
  226 + }
  227 + },
  228 + async formsubmit(){
  229 + if(this.data.buttonhide) return;
  230 + try {
  231 + let stimestr=this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];
  232 + console.log('stimestr', stimestr,this.data.form.time,this.data.timePickerIndex);
  233 + let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
  234 + this.data.form.time,stimestr);
  235 + console.log('rdate', rdate);
  236 + this.setData({
  237 + buttonhide: true,
  238 + })
  239 + let form = this.data.form;
  240 + form.tid = form.tid.toString();
  241 + form.sid = this.sellerid;
  242 + form.rdate =rdate
  243 + App.Reserve.SetReserveInfo(form).then(res => {
  244 + if(res.ret==200){
  245 + let _id=(res.data.id || res.data)
  246 + this.setData({
  247 + form:JSON.parse(JSON.stringify(formTpl)),
  248 + tablesed:null,
  249 + })
  250 + App.Reserve.Detail({rid:_id,openid:''},true)
  251 + wx.navigateTo({
  252 + url:'b_detail?id='+res.data.id,
  253 + });
  254 + }else{
  255 + util.toast(res.msg,'none')
  256 + }
  257 + })
  258 + }catch (e){}
  259 + },
  260 + selectphone:function(e){
  261 + this.data.form.phone=e.detail.phone;
  262 + this.data.form.rname=e.detail.rname;
  263 + this.data.form.cusdem=e.detail.cusdem;
  264 + var form=this.data.form
  265 + this.data.form.sex=e.detail.sex;
  266 + this.setData({
  267 + form:this.data.form,
  268 + searchlist:null
  269 + })
  270 + this.conditionInfo();
  271 + },
  272 + calendarShow(){
204 this.setData({ 273 this.setData({
205 - tables:tables 274 + calendarMask:true
206 }) 275 })
207 - })  
208 - }catch (e){ 276 + },
  277 + dateChange(event){
  278 + console.log(event);
  279 + let clickDay = event.detail.day;
  280 + let changeDay = `dayStyle[1].day`;
  281 + let changeBg = `dayStyle[1].background`;
209 this.setData({ 282 this.setData({
210 - tables:[] 283 + [changeDay]: clickDay,
  284 + [changeBg]: "#84e7d0"
211 }) 285 })
212 - }  
213 -},  
214 -async formsubmit(){  
215 - if(this.data.buttonhide) return;  
216 - try {  
217 - let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);  
218 - console.log('rdate', rdate); 286 + this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
  287 + this.getTables()
  288 + },
  289 + calendarClose(){
219 this.setData({ 290 this.setData({
220 - buttonhide: true, 291 + calendarMask:false
221 }) 292 })
222 - let form = this.data.form;  
223 - form.tid = form.tid.toString();  
224 - form.sid = this.sellerid;  
225 - form.rdate =rdate  
226 - App.Reserve.SetReserveInfo(form).then(res => {  
227 - if(res.ret==200){  
228 - wx.navigateTo({  
229 - url:'b_detail?id='+res.data.id,  
230 - });  
231 - }else{  
232 - util.toast(res.msg,'none') 293 + },
  294 + async selectdesk(){
  295 + let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
  296 + console.log(this.data.form)
  297 + wx.navigateTo({
  298 + url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
  299 + })
  300 + },
  301 + conditionInfo:function(){
  302 + var form=this.data.form
  303 + if(form.tid.length>0 && form.rname.length>0){
  304 + this.data.buttonhide=false;
233 } 305 }
234 - })  
235 - }catch (e){}  
236 -},  
237 -selectphone:function(e){  
238 - this.data.form.phone=e.detail.phone;  
239 - this.data.form.rname=e.detail.rname;  
240 - this.data.form.cusdem=e.detail.cusdem;  
241 - var form=this.data.form  
242 - this.data.form.sex=e.detail.sex;  
243 - this.setData({  
244 - form:this.data.form,  
245 - searchlist:null, 306 + this.setData({
  307 + buttonhide:this.data.buttonhide
  308 + })
  309 + },
  310 + /**
  311 + * 选中时间区域
  312 + */
  313 + bindTimePickerChange(e){
  314 + let timeIndex=util.attr(e,'timeIndex');
  315 + console.log(e,timeIndex);
  316 + let timePickerIndex=this.data.timePickerIndex;
  317 + timePickerIndex[timeIndex]=util.val(e);
  318 + this.setData({
  319 + timePickerIndex:timePickerIndex,
  320 + })
  321 + },
  322 + /**
  323 + * 修改初始化
  324 + */
  325 + async initModify(id){
  326 + try{
  327 + let res= await App.Reserve.Detail({rid:id,openid:''});
246 328
247 - })  
248 - this.conditionInfo();  
249 -},  
250 -calendarShow(){  
251 - this.setData({  
252 - calendarMask:true  
253 - })  
254 -},  
255 -dateChange(event){  
256 - console.log(event);  
257 - let clickDay = event.detail.day;  
258 - let changeDay = `dayStyle[1].day`;  
259 - let changeBg = `dayStyle[1].background`;  
260 - this.setData({  
261 - [changeDay]: clickDay,  
262 - [changeBg]: "#84e7d0"  
263 - })  
264 - this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))  
265 - this.getTables()  
266 -},  
267 -calendarClose(){  
268 - this.setData({  
269 - calendarMask:false  
270 - })  
271 -},  
272 -async selectdesk(){  
273 - let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);  
274 - console.log(this.data.form)  
275 - wx.navigateTo({  
276 - url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str  
277 - })  
278 -},  
279 -conditionInfo:function(){  
280 - var form=this.data.form  
281 - if(form.tid.length>0 && form.rname.length>0){  
282 - this.data.buttonhide=false;  
283 - }  
284 - this.setData({  
285 - buttonhide:this.data.buttonhide  
286 - })  
287 -}  
288 -}) 329 + console.log('initModify',res);
  330 + //设置日期
  331 + let obj = await this.setDateStr(res.data.rdate);
  332 + //设置时间
  333 + let nd=util.unixtoTime(res.data.rdate,'HH:II');
  334 + let timePickerIndex=this.data.timePickerIndex
  335 + console.log('initModify-',this.data.timePickerArray,obj.form.time)
  336 + this.data.timePickerArray[obj.form.time].forEach((dd,ii)=>{
  337 + console.log('initModify-',nd,dd)
  338 + if(nd==dd){
  339 + timePickerIndex[obj.form.time]=ii;
  340 + return true;
  341 + }
  342 + })
  343 +
  344 + console.log('initModify-timePickerIndex',timePickerIndex);
  345 + obj.form.pnum_str=res.data.pnum_str;
  346 + obj.form.rname=res.data.rname;
  347 + obj.form.phone=res.data.phone;
  348 + obj.form.sex=res.data.sex;
  349 + obj.form.cusdem=res.data.cusdem;
  350 + obj.form.rid=id;
  351 + obj.form.tid=[];
  352 + res.data.tables.forEach((t,ti)=>{
  353 + t.isselect=true
  354 + res.data.tables[ti]=t;
  355 + obj.form.tid.push(t.id)
  356 + })
  357 + this.setData({
  358 + timePickerIndex:timePickerIndex,
  359 + form:obj.form,
  360 + tablesed:res.data.tables,
  361 + })
  362 + }catch (e){
  363 + console.log('initModify',e)
  364 + }
  365 + },
  366 +})
@@ -23,15 +23,36 @@ @@ -23,15 +23,36 @@
23 <view class="tab"> 23 <view class="tab">
24 <item class="item {{form.time==0?'checked':''}}" 24 <item class="item {{form.time==0?'checked':''}}"
25 bindtap="selectedValue" data-key="time" data-value="0"> 25 bindtap="selectedValue" data-key="time" data-value="0">
26 - 早市 26 + <picker bindchange="bindTimePickerChange"
  27 + data-time-index="0"
  28 + value="{{timePickerIndex[0]}}"
  29 + range="{{timePickerArray[0]}}">
  30 + <view class="picker">
  31 + 早市 {{timePickerArray[0][timePickerIndex[0]]}}
  32 + </view>
  33 + </picker>
27 </item> 34 </item>
28 <item class="item {{form.time==1?'checked':''}}" 35 <item class="item {{form.time==1?'checked':''}}"
29 bindtap="selectedValue" data-key="time" data-value="1"> 36 bindtap="selectedValue" data-key="time" data-value="1">
30 - 午市 37 + <picker bindchange="bindTimePickerChange"
  38 + data-time-index="1"
  39 + value="{{timePickerIndex[1]}}"
  40 + range="{{timePickerArray[1]}}">
  41 + <view class="picker">
  42 + 午市 {{timePickerArray[1][timePickerIndex[1]]}}
  43 + </view>
  44 + </picker>
31 </item> 45 </item>
32 <item class="item {{form.time==2?'checked':''}}" 46 <item class="item {{form.time==2?'checked':''}}"
33 bindtap="selectedValue" data-key="time" data-value="2"> 47 bindtap="selectedValue" data-key="time" data-value="2">
34 - 晚市 48 + <picker bindchange="bindTimePickerChange"
  49 + data-time-index="2"
  50 + value="{{timePickerIndex[2]}}"
  51 + range="{{timePickerArray[2]}}">
  52 + <view class="picker">
  53 + 晚市 {{timePickerArray[2][timePickerIndex[2]]}}
  54 + </view>
  55 + </picker>
35 </item> 56 </item>
36 </view> 57 </view>
37 </view> 58 </view>
@@ -67,10 +88,10 @@ @@ -67,10 +88,10 @@
67 88
68 <view class="page-full tables"> 89 <view class="page-full tables">
69 <view class="page"> 90 <view class="page">
70 - <view class="title">可订桌位</view> 91 + <view class="title">可订桌位<text wx:if="{{tables.length>0}}"> ({{tables.length}})</text></view>
71 <view class="advice-desk-detail flex-lr" wx:if="{{tables.length>0}}"> 92 <view class="advice-desk-detail flex-lr" wx:if="{{tables.length>0}}">
72 <view class="flex-ll"> 93 <view class="flex-ll">
73 - <block wx:for="{{tables}}" wx:key="tables.key"> 94 + <block wx:for="{{tablesed||tables}}" wx:key="tables.key">
74 <view class="order-desk-info" 95 <view class="order-desk-info"
75 bindtap="selectedValue" 96 bindtap="selectedValue"
76 data-value="{{index}}" 97 data-value="{{index}}"
@@ -92,7 +113,7 @@ @@ -92,7 +113,7 @@
92 </view> 113 </view>
93 </block> 114 </block>
94 </view> 115 </view>
95 - <view class="flex-rr advice-more" bindtap="selectdesk"> 116 + <view class="flex-rr advice-more" bindtap="selectdesk" wx:if="{{tables.length>3 || form.id>0}}">
96 <view style="padding-right:30rpx;" class="gray-deep-font font26r">更多</view> 117 <view style="padding-right:30rpx;" class="gray-deep-font font26r">更多</view>
97 <image src="../image/click.png" class="icon12-22"></image> 118 <image src="../image/click.png" class="icon12-22"></image>
98 </view> 119 </view>
@@ -56,14 +56,17 @@ @@ -56,14 +56,17 @@
56 .section .tab .item{ 56 .section .tab .item{
57 height: 50rpx; 57 height: 50rpx;
58 line-height: 50rpx; 58 line-height: 50rpx;
59 - width: 150rpx !important;  
60 - min-width: 150rpx !important; 59 + width: 180rpx !important;
  60 + min-width: 180rpx !important;
61 border-radius: 10rpx; 61 border-radius: 10rpx;
62 border: 2rpx solid #199095; 62 border: 2rpx solid #199095;
63 - margin-right: 62rpx; 63 + margin-right: 60rpx;
64 text-align: center; 64 text-align: center;
65 display: inline-block; 65 display: inline-block;
66 } 66 }
  67 +.section .tab .item:last-child{
  68 + margin-right: 0;
  69 +}
67 .section .tab .checked{ 70 .section .tab .checked{
68 background-color:#199095; 71 background-color:#199095;
69 color: #FEFEFE; 72 color: #FEFEFE;
@@ -98,5 +98,10 @@ Page({ @@ -98,5 +98,10 @@ Page({
98 bookInfo:res.data, 98 bookInfo:res.data,
99 }) 99 })
100 }) 100 })
  101 + },
  102 + gotoModify(){
  103 + wx.redirectTo({
  104 + url:'./b_addnew?id='+this.data.bookInfo.id
  105 + })
101 } 106 }
102 }) 107 })
1 <nav>订座详情</nav> 1 <nav>订座详情</nav>
2 <!--订单信息--> 2 <!--订单信息-->
3 -<view class="order-info"> 3 +<view class="order-info" bindtap="gotoModify">
4 <view class="flex-lr order-detail"> 4 <view class="flex-lr order-detail">
5 <view class="gray-deep-font font30r">用餐时间</view> 5 <view class="gray-deep-font font30r">用餐时间</view>
6 <view class="black-font font34r">{{bookInfo.rdateStr}}</view> 6 <view class="black-font font34r">{{bookInfo.rdateStr}}</view>
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 "compileType": "miniprogram", 10 "compileType": "miniprogram",
11 "libVersion": "2.3.0", 11 "libVersion": "2.3.0",
12 "appid": "wxd3dc4206c76f14fc", 12 "appid": "wxd3dc4206c76f14fc",
13 - "projectname": "book", 13 + "projectname": "xcx-book",
14 "isGameTourist": false, 14 "isGameTourist": false,
15 "condition": { 15 "condition": {
16 "search": { 16 "search": {
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "list": [] 30 "list": []
31 }, 31 },
32 "miniprogram": { 32 "miniprogram": {
33 - "current": 14, 33 + "current": 17,
34 "list": [ 34 "list": [
35 { 35 {
36 "id": 0, 36 "id": 0,
@@ -145,7 +145,7 @@ @@ -145,7 +145,7 @@
145 } 145 }
146 }, 146 },
147 { 147 {
148 - "id": 14, 148 + "id": -1,
149 "name": "预定本-添加预定", 149 "name": "预定本-添加预定",
150 "pathName": "pages/book/b_addnew", 150 "pathName": "pages/book/b_addnew",
151 "query": "seller_id=1&seller_openid=o9pcQ0cbjRKnRWczcOJaaSRGP1lE&manager_id=500", 151 "query": "seller_id=1&seller_openid=o9pcQ0cbjRKnRWczcOJaaSRGP1lE&manager_id=500",
@@ -162,6 +162,13 @@ @@ -162,6 +162,13 @@
162 "name": "预定本-发短信", 162 "name": "预定本-发短信",
163 "pathName": "pages/book/b_sms", 163 "pathName": "pages/book/b_sms",
164 "query": "id=25" 164 "query": "id=25"
  165 + },
  166 + {
  167 + "id": -1,
  168 + "name": "预定本-编辑预定信息",
  169 + "pathName": "pages/book/b_addnew",
  170 + "query": "id=51",
  171 + "scene": "1001"
165 } 172 }
166 ] 173 ]
167 } 174 }
@@ -45,7 +45,7 @@ module.exports ={ @@ -45,7 +45,7 @@ module.exports ={
45 return timedate; 45 return timedate;
46 }, 46 },
47 //获得营业时段时间戳,用 - 链接 47 //获得营业时段时间戳,用 - 链接
48 - async getTimeSpace(mmdd='',timeIndex=0,sc=null){ 48 + async getTimeSpace(mmdd='',timeIndex=0,stimestr=null,sc=null){
49 try { 49 try {
50 let d=new Date()/1000; 50 let d=new Date()/1000;
51 if(!mmdd){ 51 if(!mmdd){
@@ -59,16 +59,84 @@ module.exports ={ @@ -59,16 +59,84 @@ module.exports ={
59 } 59 }
60 if (sc.daily){ 60 if (sc.daily){
61 let ti=['morning','noon','night']; 61 let ti=['morning','noon','night'];
  62 + console.log('getTimeSpace',sc.daily[ti[timeIndex]],timeIndex);
62 let ts=sc.daily[ti[timeIndex]].split('-'); 63 let ts=sc.daily[ti[timeIndex]].split('-');
63 - console.log(ts);  
64 - let stime=util.unixtoTime(d,'YYYY-'+mmdd+' '+ts[0]+':00'); 64 +
  65 + let stime
  66 + if(stimestr){
  67 + stime=util.unixtoTime(d,'YYYY-'+mmdd+' '+stimestr);
  68 + }else{
  69 + stime=util.unixtoTime(d,'YYYY-'+mmdd+' '+ts[0]+':00');
  70 + }
65 console.log(stime); 71 console.log(stime);
66 let etime=util.unixtoTime(d,'YYYY-'+mmdd+' '+ts[1]+':00'); 72 let etime=util.unixtoTime(d,'YYYY-'+mmdd+' '+ts[1]+':00');
67 return util.timetouUnix(stime)+'-'+util.timetouUnix(etime); 73 return util.timetouUnix(stime)+'-'+util.timetouUnix(etime);
68 } 74 }
69 }catch (e){ 75 }catch (e){
70 - console(e); 76 + console.log(e);
  77 + }
  78 + return false;
  79 + },
  80 + //获得早中晚时间分组,
  81 + async getDayTimeSpace(sc=null){
  82 + try {
  83 + let d=new Date()/1000;
  84 + if(!sc){
  85 + let res = await App.Reserve.SellerInfo(util.cache('enter_params'));
  86 + sc = res.data;
  87 + }
  88 + if (sc.daily){
  89 + let ti=['morning','noon','night'];
  90 + let dts=[[],[],[]];
  91 + ti.forEach((tx,ii)=>{
  92 + let ts=sc.daily[tx].split('-');
  93 + console.log('getDayTimeSpace',ts);
  94 + while (ts[0]<=ts[1]){
  95 + dts[ii].push(ts[0]);
  96 + let _dt=ts[0].split(':');
  97 + if(_dt[1]=='30'){
  98 + _dt[0]=parseInt(_dt[0])+1;
  99 + _dt[1]='00';
  100 + }else{
  101 + _dt[0]=parseInt(_dt[0])+0;
  102 + _dt[1]='30';
  103 + }
  104 + _dt[0]=_dt[0]<10?'0'+_dt[0]:_dt[0];
  105 + ts[0]=_dt.join(':');
  106 + }
  107 + })
  108 + return dts;
  109 + }
  110 + }catch (e){
  111 + console.log(e);
71 } 112 }
72 return false; 113 return false;
  114 + },
  115 + //获得时间戳在早中晚的索引
  116 + async getTimeSpaceIndex(d=new Date()/1000,sc=null){
  117 + try {
  118 + if(!sc){
  119 + let res = await App.Reserve.SellerInfo(util.cache('enter_params'));
  120 + sc = res.data;
  121 + }
  122 + if (sc.daily){
  123 + let ti=['morning','noon','night'];
  124 + let dti=0;
  125 + let date=util.unixtoTime(d,'HH:II')
  126 + ti.forEach((tx,ii)=>{
  127 + let ts=sc.daily[tx].split('-');
  128 + console.log('getTimeSpaceIndex',ts);
  129 + if(date>=ts[0] && ts[0]<=ts[1]){
  130 + dti=ii;
  131 + return dti;
  132 + }
  133 + })
  134 + return dti;
  135 + }
  136 + }catch (e){
  137 + console.log(e);
  138 + }
  139 + return 0;
73 } 140 }
  141 +
74 } 142 }