优化订单小票打印
This commit is contained in:
@@ -184,12 +184,19 @@ export function commOrderPrintData(orderInfo) {
|
||||
if (orderInfo.isGuest) {
|
||||
// 如果是客看单,只展示当前下单的菜品
|
||||
orderInfo.detailMap[0].map((item) => {
|
||||
let price = 0
|
||||
if (item.discountSaleAmount > 0) {
|
||||
price = item.discountSaleAmount
|
||||
} else {
|
||||
price = item.price
|
||||
}
|
||||
|
||||
data.carts.push({
|
||||
categoryId: item.categoryId,
|
||||
name: item.productName,
|
||||
number: item.num,
|
||||
name: item.isGift === 1 ? `[赠]${item.productName}` : item.productName,
|
||||
number: item.num - item.returnNum,
|
||||
skuName: item.skuName,
|
||||
salePrice: formatDecimal(+item.price),
|
||||
salePrice: formatDecimal(+price),
|
||||
totalAmount: formatDecimal(+item.payAmount),
|
||||
proGroupInfo: item.proGroupInfo
|
||||
? item.proGroupInfo.map((item) => item.goods).flat()
|
||||
@@ -198,13 +205,19 @@ export function commOrderPrintData(orderInfo) {
|
||||
});
|
||||
} else {
|
||||
orderInfo.cartList.map((item) => {
|
||||
let price = 0
|
||||
if (item.discountSaleAmount > 0) {
|
||||
price = item.discountSaleAmount
|
||||
} else {
|
||||
price = item.price
|
||||
}
|
||||
data.carts.push({
|
||||
categoryId: item.categoryId,
|
||||
name: item.productName,
|
||||
number: item.num,
|
||||
name: item.isGift === 1 ? `[赠]${item.productName}` : item.productName,
|
||||
number: item.num - item.returnNum,
|
||||
skuName: item.skuName,
|
||||
salePrice: formatDecimal(+item.price),
|
||||
totalAmount: formatDecimal(+item.payAmount),
|
||||
salePrice: formatDecimal(+price),
|
||||
totalAmount: formatDecimal((item.num - item.returnNum) * price),
|
||||
proGroupInfo: item.proGroupInfo
|
||||
? item.proGroupInfo.map((item) => item.goods).flat()
|
||||
: "",
|
||||
@@ -212,23 +225,41 @@ export function commOrderPrintData(orderInfo) {
|
||||
});
|
||||
}
|
||||
|
||||
if (orderInfo.seatAmount > 0) {
|
||||
data.carts.push({
|
||||
categoryId: '',
|
||||
name: '餐位费',
|
||||
number: orderInfo.seatNum,
|
||||
skuName: '',
|
||||
salePrice: formatDecimal(orderInfo.seatAmount / orderInfo.seatNum),
|
||||
totalAmount: orderInfo.seatAmount,
|
||||
proGroupInfo: "",
|
||||
})
|
||||
if (orderInfo.dineMode == 'dine-in') {
|
||||
if (orderInfo.seatAmount > 0 && orderInfo.isGuest && orderInfo.placeNum == 1 && !orderInfo.isRefundDish) {
|
||||
data.carts.push({
|
||||
categoryId: '',
|
||||
name: '餐位费',
|
||||
number: orderInfo.seatNum,
|
||||
skuName: '',
|
||||
salePrice: formatDecimal(orderInfo.seatAmount / orderInfo.seatNum),
|
||||
totalAmount: orderInfo.seatAmount,
|
||||
proGroupInfo: "",
|
||||
})
|
||||
}
|
||||
|
||||
if (orderInfo.seatAmount > 0 && !orderInfo.isGuest && !orderInfo.isRefundDish) {
|
||||
data.carts.push({
|
||||
categoryId: '',
|
||||
name: '餐位费',
|
||||
number: orderInfo.seatNum,
|
||||
skuName: '',
|
||||
salePrice: formatDecimal(orderInfo.seatAmount / orderInfo.seatNum),
|
||||
totalAmount: orderInfo.seatAmount,
|
||||
proGroupInfo: "",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (orderInfo.packFee > 0) {
|
||||
if (orderInfo.packFee > 0 && !orderInfo.isRefundDish) {
|
||||
let packNum = 0;
|
||||
orderInfo.cartList.forEach(item => {
|
||||
packNum += item.packNumber
|
||||
})
|
||||
data.carts.push({
|
||||
categoryId: '',
|
||||
name: '打包费',
|
||||
number: '',
|
||||
number: packNum,
|
||||
skuName: '',
|
||||
salePrice: '',
|
||||
totalAmount: formatDecimal(orderInfo.packFee),
|
||||
@@ -236,6 +267,7 @@ export function commOrderPrintData(orderInfo) {
|
||||
})
|
||||
}
|
||||
|
||||
console.log('最终组合打印数据===', data);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user