版本更新,折扣打印优化

This commit is contained in:
gyq 2024-08-28 09:53:27 +08:00
parent fbfee69b25
commit 3047fe0404
8 changed files with 85 additions and 50 deletions

View File

@ -1,7 +1,7 @@
{
"name": "vite-electron",
"private": true,
"version": "1.4.17",
"version": "1.4.18",
"main": "dist-electron/main.js",
"scripts": {
"dev": "chcp 65001 && vite",

View File

@ -75,17 +75,20 @@ export default (data) => {
<div style="margin-top: 6px;margin-bottom: 6px;width: 100%">
<hr/>
</div>
<div style="margin-top: 6px; font-size: 22px;display:flex;justify-content: space-between;">
<span>应收</span>
<span>${data.discountAmount}</span>
<div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;">
<span>原价</span>
<span>${data.amount}</span>
</div>
<div style="margin-top: 4px; font-size: 12px;">
<span>共计:</span>
<span>${data.amount}</span>
<span style="margin-left: 10px;">优惠:</span>
<span>${formatDecimal(data.amount - data.discountAmount)}(${
data.discount
})</span>
<div style="margin-top: 6px; font-size: 12px;display:flex;justify-content: space-between;">
<span>折扣</span>
<span>-${formatDecimal(data.amount - data.discountAmount)}</span>
</div>
<div style="margin-top: 6px;margin-bottom: 6px;width: 100%">
<hr/>
</div>
<div style="margin-top: 6px; font-size: 22px;display:flex;justify-content: space-between;">
<span>实付</span>
<span>${data.discountAmount}</span>
</div>
<div style="margin-top: 6px;margin-bottom: 6px;width: 100%">
<hr/>

View File

@ -6,10 +6,10 @@
<span class="num">{{ money }}</span>
</div>
<div class="t2">
<span>共计{{ props.amount }}</span>
<span>原价{{ formatDecimal(props.amount) }}</span>
<span style="margin-left: 20px;">优惠{{ formatDecimal(props.amount - money) }}</span>
<span v-if="props.discount" @click="cancelDiscount">{{ formatDecimal(props.discount * 10, 1, true) }}
<el-icon>
<span style="margin-left: 20px;" v-if="props.discount" @click="cancelDiscount">折扣{{ formatDecimal(props.discount * 10, 1, true) }}
<el-icon style="margin-left: 6px;">
<CircleClose />
</el-icon>
</span>
@ -124,7 +124,7 @@ const money = ref('0')
const scanModalRef = ref(null)
watch(props, (value) => {
money.value = `${props.amount}`
money.value = `${formatDecimal(props.amount)}`
if (props.discount > 0) {
money.value = `${formatDecimal(props.amount * props.discount)}`
}
@ -334,7 +334,7 @@ function cancelDiscount() {
}
onMounted(() => {
money.value = `${props.amount}`
money.value = `${formatDecimal(props.amount)}`
queryPayTypeAjax()
})

View File

@ -1,6 +1,6 @@
<!-- 结算订单 -->
<template>
<el-drawer size="100%" :with-header="false" direction="btt" v-model="dialogVisible">
<el-drawer size="100%" :with-header="false" direction="btt" v-model="dialogVisible" @closed="drawerClose">
<div class="drawer_wrap">
<div class="cart_list">
<div class="nav_wrap card">
@ -74,7 +74,7 @@
<div>
<el-input-number v-model="discount" :min="staffDiscount" :max="0.99" :step="0.1"
:disabled="staffDiscount == 0" />
<div class="tips">最低折扣比例{{ staffDiscount }}</div>
<div class="tips">最低折扣比例{{ staffDiscount }}</div>
</div>
</el-form-item>
</el-form>
@ -174,6 +174,7 @@ async function getStaffDiscountAjax() {
staffId: store.userInfo.staffId
})
staffDiscount.value = res
discount.value = res
} catch (error) {
console.log(error);
}
@ -187,6 +188,11 @@ function discountConfirm() {
showStaffDiscount.value = false
}
//
function drawerClose() {
propsDiscount.value = 0
}
//
const printHandle = _.throttle(async function () {
try {

View File

@ -83,9 +83,9 @@
</div>
<keyboard v-if="props.membershow == '1'" @consumeFees="consumeFees"></keyboard>
<div class="orderbox_right_button" v-if="props.membershow == '0'">
<el-button style="width: 100%;" @click="toHome">创建订单</el-button>
<!-- <el-button style="width: 100%;" @click="toHome">创建订单</el-button> -->
<!-- <el-button style="width: 60%;" type="primary" @click="recharge = true">账户充值</el-button> -->
<el-button style="width: 60%;" type="primary" @click="userChargeRef.show()">账户充值</el-button>
<el-button style="width: 100%;" type="primary" @click="userChargeRef.show()">账户充值</el-button>
</div>
<div class="orderbox_right_button" v-if="props.membershow == '1'">
<router-link to="/" style="width: 35%;">

View File

@ -7,12 +7,12 @@
<div class="demo_tabs_boxitem_one">
<div class=""
style="width: 100px; height: 70px;border-radius: 4px; background:rgb(186 200 239); display: flex; justify-content: center; align-items: center;">
<div>{{ item.tableName || "pos" }}</div>
<div>{{ item.tableName || "POS" }}</div>
</div>
<!-- <el-image style="width: 100px; height: 70px;border-radius: 10px;" :src="item.imgUrl" fit="scale-down" /> -->
<div class="demo_tabs_boxitem_oneone">
<div>
{{ dayjs(item.createAt).format(" HH:mm:ss") }}
{{ dayjs(item.createAt).format("HH:mm:ss") }}
</div>
<div style="color: #757575;">
{{ dayjs(item.createAt).format("YYYY-MM-DD") }}
@ -30,7 +30,15 @@
</div>
<div class="demo_tabs_boxitem_tow">
<div>
{{ item.orderAmount }}
<template v-if="item.discountAmount <= 0">
{{ formatDecimal(item.orderAmount) }}
</template>
<template v-else>
<span>{{ formatDecimal(item.orderAmount - item.discountAmount) }}</span>
<span style="text-decoration: line-through;color: #999;font-size: 14px;">
{{ formatDecimal(item.orderAmount) }}
</span>
</template>
</div>
<div style="color:#ff9e01;">
<span v-if="item.status == 'pending'">挂单</span>
@ -46,6 +54,7 @@
<script setup>
import { ref } from 'vue'
import { dayjs } from 'element-plus'
import { formatDecimal } from '@/utils/index.js'
const props = defineProps({
ordereData: {

View File

@ -80,9 +80,23 @@
<div class="orderbox_right_item">
<span class="span">流水号</span><span class="nunber">{{ orderDetaildata.masterId }}</span>
</div>
<div class="orderbox_right_item" v-if="orderDetaildata.discountAmount > 0">
<span class="span">折扣</span><span class="nunber">{{ formatDecimal(orderDetaildata.discountRatio *
10, 1, true) }}</span>
</div>
<div class="orderbox_right_top" style="margin-top: 20px; border-bottom: 2px solid #ccc">
<span>合计</span>
<span>{{ orderDetaildata.orderAmount }}</span>
<div>
<template v-if="orderDetaildata.discountAmount <= 0">
{{ formatDecimal(orderDetaildata.orderAmount) }}
</template>
<template v-else>
<span>{{ formatDecimal(orderDetaildata.orderAmount - orderDetaildata.discountAmount) }}</span>
<span style="text-decoration: line-through;color: #999;font-size: 14px;">
{{ formatDecimal(orderDetaildata.orderAmount) }}
</span>
</template>
</div>
</div>
<div class="orderbox_right_top" style="margin-top: 20px; border-bottom: 2px solid #ccc">
<span style="font-size: 16px" v-if="orderDetaildata.status == 'pending'">挂单</span>
@ -390,8 +404,8 @@ async function passwordSuccess(pwd) {
return item && item;
});
if (arr.length != 0) {
// await payreturnOrder(arr, md5(pwd));
await payreturnOrder(arr, '', isOnline.value);
await payreturnOrder(arr, md5(pwd), isOnline.value);
// await payreturnOrder(arr, '', isOnline.value);
changechecked.value = false;
recharge.value = false;
itemboxshow.value = false;
@ -418,8 +432,8 @@ const payreturnOrderclick = lodash.debounce(
ElMessage.error("退款金额不能为0");
return false;
}
// takeFoodCodeRef.value.show();
passwordSuccess()
takeFoodCodeRef.value.show();
// passwordSuccess()
},
500,
{ leading: true, trailing: false }
@ -463,7 +477,9 @@ const print = lodash.throttle(
shop_name: store.userInfo.shopName,
loginAccount: store.userInfo.loginAccount,
carts: [],
amount: printLabelOrder.value.orderAmount,
amount: formatDecimal(printLabelOrder.value.orderAmount),
discountAmount: printLabelOrder.value.discountAmount > 0 ? formatDecimal(printLabelOrder.value.orderAmount - printLabelOrder.value.discountAmount) : formatDecimal(printLabelOrder.value.orderAmount),
discount: printLabelOrder.value.discountRatio ? formatDecimal(printLabelOrder.value.discountRatio * 10, 1, true) : 0,
remark: printLabelOrder.value.remark,
orderInfo: printLabelOrder.value,
outNumber: printLabelOrder.value.outNumber,
@ -559,7 +575,7 @@ const printLabelOrder = ref("");
const emititemboxshow = async (e) => {
//
// console.log('emititemboxshow', e);
console.log('emititemboxshow', e);
printLabelOrder.value = e;
loadingboxshow.value = true;

View File

@ -15,7 +15,7 @@
</el-icon>
<span class="t">{{ status[props.tableInfo.status] }}</span>
</div>
<div class="cart" v-if="props.tableInfo.status == 'using'">
<div class="cart" v-loading="payLoading" v-if="props.tableInfo.status == 'using'">
<div class="cart_list">
<div class="item" v-for="item in cartList" :key="item.id">
<div class="top">
@ -32,10 +32,10 @@
</div>
<div class="btn_container">
<div class="btn_wrap">
<el-button type="success" style="width: 100%;" @click="toOrderMeal(1)">加菜</el-button>
<el-button type="success" style="width: 100%;" @click="toOrderMeal(1)">加菜/管理</el-button>
</div>
<div class="btn_wrap">
<el-button type="primary" :loading="payLoading" style="width: 100%;" @click="showPayHandle">结算({{
<el-button type="primary" style="width: 100%;" @click="showPayHandle">结算({{
orderInfo.orderAmount || 0 }})</el-button>
</div>
</div>
@ -111,24 +111,25 @@ function showPayHandle() {
//
async function getOrderDetail() {
try {
if (!props.tableInfo.status == 'using') return
payLoading.value = true
const res = await orderDetail({
shopId: store.userInfo.shopId,
id: props.tableInfo.orderId
})
payLoading.value = false
orderInfo.value = res
if (props.tableInfo.orderId) {
payLoading.value = true
const res = await orderDetail({
shopId: store.userInfo.shopId,
id: props.tableInfo.orderId
})
payLoading.value = false
orderInfo.value = res
cartList.value = res.detailList.map(item => {
let obj = {
name: item.productName,
number: item.num,
salePrice: item.price,
skuName: item.productSkuName
}
return obj
})
cartList.value = res.detailList.map(item => {
let obj = {
name: item.productName,
number: item.num,
salePrice: item.price,
skuName: item.productSkuName
}
return obj
})
}
} catch (error) {
payLoading.value = false
console.log(error);