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

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

@@ -2,7 +2,7 @@
<view> <view>
<!-- 私域引流 --> <!-- 私域引流 -->
<up-popup <up-popup
:show="showPreview" :show="show"
mode="center" mode="center"
round="16rpx" round="16rpx"
closeOnClickOverlay closeOnClickOverlay
@@ -53,10 +53,12 @@ const showPreview = defineModel({
type: Boolean, type: Boolean,
default: false, default: false,
}); });
const show=ref(false);
const emit = defineEmits(["close"]); const emit = defineEmits(["close"]);
function close() { function close() {
showPreview.value = false; show.value = false;
emit("close"); emit("close");
} }
const drainageConfig = ref({}); const drainageConfig = ref({});
@@ -67,7 +69,7 @@ async function getDrainageConfig() {
}); });
drainageConfig.value = drainageConfigRes; drainageConfig.value = drainageConfigRes;
if (drainageConfig.value.isEnable) { if (drainageConfig.value.isEnable) {
showPreview.value = true; show.value = true;
} else { } else {
close(); close();
} }

View File

@@ -61,7 +61,9 @@
:shopInfo="shopInfo" :shopInfo="shopInfo"
idKey="product_id" idKey="product_id"
></goodsPrice> ></goodsPrice>
<view class="old-price" v-if="showLimitDiscount(item)">¥{{ item.salePrice }}</view> <view class="old-price" v-if="showLimitDiscount(item)"
>¥{{ item.salePrice }}</view
>
</view> </view>
<view class="num">x{{ item.num }}</view> <view class="num">x{{ item.num }}</view>
</view> </view>
@@ -110,16 +112,24 @@ const shopUserInfo = inject("shopUserInfo");
const shopInfo = inject("shopInfo"); const shopInfo = inject("shopInfo");
function showLimitDiscount(item) { function showLimitDiscount(item) {
if (!props.limitDiscount || !props.limitDiscount.id) { if (
return false; (item.is_time_discount || item.isTimeDiscount) &&
props.limitDiscount &&
props.limitDiscount.id
) {
return true;
} }
return orderUtils.canUseLimitTimeDiscount( return false;
item, // if (!props.limitDiscount || !props.limitDiscount.id) {
props.limitDiscount, // return false;
shopInfo.value, // }
shopUserInfo.value, // return orderUtils.canUseLimitTimeDiscount(
"productId" // item,
); // props.limitDiscount,
// shopInfo.value,
// shopUserInfo.value,
// "productId"
// );
} }
onMounted(() => { onMounted(() => {
console.log("props.nowCarts"); console.log("props.nowCarts");

View File

@@ -158,7 +158,10 @@
" "
> >
<view class="u-m-t-40 u-p-l-20 u-p-r-20"> <view class="u-m-t-40 u-p-l-20 u-p-r-20">
<view class="youhui-item" v-if="cartStore.orderCostSummary.fullReduction.actualAmount"> <view
class="youhui-item"
v-if="cartStore.orderCostSummary.fullReduction.actualAmount"
>
<view class="u-flex align-center"> <view class="u-flex align-center">
<image <image
src="/static/icon/coup.png" src="/static/icon/coup.png"
@@ -169,10 +172,15 @@
</view> </view>
<view class="red font-12 u-flex align-center" <view class="red font-12 u-flex align-center"
>-¥{{ cartStore.orderCostSummary.fullReduction.actualAmount }}</view >-¥{{
cartStore.orderCostSummary.fullReduction.actualAmount
}}</view
> >
</view> </view>
<view class="youhui-item" v-if="cartStore.orderCostSummary.vipDiscountAmount"> <view
class="youhui-item"
v-if="cartStore.orderCostSummary.vipDiscountAmount"
>
<view class="u-flex align-center"> <view class="u-flex align-center">
<image <image
src="/static/icon/newUserDiscount.png" src="/static/icon/newUserDiscount.png"
@@ -685,7 +693,6 @@ async function getMaxPointsDiscount() {
res.equivalentPoints || 0, res.equivalentPoints || 0,
res.maxDeductionAmount || 0 res.maxDeductionAmount || 0
); );
}
Object.assign(pointsRes, res); Object.assign(pointsRes, res);
maxPointDiscount.value = res.maxDeductionAmount || 0; maxPointDiscount.value = res.maxDeductionAmount || 0;
console.log("积分可抵扣最大金额", maxPointDiscount.value); console.log("积分可抵扣最大金额", maxPointDiscount.value);
@@ -698,6 +705,7 @@ async function getMaxPointsDiscount() {
cartStore.setUserPoints(0); cartStore.setUserPoints(0);
} }
} }
}
watch( watch(
() => maxMoney.value, () => maxMoney.value,
(newval) => { (newval) => {
@@ -852,8 +860,13 @@ function calcDiscountActivity() {
const res = discountActivityRes.value; const res = discountActivityRes.value;
const user = uni.cache.get("shopUserInfo"); const user = uni.cache.get("shopUserInfo");
const usedFullReductionActivityFullAmount=cartStore.orderCostSummary.fullReduction.usedFullReductionActivityFullAmount; const usedFullReductionActivityFullAmount =
console.log("usedFullReductionActivityFullAmount", usedFullReductionActivityFullAmount); cartStore.orderCostSummary.fullReduction
.usedFullReductionActivityFullAmount;
console.log(
"usedFullReductionActivityFullAmount",
usedFullReductionActivityFullAmount
);
if (res && res.thresholds && res.thresholds.length > 0) { if (res && res.thresholds && res.thresholds.length > 0) {
const canUseThresholds = res.thresholds const canUseThresholds = res.thresholds
@@ -874,8 +887,6 @@ function calcDiscountActivity() {
return; return;
} }
console.log("当前满减门槛", discountActivity.value); console.log("当前满减门槛", discountActivity.value);
} }
async function getDiscountActivity() { async function getDiscountActivity() {
const res = await discountActivityApi.config({ const res = await discountActivityApi.config({

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -11,7 +11,8 @@ import { defineStore } from "pinia";
// GoodsType // GoodsType
// } = yskUtils // } = yskUtils
import { OrderPriceCalculator } from "@/utils/goods"; import yskUtils from 'ysk-utils'
const {OrderPriceCalculator}=yskUtils
import { ref, computed, reactive, watchEffect, watch } from "vue"; import { ref, computed, reactive, watchEffect, watch } from "vue";
import { import {