fix: 代客下单修改
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
v-if="score.sel == 1"
|
||||
v-model="usePointsNumber"
|
||||
step-strictly
|
||||
:step="pointsRes.equivalentPoints"
|
||||
placeholder="请输入积分抵扣数量"
|
||||
:min="pointsRes.minDeductionPoints"
|
||||
:max="pointsRes.maxUsablePoints"
|
||||
@@ -80,9 +81,10 @@
|
||||
<el-icon><ArrowDown /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-m-t-20" v-if="quansSelArr.length > 0">
|
||||
{{ carts.orderCostSummary }}
|
||||
<div class="u-m-t-20" v-if="carts.coupons.length > 0">
|
||||
<div class="font-bold u-m-b-10">已选优惠券</div>
|
||||
<el-table empty-text="未选择优惠券" :data="quansSelArr">
|
||||
<el-table empty-text="未选择优惠券" :data="carts.coupons">
|
||||
<el-table-column type="index" width="50" label="#"></el-table-column>
|
||||
<el-table-column prop="name" label="券名称"></el-table-column>
|
||||
<el-table-column label="券类型" width="80">
|
||||
@@ -294,8 +296,6 @@ function refCouponConfirm(e, goodsList) {
|
||||
quansSelArr.value = e;
|
||||
checkOrderPay.discountAmount = 0;
|
||||
checkOrderPay.discount = 0;
|
||||
score.sel = -1;
|
||||
usePointsNumber.value = 0;
|
||||
}
|
||||
function delQuan(row) {
|
||||
const index = quansSelArr.value.findIndex((v) => v.id == row.id);
|
||||
@@ -340,8 +340,7 @@ function returnMerchantReductionDiscount() {
|
||||
const total =
|
||||
goodsOriginalAmount - // 商品原价总和
|
||||
goodsDiscountAmount - // 减去商品折扣
|
||||
couponDeductionAmount - // 减去优惠券抵扣
|
||||
pointDeductionAmount; // 减去积分抵扣
|
||||
couponDeductionAmount; // 减去优惠券抵扣
|
||||
|
||||
return total <= 0 ? 0 : total;
|
||||
}
|
||||
@@ -436,7 +435,6 @@ async function pointsInit() {
|
||||
carts.pointDeductionRule.pointsPerYuan = res.equivalentPoints;
|
||||
|
||||
usePointsNumber.value = res.usable ? res.maxUsablePoints : 0;
|
||||
carts.userPoints = usePointsNumber.value;
|
||||
if (res.usable) {
|
||||
pointsToMoney();
|
||||
} else {
|
||||
@@ -491,6 +489,12 @@ watch(
|
||||
pointsInit();
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => usePointsNumber.value,
|
||||
(newval) => {
|
||||
carts.userPoints = newval;
|
||||
}
|
||||
);
|
||||
function canUsePayType(item) {
|
||||
if (currentpayMoney.value * 1 == 0) {
|
||||
return item.payType == "cash" ? false : true;
|
||||
@@ -512,6 +516,7 @@ function changePayType(i) {
|
||||
}
|
||||
|
||||
function returnPayParams() {
|
||||
console.log("carts.orderCostSummary", carts.orderCostSummary);
|
||||
return {
|
||||
money: currentpayMoney.value * 1,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
@@ -522,17 +527,15 @@ function returnPayParams() {
|
||||
// discountRatio: (checkOrderPay.discount / 100).toFixed(2),
|
||||
discountRatio: 0,
|
||||
seatNum: props.perpole * 1,
|
||||
originAmount: carts.payMoney * 1 + seatAmount.value * 1,
|
||||
originAmount: carts.orderCostSummary.goodsRealAmount,
|
||||
discountAmount: discountAmount.value,
|
||||
productCouponDiscountAmount: productCouponDiscountAmount.value * 1,
|
||||
otherCouponDiscountAmount:
|
||||
carts.orderCostSummary.couponDeductionAmount - productCouponDiscountAmount.value * 1,
|
||||
orderAmount: currentpayMoney.value * 1,
|
||||
productCouponDiscountAmount: carts.orderCostSummary.productCouponDeduction,
|
||||
otherCouponDiscountAmount: carts.orderCostSummary.fullCouponDeduction,
|
||||
orderAmount: carts.orderCostSummary.finalPayAmount, // 最终订单金额
|
||||
roundAmount: props.orderInfo.roundAmount,
|
||||
pointsDiscountAmount: pointsDiscountAmount.value * 1,
|
||||
pointsNum: usePointsNumber.value * 1,
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value * 1,
|
||||
couponList: quansSelArr.value.map((v) => v.id),
|
||||
pointsDiscountAmount: carts.orderCostSummary.pointDeductionAmount, //积分抵扣金额
|
||||
pointsNum: carts.orderCostSummary.pointUsed,
|
||||
couponList: carts.coupons.map((v) => v.id),
|
||||
userId: props.user.userId || "",
|
||||
allPack: carts.dinnerType == "take-out" ? 1 : 0,
|
||||
},
|
||||
@@ -667,11 +670,7 @@ const fullCouponDiscountAmount = computed(() => {
|
||||
//商品券抵扣金额
|
||||
const productCouponDiscountAmount = computed(() => {
|
||||
// 优先从 Store 扩展字段取,若无则用 props 数据(过渡方案)
|
||||
return (
|
||||
carts.orderCostSummary.productCouponDeduction ||
|
||||
props.orderInfo.productCouponDiscountAmount ||
|
||||
0
|
||||
);
|
||||
return carts.orderCostSummary.productCouponDeduction;
|
||||
});
|
||||
//除开客座费,打包费总金额
|
||||
const totalMoney = computed(() => {
|
||||
@@ -717,6 +716,7 @@ watch(
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
carts.payParamsInit();
|
||||
getPaytype();
|
||||
});
|
||||
defineExpose({
|
||||
|
||||
Reference in New Issue
Block a user