结算新增优惠金额
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vite-electron",
|
||||
"private": true,
|
||||
"version": "2.0.17",
|
||||
"version": "2.0.18",
|
||||
"main": "dist-electron/main.js",
|
||||
"scripts": {
|
||||
"dev": "chcp 65001 && vite",
|
||||
|
||||
@@ -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">
|
||||
<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);
|
||||
|
||||
@@ -55,7 +55,13 @@
|
||||
</div>
|
||||
<div class="shop_list" :class="{ img: shopListType == 'img' }" v-loading="loading">
|
||||
<!-- <swiper class="swiper_box" direction="vertical" @slideChange="onSlideChange"> -->
|
||||
<swiper ref="swiperRef" :loop="false" class="swiper_box" direction="vertical">
|
||||
<swiper ref="swiperRef" :loop="false" class="swiper_box" direction="vertical" :modules="[Mousewheel]"
|
||||
:simulate-touch="true" :allow-touch-move="true" :mousewheel="{
|
||||
enabled: true,
|
||||
forceToAxis: true,
|
||||
releaseOnEdges: true,
|
||||
invert: false,
|
||||
}">
|
||||
<swiper-slide class="slide_item" v-for="(goods, index) in goodsStore.goodsList" :key="index">
|
||||
<div class="item_wrap" v-for="item in goods" :key="item.id" @click="showSkuHandle(item)">
|
||||
<div class="item">
|
||||
@@ -294,6 +300,8 @@ import { staffPermission } from '@/api/user.js'
|
||||
import { clearNoNum } from '@/utils/index.js'
|
||||
import { productOnOff, markIsSoldOut } from '@/api/product_new.js'
|
||||
|
||||
import { Mousewheel } from 'swiper/modules'
|
||||
|
||||
const swiperRef = ref(null)
|
||||
|
||||
const store = useUser()
|
||||
|
||||
@@ -204,7 +204,7 @@ function confirmHandle() {
|
||||
goodsStore.operateCart({
|
||||
table_code: table_code,
|
||||
new_table_code: new_table_code,
|
||||
cart_ids: cart_ids
|
||||
cart_id: cart_ids
|
||||
}, 'rottable')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user