1513 lines
37 KiB
Vue
1513 lines
37 KiB
Vue
<template>
|
|
<view>
|
|
<view class="card_box">
|
|
<!-- <view class="card_head_box">
|
|
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
|
|
</view> -->
|
|
|
|
<!-- 先付款 -->
|
|
<view class="tabBox" v-if="listinfo.status == 'unpaid' || !listinfo.id">
|
|
<view class="tab">
|
|
<view
|
|
v-for="(item, index) in tebtypeList"
|
|
:key="index"
|
|
:class="
|
|
is_type == index
|
|
? 'tab_item' + (is_type + 1) + ' tab_item active '
|
|
: 'tab_item'
|
|
"
|
|
@click="tabClick(item, index)"
|
|
>
|
|
<view></view>
|
|
<image
|
|
class="icon"
|
|
:src="is_type == index ? item.url_active : item.url"
|
|
mode="aspectFill"
|
|
/>
|
|
<text class="title" :class="{ active: is_type == index }">{{
|
|
item.title
|
|
}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="table" v-if="is_type == 0">
|
|
<view class="table_left">
|
|
<image
|
|
class="icon"
|
|
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png"
|
|
mode="aspectFill"
|
|
/>
|
|
<text class="title">桌台</text>
|
|
</view>
|
|
<view class="value" v-if="listinfo.tableName">
|
|
{{ listinfo.tableName || "" }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="card">
|
|
<orderItemVue
|
|
:useVipPrice="useVipPrice"
|
|
v-if="nowCarts.length"
|
|
:nowCarts="nowCarts"
|
|
></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>
|
|
</view>
|
|
<view class="num">x{{ item.num }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view
|
|
class="total-wrap u-m-t-30"
|
|
v-if="listinfo.status == 'unpaid' || !listinfo.id"
|
|
>
|
|
<view>总计¥</view>
|
|
<view class="price">
|
|
{{ cartStore.orderCostSummary.goodsRealAmount }}
|
|
</view>
|
|
</view>
|
|
|
|
<!-- <view class="total-wrap" v-else>
|
|
<view>实付¥</view>
|
|
<view class="price"> {{listinfo.payAmount||''}} </view>
|
|
</view> -->
|
|
|
|
<view class="cell-item" v-if="is_type != 0">
|
|
<view class="label">打包费</view>
|
|
<view class="val">
|
|
<view></view>
|
|
<view style="font-size: 28rpx">¥</view>
|
|
<view>{{ cartStore.orderCostSummary.packFee }}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- isTableFee == 0是不免除 -->
|
|
<view class="cell-item" v-if="cartStore.orderCostSummary.seatFee">
|
|
<view class="label">餐位费</view>
|
|
<view class="val">
|
|
<view>X{{ cartStore.seatFeeConfig.personCount }}</view>
|
|
<view style="font-size: 28rpx">¥</view>
|
|
<view>{{ cartStore.orderCostSummary.seatFee }}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- <view class="cell-item" v-else>
|
|
<view class="label">免餐位费</view>
|
|
<view class="val">
|
|
<view></view>
|
|
<view style="font-size: 28rpx;">¥</view>
|
|
<view>{{listinfo.Seatcharge}}</view>
|
|
</view>
|
|
</view> -->
|
|
|
|
<!-- 支付之前 -->
|
|
<block
|
|
v-if="
|
|
listinfo.status == 'unpaid' ||
|
|
listinfo.status == 'paying' ||
|
|
!listinfo.id
|
|
"
|
|
>
|
|
<view class="u-m-t-40 u-p-l-20 u-p-r-20">
|
|
<view class="youhui-item" v-if="discountActivity">
|
|
<view class="u-flex align-center">
|
|
<image
|
|
src="/static/icon/coup.png"
|
|
bgColor="#fff"
|
|
style="width: 40rpx; height: 34rpx"
|
|
></image>
|
|
<text class="color-333 font-14 u-m-l-16 no-wrap">满减活动</text>
|
|
</view>
|
|
|
|
<view class="red font-12 u-flex align-center"
|
|
>-¥{{ discountActivity.discountAmount }}</view
|
|
>
|
|
</view>
|
|
<view class="youhui-item" v-if="newUserDiscount">
|
|
<view class="u-flex align-center">
|
|
<image
|
|
src="/static/icon/coup.png"
|
|
bgColor="#fff"
|
|
style="width: 40rpx; height: 34rpx"
|
|
></image>
|
|
<text class="color-333 font-14 u-m-l-16 no-wrap">新客立减</text>
|
|
</view>
|
|
|
|
<view class="red font-12 u-flex align-center"
|
|
>-¥{{ newUserDiscount }}</view
|
|
>
|
|
</view>
|
|
<view
|
|
class="favorable"
|
|
v-for="(item, indexe) in favorablelist"
|
|
:key="indexe"
|
|
:class="{ column: item.type == 'product' }"
|
|
@click="goUrl(item)"
|
|
>
|
|
<view class="favorable_left">
|
|
<view class="u-flex" style="width: 44rpx">
|
|
<u-image
|
|
bgColor="#fff"
|
|
:width="item.width || '44rpx'"
|
|
:height="item.height || '44rpx'"
|
|
v-if="item.icon"
|
|
:src="item.icon"
|
|
mode=""
|
|
></u-image>
|
|
</view>
|
|
<text class="name u-m-l-16 no-wrap"> {{ item.name }} </text>
|
|
<template v-if="item.type == 'points' && !disabledPointsUse">
|
|
<text
|
|
class="u-p-l-6"
|
|
style="color: #666; max-width: 400rpx; font-size: 10px"
|
|
>
|
|
「可用积分{{ pointsRes.accountPoints }},最大可抵扣{{
|
|
maxPointDiscount
|
|
}}元」
|
|
</text>
|
|
</template>
|
|
</view>
|
|
|
|
<!-- 优惠卷 -->
|
|
<view class="favorable_right" v-if="item.type == 'coupon'">
|
|
<template
|
|
v-if="cartStore.orderCostSummary.couponDeductionAmount > 0"
|
|
>
|
|
<text class="favorable_right_text red"
|
|
>-¥{{
|
|
cartStore.orderCostSummary.couponDeductionAmount
|
|
}}</text
|
|
>
|
|
</template>
|
|
<template v-else>
|
|
<text
|
|
class="favorable_right_text red"
|
|
v-if="disabledCouponUse"
|
|
>{{ disabledCouponReason }}</text
|
|
>
|
|
<text
|
|
class="favorable_right_text red"
|
|
v-else-if="hasCouponCanUse"
|
|
>有可用优惠券</text
|
|
>
|
|
<text class="favorable_right_text" v-else
|
|
>暂无可用优惠券</text
|
|
>
|
|
</template>
|
|
<template v-if="!disabledCouponUse">
|
|
<up-icon
|
|
name="arrow-right"
|
|
color="#575B66"
|
|
size="16"
|
|
v-if="
|
|
listinfo.status == 'unpaid' ||
|
|
listinfo.status == 'paying' ||
|
|
!listinfo.id
|
|
"
|
|
></up-icon>
|
|
</template>
|
|
</view>
|
|
|
|
<!-- 新客立减 -->
|
|
<view class="favorable_right" v-if="item.type == 'newUser'">
|
|
<text
|
|
class="favorable_right_text red"
|
|
v-if="newUserDiscount > 0"
|
|
>-¥{{ newUserDiscount }}</text
|
|
>
|
|
</view>
|
|
|
|
<!-- 积分 -->
|
|
<view
|
|
class="favorable_right u-flex u-col-center"
|
|
v-if="item.type == 'points'"
|
|
>
|
|
<text
|
|
v-if="disabledPointsUse"
|
|
class="u-p-l-6 red"
|
|
style="max-width: 400rpx; font-size: 24rpx"
|
|
>{{ disabledPointsUseReason }}</text
|
|
>
|
|
<template
|
|
v-else-if="
|
|
usePoints && cartStore.orderCostSummary.pointDeductionAmount
|
|
"
|
|
>
|
|
<up-icon
|
|
name="checkmark-circle-fill"
|
|
size="24rpx"
|
|
color="#FE7E00"
|
|
></up-icon>
|
|
<text class="red">
|
|
-¥{{ cartStore.orderCostSummary.pointDeductionAmount }}
|
|
</text>
|
|
</template>
|
|
|
|
<template v-else>
|
|
<view
|
|
v-if="maxPointDiscount > 0 && !disabledPointsUse"
|
|
class="u-flex u-col-center"
|
|
>
|
|
<view class="round"></view>
|
|
<text class="color-333 font-12 no-wrap u-m-l-4"
|
|
>使用抵扣</text
|
|
>
|
|
</view>
|
|
</template>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</block>
|
|
<block v-else>
|
|
<view class="cell-item column" v-if="listinfo.discountInfo">
|
|
<view class="label">优惠折扣</view>
|
|
<view class="val column">
|
|
<view
|
|
class="productCoupon"
|
|
v-for="(item, index) in listinfo.discountInfo"
|
|
:key="index"
|
|
>
|
|
<view class="name">{{ item.name }}</view>
|
|
<!-- <view class="num">{{item.amount}}</view> -->
|
|
<view class="amount" style="margin-left: 10rpx"
|
|
>{{ item.amount }}元</view
|
|
>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</block>
|
|
</view>
|
|
</view>
|
|
<view class="orderInfo">
|
|
<view class="row" @click="copyHandle(listinfo.orderNo)">
|
|
<text class="t">订单编号:</text>
|
|
<text
|
|
class="info"
|
|
style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap"
|
|
>{{ listinfo.orderNo }}(点击复制)</text
|
|
>
|
|
</view>
|
|
<view class="row">
|
|
<text class="t">下单时间:</text>
|
|
<text class="info">{{
|
|
$u.timeFormat(listinfo.updateTime, "yyyy-mm-dd hh:MM:ss")
|
|
}}</text>
|
|
</view>
|
|
<view class="row" v-if="listinfo.tableName">
|
|
<text class="t">下单台桌:</text>
|
|
<text class="info">{{ listinfo.tableName }}</text>
|
|
</view>
|
|
<view class="row" v-if="orderVIP.shopName">
|
|
<text class="t">下单门店:</text>
|
|
<text class="info">{{ orderVIP.shopName }}</text>
|
|
</view>
|
|
<view class="row" v-if="listinfo.dineMod">
|
|
<text class="t">用餐模式:</text>
|
|
<text class="info" v-if="listinfo.dineMod == 'dine-in'">堂食</text>
|
|
<text class="info" v-if="listinfo.dineMod == 'take-out'">外带</text>
|
|
<text class="info" v-if="listinfo.dineMod == 'take-away'">外卖</text>
|
|
</view>
|
|
<view class="row" v-if="listinfo.id && listinfo.satus != 'unpaid'">
|
|
<text class="t">备注:</text>
|
|
<text class="info u-line-5">{{ listinfo.remark || "" }}</text>
|
|
</view>
|
|
<view class="row" v-if="listinfo.seatNum">
|
|
<text class="t">就餐人数:</text>
|
|
<text class="info">{{ listinfo.seatNum || "" }}</text>
|
|
</view>
|
|
<view class="row" v-if="listinfo.refundType">
|
|
<text class="t">退款方式:</text>
|
|
<text class="info">{{
|
|
listinfo.refundType == "cash" ? "手动退款" : "原路退回"
|
|
}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { useCartsStore } from "@/stores/carts.js";
|
|
import * as discountActivityApi from "@/common/api/market/discountActivity";
|
|
const cartStore = useCartsStore();
|
|
import { consumeDiscount } from "@/common/api/market/index.js";
|
|
import orderItemVue from "./order-item.vue";
|
|
import {
|
|
ref,
|
|
reactive,
|
|
defineProps,
|
|
computed,
|
|
defineEmits,
|
|
watch,
|
|
watchEffect,
|
|
defineExpose,
|
|
toRaw,
|
|
onMounted,
|
|
nextTick,
|
|
} from "vue";
|
|
import { returnHasCouponCanUse } from "@/utils/coupon.js";
|
|
let hasCouponCanUse = ref(false);
|
|
|
|
const usePoints = ref(false);
|
|
|
|
function chnageIsUsePoints() {
|
|
usePoints.value = !usePoints.value;
|
|
}
|
|
|
|
import IntegralInput from "./IntegralInput.vue";
|
|
import {
|
|
APImemberPointsmyPoints,
|
|
APImemberPointscalcUsablePoints,
|
|
APImemberPointscalcDeductionAmount,
|
|
} from "@/common/api/shop/index.js";
|
|
import goodsIcon from "@/static/icon/goods.png";
|
|
import coupIcon from "@/static/icon/coup.png";
|
|
import pointsIcon from "@/static/icon/points.png";
|
|
// 定义自定义事件
|
|
const emits = defineEmits(["customevent", "istype", "learcoupons"]);
|
|
|
|
// teb 切换送餐和打包
|
|
const tebtypeList = reactive([
|
|
{
|
|
title: "送餐到桌",
|
|
show: false,
|
|
type: "table",
|
|
val: "dine-in",
|
|
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1.png",
|
|
url_active:
|
|
"https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1_active.png",
|
|
},
|
|
{
|
|
title: "打包外带",
|
|
show: false,
|
|
type: "takeself",
|
|
val: "take-out",
|
|
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2.png",
|
|
url_active:
|
|
"https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2_active.png",
|
|
},
|
|
]);
|
|
|
|
const favorablelist = ref([
|
|
// {
|
|
// name: "新客立减",
|
|
// type: "newUser",
|
|
// width: "40rpx",
|
|
// height: "34rpx",
|
|
// value: "",
|
|
// icon: coupIcon,
|
|
// url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png",
|
|
// },
|
|
{
|
|
name: "优惠券",
|
|
type: "coupon",
|
|
width: "40rpx",
|
|
height: "34rpx",
|
|
value: "",
|
|
icon: coupIcon,
|
|
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png",
|
|
},
|
|
{
|
|
icon: pointsIcon,
|
|
name: "积分抵扣",
|
|
type: "points",
|
|
value: "",
|
|
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png",
|
|
},
|
|
]);
|
|
|
|
const props = defineProps({
|
|
useVipPrice: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
freeCheck: {
|
|
type: Boolean,
|
|
},
|
|
shifu: {
|
|
type: [String, Number],
|
|
defalut: 0,
|
|
},
|
|
listinfo: {
|
|
type: Object,
|
|
default: {
|
|
combinedArray: {},
|
|
Productroll: 0,
|
|
coupondiscountAmount: 0,
|
|
couponInfoList: "",
|
|
pointsDiscountAmount: 0,
|
|
packFeess: 0,
|
|
totalPrices: 0,
|
|
Seatcharge: 0,
|
|
payAmount: 0,
|
|
remark: "",
|
|
},
|
|
},
|
|
orderVIP: {
|
|
type: Object,
|
|
},
|
|
ordershopUserInfo: {
|
|
type: Object,
|
|
default: {
|
|
isTableFee: 0,
|
|
},
|
|
},
|
|
isBwc: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
nowCarts: {
|
|
type: Array,
|
|
default: () => {
|
|
return [];
|
|
},
|
|
},
|
|
});
|
|
|
|
const is_type = ref(0);
|
|
|
|
//满减活动
|
|
const discountActivityRes = ref(null);
|
|
|
|
//当前使用的满减活动的门槛满减
|
|
const discountActivity = ref(null);
|
|
//备份当前使用的满减活动的门槛满减
|
|
let back_discountActivity = null;
|
|
//禁止使用优惠券
|
|
const disabledCouponUse = ref(false);
|
|
const disabledCouponReason = ref("");
|
|
//禁止使用积分
|
|
const disabledPointsUse = ref(false);
|
|
//禁止使用积分原因
|
|
const disabledPointsUseReason = ref("");
|
|
|
|
// 监听送餐/打包切换
|
|
const tabClick = (item, index) => {
|
|
is_type.value = index;
|
|
emits("istype", is_type.value);
|
|
cartStore.setDinnerType(item.val);
|
|
// this.getchoseEatModel('tabClick', index, item);
|
|
};
|
|
cartStore.setDinnerType(tebtypeList[is_type.value].val);
|
|
|
|
// 操作优惠卷
|
|
const dataprocessing = (data) => {
|
|
favorablelist.value[1].value = data;
|
|
};
|
|
|
|
// 清空
|
|
const bwcclear = () => {
|
|
IntegralInputclose();
|
|
};
|
|
|
|
// 跳转
|
|
const goUrl = (item) => {
|
|
const canDikouGoodsArr = props.nowCarts;
|
|
// const goodsOrderPrice = props.listinfo.totalPrices
|
|
// const user=uni.cache.get('shopUserInfo')
|
|
uni.setStorageSync(
|
|
"goodsOrderPrice",
|
|
cartStore.orderCostSummary.goodsRealAmount
|
|
);
|
|
|
|
switch (item.type) {
|
|
case "coupon":
|
|
if (disabledCouponUse.value) {
|
|
return uni.showToast({
|
|
title: disabledCouponReason.value,
|
|
icon: "none",
|
|
});
|
|
}
|
|
emits("learcoupons", "coupon");
|
|
uni.pro.navigateTo("/pages/order/coupon", {});
|
|
break;
|
|
|
|
case "points":
|
|
if (disabledPointsUse.value) {
|
|
return uni.showToast({
|
|
title: disabledPointsUseReason.value,
|
|
icon: "none",
|
|
});
|
|
}
|
|
if (maxPointDiscount.value <= 0) {
|
|
return;
|
|
}
|
|
chnageIsUsePoints();
|
|
break;
|
|
}
|
|
};
|
|
|
|
// 积分
|
|
const calcUsablePointsData = reactive({
|
|
minIntegral: 1, //最小
|
|
maxIntegral: "", //最多积分
|
|
instructionText: "",
|
|
unusableReason: "",
|
|
showModal: false,
|
|
integral: "",
|
|
});
|
|
|
|
const pointsRes = reactive({
|
|
accountPoints: 0,
|
|
});
|
|
const maxPointDiscount = ref(0);
|
|
//积分可抵扣最大金额
|
|
const maxMoney = computed(() => {
|
|
return (
|
|
cartStore.orderCostSummary.finalPayAmount +
|
|
cartStore.orderCostSummary.pointDeductionAmount
|
|
);
|
|
});
|
|
|
|
async function getMaxPointsDiscount() {
|
|
let res = await APImemberPointscalcUsablePoints({
|
|
shopUserId: props.orderVIP.id,
|
|
orderAmount: maxMoney.value,
|
|
});
|
|
Object.assign(pointsRes, res);
|
|
maxPointDiscount.value = res.maxDeductionAmount;
|
|
if (usePoints.value) {
|
|
cartStore.setUserPoints(res.maxUsablePoints || 0);
|
|
}
|
|
}
|
|
watch(
|
|
() => maxMoney.value,
|
|
(newval) => {
|
|
console.log("maxMoney.value", newval);
|
|
getMaxPointsDiscount();
|
|
}
|
|
);
|
|
watch(
|
|
() => usePoints.value,
|
|
(newval) => {
|
|
if (newval) {
|
|
getMaxPointsDiscount();
|
|
} else {
|
|
cartStore.setUserPoints(0);
|
|
}
|
|
}
|
|
);
|
|
|
|
// * 获取积分相关信息
|
|
const getCalcUsablePoints = async (data) => {
|
|
Object.assign(calcUsablePointsData, data);
|
|
try {
|
|
cartStore.setPointDeductionRule(
|
|
data.equivalentPoints,
|
|
data.maxDeductionAmount
|
|
);
|
|
calcUsablePointsData.minIntegral = data.minDeductionPoints;
|
|
calcUsablePointsData.maxIntegral = data.maxUsablePoints;
|
|
calcUsablePointsData.instructionText = `请输入 ${data.minDeductionPoints} - ${data.maxUsablePoints} 之间的积分`;
|
|
} catch (error) {
|
|
//TODO handle the exception
|
|
}
|
|
};
|
|
|
|
// 积分取消清空
|
|
const IntegralInputclose = async () => {
|
|
calcUsablePointsData.integral = null;
|
|
props.listinfo.pointsDiscountAmount = 0;
|
|
calcUsablePointsData.showModal = false;
|
|
// cartStore.setUserPoints(0);
|
|
};
|
|
|
|
// * 复制订单号
|
|
const copyHandle = (e) => {
|
|
uni.setClipboardData({
|
|
data: e,
|
|
success() {
|
|
uni.showToast({
|
|
title: "复制成功",
|
|
icon: "none",
|
|
});
|
|
},
|
|
});
|
|
};
|
|
|
|
// 将方法暴露给父组件
|
|
defineExpose({
|
|
dataprocessing,
|
|
getCalcUsablePoints,
|
|
bwcclear,
|
|
IntegralInputclose,
|
|
});
|
|
|
|
watch(
|
|
() => props.listinfo.seatNum,
|
|
(newval) => {
|
|
cartStore.setSeatFeeConfig("personCount", newval || 0);
|
|
}
|
|
);
|
|
|
|
const newUserDiscount = ref(0);
|
|
const back_favorablelist = toRaw(favorablelist.value);
|
|
async function getConsumeDiscount() {
|
|
const consumeDiscountRes = await consumeDiscount({
|
|
shopId: uni.cache.get("shopId"),
|
|
});
|
|
if (!consumeDiscountRes) {
|
|
favorablelist.value = back_favorablelist.filter(
|
|
(v) => v.name != "新客立减"
|
|
);
|
|
return;
|
|
}
|
|
|
|
if (consumeDiscountRes) {
|
|
newUserDiscount.value = consumeDiscountRes.amount;
|
|
cartStore.newUserDiscount = consumeDiscountRes.amount || 0;
|
|
cartStore.consumeDiscount = consumeDiscountRes;
|
|
}
|
|
}
|
|
|
|
// 初始化订单计算可能为计算完毕,所以判断监听价格变化后再获取优惠券
|
|
let loadFinish = false;
|
|
watch(
|
|
() => cartStore.orderCostSummary.goodsRealAmount,
|
|
async (newval) => {
|
|
if (newval && !loadFinish) {
|
|
const goodsOrderPrice = cartStore.orderCostSummary.goodsRealAmount;
|
|
const dinnerType = cartStore.dinnerType;
|
|
const shopInfo = cartStore.shopInfo;
|
|
const shopId = cartStore.shopInfo.shopId;
|
|
const user = uni.cache.get("shopUserInfo");
|
|
const shopUserId = user.id;
|
|
const allGoods = cartStore.allGoods;
|
|
|
|
hasCouponCanUse.value = await returnHasCouponCanUse({
|
|
goodsOrderPrice,
|
|
dinnerType,
|
|
shopId,
|
|
shopInfo,
|
|
shopUserId,
|
|
allGoods,
|
|
user,
|
|
});
|
|
}
|
|
}
|
|
);
|
|
|
|
const originalPrice = computed(() => {
|
|
const originalPrice =
|
|
cartStore.orderCostSummary.goodsRealAmount +
|
|
cartStore.orderCostSummary.packFee +
|
|
cartStore.orderCostSummary.seatFee;
|
|
console.log("originalPrice", originalPrice);
|
|
return originalPrice;
|
|
});
|
|
|
|
watch(
|
|
() => originalPrice.value,
|
|
() => {
|
|
if (discountActivityRes.value) {
|
|
calcDiscountActivity();
|
|
}
|
|
}
|
|
);
|
|
|
|
watch(
|
|
() => props.isBwc,
|
|
(newval) => {
|
|
const freeDineConfig = props.orderVIP.freeDineConfig;
|
|
if (newval) {
|
|
discountActivity.value = null;
|
|
cartStore.fullReductionActivities = [];
|
|
if (!freeDineConfig.withCoupon) {
|
|
disabledCouponUse.value = true;
|
|
disabledCouponReason.value = "霸王餐与优惠券不可同时使用";
|
|
cartStore.setCoupons([]);
|
|
}
|
|
if (!freeDineConfig.withPoints) {
|
|
disabledPointsUse.value = true;
|
|
disabledPointsUseReason.value = "霸王餐与积分不可同时使用";
|
|
usePoints.value = false;
|
|
cartStore.setUserPoints(0);
|
|
}
|
|
} else {
|
|
if (back_discountActivity) {
|
|
calcDiscountActivity();
|
|
}
|
|
}
|
|
}
|
|
);
|
|
|
|
function calcDiscountActivity() {
|
|
const res = discountActivityRes.value;
|
|
const user = uni.cache.get("shopUserInfo");
|
|
|
|
//不与会员同享
|
|
if (!res.vipPriceShare && user.isVip) {
|
|
return;
|
|
}
|
|
if (res && res.thresholds && res.thresholds.length > 0) {
|
|
console.log("calcDiscountActivity", res);
|
|
const canUseThresholds = res.thresholds.filter((v) => {
|
|
return originalPrice.value >= v.fullAmount;
|
|
});
|
|
if (canUseThresholds.length) {
|
|
discountActivity.value = canUseThresholds[0];
|
|
back_discountActivity = canUseThresholds[0];
|
|
}
|
|
}
|
|
if (!discountActivity.value) {
|
|
return;
|
|
}
|
|
console.log("当前满减门槛", discountActivity.value);
|
|
if (!res.couponShare) {
|
|
disabledCouponUse.value = true;
|
|
cartStore.backendCoupons = [];
|
|
disabledCouponReason.value = "当前满减活动不可与其他优惠共享";
|
|
}
|
|
//不与积分同享
|
|
if (!res.pointsShare && discountActivity.value) {
|
|
disabledPointsUse.value = true;
|
|
disabledPointsUseReason.value = "当前满减活动不与积分同享";
|
|
cartStore.setUserPoints(0);
|
|
}
|
|
if (discountActivity.value) {
|
|
cartStore.fullReductionActivities = [discountActivityRes.value];
|
|
}
|
|
}
|
|
async function getDiscountActivity() {
|
|
const res = await discountActivityApi.config({
|
|
shopId: uni.cache.get("shopId"),
|
|
});
|
|
if (!res) {
|
|
return;
|
|
}
|
|
discountActivityRes.value = res;
|
|
calcDiscountActivity();
|
|
}
|
|
onMounted(() => {
|
|
getConsumeDiscount();
|
|
getDiscountActivity();
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
::v-deep .orderInfo .u-textarea {
|
|
background: #fafafa;
|
|
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
|
}
|
|
|
|
.round {
|
|
width: 24rpx;
|
|
height: 24rpx;
|
|
border-radius: 50%;
|
|
background-color: #fff;
|
|
border: 1px solid #d9d9d9;
|
|
}
|
|
|
|
::v-deep .u-textarea__field {
|
|
background: #fafafa;
|
|
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
|
}
|
|
|
|
.t {
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.card_box {
|
|
background-color: #fff;
|
|
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
|
border-radius: 18rpx;
|
|
padding-bottom: 32rpx;
|
|
|
|
.tabBox {
|
|
width: 100%;
|
|
margin-top: 52rpx;
|
|
position: relative;
|
|
z-index: 1;
|
|
|
|
.tab {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
border-radius: 22rpx 22rpx 0 0;
|
|
// background-color: $uni-bg-color;
|
|
|
|
.tab_item {
|
|
width: 50%;
|
|
height: 90rpx;
|
|
line-height: 90rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
padding-left: 30rpx;
|
|
box-sizing: border-box;
|
|
background-color: #fefbf8;
|
|
border-radius: 0 22rpx 0 0;
|
|
position: relative;
|
|
|
|
.title {
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
color: #999999;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.title.active {
|
|
color: #e8ad7b;
|
|
}
|
|
|
|
.icon {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
margin-right: 16rpx;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
}
|
|
|
|
.tab_item.active {
|
|
background-color: #fff;
|
|
}
|
|
|
|
// .tab_item.active:after {
|
|
// content: "";
|
|
// position: absolute;
|
|
// top: 0;
|
|
// left: -4px;
|
|
// width: 40px;
|
|
// height: 26px;
|
|
// background: orange;
|
|
// }
|
|
.tab_item.active:before {
|
|
content: "";
|
|
position: absolute;
|
|
top: -20rpx;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
border-radius: 2px;
|
|
background: #fff;
|
|
transform: skewX(0deg);
|
|
}
|
|
|
|
.tab_item1.active:before {
|
|
border-radius: 22rpx 40rpx 0 0;
|
|
}
|
|
|
|
.tab_item2.active:before {
|
|
border-radius: 40rpx 22rpx 0 0;
|
|
}
|
|
}
|
|
|
|
.table {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin: 0 30rpx;
|
|
box-sizing: border-box;
|
|
height: 90rpx;
|
|
background-color: $uni-bg-color;
|
|
border-bottom: 1rpx solid #e5e5e5;
|
|
|
|
.table_left {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.icon {
|
|
width: 32.86rpx;
|
|
height: 39.07rpx;
|
|
margin-right: 24rpx;
|
|
}
|
|
|
|
.title {
|
|
display: flex;
|
|
align-items: center;
|
|
color: #e8ad7b;
|
|
}
|
|
}
|
|
|
|
.value {
|
|
font-weight: 500;
|
|
font-size: 32rpx;
|
|
color: #333333;
|
|
}
|
|
}
|
|
|
|
.pack {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 30rpx;
|
|
box-sizing: border-box;
|
|
background-color: $uni-bg-color;
|
|
border-radius: 0 0 22rpx 22rpx;
|
|
|
|
.top {
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-top: 8rpx;
|
|
|
|
.title {
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
font-weight: bold;
|
|
margin-bottom: 16rpx;
|
|
}
|
|
|
|
.address {
|
|
font-size: 24rpx;
|
|
font-weight: 400;
|
|
color: #999;
|
|
}
|
|
}
|
|
|
|
.list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.item {
|
|
height: 70rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
font-size: 28rpx;
|
|
|
|
.lable {
|
|
color: #666;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.getPhone {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.u-input {
|
|
width: 340rpx;
|
|
border: none;
|
|
|
|
input {
|
|
font-size: 24rpx;
|
|
color: #333;
|
|
}
|
|
|
|
.input-placeholder {
|
|
font-size: 24rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.text,
|
|
.getBtn {
|
|
color: #e8ad7b;
|
|
}
|
|
|
|
.getBtn {
|
|
border-radius: 12rpx;
|
|
border: 2rpx solid #e8ad7b;
|
|
padding: 8rpx 20rpx;
|
|
box-sizing: border-box;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.card_head_box {
|
|
width: 100%;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
position: absolute;
|
|
top: -22.5rpx;
|
|
padding: 0 44rpx;
|
|
|
|
.card_head_item {
|
|
width: 45rpx;
|
|
height: 45rpx;
|
|
background-color: #f9f9f9;
|
|
border-radius: 50%;
|
|
// box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
|
|
}
|
|
}
|
|
|
|
.card {
|
|
// background-color: #fff;
|
|
border-radius: 20upx;
|
|
margin-bottom: 28upx;
|
|
position: relative;
|
|
|
|
.card_item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
position: relative;
|
|
padding: 0 34rpx;
|
|
|
|
.head {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
// padding: 32rpx 0;
|
|
|
|
.head_left {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.placeNum {
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
color: #333333;
|
|
margin-right: 32rpx;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.placeTime {
|
|
font-weight: 400;
|
|
font-size: 32rpx;
|
|
color: #666666;
|
|
flex-shrink: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.shop-info {
|
|
padding-top: 28rpx;
|
|
|
|
.item:nth-child(1) {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.item {
|
|
margin-bottom: 32rpx;
|
|
display: flex;
|
|
|
|
.cover {
|
|
}
|
|
|
|
.info {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding-left: 16upx;
|
|
|
|
.productName {
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.productSkuName {
|
|
font-weight: 400;
|
|
font-size: 24rpx;
|
|
color: #999999;
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 3;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.n {
|
|
font-size: 24upx;
|
|
color: #999;
|
|
}
|
|
}
|
|
|
|
.price {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-end;
|
|
padding-left: 68rpx;
|
|
|
|
.priceAmount {
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
margin-top: 26rpx;
|
|
}
|
|
|
|
.num {
|
|
font-weight: 400;
|
|
font-size: 24rpx;
|
|
color: #999999;
|
|
margin-top: 22rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.status {
|
|
align-self: flex-end;
|
|
width: 92rpx;
|
|
height: 40rpx;
|
|
line-height: 40rpx;
|
|
text-align: center;
|
|
background: #999999;
|
|
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
|
font-weight: 400;
|
|
font-size: 22rpx;
|
|
color: #ffffff;
|
|
margin-top: 32rpx;
|
|
}
|
|
|
|
.totalAmount {
|
|
width: 100%;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: flex-end;
|
|
padding: 32rpx 0;
|
|
border-bottom: 2rpx dashed #e5e5e5;
|
|
|
|
.label {
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
}
|
|
|
|
.price {
|
|
font-weight: bold;
|
|
font-size: 36rpx;
|
|
color: #333333;
|
|
}
|
|
}
|
|
|
|
.semicircle_icon {
|
|
width: 100%;
|
|
position: absolute;
|
|
top: -22.5rpx;
|
|
left: 0;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.semicircle_left_icon {
|
|
width: 45rpx;
|
|
height: 45rpx;
|
|
margin-left: -22.5rpx;
|
|
background-color: #f9f9f9;
|
|
border-radius: 50%;
|
|
// box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
|
|
}
|
|
|
|
.semicircle_right_icon {
|
|
width: 45rpx;
|
|
height: 45rpx;
|
|
margin-right: -22.5rpx;
|
|
background-color: #f9f9f9;
|
|
border-radius: 50%;
|
|
// box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
|
|
}
|
|
}
|
|
}
|
|
|
|
.cell-item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 32rpx 34rpx 0 34rpx;
|
|
|
|
.label {
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
color: #333333;
|
|
padding-bottom: 32rpx;
|
|
}
|
|
|
|
.val {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
padding-bottom: 32rpx;
|
|
border-bottom: 2rpx dashed #e5e5e5;
|
|
|
|
view:nth-child(1) {
|
|
font-weight: 400;
|
|
font-size: 24rpx;
|
|
color: #999999;
|
|
margin-right: 42rpx;
|
|
}
|
|
|
|
view:nth-child(2) {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
font-weight: bold;
|
|
font-size: 36rpx;
|
|
color: #333333;
|
|
}
|
|
}
|
|
|
|
.val.column {
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.productCoupon {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
margin: 0 0 10rpx 0;
|
|
|
|
.name {
|
|
font-weight: 400;
|
|
font-size: 26rpx;
|
|
color: #999;
|
|
margin: 0;
|
|
}
|
|
|
|
.num {
|
|
font-weight: 400;
|
|
font-size: 26rpx;
|
|
color: #999;
|
|
margin: 0 30rpx;
|
|
line-height: 20rpx;
|
|
}
|
|
|
|
.amount {
|
|
font-weight: bold;
|
|
font-size: 26rpx;
|
|
color: #333;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.favorable {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 60rpx;
|
|
box-sizing: border-box;
|
|
// border-bottom: 2rpx solid #E5E5E5;
|
|
|
|
.favorable_left {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.icon {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
margin-right: 16rpx;
|
|
}
|
|
|
|
.name {
|
|
font-size: 28rpx;
|
|
font-weight: 400rpx;
|
|
color: #333;
|
|
}
|
|
}
|
|
|
|
.favorable_right {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.favorable_right_text {
|
|
font-size: 24rpx;
|
|
color: #999;
|
|
font-weight: 400rpx;
|
|
|
|
&.red {
|
|
color: #ff3232;
|
|
}
|
|
}
|
|
}
|
|
|
|
.favorable_right {
|
|
.column {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-end;
|
|
|
|
.favorable_right_text {
|
|
margin-bottom: 10rpx;
|
|
|
|
&.red {
|
|
color: #ff3232;
|
|
}
|
|
|
|
text:nth-child(1) {
|
|
font-size: 26rpx;
|
|
color: #999;
|
|
}
|
|
|
|
text:nth-child(2) {
|
|
font-size: 26rpx;
|
|
color: #999;
|
|
margin: 0 30rpx;
|
|
}
|
|
|
|
text:nth-child(3) {
|
|
font-size: 26rpx;
|
|
color: #333;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.favorable_right.column {
|
|
align-items: flex-start;
|
|
}
|
|
}
|
|
|
|
.favorable.column {
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.cell-item.column {
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.total-wrap {
|
|
display: flex;
|
|
margin: 0 30rpx;
|
|
justify-content: flex-end;
|
|
align-items: flex-end;
|
|
padding: 0 0 30rpx 34rpx;
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
border-bottom: 2rpx dashed #e5e5e5;
|
|
|
|
.price {
|
|
font-weight: bold;
|
|
font-size: 36rpx;
|
|
}
|
|
}
|
|
|
|
.order_footer {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 34rpx;
|
|
position: relative;
|
|
}
|
|
}
|
|
}
|
|
|
|
.orderInfo {
|
|
background: #ffffff;
|
|
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
|
margin-top: 32rpx;
|
|
padding: 32rpx 34rpx;
|
|
|
|
// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
|
.row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 32rpx;
|
|
|
|
.t {
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.info {
|
|
font-weight: 400;
|
|
font-size: 28rpx;
|
|
color: #666666;
|
|
}
|
|
}
|
|
|
|
.row:last-child {
|
|
margin-bottom: none;
|
|
}
|
|
}
|
|
|
|
.fixedview {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
|
|
.flex-between {
|
|
width: 100%;
|
|
padding: 36rpx 54rpx 102rpx 54rpx;
|
|
background: #ffffff;
|
|
|
|
.fixedview_one {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
|
|
.fixedview_oneone {
|
|
font-weight: 400;
|
|
font-size: 28rpx;
|
|
color: #666666;
|
|
}
|
|
|
|
.fixedview_onetow {
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
color: #333333;
|
|
|
|
text {
|
|
font-size: 24rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.fixedview_tow {
|
|
width: 140rpx;
|
|
height: 56rpx;
|
|
line-height: 56rpx;
|
|
text-align: center;
|
|
background: #e3ad7f;
|
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
|
font-weight: 400;
|
|
font-size: 28rpx;
|
|
color: #ffffff;
|
|
}
|
|
}
|
|
}
|
|
|
|
.red {
|
|
color: #ff3232;
|
|
}
|
|
.youhui-item {
|
|
height: 60rpx;
|
|
width: 100%;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-content: center;
|
|
}
|
|
.align-center {
|
|
align-items: center;
|
|
}
|
|
</style> |