wangfukang 2 days ago
parent
commit
a1a4577dc7
  1. 82
      package2/group/groupBuySingle.vue

82
package2/group/groupBuySingle.vue

@ -672,7 +672,7 @@
<text style="font-size: 30rpx;font-weight: 700;">立即出餐</text>
</view>
<view style="color: #777;width: 500rpx;">
{{nowMake === false ? '选择用餐时间,系统会在用餐前30分钟通知商家并打印小票' : '拼团成功后立即出餐'}}
{{nowMake === true ? '请选择到店用餐时间' : (nowMake === false ? '可到店后再安排出餐' : '请选择是否现在备餐')}}
</view>
<view class="now-make-options">
<view class="now-make-option" @tap="checkNowMake(true)">
@ -688,7 +688,7 @@
否
</view>
</view>
<view class="pickup-time-row" v-if="nowMake === false" @tap="openPickupTimePicker">
<view class="pickup-time-row" v-if="nowMake === true" @tap="openPickupTimePicker">
<text>用餐时间</text>
<text :class="{'pickup-time-placeholder': !pickupTime}">{{pickupTime || '选择时间 >'}}</text>
</view>
@ -725,7 +725,7 @@
</view>
</view>
<view class="btn pay-confirm-btn" @tap="wxPayment">
确认付款{{nowMake === true && groupdeliveryType == 2 && !isStoreGroupOrder ? '-即刻出餐' : ''}}
确认付款
</view>
</view>
</view>
@ -738,7 +738,7 @@
<view class="now-make-popup-title">是否立即出餐</view>
<view class="now-make-popup-desc">请选择是否需要商家在成团后立即出餐。</view>
<view class="now-make-popup-tip">
选择“否”后需要预约用餐时间,系统会在用餐前30分钟通知商家并打印小票
选择“是”后请选择到店用餐时间,成团后商家会按这个时间为你备餐。选择“否”可到店后再安排出餐
</view>
<view class="now-make-popup-actions">
<view class="now-make-popup-cancel" @tap="confirmNowMake(false)">否</view>
@ -746,6 +746,19 @@
</view>
</view>
</uni-popup>
<uni-popup ref="pickupTimeConfirmPopup" type="center" background-color="transparent">
<view class="now-make-popup">
<view class="now-make-popup-title">确认用餐时间</view>
<view class="now-make-popup-time">{{pendingPickupTime}}</view>
<view class="now-make-popup-tip">
确认后,成团后商家会按这个时间为你备餐
</view>
<view class="now-make-popup-actions">
<view class="now-make-popup-cancel" @tap="cancelPickupTimeConfirm">取消</view>
<view class="now-make-popup-confirm" @tap="confirmPickupTime">确认</view>
</view>
</view>
</uni-popup>
<!-- 参团成功提示弹出层 -->
<uni-popup ref="tishiPopup" background-color="transparent" @change="onTishiPopupChange">
<view v-if="!isPindan && isStoreGroupOrder" class="group-face-tip-popup" @tap.stop>
@ -927,6 +940,7 @@
productId: '',
nowMake: null,
pickupTime: '',
pendingPickupTime: '',
pickupTimeContent: [],
isPack: 0,
productItem: [],
@ -1525,8 +1539,10 @@
checkNowMake(value) {
this.nowMake = value;
if (value === false) {
this.openPickupTimePicker();
this.pickupTime = '';
return;
}
this.openPickupTimePicker();
},
openNowMakePopup() {
this.$refs.nowMakePopup.open('center');
@ -1535,30 +1551,44 @@
this.nowMake = value;
this.$refs.nowMakePopup.close();
this.$nextTick(() => {
if (value === false) {
if (value === true) {
this.openPickupTimePicker();
return;
}
this.pickupTime = '';
this.wxPayment();
});
},
needsPickupAppointment() {
return this.groupdeliveryType == 2 && !this.isStoreGroupOrder && this.nowMake === false;
return this.groupdeliveryType == 2 && !this.isStoreGroupOrder && this.nowMake === true;
},
openPickupTimePicker() {
this.generatePickupTimes();
this.$refs.pickupTimeModel.open();
},
pickupTimeCallback(val) {
this.pickupTime = val.timestr;
this.pendingPickupTime = val.timestr;
this.$refs.pickupTimeModel.close();
this.$nextTick(() => {
this.$refs.pickupTimeConfirmPopup.open('center');
});
},
cancelPickupTimeConfirm() {
this.pendingPickupTime = '';
this.$refs.pickupTimeConfirmPopup.close();
},
confirmPickupTime() {
if (!this.pendingPickupTime) return;
this.pickupTime = this.pendingPickupTime;
this.pendingPickupTime = '';
this.$refs.pickupTimeConfirmPopup.close();
},
getPickupLeadMinutes() {
const cookingTime = Number(this.shopItem.shopTakeaway && this.shopItem.shopTakeaway.cookingTime ? this.shopItem.shopTakeaway.cookingTime : 0);
return !isNaN(cookingTime) && cookingTime > 0 ? cookingTime : 30;
},
getNextPickupSlot(date) {
const interval = 20;
const interval = 10;
const slot = new Date(date);
slot.setSeconds(0, 0);
const remainder = slot.getMinutes() % interval;
@ -1591,7 +1621,7 @@
return fallbackEndTime;
}
endTime.setHours(parts[0], parts[1], 0, 0);
endTime.setMinutes(endTime.getMinutes() + 20);
endTime.setMinutes(endTime.getMinutes() + 10);
return endTime > fallbackEndTime ? fallbackEndTime : endTime;
},
generatePickupTimes() {
@ -1602,11 +1632,15 @@
earliestTime.setMinutes(earliestTime.getMinutes() + this.getPickupLeadMinutes());
const todayStartTime = this.getNextPickupSlot(earliestTime);
const todayEndTime = this.getPickupAppointmentEndTime(today);
const currentTime = this.formatClockTime(now);
const timelist = [];
const cursor = new Date(todayStartTime);
while (cursor <= todayEndTime) {
timelist.push({ timestr: this.formatClockTime(cursor) });
cursor.setMinutes(cursor.getMinutes() + 20);
cursor.setMinutes(cursor.getMinutes() + 10);
}
if (!timelist.length || timelist[0].timestr !== currentTime) {
timelist.unshift({ timestr: currentTime });
}
this.pickupTimeContent = [{
id: 'today',
@ -1619,12 +1653,11 @@
let [h, m] = this.pickupTime.split(':');
let targetHour = parseInt(h);
let targetMinute = parseInt(m);
let d = new Date();
if (targetHour < d.getHours() || (targetHour === d.getHours() && targetMinute <= d.getMinutes())) {
d.setDate(d.getDate() + 1);
}
d.setHours(targetHour, targetMinute, 0, 0);
return this.formatDateTimeValue(d);
if (isNaN(targetHour) || isNaN(targetMinute)) return null;
const now = new Date();
const target = new Date();
target.setHours(targetHour, targetMinute, 0, 0);
return this.formatDateTimeValue(target.getTime() <= now.getTime() ? now : target);
},
toNumber(value) {
let amount = parseFloat(value);
@ -2404,7 +2437,6 @@
payload.isPack = this.isPack;
if (this.nowMake === true) {
payload.userRequireMake = 1;
} else if (this.nowMake === false) {
payload.userRequireMakeTime = this.getPickupMakeTime();
}
}
@ -2845,6 +2877,11 @@
this.openNowMakePopup();
return;
}
if (this.needsPickupAppointment() && !this.pickupTime) {
this.tui.toast('请选择用餐时间');
this.openPickupTimePicker();
return;
}
if (!this.currentOrderId || !this.backendTotalAmount) {
if (this.pendingPaySpecChoices) {
this.createFTFJoinOrder(this.pendingPaySpecChoices, true);
@ -3418,6 +3455,15 @@
text-align: center;
}
.now-make-popup-time {
margin-top: 18rpx;
color: #00231C;
font-size: 48rpx;
font-weight: 900;
line-height: 64rpx;
text-align: center;
}
.now-make-popup-desc {
margin-top: 12rpx;
color: #6f7f79;

Loading…
Cancel
Save