优化小票打印新增餐位费和打包费

This commit is contained in:
gyq
2026-01-14 09:39:37 +08:00
parent a60acb4f1a
commit 217cabcb96
7 changed files with 225 additions and 116 deletions

View File

@@ -45,9 +45,9 @@
<div>{{ item.productName }}</div>
<div v-if="item.skuName">规格{{ item.skuName }}</div>
</div>
<div class="item">{{ formatDecimal(item.price) }}</div>
<div class="item">{{ formatDecimal(+item.price) }}</div>
<div class="item">{{ item.num }}</div>
<div class="item">{{ formatDecimal(item.payAmount) }}</div>
<div class="item">{{ formatDecimal(+item.payAmount) }}</div>
</div>
</div>
</div>
@@ -60,9 +60,7 @@
</div>
<div class="row between">
<span>折扣</span>
<span>-{{ orderInfo.status == "unpaid"
? "0.00"
: formatDecimal(orderInfo.originAmount - orderInfo.orderAmount) }}
<span>-{{ formatDecimal(+orderInfo.discountAmount) }}
</span>
</div>
<div class="line"></div>
@@ -92,6 +90,7 @@
</template>
<script setup>
import _ from 'lodash'
import { ref } from "vue";
import { usePrint } from "@/store/print.js";
import { useUser } from "@/store/user.js";
@@ -119,7 +118,7 @@ async function printHandle(type) {
case "normal":
// 打印订单小票
if (printStore.deviceNoteList.length) {
printStore.pushReceiptData(commOrderPrintData(orderInfo.value));
printStore.pushReceiptData(commOrderPrintData(originOrderInfo.value));
} else {
await orderPrint({
id: orderInfo.value.id,
@@ -130,7 +129,7 @@ async function printHandle(type) {
break;
case "label":
// 打印标签小票
printStore.labelPrint(commOrderPrintData(orderInfo.value));
printStore.labelPrint(commOrderPrintData(originOrderInfo.value));
break;
default:
break;
@@ -143,11 +142,38 @@ async function printHandle(type) {
}, 2500);
}
const originOrderInfo = ref('')
async function show(row) {
try {
showDrawer.value = true;
loading.value = true;
orderInfo.value = await getOrderByIdAjax(row.id);
originOrderInfo.value = await getOrderByIdAjax(row.id);
orderInfo.value = _.cloneDeep(originOrderInfo.value)
if (orderInfo.value.seatAmount > 0) {
orderInfo.value.cartList.push({
categoryId: '',
productName: '餐位费',
num: orderInfo.value.seatNum,
skuName: '',
price: formatDecimal(orderInfo.value.seatAmount / orderInfo.value.seatNum),
payAmount: orderInfo.value.seatAmount,
proGroupInfo: "",
})
}
if (orderInfo.value.packFee > 0) {
orderInfo.value.cartList.push({
categoryId: '',
productName: '打包费',
num: '',
skuName: '',
price: '',
payAmount: orderInfo.value.packFee,
proGroupInfo: "",
})
}
} catch (error) {
console.log(error);
}