修复订单结算私域引流弹窗问题,修复后付费模式下确认订单显示问题
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<view>
|
||||
<!-- 私域引流 -->
|
||||
<up-popup
|
||||
:show="showPreview"
|
||||
:show="show"
|
||||
mode="center"
|
||||
round="16rpx"
|
||||
closeOnClickOverlay
|
||||
@@ -53,10 +53,12 @@ const showPreview = defineModel({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
});
|
||||
|
||||
const show=ref(false);
|
||||
const emit = defineEmits(["close"]);
|
||||
|
||||
function close() {
|
||||
showPreview.value = false;
|
||||
show.value = false;
|
||||
emit("close");
|
||||
}
|
||||
const drainageConfig = ref({});
|
||||
@@ -67,7 +69,7 @@ async function getDrainageConfig() {
|
||||
});
|
||||
drainageConfig.value = drainageConfigRes;
|
||||
if (drainageConfig.value.isEnable) {
|
||||
showPreview.value = true;
|
||||
show.value = true;
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
:shopInfo="shopInfo"
|
||||
idKey="product_id"
|
||||
></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 class="num">x{{ item.num }}</view>
|
||||
</view>
|
||||
@@ -110,16 +112,24 @@ const shopUserInfo = inject("shopUserInfo");
|
||||
const shopInfo = inject("shopInfo");
|
||||
|
||||
function showLimitDiscount(item) {
|
||||
if (!props.limitDiscount || !props.limitDiscount.id) {
|
||||
return false;
|
||||
if (
|
||||
(item.is_time_discount || item.isTimeDiscount) &&
|
||||
props.limitDiscount &&
|
||||
props.limitDiscount.id
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return orderUtils.canUseLimitTimeDiscount(
|
||||
item,
|
||||
props.limitDiscount,
|
||||
shopInfo.value,
|
||||
shopUserInfo.value,
|
||||
"productId"
|
||||
);
|
||||
return false;
|
||||
// if (!props.limitDiscount || !props.limitDiscount.id) {
|
||||
// return false;
|
||||
// }
|
||||
// return orderUtils.canUseLimitTimeDiscount(
|
||||
// item,
|
||||
// props.limitDiscount,
|
||||
// shopInfo.value,
|
||||
// shopUserInfo.value,
|
||||
// "productId"
|
||||
// );
|
||||
}
|
||||
onMounted(() => {
|
||||
console.log("props.nowCarts");
|
||||
@@ -542,4 +552,4 @@ const showOldPrice = computed(() => {});
|
||||
text-decoration: line-through;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -158,7 +158,10 @@
|
||||
"
|
||||
>
|
||||
<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">
|
||||
<image
|
||||
src="/static/icon/coup.png"
|
||||
@@ -169,10 +172,15 @@
|
||||
</view>
|
||||
|
||||
<view class="red font-12 u-flex align-center"
|
||||
>-¥{{ cartStore.orderCostSummary.fullReduction.actualAmount }}</view
|
||||
>-¥{{
|
||||
cartStore.orderCostSummary.fullReduction.actualAmount
|
||||
}}</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">
|
||||
<image
|
||||
src="/static/icon/newUserDiscount.png"
|
||||
@@ -685,17 +693,17 @@ async function getMaxPointsDiscount() {
|
||||
res.equivalentPoints || 0,
|
||||
res.maxDeductionAmount || 0
|
||||
);
|
||||
}
|
||||
Object.assign(pointsRes, res);
|
||||
maxPointDiscount.value = res.maxDeductionAmount || 0;
|
||||
console.log("积分可抵扣最大金额", maxPointDiscount.value);
|
||||
Object.assign(pointsRes, res);
|
||||
maxPointDiscount.value = res.maxDeductionAmount || 0;
|
||||
console.log("积分可抵扣最大金额", maxPointDiscount.value);
|
||||
|
||||
if (usePoints.value && res.usable) {
|
||||
console.log("积分抵扣金额", res.maxDeductionAmount);
|
||||
cartStore.setUserPoints(res.maxUsablePoints || 0);
|
||||
}
|
||||
if (!res.usable) {
|
||||
cartStore.setUserPoints(0);
|
||||
if (usePoints.value && res.usable) {
|
||||
console.log("积分抵扣金额", res.maxDeductionAmount);
|
||||
cartStore.setUserPoints(res.maxUsablePoints || 0);
|
||||
}
|
||||
if (!res.usable) {
|
||||
cartStore.setUserPoints(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
watch(
|
||||
@@ -852,8 +860,13 @@ function calcDiscountActivity() {
|
||||
const res = discountActivityRes.value;
|
||||
const user = uni.cache.get("shopUserInfo");
|
||||
|
||||
const usedFullReductionActivityFullAmount=cartStore.orderCostSummary.fullReduction.usedFullReductionActivityFullAmount;
|
||||
console.log("usedFullReductionActivityFullAmount", usedFullReductionActivityFullAmount);
|
||||
const usedFullReductionActivityFullAmount =
|
||||
cartStore.orderCostSummary.fullReduction
|
||||
.usedFullReductionActivityFullAmount;
|
||||
console.log(
|
||||
"usedFullReductionActivityFullAmount",
|
||||
usedFullReductionActivityFullAmount
|
||||
);
|
||||
|
||||
if (res && res.thresholds && res.thresholds.length > 0) {
|
||||
const canUseThresholds = res.thresholds
|
||||
@@ -874,8 +887,6 @@ function calcDiscountActivity() {
|
||||
return;
|
||||
}
|
||||
console.log("当前满减门槛", discountActivity.value);
|
||||
|
||||
|
||||
}
|
||||
async function getDiscountActivity() {
|
||||
const res = await discountActivityApi.config({
|
||||
@@ -1593,4 +1604,4 @@ onMounted(async () => {
|
||||
z-index: 9;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
|
||||
@@ -11,7 +11,8 @@ import { defineStore } from "pinia";
|
||||
// GoodsType
|
||||
// } = yskUtils
|
||||
|
||||
import { OrderPriceCalculator } from "@/utils/goods";
|
||||
import yskUtils from 'ysk-utils'
|
||||
const {OrderPriceCalculator}=yskUtils
|
||||
|
||||
import { ref, computed, reactive, watchEffect, watch } from "vue";
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user