Showing
1 changed file
with
36 additions
and
2 deletions
| 1 | +import util from './util' | ||
| 1 | //0:待确认1:已定座2:确认到店(到店)3:用餐完成(离店)4:取消预定 5:C端在线预定(分配包间)6:拒单 | 2 | //0:待确认1:已定座2:确认到店(到店)3:用餐完成(离店)4:取消预定 5:C端在线预定(分配包间)6:拒单 |
| 2 | const status=[ | 3 | const status=[ |
| 3 | '待确认',//0:待确认 | 4 | '待确认',//0:待确认 |
| @@ -48,7 +49,40 @@ export default { | @@ -48,7 +49,40 @@ export default { | ||
| 48 | let flag=true; | 49 | let flag=true; |
| 49 | if(detail.status==0 || detail.status==6 || detail.status==4) return false//未进行状态 | 50 | if(detail.status==0 || detail.status==6 || detail.status==4) return false//未进行状态 |
| 50 | if(detail.status==3) return false //用餐完成(离店) | 51 | if(detail.status==3) return false //用餐完成(离店) |
| 51 | - if(ns > detail.edate) return false//超时 | 52 | + //if(ns > detail.edate) return false//超时 |
| 53 | + if(ns > this.getNextTime(detail)) return false//超时 | ||
| 52 | return flag | 54 | return flag |
| 53 | - } | 55 | + }, |
| 56 | + getNextTime(detail){//获取下时段时间 | ||
| 57 | + let solt=['','morning','noon','night','ye']; | ||
| 58 | + let daily=detail.seller.daily | ||
| 59 | + let solt_index=solt[detail.ddate_solt] | ||
| 60 | + if(!solt_index) return detail.edate; | ||
| 61 | + let dur=daily[solt[detail.ddate_solt]] | ||
| 62 | + if(!dur) return detail.edate; | ||
| 63 | + let last_time=''; | ||
| 64 | + let hasToday=true | ||
| 65 | + for(let i=(parseInt(detail.ddate_solt)+1);i<solt.length;i++){ | ||
| 66 | + if(daily[solt[i]]){ | ||
| 67 | + last_time=daily[solt[i]] | ||
| 68 | + break; | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + if(!last_time){//跨天 | ||
| 72 | + for(let i=1;i<solt.length;i++){ | ||
| 73 | + if(daily[solt[i]]){ | ||
| 74 | + hasToday=false | ||
| 75 | + last_time=daily[solt[i]] | ||
| 76 | + break; | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + if(!last_time) return detail.edate; | ||
| 81 | + let ns=new Date()/1000; | ||
| 82 | + if(!hasToday){ | ||
| 83 | + ns+=86400 | ||
| 84 | + } | ||
| 85 | + let timestr=util.unixtoTime(ns,"YYYY-MM-DD "+last_time.substr(0,5)+':00') | ||
| 86 | + return util.timetouUnix(timestr) | ||
| 87 | + }, | ||
| 54 | } | 88 | } |
-
Please register or login to post a comment