Commit 0f601a091e55f7c7aa97c9d9ee704b3f5280ef0e

Authored by pengye
1 parent 503de2fb

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

... ... @@ -351,7 +351,16 @@ Page({
},
// 继续点菜
continueOrdering() {
wx.navigateBack(1)
let url = util.http_build_query({
sid: this.data.options.sid,
sellerName: this.data.options.sellerName,
rid: this.data.options.rid,
oid: this.data.options.oid,
identity: '1',
}, '/pack-cookbook/pages/index_new')
wx.redirectTo({
url
})
},
// 确认下单
determineFun() {
... ... @@ -368,7 +377,7 @@ Page({
identity: this.data.options.identity,
remark:this.data.notes+''
}).then(res => {
wx.navigateTo({
wx.redirectTo({
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}`
})
})
... ...
... ... @@ -96,7 +96,7 @@ Page({
}
cookbookObj.themeColor=this.data.themeColor;
cookbookObj.navColor=this.data.navColor;
wx.navigateTo({
wx.redirectTo({
url: `/pack-cookbook/pages/cart_new?cookbookObj=${JSON.stringify(cookbookObj)}`,
})
},
... ... @@ -242,7 +242,8 @@ Page({
}).then(res => {
let orderItemCount = 0;
res.data.cookbooklist.forEach(cb => {
if (cb.status > 0) {
// options.identity代表是从APP分享的请客人点餐,如果已点菜,就要显示success_new页
if (cb.status > 0 && this.data.options.identity=='2') {
let data={
...this.data.options
}
... ... @@ -250,7 +251,7 @@ Page({
data.sellerName=res.data.seller.sellername;
data.oid=res.data.id;
console.log('跳转到下单页携带参数',{...data});
wx.navigateTo({
wx.redirectTo({
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}`,
})
return false;
... ...
... ... @@ -41,7 +41,7 @@ page {
}
.dishWrap:nth-last-of-type(1) {
padding-bottom: 200rpx;
padding-bottom: 220rpx;
}
.oneBox {
... ...
... ... @@ -22,6 +22,7 @@ Page({
navColor:'',
height:wx.getSystemInfoSync().windowWidth*1,
is_show_price:'',
changeType:'1',//1不允许修改 2开餐1小时之前 3开餐2小时之前 4预订日期1天前 5预订日期2天前
},
myToast :'',
imageLoad(e) {
... ... @@ -404,6 +405,7 @@ Page({
navColor,
textsInfoColor,
is_show_price:res.data.is_show_price,
changeType:res.data.is_allow_update,
})
}
}).catch(res => {
... ... @@ -417,7 +419,69 @@ Page({
},
// 菜品更换
continueOrdering() {
this.myToast.showToast('您的订单已经下达给商家,如果需要改菜需和商家确认,以免产生误解。',3000)
if (this.data.changeType == '1') {
return this.myToast.showToast('您的订单已经下达给商家,如果需要改菜需和商家确认,以免产生误解。', 3000)
}
App.Reserve.Detail({
rid: this.data.options.rid
}).then(res => {
let daily = res.data.seller.daily
let str = ''
switch (res.data.ddate_solt) {
case '1':
str = 'morning'
break;
case '2':
str = 'noon'
break;
case '3':
str = 'night'
break;
}
const currentTimestamp = Date.now();
let dur;
Object.keys(daily).forEach(k => {
if (k == str) {
dur = daily[k].split('-')[0];
}
})
let ddate = util.unixtoTime(this.data.seller.reserev.ddate, 'YYYY-MM-DD');
const dateTimeString = `${ddate}T${dur}:00`;
const timestamp = new Date(dateTimeString).getTime();
let times = 0;
const oneHour = 60 * 60 * 1000; // 1小时的毫秒数
const twoHours = 2 * oneHour; // 2小时的毫秒数
const oneDay = 24 * 60 * 60 * 1000; // 1天的毫秒数
const twoDays = 2 * oneDay; // 2天的毫秒数
switch (this.data.changeType) {
case '2':
times = timestamp - oneHour;
break;
case '3':
times = timestamp - twoHours;
break;
case '4':
times = timestamp - oneDay;
break;
case '5':
times = timestamp - twoDays;
break;
}
if (currentTimestamp >= times) {
return this.myToast.showToast('您的订单已经下达给商家,如果需要改菜需和商家确认,以免产生误解。', 3000)
} else {
let url = util.http_build_query({
sid: this.data.options.sid,
sellerName: this.data.options.sellerName,
rid: this.data.options.rid,
oid: this.data.options.oid,
identity: '1',
}, '/pack-cookbook/pages/index_new')
wx.redirectTo({
url
})
}
})
},
// 点击了解更多会员优惠政策
gotoFavourableList() {
... ... @@ -462,6 +526,7 @@ Page({
date: dateSmart,
tableNum,
tablesText,
reserev,
map_address:reserev.seller.map_address,
}
})
... ...