Commit 0f601a091e55f7c7aa97c9d9ee704b3f5280ef0e

Authored by pengye
1 parent 503de2fb

提前点餐菜品更换时间限制、提前点餐手机两侧滑动返回问题处理

@@ -351,7 +351,16 @@ Page({ @@ -351,7 +351,16 @@ Page({
351 }, 351 },
352 // 继续点菜 352 // 继续点菜
353 continueOrdering() { 353 continueOrdering() {
354 - wx.navigateBack(1) 354 + let url = util.http_build_query({
  355 + sid: this.data.options.sid,
  356 + sellerName: this.data.options.sellerName,
  357 + rid: this.data.options.rid,
  358 + oid: this.data.options.oid,
  359 + identity: '1',
  360 + }, '/pack-cookbook/pages/index_new')
  361 + wx.redirectTo({
  362 + url
  363 + })
355 }, 364 },
356 // 确认下单 365 // 确认下单
357 determineFun() { 366 determineFun() {
@@ -368,7 +377,7 @@ Page({ @@ -368,7 +377,7 @@ Page({
368 identity: this.data.options.identity, 377 identity: this.data.options.identity,
369 remark:this.data.notes+'' 378 remark:this.data.notes+''
370 }).then(res => { 379 }).then(res => {
371 - wx.navigateTo({ 380 + wx.redirectTo({
372 url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&type=1&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}` 381 url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&type=1&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`
373 }) 382 })
374 }) 383 })
@@ -96,7 +96,7 @@ Page({ @@ -96,7 +96,7 @@ Page({
96 } 96 }
97 cookbookObj.themeColor=this.data.themeColor; 97 cookbookObj.themeColor=this.data.themeColor;
98 cookbookObj.navColor=this.data.navColor; 98 cookbookObj.navColor=this.data.navColor;
99 - wx.navigateTo({ 99 + wx.redirectTo({
100 url: `/pack-cookbook/pages/cart_new?cookbookObj=${JSON.stringify(cookbookObj)}`, 100 url: `/pack-cookbook/pages/cart_new?cookbookObj=${JSON.stringify(cookbookObj)}`,
101 }) 101 })
102 }, 102 },
@@ -242,7 +242,8 @@ Page({ @@ -242,7 +242,8 @@ Page({
242 }).then(res => { 242 }).then(res => {
243 let orderItemCount = 0; 243 let orderItemCount = 0;
244 res.data.cookbooklist.forEach(cb => { 244 res.data.cookbooklist.forEach(cb => {
245 - if (cb.status > 0) { 245 + // options.identity代表是从APP分享的请客人点餐,如果已点菜,就要显示success_new页
  246 + if (cb.status > 0 && this.data.options.identity=='2') {
246 let data={ 247 let data={
247 ...this.data.options 248 ...this.data.options
248 } 249 }
@@ -250,7 +251,7 @@ Page({ @@ -250,7 +251,7 @@ Page({
250 data.sellerName=res.data.seller.sellername; 251 data.sellerName=res.data.seller.sellername;
251 data.oid=res.data.id; 252 data.oid=res.data.id;
252 console.log('跳转到下单页携带参数',{...data}); 253 console.log('跳转到下单页携带参数',{...data});
253 - wx.navigateTo({ 254 + wx.redirectTo({
254 url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&type=1&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`, 255 url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&type=1&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`,
255 }) 256 })
256 return false; 257 return false;
@@ -41,7 +41,7 @@ page { @@ -41,7 +41,7 @@ page {
41 } 41 }
42 42
43 .dishWrap:nth-last-of-type(1) { 43 .dishWrap:nth-last-of-type(1) {
44 - padding-bottom: 200rpx; 44 + padding-bottom: 220rpx;
45 } 45 }
46 46
47 .oneBox { 47 .oneBox {
@@ -22,6 +22,7 @@ Page({ @@ -22,6 +22,7 @@ Page({
22 navColor:'', 22 navColor:'',
23 height:wx.getSystemInfoSync().windowWidth*1, 23 height:wx.getSystemInfoSync().windowWidth*1,
24 is_show_price:'', 24 is_show_price:'',
  25 + changeType:'1',//1不允许修改 2开餐1小时之前 3开餐2小时之前 4预订日期1天前 5预订日期2天前
25 }, 26 },
26 myToast :'', 27 myToast :'',
27 imageLoad(e) { 28 imageLoad(e) {
@@ -404,6 +405,7 @@ Page({ @@ -404,6 +405,7 @@ Page({
404 navColor, 405 navColor,
405 textsInfoColor, 406 textsInfoColor,
406 is_show_price:res.data.is_show_price, 407 is_show_price:res.data.is_show_price,
  408 + changeType:res.data.is_allow_update,
407 }) 409 })
408 } 410 }
409 }).catch(res => { 411 }).catch(res => {
@@ -417,7 +419,69 @@ Page({ @@ -417,7 +419,69 @@ Page({
417 }, 419 },
418 // 菜品更换 420 // 菜品更换
419 continueOrdering() { 421 continueOrdering() {
420 - this.myToast.showToast('您的订单已经下达给商家,如果需要改菜需和商家确认,以免产生误解。',3000) 422 + if (this.data.changeType == '1') {
  423 + return this.myToast.showToast('您的订单已经下达给商家,如果需要改菜需和商家确认,以免产生误解。', 3000)
  424 + }
  425 + App.Reserve.Detail({
  426 + rid: this.data.options.rid
  427 + }).then(res => {
  428 + let daily = res.data.seller.daily
  429 + let str = ''
  430 + switch (res.data.ddate_solt) {
  431 + case '1':
  432 + str = 'morning'
  433 + break;
  434 + case '2':
  435 + str = 'noon'
  436 + break;
  437 + case '3':
  438 + str = 'night'
  439 + break;
  440 + }
  441 + const currentTimestamp = Date.now();
  442 + let dur;
  443 + Object.keys(daily).forEach(k => {
  444 + if (k == str) {
  445 + dur = daily[k].split('-')[0];
  446 + }
  447 + })
  448 + let ddate = util.unixtoTime(this.data.seller.reserev.ddate, 'YYYY-MM-DD');
  449 + const dateTimeString = `${ddate}T${dur}:00`;
  450 + const timestamp = new Date(dateTimeString).getTime();
  451 + let times = 0;
  452 + const oneHour = 60 * 60 * 1000; // 1小时的毫秒数
  453 + const twoHours = 2 * oneHour; // 2小时的毫秒数
  454 + const oneDay = 24 * 60 * 60 * 1000; // 1天的毫秒数
  455 + const twoDays = 2 * oneDay; // 2天的毫秒数
  456 + switch (this.data.changeType) {
  457 + case '2':
  458 + times = timestamp - oneHour;
  459 + break;
  460 + case '3':
  461 + times = timestamp - twoHours;
  462 + break;
  463 + case '4':
  464 + times = timestamp - oneDay;
  465 + break;
  466 + case '5':
  467 + times = timestamp - twoDays;
  468 + break;
  469 + }
  470 + if (currentTimestamp >= times) {
  471 + return this.myToast.showToast('您的订单已经下达给商家,如果需要改菜需和商家确认,以免产生误解。', 3000)
  472 + } else {
  473 + let url = util.http_build_query({
  474 + sid: this.data.options.sid,
  475 + sellerName: this.data.options.sellerName,
  476 + rid: this.data.options.rid,
  477 + oid: this.data.options.oid,
  478 + identity: '1',
  479 + }, '/pack-cookbook/pages/index_new')
  480 + wx.redirectTo({
  481 + url
  482 + })
  483 + }
  484 + })
421 }, 485 },
422 // 点击了解更多会员优惠政策 486 // 点击了解更多会员优惠政策
423 gotoFavourableList() { 487 gotoFavourableList() {
@@ -462,6 +526,7 @@ Page({ @@ -462,6 +526,7 @@ Page({
462 date: dateSmart, 526 date: dateSmart,
463 tableNum, 527 tableNum,
464 tablesText, 528 tablesText,
  529 + reserev,
465 map_address:reserev.seller.map_address, 530 map_address:reserev.seller.map_address,
466 } 531 }
467 }) 532 })