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