Showing
7 changed files
with
110 additions
and
30 deletions
| @@ -74,7 +74,7 @@ Component({ | @@ -74,7 +74,7 @@ Component({ | ||
| 74 | if (this.data.detail.tableFirst) { | 74 | if (this.data.detail.tableFirst) { |
| 75 | tableSubInfo = (this.data.detail.tableFirst || '') + ' ' + (this.data.detail.tableSubInfo || ''); | 75 | tableSubInfo = (this.data.detail.tableFirst || '') + ' ' + (this.data.detail.tableSubInfo || ''); |
| 76 | tableFirst = this.data.detail.tableFirst | 76 | tableFirst = this.data.detail.tableFirst |
| 77 | - } else if(this.data.detail.tables) { | 77 | + } else if(this.data.detail.tables.length>0) { |
| 78 | tableFirst = this.data.detail.tables[0].name | 78 | tableFirst = this.data.detail.tables[0].name |
| 79 | tableSubInfo = this.data.detail.tables[0].name; | 79 | tableSubInfo = this.data.detail.tables[0].name; |
| 80 | if (this.data.detail.tables.length > 1) { | 80 | if (this.data.detail.tables.length > 1) { |
| 1 | // pages/customer/detail_owner.js | 1 | // pages/customer/detail_owner.js |
| 2 | import util from '../../utils/util'; | 2 | import util from '../../utils/util'; |
| 3 | import App from '../../utils/api'; | 3 | import App from '../../utils/api'; |
| 4 | +import RS from './reserveStatus'; | ||
| 4 | 5 | ||
| 5 | const {regeneratorRuntime} = global | 6 | const {regeneratorRuntime} = global |
| 6 | import TP from '../../utils/tpls'; | 7 | import TP from '../../utils/tpls'; |
| @@ -13,6 +14,7 @@ Page({ | @@ -13,6 +14,7 @@ Page({ | ||
| 13 | data: { | 14 | data: { |
| 14 | detail: null, | 15 | detail: null, |
| 15 | hasOnlineReserve: false, | 16 | hasOnlineReserve: false, |
| 17 | + hasFirstShow:0, | ||
| 16 | }, | 18 | }, |
| 17 | id: null, | 19 | id: null, |
| 18 | tpls: TP.tpls(), | 20 | tpls: TP.tpls(), |
| @@ -21,6 +23,9 @@ Page({ | @@ -21,6 +23,9 @@ Page({ | ||
| 21 | */ | 23 | */ |
| 22 | onLoad: function (options) { | 24 | onLoad: function (options) { |
| 23 | this.id = options.id; | 25 | this.id = options.id; |
| 26 | + this.setData({ | ||
| 27 | + hasFirstShow:options.hasFirstShow||0, | ||
| 28 | + }) | ||
| 24 | }, | 29 | }, |
| 25 | 30 | ||
| 26 | /** | 31 | /** |
| @@ -38,9 +43,10 @@ Page({ | @@ -38,9 +43,10 @@ Page({ | ||
| 38 | openid: getApp().openid, | 43 | openid: getApp().openid, |
| 39 | rid: this.id | 44 | rid: this.id |
| 40 | }).then(res => { | 45 | }).then(res => { |
| 46 | + console.log('res.data.type',res.data.type) | ||
| 41 | this.setData({ | 47 | this.setData({ |
| 42 | detail: this.formatDatail(res.data), | 48 | detail: this.formatDatail(res.data), |
| 43 | - hasOnlineReserve:res.data.type==0, | 49 | + hasOnlineReserve:res.data.type==1, |
| 44 | }) | 50 | }) |
| 45 | }) | 51 | }) |
| 46 | }, | 52 | }, |
| @@ -68,22 +74,19 @@ Page({ | @@ -68,22 +74,19 @@ Page({ | ||
| 68 | }, | 74 | }, |
| 69 | formatDatail(detail) { | 75 | formatDatail(detail) { |
| 70 | detail.rdateStr = util.unixtoTime(detail.ddate, 'MM月DD日 WW HH:II'); | 76 | detail.rdateStr = util.unixtoTime(detail.ddate, 'MM月DD日 WW HH:II'); |
| 71 | - detail.tableFirst = detail.tables[0].name; | ||
| 72 | - if (detail.tables.length > 1) { | ||
| 73 | - detail.tableSubInfo = '等' + (detail.tables.length) + '个' | ||
| 74 | - + (detail.tables[0].tid == 2 ? '包间' : ''); | 77 | + if(detail.tables.length>0){ |
| 78 | + detail.tableFirst = detail.tables[0].name; | ||
| 79 | + if (detail.tables.length > 1) { | ||
| 80 | + detail.tableSubInfo = '等' + (detail.tables.length) + '个' | ||
| 81 | + + (detail.tables[0].tid == 2 ? '包间' : ''); | ||
| 82 | + } | ||
| 75 | } | 83 | } |
| 76 | // if(!detail.cusman){ | 84 | // if(!detail.cusman){ |
| 77 | // detail.cusman='vking'; | 85 | // detail.cusman='vking'; |
| 78 | // detail.cusman_phone='15877556369'; | 86 | // detail.cusman_phone='15877556369'; |
| 79 | // detail.cusman_account='wx:vking'; | 87 | // detail.cusman_account='wx:vking'; |
| 80 | // } | 88 | // } |
| 81 | - let ns = new Date() / 1000 | ||
| 82 | - detail.hasCancel = detail.status == 4 | ||
| 83 | - detail.hasOvered = false | ||
| 84 | - if (!detail.hasCancel) { | ||
| 85 | - detail.hasOvered = ns > detail.ddate || detail.status >= 2 | ||
| 86 | - } | 89 | + detail=RS.reserve(detail); |
| 87 | detail.seller.seller_tel=detail.seller.seller_tel.split(','); | 90 | detail.seller.seller_tel=detail.seller.seller_tel.split(','); |
| 88 | return detail; | 91 | return detail; |
| 89 | }, | 92 | }, |
| @@ -15,15 +15,30 @@ | @@ -15,15 +15,30 @@ | ||
| 15 | <view class="title Medium">订座已完成</view> | 15 | <view class="title Medium">订座已完成</view> |
| 16 | </block> | 16 | </block> |
| 17 | <block wx:else=""> | 17 | <block wx:else=""> |
| 18 | - <view class="icon"> | ||
| 19 | - <icon type="success" size="47" color="#C8B16D"/> | ||
| 20 | - </view> | ||
| 21 | - <view class="title Medium">订座成功</view> | ||
| 22 | - <view class="info">分享订座信息给朋友,及时获知朋友们的反馈</view> | 18 | + <block wx:if="{{detail.status==0}}"> |
| 19 | + <view class="icon"> | ||
| 20 | + <icon type="waiting" size="47" color="#C8B16D"/> | ||
| 21 | + </view> | ||
| 22 | + <view class="title Medium">餐厅处理中</view> | ||
| 23 | + <view class="info" wx:if="{{hasFirstShow}}">预计10分钟左右餐厅将告知您结果(请留意短息或微信通知)</view> | ||
| 24 | + </block> | ||
| 25 | + <block wx:elif="{{detail.status==6}}"> | ||
| 26 | + <view class="icon"> | ||
| 27 | + <icon type="warn" size="47" color="#999999"/> | ||
| 28 | + </view> | ||
| 29 | + <view class="title Medium">{{detail.msg||'包间已订满'}}</view> | ||
| 30 | + </block> | ||
| 31 | + <block wx:else=""> | ||
| 32 | + <view class="icon"> | ||
| 33 | + <icon type="success" size="47" color="#C8B16D"/> | ||
| 34 | + </view> | ||
| 35 | + <view class="title Medium">订座成功</view> | ||
| 36 | + <view class="info">分享订座信息给朋友,及时获知朋友们的反馈</view> | ||
| 37 | + </block> | ||
| 23 | </block> | 38 | </block> |
| 24 | </view> | 39 | </view> |
| 25 | 40 | ||
| 26 | - <block wx:if="{{!detail.hasOvered && !detail.hasCancel}}"> | 41 | + <block wx:if="{{detail.hasRunning}}"> |
| 27 | <view class="flex-lr share-view" > | 42 | <view class="flex-lr share-view" > |
| 28 | <userinfo-share | 43 | <userinfo-share |
| 29 | binduserinfo="userinfo" | 44 | binduserinfo="userinfo" |
pages/customer/reserveStatus.js
0 → 100644
| 1 | +//0:待确认1:已定座2:确认到店(到店)3:用餐完成(离店)4:取消预定 5:C端在线预定(分配包间)6:拒单 | ||
| 2 | +const status=[ | ||
| 3 | + '待确认',//0 | ||
| 4 | + '已定座',//1 | ||
| 5 | + '确认到店(到店)',//2 | ||
| 6 | + '用餐完成(离店)',//3 | ||
| 7 | + '取消预定',//4 | ||
| 8 | + 'C端在线预定(分配包间)',//5 | ||
| 9 | + '拒单'//6 | ||
| 10 | +]; | ||
| 11 | +export default { | ||
| 12 | + reserve(detail){ | ||
| 13 | + let ns = new Date() / 1000 | ||
| 14 | + //取消 | ||
| 15 | + detail.hasCancel=detail.status==4; | ||
| 16 | + //结束 | ||
| 17 | + detail.hasOvered= ns > detail.ddate || (detail.status >= 2 && detail.status <= 3) | ||
| 18 | + //正常运行已接单 | ||
| 19 | + if(detail.type==0){//B端 | ||
| 20 | + detail.hasRunning = !detail.hasOvered && !detail.hasCancel | ||
| 21 | + }else{//C端 | ||
| 22 | + detail.hasRunning = !detail.hasOvered && !detail.hasCancel && detail.status==5 | ||
| 23 | + } | ||
| 24 | + return detail; | ||
| 25 | + }, | ||
| 26 | +} |
| @@ -113,11 +113,40 @@ Page({ | @@ -113,11 +113,40 @@ Page({ | ||
| 113 | if(!this.user.phone){ | 113 | if(!this.user.phone){ |
| 114 | return util.toast('请填写手机','none') | 114 | return util.toast('请填写手机','none') |
| 115 | } | 115 | } |
| 116 | - App.Customer.SetCustomerInfo({ | ||
| 117 | - ...this.user | 116 | + App.Customer.SetReserveInfo({ |
| 117 | + sid:this.options.sid, | ||
| 118 | + pnum:this.options.pnum, | ||
| 119 | + ddate:this.options.ddate, | ||
| 120 | + rdate:this.getRdate(), | ||
| 121 | + rname:this.user.name, | ||
| 122 | + sex:this.user.sex, | ||
| 123 | + phone:this.user.phone, | ||
| 124 | + cusdem:this.user.remark||'', | ||
| 118 | }).then(res=>{ | 125 | }).then(res=>{ |
| 119 | - App.Customer.GetCustomerInfo({},'clear') | ||
| 120 | - wx.navigateBack() | 126 | + if(res.ret!=200){ |
| 127 | + return util.toast(res.msg,'none'); | ||
| 128 | + } | ||
| 129 | + if(res.data.hasSetUserInfo){ | ||
| 130 | + App.Customer.GetCustomerInfo({},'clear') | ||
| 131 | + } | ||
| 132 | + wx.redirectTo({ | ||
| 133 | + url:util.http_build_query({ | ||
| 134 | + id:res.data.rid, | ||
| 135 | + hasFirstShow:1, | ||
| 136 | + },'/pages/customer/detail_owner') | ||
| 137 | + }) | ||
| 138 | + }) | ||
| 139 | + }, | ||
| 140 | + getRdate(){ | ||
| 141 | + let daily=this.data.seller.daily; | ||
| 142 | + let ddate=util.unixtoTime(this.options.ddate,'YYYY-MM-DD,HH:II').split(','); | ||
| 143 | + let rd=['00:00','00:00']; | ||
| 144 | + Object.keys(daily).forEach((k)=>{ | ||
| 145 | + let t=daily[k].split('-') | ||
| 146 | + if(t[0]<=ddate[1] && ddate[1]<=t[1]){ | ||
| 147 | + rd=t; | ||
| 148 | + } | ||
| 121 | }) | 149 | }) |
| 150 | + return util.timetouUnix(ddate[0]+' '+rd[0]+':00')+'-'+util.timetouUnix(ddate[0]+' '+rd[1]+':00') | ||
| 122 | }, | 151 | }, |
| 123 | }) | 152 | }) |
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | "minified": true, | 7 | "minified": true, |
| 8 | "newFeature": true, | 8 | "newFeature": true, |
| 9 | "nodeModules": true, | 9 | "nodeModules": true, |
| 10 | - "autoAudits": false, | 10 | + "autoAudits": true, |
| 11 | "uglifyFileName": false, | 11 | "uglifyFileName": false, |
| 12 | "checkInvalidKey": true, | 12 | "checkInvalidKey": true, |
| 13 | "enhance": true, | 13 | "enhance": true, |
| @@ -463,16 +463,18 @@ | @@ -463,16 +463,18 @@ | ||
| 463 | "query": "sid=1&ddate=1234567890&pnum=10", | 463 | "query": "sid=1&ddate=1234567890&pnum=10", |
| 464 | "scene": null | 464 | "scene": null |
| 465 | }, | 465 | }, |
| 466 | + { | ||
| 467 | + "id": 56, | ||
| 468 | + "name": "测试组件", | ||
| 469 | + "pathName": "pages/reserve/detail", | ||
| 470 | + "query": "id=154", | ||
| 471 | + "scene": null | ||
| 472 | + }, | ||
| 466 | { | 473 | { |
| 467 | -<<<<<<< HEAD | ||
| 468 | - "id": 56, | ||
| 469 | - "name": "测试组件", | ||
| 470 | - "pathName": "pages/reserve/detail", | ||
| 471 | - "query": "id=154", | ||
| 472 | - "id": -1, | 474 | + "id": 57, |
| 473 | "name": "pages/customer/detail_owner", | 475 | "name": "pages/customer/detail_owner", |
| 474 | "pathName": "pages/customer/detail_owner", | 476 | "pathName": "pages/customer/detail_owner", |
| 475 | - "query": "id=18599", | 477 | + "query": "id=24838&hasFirstShow=1", |
| 476 | "scene": null | 478 | "scene": null |
| 477 | } | 479 | } |
| 478 | ] | 480 | ] |
| @@ -268,6 +268,11 @@ export default { | @@ -268,6 +268,11 @@ export default { | ||
| 268 | cachetime: -1, | 268 | cachetime: -1, |
| 269 | }, | 269 | }, |
| 270 | 270 | ||
| 271 | + //C端录入预定 | ||
| 272 | + 'App.Customer.SetReserveInfo':{ | ||
| 273 | + openid:'openid', | ||
| 274 | + silence:false, | ||
| 275 | + }, | ||
| 271 | 276 | ||
| 272 | //获得小程序码 | 277 | //获得小程序码 |
| 273 | 'App.Other.generate_qrcode':{ | 278 | 'App.Other.generate_qrcode':{ |
-
Please register or login to post a comment