修复订单结算私域引流弹窗问题,修复后付费模式下确认订单显示问题

This commit is contained in:
2025-12-09 09:19:18 +08:00
parent a6190774c8
commit d02948a936
6 changed files with 1513 additions and 1317 deletions

View File

@@ -555,7 +555,8 @@
<script setup>
import xbSwiperPreview from '@/components/xb-swiper-preview/index.vue';
//价格计算辅助函数
import * as orderUtils from '@/utils/order-utils.js';
// import * as limitUtils from '@/utils/order-utils.js';
import {limitUtils } from 'ysk-utils'
import BigNumber from 'bignumber.js';
import GoodsPrice from '@/components/goods-price.vue';
@@ -1341,8 +1342,7 @@ const singleclick = async (item, i) => {
} else if (item.suitNum >= cartNumberFloat && i === '-') {
suitNum = item.cartNumber;
}
websocketsendMessage({
id: res ? item.cartListId : '',
const sendMsg={
type: 'shopping',
suitNum: item.suitNum,
table_code: uni.cache.get('tableCode'),
@@ -1355,7 +1355,11 @@ const singleclick = async (item, i) => {
is_print: 1,
product_type: item.type,
is_time_discount: item.is_time_discount
});
}
if(item.cartListId){
sendMsg.id=item.cartListId;
}
websocketsendMessage(sendMsg);
};
const calculateValue = (cartNumber, i, step = 1) => {
@@ -1677,6 +1681,7 @@ const confirmorderref = ref(null);
// 结账
const orderdetail = async () => {
isAutoClose = false;
uni.navigateTo({
url: '/pages/order/confirm-order?tableCode=' + uni.cache.get('tableCode') + '&shopId=' + uni.cache.get('shopId')
});
@@ -1734,7 +1739,7 @@ const totalPrices = computed(() => {
}
if (limitTimeDiscountRes.value && limitTimeDiscountRes.value.id && item.is_time_discount == 1) {
//限时折扣
const price = orderUtils.returnPrice({
const price = limitUtils.returnPrice({
goods: item,
shopInfo,
limitTimeDiscountRes: limitTimeDiscountRes.value,
@@ -2083,11 +2088,11 @@ function showLimitDiscount(item) {
if (!cartStore.limitTimeDiscount || !cartStore.limitTimeDiscount.id) {
return false;
}
return orderUtils.canUseLimitTimeDiscount(item, cartStore.limitTimeDiscount, shopInfo, shopUserInfo.value, 'id');
return limitUtils.canUseLimitTimeDiscount(item, cartStore.limitTimeDiscount, shopInfo, shopUserInfo.value, 'id');
}
function returnLimitPrice(item) {
return orderUtils.returnPrice({
return limitUtils.returnPrice({
goods: item,
limitTimeDiscountRes: cartStore.limitTimeDiscount,
shopInfo: shopInfo,
@@ -2097,6 +2102,7 @@ function returnLimitPrice(item) {
}
onShow(async () => {
isAutoClose=true
// 监听页面显示和隐藏
useSocket.setOnMessage(onMessage);
useSocket.onShowconnect();
@@ -2116,17 +2122,23 @@ onShow(async () => {
}
});
onHide(() => {
console.log('product index onHide');
//是否自动关闭socket
let isAutoClose = true;
function closeSocket(){
if(isAutoClose){
useSocket.closeSocket();
}
useSocket.setOnMessage(() => {});
}
onHide(() => {
closeSocket()
});
onUnload(() => {
console.log('product index onUnload');
useSocket.closeSocket();
useSocket.setOnMessage(() => {});
closeSocket()
});
const oldOrder=ref(null)
onMounted(async () => {
await proxy.$onLaunched;
// 获取当前页面栈
@@ -2139,6 +2151,7 @@ onMounted(async () => {
let res = await APIhistoryOrder({
tableCode: uni.cache.get('tableCode')
});
oldOrder.value = res;
const limitRes = await limitTimeDiscountapi.getConfig({
shopId: uni.cache.get('shopId')
});
@@ -2179,10 +2192,17 @@ onMounted(async () => {
//跳转历史订单
function toHistory() {
isAutoClose = false;
const tableCode = uni.cache.get('tableCode');
const shopId = uni.cache.get('shopId');
let url= `/pages/order/confirm-order?tableCode=${tableCode}&shopId=${shopId}`
const res=oldOrder.value;
console.log('toHistory',res);
// if (res && res.id && shopInfo.registerType == 'after') {
// url+='&orderId='+res.id
// }
uni.navigateTo({
url: `/pages/order/confirm-order?tableCode=${tableCode}&shopId=${shopId}`
url
});
}
</script>