优化下单折扣
This commit is contained in:
parent
87e8976353
commit
a914adc9f8
|
|
@ -465,7 +465,7 @@ async function confirmOrder() {
|
||||||
emit("paySuccess");
|
emit("paySuccess");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code == 701) {
|
if (error.code == 701 || error.code == 603) {
|
||||||
// 订单已过期需刷新购物车和订单
|
// 订单已过期需刷新购物车和订单
|
||||||
emit('orderExpired')
|
emit('orderExpired')
|
||||||
}
|
}
|
||||||
|
|
@ -593,6 +593,32 @@ const discountInput = _.debounce(function (e) {
|
||||||
pointOptions.value.amount = 0
|
pointOptions.value.amount = 0
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
|
// const discountInput = (e) => {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// couponForm.value.amount = couponForm.value.originAmount
|
||||||
|
// couponForm.value.discountRatio = inputFilterFloat(e)
|
||||||
|
// if (couponForm.value.discountRatio > 9.9) {
|
||||||
|
// couponForm.value.discountRatio = 9.9
|
||||||
|
// }
|
||||||
|
// if (couponForm.value.discountRatio < 0.1) {
|
||||||
|
// couponForm.value.discountRatio = 0.1
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (couponForm.value.discountRatio) {
|
||||||
|
// couponForm.value.amount = formatDecimal(couponForm.value.amount * (couponForm.value.discountRatio / couponFormDiscountRate.value))
|
||||||
|
// } else {
|
||||||
|
// couponForm.value.amount = formatDecimal(+couponForm.value.originAmount)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 将优惠券/积分所有设置初始化
|
||||||
|
// couponResList1.value = []
|
||||||
|
// couponResList2.value = []
|
||||||
|
|
||||||
|
// couponForm.value.pointsNum = ''
|
||||||
|
// pointOptions.value.amount = 0
|
||||||
|
// }, 50)
|
||||||
|
// }
|
||||||
|
|
||||||
// 积分输入格式化
|
// 积分输入格式化
|
||||||
function pointInput(e) {
|
function pointInput(e) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -624,7 +650,7 @@ function pointInput(e) {
|
||||||
const calcPointMoney = _.debounce(async function () {
|
const calcPointMoney = _.debounce(async function () {
|
||||||
try {
|
try {
|
||||||
const res = await calcDeductionAmount({
|
const res = await calcDeductionAmount({
|
||||||
userId: couponFormUser.value.id,
|
shopUserId: couponFormUser.value.id,
|
||||||
orderAmount: couponForm.value.amount,
|
orderAmount: couponForm.value.amount,
|
||||||
points: couponForm.value.pointsNum
|
points: couponForm.value.pointsNum
|
||||||
})
|
})
|
||||||
|
|
@ -701,7 +727,7 @@ function resetCoupon() {
|
||||||
async function pointOptionsAjax() {
|
async function pointOptionsAjax() {
|
||||||
try {
|
try {
|
||||||
const res = await calcUsablePoints({
|
const res = await calcUsablePoints({
|
||||||
userId: couponFormUser.value.id,
|
shopUserId: couponFormUser.value.id,
|
||||||
orderAmount: couponForm.value.amount
|
orderAmount: couponForm.value.amount
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -797,7 +823,18 @@ function delCoupon(index, t) {
|
||||||
function discountConfirm() {
|
function discountConfirm() {
|
||||||
// 确认折扣
|
// 确认折扣
|
||||||
discountRateVlaue.value = couponForm.value.discountRatio || ''
|
discountRateVlaue.value = couponForm.value.discountRatio || ''
|
||||||
payData.value.checkOrderPay.discountAmount = couponForm.value.discountRatio ? formatDecimal(couponForm.value.originAmount - (couponForm.value.originAmount * (couponForm.value.discountRatio / couponFormDiscountRate.value))) : 0
|
|
||||||
|
// 计算折扣金额
|
||||||
|
if (couponForm.value.discountRatio) {
|
||||||
|
let rate = couponForm.value.discountRatio / couponFormDiscountRate.value
|
||||||
|
let discount = formatDecimal(couponForm.value.originAmount * rate)
|
||||||
|
payData.value.checkOrderPay.discountAmount = formatDecimal(couponForm.value.originAmount - discount)
|
||||||
|
// console.log(rate);
|
||||||
|
// console.log(discount);
|
||||||
|
// console.log(payData.value.checkOrderPay.discountAmount);
|
||||||
|
} else {
|
||||||
|
payData.value.checkOrderPay.discountAmount = 0
|
||||||
|
}
|
||||||
|
|
||||||
if (couponFormUser.value.id) {
|
if (couponFormUser.value.id) {
|
||||||
payData.value.checkOrderPay.userId = couponFormUser.value.userId
|
payData.value.checkOrderPay.userId = couponFormUser.value.userId
|
||||||
|
|
|
||||||
|
|
@ -225,12 +225,12 @@ function paySuccess() {
|
||||||
emits('success')
|
emits('success')
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
ElMessage.success('支付成功')
|
ElMessage.success('支付成功')
|
||||||
|
goodsStore.clearCart()
|
||||||
useStorage.del('tableCode')
|
useStorage.del('tableCode')
|
||||||
socket.cartInit()
|
socket.cartInit()
|
||||||
goodsStore.successClearCart()
|
goodsStore.successClearCart()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const payCardRef = ref(null)
|
const payCardRef = ref(null)
|
||||||
function show(t) {
|
function show(t) {
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
</div>
|
</div>
|
||||||
<CartItem
|
<CartItem
|
||||||
:item="{ product_name: '客座费', number: goodsStore.tableInfo.num, lowPrice: store.shopInfo.tableFee, memberPrice: store.shopInfo.tableFee }"
|
:item="{ product_name: '客座费', number: goodsStore.tableInfo.num, lowPrice: store.shopInfo.tableFee, memberPrice: store.shopInfo.tableFee }"
|
||||||
v-if="!store.shopInfo.isTableFee && goodsStore.tableInfo.name && (goodsStore.cartList.length || goodsStore.orderList.length)" />
|
v-if="!store.shopInfo.isTableFee && goodsStore.tableInfo.id" />
|
||||||
<div class="order_list_item" v-for="(arr, index) in goodsStore.orderList" :key="index">
|
<div class="order_list_item" v-for="(arr, index) in goodsStore.orderList" :key="index">
|
||||||
<div class="order_num">{{ `第${arr.orderNum}次下单` }}</div>
|
<div class="order_num">{{ `第${arr.orderNum}次下单` }}</div>
|
||||||
<CartItem type="order" :border="false" :item="item" :index="index" :i="i" :key="item.id"
|
<CartItem type="order" :border="false" :item="item" :index="index" :i="i" :key="item.id"
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,8 @@ async function checkRecord() {
|
||||||
// 开始交班
|
// 开始交班
|
||||||
const exit = async () => {
|
const exit = async () => {
|
||||||
try {
|
try {
|
||||||
|
if (loading.value) return
|
||||||
|
loading.value = true;
|
||||||
// await staffPermission('yun_xu_jiao_ban')
|
// await staffPermission('yun_xu_jiao_ban')
|
||||||
const res = await handover(isPrint.value)
|
const res = await handover(isPrint.value)
|
||||||
const data = await handoverData(res)
|
const data = await handoverData(res)
|
||||||
|
|
@ -188,8 +190,8 @@ const exit = async () => {
|
||||||
}
|
}
|
||||||
logoutHandle()
|
logoutHandle()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,9 +207,9 @@ async function logoutHandle() {
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
loading.value = false;
|
||||||
console.log('退出失败');
|
console.log('退出失败');
|
||||||
}
|
}
|
||||||
loading.value = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取交班打印数据前置
|
// 获取交班打印数据前置
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="box_content_left_top_item_top">
|
<div class="box_content_left_top_item_top">
|
||||||
<div>
|
<div>
|
||||||
{{ infoData.amount }}
|
{{ formatDecimal(+infoData.amount) }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
总收款
|
总收款
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex;">
|
<div style="display: flex;">
|
||||||
<span>挂账金额</span>
|
<span>挂账金额</span>
|
||||||
<span style="font-weight: bold;">{{ item.creditAmount }}</span>
|
<span style="font-weight: bold;">{{ formatDecimal(+item.creditAmount) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -123,8 +123,7 @@
|
||||||
import { reactive, onMounted } from 'vue'
|
import { reactive, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { handoverRecordPage } from '@/api/account.js'
|
import { handoverRecordPage } from '@/api/account.js'
|
||||||
import { useUser } from "@/store/user.js"
|
import { formatDecimal } from "@/utils/index.js";
|
||||||
import { ElMessage, dayjs } from 'element-plus'
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue