结算新增优惠金额
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
<div class="t2">
|
||||
<span>商品原价:¥{{ goodsStore.cartInfo.costSummary.goodsRealAmount || 0 }}</span>
|
||||
<span>餐位费:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.seatFee || 0)
|
||||
}}</span>
|
||||
}}</span>
|
||||
<span>打包费:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.packFee || 0)
|
||||
}}</span>
|
||||
}}</span>
|
||||
<span>优惠:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.totalDiscountAmount || 0) }}</span>
|
||||
<!-- <span v-if="goodsStore.cartInfo.costSummary.goodsDiscountAmount">
|
||||
<span>折扣:{{ goodsStore.cartInfo.costSummary.goodsDiscountAmount }}</span>
|
||||
@@ -48,6 +48,7 @@
|
||||
<div class="input_wrap">
|
||||
<div class="input" style="flex: 1">付款:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.finalPayAmount
|
||||
|| 0) }}</div>
|
||||
<!-- <el-button type="warning" style="width: 80px;border-radius: 6px; height: 60px;" @click="applyRounding">抹零</el-button> -->
|
||||
<el-button type="primary" style="width: 120px;border-radius: 6px; height: 60px;"
|
||||
@click="showCouponHandle">添加优惠</el-button>
|
||||
</div>
|
||||
@@ -139,11 +140,25 @@
|
||||
<el-button type="danger" @click="clearCouponUser">清除</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="整单折扣">
|
||||
<el-input v-model="couponForm.discountRatio" placeholder="请输入折扣" style="width: 180px;"
|
||||
@input="discountInput">
|
||||
<template #append>折</template>
|
||||
</el-input>
|
||||
<el-form-item label="优惠金额">
|
||||
<div class="column">
|
||||
<div>
|
||||
<el-radio-group v-model="discountType" @change="clearDiscountChange">
|
||||
<el-radio-button label="按金额优惠" :value="1"></el-radio-button>
|
||||
<el-radio-button label="按折扣优惠" :value="2"></el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div>
|
||||
<el-input v-model="couponForm.discountAmount" placeholder="请输入金额" style="width: 239px;"
|
||||
@input="amountDiscountInput" v-if="discountType == 1">
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
<el-input v-model="couponForm.discountRatio" placeholder="请输入折扣" style="width: 239px;"
|
||||
@input="discountInput" v-if="discountType == 2">
|
||||
<template #append>折</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券">
|
||||
<div style="width: 100%;">
|
||||
@@ -576,6 +591,20 @@ function amountInput(num) {
|
||||
payData.value.checkOrderPay.orderAmount = money.value;
|
||||
}
|
||||
|
||||
// 应用抹零
|
||||
function applyRounding() {
|
||||
if (discountAmount.value !== null) {
|
||||
money.value = formatDecimal(discountAmount.value)
|
||||
roundAmount.value = 0
|
||||
} else {
|
||||
money.value = formatDecimal(props.amount)
|
||||
roundAmount.value = 0
|
||||
}
|
||||
|
||||
payData.value.checkOrderPay.roundAmount = roundAmount.value;
|
||||
payData.value.checkOrderPay.orderAmount = money.value;
|
||||
}
|
||||
|
||||
// 删除
|
||||
function delHandle() {
|
||||
if (!money.value) return; money.value = money.value.substring(0, money.value.length - 1);
|
||||
@@ -718,6 +747,32 @@ function clearCouponUser() {
|
||||
// resetCouponFormHandle()
|
||||
}
|
||||
|
||||
// 按照金额优惠
|
||||
const discountType = ref(1)
|
||||
|
||||
// 清除优惠方式变更时的优惠数据
|
||||
function clearDiscountChange() {
|
||||
couponForm.value.discountRatio = ''
|
||||
couponForm.value.discountAmount = ''
|
||||
discountRateNumber.value = 0
|
||||
|
||||
updateCartCalc()
|
||||
}
|
||||
|
||||
const amountDiscountInput = _.debounce(function (e) {
|
||||
couponForm.value.discountAmount = inputFilterFloat(e)
|
||||
if (couponForm.value.discountAmount > goodsStore.cartInfo.costSummary.goodsRealAmount) {
|
||||
couponForm.value.discountAmount = goodsStore.cartInfo.costSummary.goodsRealAmount
|
||||
}
|
||||
if (couponForm.value.discountAmount < 0) {
|
||||
couponForm.value.discountAmount = 0
|
||||
}
|
||||
|
||||
discountRateNumber.value = couponForm.value.discountAmount
|
||||
|
||||
updateCartCalc()
|
||||
}, 500)
|
||||
|
||||
// 折扣格式化
|
||||
const discountRateNumber = ref(0)
|
||||
const discountInput = _.debounce(function (e) {
|
||||
@@ -1251,6 +1306,12 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.point_tips {
|
||||
&.err {
|
||||
color: var(--el-color-danger);
|
||||
|
||||
Reference in New Issue
Block a user