修复获取限时折扣问题

This commit is contained in:
YeMingfei666 2025-11-19 11:10:41 +08:00
parent 6376557149
commit fdc3765a2c
3 changed files with 55 additions and 27 deletions

View File

@ -295,7 +295,7 @@
v-else-if=" v-else-if="
isVip && isVip &&
item.lowMemberPrice && item.lowMemberPrice &&
item.lowMemberPrice * 1 != item.lowPrice * 1 item.lowMemberPrice * 1 !=0
" "
> >
<text class="line-th color-999" <text class="line-th color-999"
@ -427,9 +427,14 @@
v-if="orderCostSummary.totalDiscountAmount" v-if="orderCostSummary.totalDiscountAmount"
> >
<view class="">优惠金额</view> <view class="">优惠金额</view>
<view class="font-bold u-font-32" <view class="font-bold u-font-32 u-m-r-16"
>{{ orderCostSummary.totalDiscountAmount }}</view >{{ orderCostSummary.totalDiscountAmount }}</view
> >
<up-icon
name="question-circle"
color="#666"
@click="showDiscountInfo = true"
></up-icon>
</view> </view>
</view> </view>
@ -477,6 +482,28 @@
:ref="setModel" :ref="setModel"
name="packNumber" name="packNumber"
></pack-number> ></pack-number>
<up-popup :show="showDiscountInfo" mode="center" round="16rpx" @close="showDiscountInfo = false" closeOnClickOverlay >
<view class="u-p-30 u-flex u-flex-col gap-20" style="min-width: 300rpx;">
<view class="u-flex gap-20 u-row-between w-full" v-if="orderCostSummary.goodsDiscountAmount">
<text>商品优惠</text>
<text class="color-red">{{ orderCostSummary.goodsDiscountAmount }}</text>
</view>
<view class="u-flex gap-20 u-row-between w-full" v-if="orderCostSummary.newUserDiscount">
<text>新客立减</text>
<text class="color-red">{{ orderCostSummary.newUserDiscount }}</text>
</view>
<view class="u-flex gap-20 u-row-between w-full" v-if="orderCostSummary.fullReduction.actualAmount">
<text>满减活动</text>
<text class="color-red">{{ orderCostSummary.fullReduction.actualAmount }}</text>
</view>
<view class="u-flex gap-20 u-row-between w-full" v-if="orderCostSummary.vipDiscountAmount">
<text>会员折扣</text>
<text class="color-red">{{ orderCostSummary.vipDiscountAmount }}</text>
</view>
</view>
</up-popup>
<!-- <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount> --> <!-- <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount> -->
</view> </view>
</template> </template>
@ -506,7 +533,6 @@ import { getSafeBottomHeight } from "@/commons/utils/safe-bottom.js";
import go from "@/commons/utils/go.js"; import go from "@/commons/utils/go.js";
import { hasPermission } from "@/commons/utils/hasPermission.js"; import { hasPermission } from "@/commons/utils/hasPermission.js";
import { getNowCart } from "@/pagesCreateOrder/util.js"; import { getNowCart } from "@/pagesCreateOrder/util.js";
import { number } from "uview-plus/libs/function/test";
import { getShopInfo } from "@/http/api/shop.js"; import { getShopInfo } from "@/http/api/shop.js";
import { getShopTableDetail } from "@/http/api/table.js"; import { getShopTableDetail } from "@/http/api/table.js";
@ -518,6 +544,9 @@ import BigNumber from "bignumber.js";
import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js"; import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js";
import yskUtils from "ysk-utils"; import yskUtils from "ysk-utils";
//
const showDiscountInfo = ref(false);
// import yskUtils from "@/lib/index"; // import yskUtils from "@/lib/index";
const limitUtils = yskUtils.limitUtils; const limitUtils = yskUtils.limitUtils;
provide("yskUtils", yskUtils); provide("yskUtils", yskUtils);
@ -687,10 +716,6 @@ const $seatFee = reactive({
totalAmount: 0, totalAmount: 0,
}); });
/** /**
* 判断是否是会员 * 判断是否是会员
*/ */
@ -703,7 +728,6 @@ const isVip = computed(() => {
); );
}); });
/** /**
* init * init
*/ */
@ -724,7 +748,7 @@ function onMessage() {
websocketUtil.offMessage(); websocketUtil.offMessage();
websocketUtil.onMessage((res) => { websocketUtil.onMessage((res) => {
let msg = JSON.parse(res); let msg = JSON.parse(res);
console.log('msg===',msg); console.log("msg===", msg);
let cartItem; let cartItem;
if (msg.msg_id) { if (msg.msg_id) {
websocketUtil.send( websocketUtil.send(
@ -742,9 +766,9 @@ function onMessage() {
switch (msg.operate_type) { switch (msg.operate_type) {
case "onboc_init": case "onboc_init":
goods.list = []; goods.list = [];
console.log('msg.data', msg.data); console.log("msg.data", msg.data);
msg.data.map((item) => { msg.data.map((item) => {
console.log("item===",item) console.log("item===", item);
cartItem = getNowCart(item, $goods, pageData.user); cartItem = getNowCart(item, $goods, pageData.user);
console.log(cartItem); console.log(cartItem);
if (cartItem.isGrounding || cartItem.is_temporary == 1) { if (cartItem.isGrounding || cartItem.is_temporary == 1) {
@ -895,6 +919,9 @@ async function getTableInfo(opt) {
// //
getCart(); getCart();
// //
if(shopInfo.registerType==='before'){
return
}
getHistoryOrderDetail(opt.tableCode); getHistoryOrderDetail(opt.tableCode);
} }
@ -1124,8 +1151,6 @@ function showModel(key, index, item) {
} }
} }
/** /**
* 更新就餐人数 * 更新就餐人数
*/ */
@ -1213,7 +1238,8 @@ async function createAnOrder() {
tableCode: pageData.table.tableCode, // tableCode: pageData.table.tableCode, //
dineMode: pageData.eatTypes.active, // dine-in take-out take-away dineMode: pageData.eatTypes.active, // dine-in take-out take-away
remark: pageData.form.note, // remark: pageData.form.note, //
seatNum: pageData.eatTypes.active == "dine-in" ? seatFeeConfig.personCount : 0, // seatNum:
pageData.eatTypes.active == "dine-in" ? seatFeeConfig.personCount : 0, //
packFee: orderCostSummary.value.packFee, // packFee: orderCostSummary.value.packFee, //
originAmount: orderCostSummary.value.goodsRealAmount, //+ originAmount: orderCostSummary.value.goodsRealAmount, //+
placeNum: placeNum, // placeNum: placeNum, //
@ -1227,7 +1253,7 @@ async function createAnOrder() {
if (pageData.orderInfo && pageData.shopInfo.registerType != "before") { if (pageData.orderInfo && pageData.shopInfo.registerType != "before") {
par.orderId = pageData.orderInfo.id; par.orderId = pageData.orderInfo.id;
} }
let res = null let res = null;
if (goods.list.length) { if (goods.list.length) {
res = await createOrder(par); res = await createOrder(par);
console.log(res, "创建订单"); console.log(res, "创建订单");
@ -1366,7 +1392,9 @@ const allGoodsList = computed(() => {
cur.map((v) => { cur.map((v) => {
v.number = v.num; v.number = v.num;
v.salePrice = v.price; v.salePrice = v.price;
v.discount_sale_amount=v.discount_sale_amount?v.discount_sale_amount*1:0; v.discount_sale_amount = v.discount_sale_amount
? v.discount_sale_amount * 1
: 0;
}); });
prve.push(...cur); prve.push(...cur);
return prve; return prve;
@ -1513,4 +1541,10 @@ watch(
z-index: 9; z-index: 9;
color: #fff; color: #fff;
} }
.u-row-between {
justify-content: space-between;
}
.w-full{
width: 100%;
}
</style> </style>

View File

@ -13,17 +13,11 @@ export function getNowCart(carItem,goodsList,user) {
if(carItem.product_id == goodsItem.id){ if(carItem.product_id == goodsItem.id){
goodsItem.skuList.map(item=>{ goodsItem.skuList.map(item=>{
if(carItem.sku_id == item.id){ if(carItem.sku_id == item.id){
carItem.lowPrice = item.salePrice carItem.lowPrice = item.lowPrice||item.salePrice
carItem.lowMemberPrice = item.memberPrice carItem.lowMemberPrice = item.memberPrice
carItem.memberPrice = item.memberPrice carItem.memberPrice = item.memberPrice
carItem.specInfo = item.specInfo carItem.specInfo = item.specInfo
carItem.salePrice = item.salePrice carItem.salePrice = item.lowPrice
if( uni.getStorageSync('shopInfo').isMemberPrice && user && user.id && user.isVip ){
carItem.salePrice = item.memberPrice
} else {
carItem.salePrice = item.salePrice
}
} }
}) })

View File

@ -441,7 +441,7 @@
let res = await discountActivity({ let res = await discountActivity({
shopId: uni.getStorageSync("shopInfo").id||'', shopId: uni.getStorageSync("shopInfo").id||'',
}); });
if (res.code == 200) { if (res) {
fullReductionActivities.value = res ? [res] : []; fullReductionActivities.value = res ? [res] : [];
} }
} }