优化下单

This commit is contained in:
gyq
2025-04-21 17:45:05 +08:00
parent 694cb154a6
commit b5773cf78c
12 changed files with 275 additions and 16268 deletions

View File

@@ -282,7 +282,6 @@ watch(props, () => {
money.value = formatDecimal(props.amount)
originOrderAmount.value = formatDecimal(props.amount - (goodsStore.tableInfo.tableFee || 0) -
(goodsStore.cartInfo.packFee || 0))
payData.value.checkOrderPay.isPrint = props.isPrint
})
const originOrderAmount = ref(0)
@@ -912,7 +911,26 @@ function discountConfirm() {
/** 添加优惠 end */
// 初始化
function reset() {
async function payCardInit() {
console.log('payCardInit111111==============================', goodsStore.orderListInfo);
// const maxRetries = 10;
// let retries = 0;
// const waitForOrderId = async () => {
// while (retries < maxRetries && !goodsStore.orderListInfo.id) {
// await new Promise(resolve => setTimeout(resolve, 200));
// retries++;
// }
// return goodsStore.orderListInfo.id;
// };
// const orderId = await waitForOrderId();
// if (!orderId) {
// console.error('无法获取订单 ID');
// return;
// }
discountAmount.value = null
roundAmount.value = 0
discountRateVlaue.value = 0
@@ -926,7 +944,7 @@ function reset() {
orderId: goodsStore.orderListInfo.id,
vipPrice: store.shopInfo.isMemberPrice ? goodsStore.showVipPrice : 0, // 是否使用会员价
allPack: goodsStore.allSelected, // 是否整单打包
userId: goodsStore.vipUserInfo.userId,
userId: goodsStore.vipUserInfo.userId || '',
seatNum: goodsStore.tableInfo.num, // 用餐人数
originAmount: formatDecimal(+goodsStore.cartInfo.totalAmount), // 订单原金额(包含打包费+餐位费) 不含折扣价格
discountRatio: '', // 折扣比例(计算时 向上取整保留 两位小数)
@@ -942,13 +960,15 @@ function reset() {
},
};
console.log('payData================================', payData.value);
if (!payList.value.length) {
queryPayTypeAjax()
}
}
defineExpose({
reset
payCardInit
})
</script>