修改计算商家减免前金额,将会员折扣金额减去
This commit is contained in:
@@ -7,7 +7,9 @@
|
|||||||
<div class="u-m-l-12">
|
<div class="u-m-l-12">
|
||||||
<p>
|
<p>
|
||||||
<span class="name u-font-16">{{ carts.vipUser.nickName }}</span>
|
<span class="name u-font-16">{{ carts.vipUser.nickName }}</span>
|
||||||
<span class="vip" v-if="carts.vipUser.isVip">VIP{{ carts.vipUser.memberLevelName }}</span>
|
<span class="vip" v-if="carts.vipUser.isVip">
|
||||||
|
VIP{{ carts.vipUser.memberLevelName }}
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="u-font-14 color-666 u-m-t-10">
|
<p class="u-font-14 color-666 u-m-t-10">
|
||||||
<span class="money">余额:{{ carts.vipUser.amount }}</span>
|
<span class="money">余额:{{ carts.vipUser.amount }}</span>
|
||||||
@@ -42,11 +44,22 @@
|
|||||||
<span class="u-font-14">部分抵扣</span>
|
<span class="u-font-14">部分抵扣</span>
|
||||||
</el-radio> -->
|
</el-radio> -->
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<el-input-number class="u-m-l-10" v-if="score.sel != -1" v-model="usePointsNumber" step-strictly
|
<el-input-number
|
||||||
:step="pointsRes.equivalentPoints" placeholder="请输入积分抵扣数量" :min="pointsRes.minDeductionPoints"
|
class="u-m-l-10"
|
||||||
:max="pointsRes.maxUsablePoints" @change="pointsToMoney"></el-input-number>
|
v-if="score.sel != -1"
|
||||||
|
v-model="usePointsNumber"
|
||||||
|
step-strictly
|
||||||
|
:step="pointsRes.equivalentPoints"
|
||||||
|
placeholder="请输入积分抵扣数量"
|
||||||
|
:min="pointsRes.minDeductionPoints"
|
||||||
|
:max="pointsRes.maxUsablePoints"
|
||||||
|
@change="pointsToMoney"
|
||||||
|
></el-input-number>
|
||||||
</div>
|
</div>
|
||||||
<p class="u-font-14 color-666 u-m-t-10" v-if="pointsRes.unusableReason && !pointsRes.usable">
|
<p
|
||||||
|
class="u-font-14 color-666 u-m-t-10"
|
||||||
|
v-if="pointsRes.unusableReason && !pointsRes.usable"
|
||||||
|
>
|
||||||
<span class="color-red">*</span>
|
<span class="color-red">*</span>
|
||||||
<span>{{ pointsRes.unusableReason }}</span>
|
<span>{{ pointsRes.unusableReason }}</span>
|
||||||
</p>
|
</p>
|
||||||
@@ -68,8 +81,14 @@
|
|||||||
<div class="u-flex u-col-center u-m-t-20 no-wrap">
|
<div class="u-flex u-col-center u-m-t-20 no-wrap">
|
||||||
<span class="u-font-14 font-bold u-m-r-20">优惠券</span>
|
<span class="u-font-14 font-bold u-m-r-20">优惠券</span>
|
||||||
<div
|
<div
|
||||||
v-if="carts.orderCostSummary.fullReduction !== undefined && carts.orderCostSummary.fullReduction.actualAmount > 0"
|
v-if="
|
||||||
style="font-size: 14px;color: #555;">参与满减活动不可用优惠券!</div>
|
carts.orderCostSummary.fullReduction !== undefined &&
|
||||||
|
carts.orderCostSummary.fullReduction.actualAmount > 0
|
||||||
|
"
|
||||||
|
style="font-size: 14px; color: #555"
|
||||||
|
>
|
||||||
|
参与满减活动不可用优惠券!
|
||||||
|
</div>
|
||||||
<div class="u-flex my-select" @click="openCoupon" v-else>
|
<div class="u-flex my-select" @click="openCoupon" v-else>
|
||||||
<span class="u-m-r-10">选择优惠券</span>
|
<span class="u-m-r-10">选择优惠券</span>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
@@ -118,9 +137,14 @@
|
|||||||
<p class="u-font-16 font-bold u-m-r-20 font-bold u-flex">选择支付方式</p>
|
<p class="u-font-16 font-bold u-m-r-20 font-bold u-flex">选择支付方式</p>
|
||||||
<div class="u-m-t-20">
|
<div class="u-m-t-20">
|
||||||
<div>
|
<div>
|
||||||
<el-button v-for="(item, index) in payTypes.list" :key="index" size="large"
|
<el-button
|
||||||
:type="index == payTypes.sel ? 'primary' : ''" :disabled="canUsePayType(item)"
|
v-for="(item, index) in payTypes.list"
|
||||||
@click="changePayType(index)">
|
:key="index"
|
||||||
|
size="large"
|
||||||
|
:type="index == payTypes.sel ? 'primary' : ''"
|
||||||
|
:disabled="canUsePayType(item)"
|
||||||
|
@click="changePayType(index)"
|
||||||
|
>
|
||||||
{{ item.payName }}
|
{{ item.payName }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -167,9 +191,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">新客立减</span>
|
<span class="title">新客立减</span>
|
||||||
<span class="u-m-l-10 value">
|
<span class="u-m-l-10 value">-¥{{ carts.orderCostSummary.newUserDiscount }}</span>
|
||||||
-¥{{ carts.orderCostSummary.newUserDiscount }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="u-flex u-m-b-10 u-row-between">
|
<div class="u-flex u-m-b-10 u-row-between">
|
||||||
<span class="title">商品优惠券</span>
|
<span class="title">商品优惠券</span>
|
||||||
@@ -209,13 +231,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 扫码 -->
|
<!-- 扫码 -->
|
||||||
<scanPay ref="refScanPay" :order="orderInfo" @confirm="refScanPayConfirm" @paysuccess="paysuccess"></scanPay>
|
<scanPay
|
||||||
|
ref="refScanPay"
|
||||||
|
:order="orderInfo"
|
||||||
|
@confirm="refScanPayConfirm"
|
||||||
|
@paysuccess="paysuccess"
|
||||||
|
></scanPay>
|
||||||
<!-- 打折 -->
|
<!-- 打折 -->
|
||||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||||
<!-- 优惠券 -->
|
<!-- 优惠券 -->
|
||||||
<popup-coupon ref="refCoupon" :user="carts.vipUser" @confirm="refCouponConfirm"></popup-coupon>
|
<popup-coupon ref="refCoupon" :user="carts.vipUser" @confirm="refCouponConfirm"></popup-coupon>
|
||||||
<!-- 挂账 -->
|
<!-- 挂账 -->
|
||||||
<chooseGuaZahng ref="refGuaZhang" :payMoney="currentpayMoney" @confirm="refGuaZhangConfirm"></chooseGuaZahng>
|
<chooseGuaZahng
|
||||||
|
ref="refGuaZhang"
|
||||||
|
:payMoney="currentpayMoney"
|
||||||
|
@confirm="refGuaZhangConfirm"
|
||||||
|
></chooseGuaZahng>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -231,7 +262,7 @@ const shopUser = useUserStore();
|
|||||||
const carts = useCartsStore();
|
const carts = useCartsStore();
|
||||||
import popupCoupon from "./popup-coupon.vue";
|
import popupCoupon from "./popup-coupon.vue";
|
||||||
import PointsApi from "@/api/account/points";
|
import PointsApi from "@/api/account/points";
|
||||||
import limitTimeDiscountApi from '@/api/market/limitTimeDiscount.js'
|
import limitTimeDiscountApi from "@/api/market/limitTimeDiscount.js";
|
||||||
import payTypeApi from "@/api/account/payType";
|
import payTypeApi from "@/api/account/payType";
|
||||||
import payApi from "@/api/order/pay";
|
import payApi from "@/api/order/pay";
|
||||||
import scanPay from "./scan-pay.vue";
|
import scanPay from "./scan-pay.vue";
|
||||||
@@ -326,6 +357,7 @@ function returnMerchantReductionDiscount() {
|
|||||||
const seat = new BigNumber(seatFee);
|
const seat = new BigNumber(seatFee);
|
||||||
const pack = new BigNumber(packFee);
|
const pack = new BigNumber(packFee);
|
||||||
const additional = new BigNumber(additionalFee);
|
const additional = new BigNumber(additionalFee);
|
||||||
|
const vipDiscountAmount = new BigNumber(carts.orderCostSummary.vipDiscountAmount);
|
||||||
|
|
||||||
// 按照原逻辑进行精确计算
|
// 按照原逻辑进行精确计算
|
||||||
const total = originalAmount
|
const total = originalAmount
|
||||||
@@ -333,6 +365,7 @@ function returnMerchantReductionDiscount() {
|
|||||||
.minus(discountAmount) // 减去商品折扣
|
.minus(discountAmount) // 减去商品折扣
|
||||||
.minus(couponAmount) // 减去优惠券抵扣
|
.minus(couponAmount) // 减去优惠券抵扣
|
||||||
.minus(pointAmount) // 减去积分抵扣
|
.minus(pointAmount) // 减去积分抵扣
|
||||||
|
.minus(vipDiscountAmount) // 减去会员折扣
|
||||||
.plus(seat) // 加上餐位费
|
.plus(seat) // 加上餐位费
|
||||||
.plus(pack) // 加上打包费
|
.plus(pack) // 加上打包费
|
||||||
.plus(additional); // 加上附加费
|
.plus(additional); // 加上附加费
|
||||||
@@ -351,7 +384,7 @@ function discountShow(e) {
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
table: {
|
table: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => { },
|
default: () => {},
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -365,7 +398,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
orderInfo: {
|
orderInfo: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => { },
|
default: () => {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -483,18 +516,18 @@ function changePayType(i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据用户id获取新客立减金额,返回null代表不可用
|
// 根据用户id获取新客立减金额,返回null代表不可用
|
||||||
const newCustomerDiscount = ref(null)
|
const newCustomerDiscount = ref(null);
|
||||||
async function getConsumeDiscountAjax() {
|
async function getConsumeDiscountAjax() {
|
||||||
try {
|
try {
|
||||||
if (carts.vipUser.id) {
|
if (carts.vipUser.id) {
|
||||||
newCustomerDiscount.value = await limitTimeDiscountApi.getConsumeDiscount({
|
newCustomerDiscount.value = await limitTimeDiscountApi.getConsumeDiscount({
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
shopUserId: carts.vipUser.id,
|
shopUserId: carts.vipUser.id,
|
||||||
orderId: props.orderInfo.id
|
orderId: props.orderInfo.id,
|
||||||
})
|
});
|
||||||
console.log('根据用户id获取新客立减金额,返回null代表不可用', newCustomerDiscount.value);
|
console.log("根据用户id获取新客立减金额,返回null代表不可用", newCustomerDiscount.value);
|
||||||
if (newCustomerDiscount.value !== null) {
|
if (newCustomerDiscount.value !== null) {
|
||||||
carts.newUserDiscount = newCustomerDiscount.value.amount
|
carts.newUserDiscount = newCustomerDiscount.value.amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -523,13 +556,17 @@ function returnPayParams() {
|
|||||||
pointsDiscountAmount: carts.orderCostSummary.pointDeductionAmount, //积分抵扣金额
|
pointsDiscountAmount: carts.orderCostSummary.pointDeductionAmount, //积分抵扣金额
|
||||||
pointsNum: carts.orderCostSummary.pointUsed,
|
pointsNum: carts.orderCostSummary.pointUsed,
|
||||||
discountActAmount: carts.orderCostSummary.fullReduction.actualAmount, // 满减活动金额
|
discountActAmount: carts.orderCostSummary.fullReduction.actualAmount, // 满减活动金额
|
||||||
discountActId: carts.orderCostSummary.fullReduction.usedThreshold !== undefined ? carts.orderCostSummary.fullReduction.usedThreshold.activityId : '', // 满减活动id
|
discountActId:
|
||||||
|
carts.orderCostSummary.fullReduction.usedThreshold !== undefined
|
||||||
|
? carts.orderCostSummary.fullReduction.usedThreshold.activityId
|
||||||
|
: "", // 满减活动id
|
||||||
couponList: carts.coupons.map((v) => v.id),
|
couponList: carts.coupons.map((v) => v.id),
|
||||||
userId: carts.vipUser.userId || "",
|
userId: carts.vipUser.userId || "",
|
||||||
allPack: carts.dinnerType == "take-out" ? 1 : 0,
|
allPack: carts.dinnerType == "take-out" ? 1 : 0,
|
||||||
limitRate: carts.limitDiscountRes,
|
limitRate: carts.limitDiscountRes,
|
||||||
newCustomerDiscountId: newCustomerDiscount.value !== null ? newCustomerDiscount.value.id : '', // 新客立减Id
|
newCustomerDiscountId: newCustomerDiscount.value !== null ? newCustomerDiscount.value.id : "", // 新客立减Id
|
||||||
newCustomerDiscountAmount: newCustomerDiscount.value !== null ? newCustomerDiscount.value.amount : 0, // 新客立减金额
|
newCustomerDiscountAmount:
|
||||||
|
newCustomerDiscount.value !== null ? newCustomerDiscount.value.amount : 0, // 新客立减金额
|
||||||
vipDiscountAmount: carts.orderCostSummary.vipDiscountAmount, // 超级会员折扣
|
vipDiscountAmount: carts.orderCostSummary.vipDiscountAmount, // 超级会员折扣
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -570,7 +607,7 @@ function nowPayClick(payType) {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
payOrder("cash");
|
payOrder("cash");
|
||||||
})
|
})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (payType == "member-account") {
|
if (payType == "member-account") {
|
||||||
@@ -705,10 +742,10 @@ watch(
|
|||||||
async function getlimitTimeDiscount() {
|
async function getlimitTimeDiscount() {
|
||||||
try {
|
try {
|
||||||
const res = await limitTimeDiscountApi.getLimitTimeDiscount({
|
const res = await limitTimeDiscountApi.getLimitTimeDiscount({
|
||||||
shopId: localStorage.getItem("shopId")
|
shopId: localStorage.getItem("shopId"),
|
||||||
})
|
});
|
||||||
|
|
||||||
console.log('获取当前店铺可用的限时折扣===', res);
|
console.log("获取当前店铺可用的限时折扣===", res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
@@ -717,8 +754,8 @@ async function getlimitTimeDiscount() {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
carts.payParamsInit();
|
carts.payParamsInit();
|
||||||
getPaytype();
|
getPaytype();
|
||||||
getlimitTimeDiscount()
|
getlimitTimeDiscount();
|
||||||
getConsumeDiscountAjax()
|
getConsumeDiscountAjax();
|
||||||
});
|
});
|
||||||
defineExpose({
|
defineExpose({
|
||||||
nowPayClick,
|
nowPayClick,
|
||||||
@@ -764,9 +801,11 @@ defineExpose({
|
|||||||
.order-info {
|
.order-info {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
.title {}
|
.title {
|
||||||
|
}
|
||||||
|
|
||||||
.value {}
|
.value {
|
||||||
|
}
|
||||||
|
|
||||||
.price {
|
.price {
|
||||||
color: #fa5555;
|
color: #fa5555;
|
||||||
|
|||||||
Reference in New Issue
Block a user