结算新增优惠金额
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vite-electron",
|
"name": "vite-electron",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.0.17",
|
"version": "2.0.18",
|
||||||
"main": "dist-electron/main.js",
|
"main": "dist-electron/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "chcp 65001 && vite",
|
"dev": "chcp 65001 && vite",
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
<div class="input_wrap">
|
<div class="input_wrap">
|
||||||
<div class="input" style="flex: 1">付款:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.finalPayAmount
|
<div class="input" style="flex: 1">付款:¥{{ formatDecimal(goodsStore.cartInfo.costSummary.finalPayAmount
|
||||||
|| 0) }}</div>
|
|| 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;"
|
<el-button type="primary" style="width: 120px;border-radius: 6px; height: 60px;"
|
||||||
@click="showCouponHandle">添加优惠</el-button>
|
@click="showCouponHandle">添加优惠</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -139,11 +140,25 @@
|
|||||||
<el-button type="danger" @click="clearCouponUser">清除</el-button>
|
<el-button type="danger" @click="clearCouponUser">清除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="整单折扣">
|
<el-form-item label="优惠金额">
|
||||||
<el-input v-model="couponForm.discountRatio" placeholder="请输入折扣" style="width: 180px;"
|
<div class="column">
|
||||||
@input="discountInput">
|
<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>
|
<template #append>折</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="优惠券">
|
<el-form-item label="优惠券">
|
||||||
<div style="width: 100%;">
|
<div style="width: 100%;">
|
||||||
@@ -576,6 +591,20 @@ function amountInput(num) {
|
|||||||
payData.value.checkOrderPay.orderAmount = money.value;
|
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() {
|
function delHandle() {
|
||||||
if (!money.value) return; money.value = money.value.substring(0, money.value.length - 1);
|
if (!money.value) return; money.value = money.value.substring(0, money.value.length - 1);
|
||||||
@@ -718,6 +747,32 @@ function clearCouponUser() {
|
|||||||
// resetCouponFormHandle()
|
// 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 discountRateNumber = ref(0)
|
||||||
const discountInput = _.debounce(function (e) {
|
const discountInput = _.debounce(function (e) {
|
||||||
@@ -1251,6 +1306,12 @@ defineExpose({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.column {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.point_tips {
|
.point_tips {
|
||||||
&.err {
|
&.err {
|
||||||
color: var(--el-color-danger);
|
color: var(--el-color-danger);
|
||||||
|
|||||||
@@ -55,7 +55,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="shop_list" :class="{ img: shopListType == 'img' }" v-loading="loading">
|
<div class="shop_list" :class="{ img: shopListType == 'img' }" v-loading="loading">
|
||||||
<!-- <swiper class="swiper_box" direction="vertical" @slideChange="onSlideChange"> -->
|
<!-- <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">
|
<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_wrap" v-for="item in goods" :key="item.id" @click="showSkuHandle(item)">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
@@ -294,6 +300,8 @@ import { staffPermission } from '@/api/user.js'
|
|||||||
import { clearNoNum } from '@/utils/index.js'
|
import { clearNoNum } from '@/utils/index.js'
|
||||||
import { productOnOff, markIsSoldOut } from '@/api/product_new.js'
|
import { productOnOff, markIsSoldOut } from '@/api/product_new.js'
|
||||||
|
|
||||||
|
import { Mousewheel } from 'swiper/modules'
|
||||||
|
|
||||||
const swiperRef = ref(null)
|
const swiperRef = ref(null)
|
||||||
|
|
||||||
const store = useUser()
|
const store = useUser()
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ function confirmHandle() {
|
|||||||
goodsStore.operateCart({
|
goodsStore.operateCart({
|
||||||
table_code: table_code,
|
table_code: table_code,
|
||||||
new_table_code: new_table_code,
|
new_table_code: new_table_code,
|
||||||
cart_ids: cart_ids
|
cart_id: cart_ids
|
||||||
}, 'rottable')
|
}, 'rottable')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user