订单结算修改,增加限时折扣
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -45,62 +45,66 @@
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<orderItemVue
|
||||
<!-- <orderItemVue
|
||||
:useVipPrice="useVipPrice"
|
||||
v-if="nowCarts.length"
|
||||
:nowCarts="nowCarts"
|
||||
:limitDiscount="cartStore.limitTimeDiscount"
|
||||
></orderItemVue> -->
|
||||
<orderItemVue
|
||||
:useVipPrice="useVipPrice"
|
||||
v-if="cartStore.allGoods.length"
|
||||
:nowCarts="cartStore.allGoods"
|
||||
:limitDiscount="cartStore.limitTimeDiscount"
|
||||
></orderItemVue>
|
||||
<!-- 订单头部 -->
|
||||
<view
|
||||
class="card_item"
|
||||
v-for="(value, key) in listinfo.detailMap"
|
||||
:key="key"
|
||||
>
|
||||
<!-- <view class="head">
|
||||
<view class="head_left">
|
||||
<text class="placeNum" v-if="key!=0">第{{key}}次下单</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 订单详情 -->
|
||||
<view class="shop-info">
|
||||
<view class="item" v-for="item in value" :key="item.id">
|
||||
<view class="cover">
|
||||
<up-image
|
||||
width="76"
|
||||
height="76"
|
||||
radius="16"
|
||||
:src="item.productImg"
|
||||
v-if="item.productId != -999"
|
||||
></up-image>
|
||||
<up-image
|
||||
width="76"
|
||||
height="76"
|
||||
radius="16"
|
||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||
mode="heightFix"
|
||||
v-else
|
||||
></up-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<text class="productName">{{ item.productName }}</text>
|
||||
<text class="productSkuName" v-if="item.skuName">{{
|
||||
item.skuName
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="price">
|
||||
<view class="priceAmount">
|
||||
<text v-if="isBwc">{{ item.price }}</text>
|
||||
<text v-else>
|
||||
¥{{
|
||||
useVipPrice ? item.memberPrice || item.price : item.price
|
||||
}}
|
||||
</text>
|
||||
<template v-if="false">
|
||||
<view
|
||||
class="card_item"
|
||||
v-for="(value, key) in listinfo.detailMap"
|
||||
:key="key"
|
||||
>
|
||||
<view class="shop-info">
|
||||
<view class="item" v-for="item in value" :key="item.id">
|
||||
<view class="cover">
|
||||
<up-image
|
||||
width="76"
|
||||
height="76"
|
||||
radius="6"
|
||||
:src="item.productImg"
|
||||
v-if="item.productId != -999"
|
||||
></up-image>
|
||||
<up-image
|
||||
width="76"
|
||||
height="76"
|
||||
radius="6"
|
||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||
mode="heightFix"
|
||||
v-else
|
||||
></up-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<text class="productName">{{ item.productName }}</text>
|
||||
<text class="productSkuName" v-if="item.skuName">{{
|
||||
item.skuName
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="price">
|
||||
<view class="priceAmount">
|
||||
<text v-if="isBwc">{{ item.price }}</text>
|
||||
<text v-else>
|
||||
¥{{
|
||||
useVipPrice
|
||||
? item.memberPrice || item.price
|
||||
: item.price
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="num">x{{ item.num }}</view>
|
||||
</view>
|
||||
<view class="num">x{{ item.num }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view
|
||||
class="total-wrap u-m-t-30"
|
||||
@@ -154,7 +158,7 @@
|
||||
"
|
||||
>
|
||||
<view class="u-m-t-40 u-p-l-20 u-p-r-20">
|
||||
<view class="youhui-item" v-if="discountActivity">
|
||||
<view class="youhui-item" v-if="cartStore.orderCostSummary.fullReduction.actualAmount">
|
||||
<view class="u-flex align-center">
|
||||
<image
|
||||
src="/static/icon/coup.png"
|
||||
@@ -165,13 +169,13 @@
|
||||
</view>
|
||||
|
||||
<view class="red font-12 u-flex align-center"
|
||||
>-¥{{ discountActivity.discountAmount }}</view
|
||||
>-¥{{ cartStore.orderCostSummary.fullReduction.actualAmount }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="youhui-item" v-if="newUserDiscount">
|
||||
<view class="u-flex align-center">
|
||||
<image
|
||||
src="/static/icon/coup.png"
|
||||
src="/static/icon/newUserDiscount.png"
|
||||
bgColor="#fff"
|
||||
style="width: 40rpx; height: 34rpx"
|
||||
></image>
|
||||
@@ -304,7 +308,10 @@
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="cell-item column" v-if="listinfo.discountInfo">
|
||||
<view
|
||||
class="cell-item column"
|
||||
v-if="listinfo.discountInfo && listinfo.discountInfo != '{}'"
|
||||
>
|
||||
<view class="label">优惠折扣</view>
|
||||
<view class="val column">
|
||||
<view
|
||||
@@ -387,6 +394,7 @@ import {
|
||||
defineExpose,
|
||||
toRaw,
|
||||
onMounted,
|
||||
provide,
|
||||
nextTick,
|
||||
} from "vue";
|
||||
import { returnHasCouponCanUse } from "@/utils/coupon.js";
|
||||
@@ -588,8 +596,6 @@ const tabClick = (item, index) => {
|
||||
};
|
||||
cartStore.setDinnerType(tebtypeList[is_type.value].val);
|
||||
|
||||
|
||||
|
||||
// 清空
|
||||
const bwcclear = () => {
|
||||
IntegralInputclose();
|
||||
@@ -833,16 +839,13 @@ function calcDiscountActivity() {
|
||||
const res = discountActivityRes.value;
|
||||
const user = uni.cache.get("shopUserInfo");
|
||||
|
||||
//不与会员同享
|
||||
if (!res.vipPriceShare && user.isVip) {
|
||||
return;
|
||||
}
|
||||
console.log("calcDiscountActivity:originalPrice", originalPrice.value);
|
||||
const usedFullReductionActivityFullAmount=cartStore.orderCostSummary.fullReduction.usedFullReductionActivityFullAmount;
|
||||
console.log("usedFullReductionActivityFullAmount", usedFullReductionActivityFullAmount);
|
||||
|
||||
if (res && res.thresholds && res.thresholds.length > 0) {
|
||||
const canUseThresholds = res.thresholds
|
||||
.filter((v) => {
|
||||
return originalPrice.value >= v.fullAmount;
|
||||
return usedFullReductionActivityFullAmount >= v.fullAmount;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return b.discountAmount - a.discountAmount;
|
||||
@@ -859,9 +862,7 @@ function calcDiscountActivity() {
|
||||
}
|
||||
console.log("当前满减门槛", discountActivity.value);
|
||||
|
||||
if (discountActivity.value) {
|
||||
cartStore.fullReductionActivities = [discountActivityRes.value];
|
||||
}
|
||||
|
||||
}
|
||||
async function getDiscountActivity() {
|
||||
const res = await discountActivityApi.config({
|
||||
@@ -871,6 +872,8 @@ async function getDiscountActivity() {
|
||||
return;
|
||||
}
|
||||
discountActivityRes.value = res;
|
||||
cartStore.fullReductionActivities = [res];
|
||||
|
||||
calcDiscountActivity();
|
||||
}
|
||||
onMounted(async () => {
|
||||
@@ -1174,6 +1177,7 @@ onMounted(async () => {
|
||||
display: flex;
|
||||
|
||||
.cover {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.info {
|
||||
@@ -1561,4 +1565,19 @@ onMounted(async () => {
|
||||
.align-center {
|
||||
align-items: center;
|
||||
}
|
||||
.limitDiscount {
|
||||
background-color: #cc5617;
|
||||
padding: 2rpx 10rpx;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
border-radius: 20rpx 0rpx 20rpx 0rpx;
|
||||
z-index: 9;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -223,7 +223,7 @@
|
||||
@close="ispws = false"
|
||||
/>
|
||||
<!-- 私域引流配置 -->
|
||||
<OrderFinshModal v-model="showDrainage" ></OrderFinshModal>
|
||||
<OrderFinshModal v-model="showDrainage"></OrderFinshModal>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
@@ -243,8 +243,10 @@ import {
|
||||
watch,
|
||||
onBeforeMount,
|
||||
onBeforeUnmount,
|
||||
provide,
|
||||
} from "vue";
|
||||
|
||||
provide("shopUserInfo", ref(uni.cache.get("shopUserInfo")));
|
||||
provide("shopInfo", ref(uni.cache.get("shopInfo")));
|
||||
import { getTableInfo } from "@/common/api/shop/index.js";
|
||||
import {
|
||||
APIgetOrderById,
|
||||
@@ -278,8 +280,8 @@ const cartStore = useCartsStore();
|
||||
|
||||
//充值相关start
|
||||
//充值和余额支付是否可用
|
||||
const isCanUseCharge = ref(false);
|
||||
function updateIsShow(e){
|
||||
const isCanUseCharge = ref(true);
|
||||
function updateIsShow(e) {
|
||||
isCanUseCharge.value = e;
|
||||
}
|
||||
const rechargeItem = ref({
|
||||
@@ -437,20 +439,22 @@ let historyTotalPrices = 0;
|
||||
// * 获取订单详情接口
|
||||
const orderorderInfo = async () => {
|
||||
console.log("listinfo.id", listinfo.id);
|
||||
if (!listinfo.id && !options.tableCode) {
|
||||
return;
|
||||
}
|
||||
let res = listinfo.id
|
||||
? await APIgetOrderById({
|
||||
orderId: listinfo.id,
|
||||
})
|
||||
: await APIhistoryOrder({
|
||||
tableCode: options.tableCode||"",
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
orderRemarker.value = res.remark;
|
||||
Object.assign(listinfo, res);
|
||||
if (res && res.tableCode) {
|
||||
socketInitPar.table_code = res.tableCode;
|
||||
let tableRes = await getTableInfo({
|
||||
tableCode: options.tableCode||"",
|
||||
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
console.log(tableRes);
|
||||
listinfo.tableName = tableRes.name;
|
||||
@@ -458,7 +462,7 @@ const orderorderInfo = async () => {
|
||||
if (options.tableCode) {
|
||||
socketInitPar.table_code = options.tableCode;
|
||||
let tableRes = await getTableInfo({
|
||||
tableCode: options.tableCode||"",
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
console.log(tableRes);
|
||||
listinfo.tableName = tableRes.name;
|
||||
@@ -634,8 +638,17 @@ const createOrder = async () => {
|
||||
placeNum: listinfo.id ? listinfo.placeNum * 1 + 1 : 1, //当前订单下单次数
|
||||
waitCall: "", //是否等叫 0 否 1 等叫
|
||||
orderId: listinfo.id || "",
|
||||
tableCode: options.tableCode||'',
|
||||
tableCode: options.tableCode || "",
|
||||
userId: uni.cache.get("userInfo").id || "", //
|
||||
limitRate: (cartStore.limitTimeDiscount&&cartStore.limitTimeDiscount.id)
|
||||
? {
|
||||
id: cartStore.limitTimeDiscount.id,
|
||||
discountRate: cartStore.limitTimeDiscount.discountRate,
|
||||
discountPriority: cartStore.limitTimeDiscount.discountPriority,
|
||||
foodType: cartStore.limitTimeDiscount.foodType,
|
||||
foods: cartStore.limitTimeDiscount.foods,
|
||||
}
|
||||
: null,
|
||||
});
|
||||
// 清空购物车
|
||||
if (res) {
|
||||
@@ -716,7 +729,18 @@ function returnPayParams() {
|
||||
: "",
|
||||
remark: orderRemarker.value, //用户备注
|
||||
discountActAmount: cartStore.orderCostSummary.fullReduction.actualAmount, //满减抵扣金额
|
||||
discountActId:cartStore.orderCostSummary.fullReduction.usedActivity?cartStore.orderCostSummary.fullReduction.usedActivity.id:null,
|
||||
userId: uni.cache.get("userInfo").id || "", //
|
||||
limitRate: (cartStore.limitTimeDiscount&&cartStore.limitTimeDiscount.id)
|
||||
? {
|
||||
id: cartStore.limitTimeDiscount.id,
|
||||
discountRate: cartStore.limitTimeDiscount.discountRate,
|
||||
discountPriority: cartStore.limitTimeDiscount.discountPriority,
|
||||
foodType: cartStore.limitTimeDiscount.foodType,
|
||||
foods: cartStore.limitTimeDiscount.foods,
|
||||
}
|
||||
: null,
|
||||
vipDiscountAmount: cartStore.orderCostSummary.vipDiscountAmount, //会员折扣减免金额
|
||||
};
|
||||
return {
|
||||
isBwc: isBwc.value,
|
||||
@@ -919,7 +943,6 @@ const goToPay = async (payParams) => {
|
||||
orderorderInfo();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
const clickPointsamount = (Pointsamount) => {
|
||||
listinfo.pointsDiscountAmount = Pointsamount.pointsDiscountAmount;
|
||||
@@ -1063,9 +1086,13 @@ async function init(opt) {
|
||||
if (res) {
|
||||
uni.cache.set("tableCode", res.tableCode);
|
||||
uni.cache.set("tableCode", res.seatNum);
|
||||
options.tableCode = res.tableCode||'';
|
||||
options.tableCode = res.tableCode || "";
|
||||
cartStore.setSeatFeeConfig("personCount", res.seatNum);
|
||||
cartStore.setDinnerType(res.dineMode || "dine-in");
|
||||
cartStore.setOldOrder(res);
|
||||
if(res.limitRate){
|
||||
cartStore.limitTimeDiscount=res.limitRate
|
||||
}
|
||||
orderRemarker.value = res.remark;
|
||||
Object.assign(listinfo, res);
|
||||
}
|
||||
@@ -1162,7 +1189,7 @@ const disablePayType = computed(() => {
|
||||
// if (cartStore.orderCostSummary.orderOriginFinalPayAmount <= 0) {
|
||||
// arr.add("微信支付");
|
||||
// }
|
||||
if(!isCanUseCharge.value){
|
||||
if (!isCanUseCharge.value) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +328,8 @@ function formatCoupon(){
|
||||
goodsOrderPrice,
|
||||
user,
|
||||
selCoupon:selCoupon,
|
||||
shopInfo
|
||||
shopInfo,
|
||||
limitTimeDiscount:cartStore.limitTimeDiscount
|
||||
});
|
||||
const { canUse, reason } = canuseResult;
|
||||
if (coupon.type == 2) {
|
||||
@@ -353,7 +354,7 @@ function formatCoupon(){
|
||||
}
|
||||
//商品券
|
||||
canUseGoodsCoupon = canUseGoodsCoupon.map((v) => {
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, quansSelArr.value, shopInfo);
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, quansSelArr.value, shopInfo,cartStore.limitTimeDiscount);
|
||||
return {
|
||||
...v,
|
||||
discount,
|
||||
@@ -362,7 +363,7 @@ function formatCoupon(){
|
||||
});
|
||||
//非商品券
|
||||
canUseDiscountCoupon = canUseDiscountCoupon.map((v) => {
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, quansSelArr.value, shopInfo);
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, quansSelArr.value, shopInfo,cartStore.limitTimeDiscount);
|
||||
return {
|
||||
...v,
|
||||
discount,
|
||||
@@ -518,7 +519,7 @@ watch(
|
||||
let goodsCoupon = newval.filter((v) => v.type == 2);
|
||||
let otherCoupon = newval.filter((v) => v.type != 2);
|
||||
goodsCoupon = goodsCoupon.map((v) => {
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, [], shopInfo);
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, [], shopInfo,cartStore.limitTimeDiscount);
|
||||
return {
|
||||
...v,
|
||||
discount,
|
||||
@@ -526,7 +527,7 @@ watch(
|
||||
};
|
||||
});
|
||||
otherCoupon = otherCoupon.map((v) => {
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, goodsCoupon, shopInfo);
|
||||
const discount = UTILS.returnCouponDiscount(canDikouGoodsArr, v, user, goodsOrderPrice, goodsCoupon, shopInfo,cartStore.limitTimeDiscount);
|
||||
return {
|
||||
...v,
|
||||
discount,
|
||||
|
||||
Reference in New Issue
Block a user