优化小票打印
This commit is contained in:
@@ -68,12 +68,12 @@
|
||||
</el-icon>
|
||||
<el-text class="t">删除</el-text>
|
||||
</div>
|
||||
<!-- <div class="item" @click="props.item.id && emit('pending', props.item)">
|
||||
<div class="item" @click="pendingOrderHandle">
|
||||
<el-icon class="icon">
|
||||
<Sell />
|
||||
</el-icon>
|
||||
<el-text class="t">挂单</el-text>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="item" @click="tableMergingRef.show()">
|
||||
<el-icon class="icon">
|
||||
<EditPen />
|
||||
@@ -143,12 +143,12 @@
|
||||
</el-icon>
|
||||
<el-text class="t">退菜</el-text>
|
||||
</div>
|
||||
<!-- <div class="item" @click="props.item.id && emit('pending', props.item)">
|
||||
<el-icon class="icon">
|
||||
<Sell />
|
||||
</el-icon>
|
||||
<el-text class="t">挂单</el-text>
|
||||
</div> -->
|
||||
<div class="item" @click="pendingOrderHandle">
|
||||
<el-icon class="icon">
|
||||
<Sell />
|
||||
</el-icon>
|
||||
<el-text class="t">挂单</el-text>
|
||||
</div>
|
||||
<div class="item" @click="tableMergingRef.show()">
|
||||
<el-icon class="icon">
|
||||
<EditPen />
|
||||
@@ -254,14 +254,13 @@ import { ElMessage } from 'element-plus'
|
||||
import takeFoodCode from '@/components/takeFoodCode.vue'
|
||||
import TableMerging from './tableMerging.vue'
|
||||
import skuModal from '@/components/skuModal.vue'
|
||||
import { useShop } from '@/store/shop.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
import { inputFilterFloat, formatDecimal } from '@/utils/index.js'
|
||||
import { updatePrice, orderPrint } from '@/api/product.js'
|
||||
import { refundOrder } from '@/api/order.js'
|
||||
import { useSocket } from '@/store/socket.js'
|
||||
|
||||
const shopStore = useShop()
|
||||
const goodsStore = useGoods()
|
||||
const socket = useSocket()
|
||||
|
||||
const tableMergingRef = ref(null)
|
||||
|
||||
@@ -282,6 +281,18 @@ const returnForm = ref({
|
||||
num: 1
|
||||
})
|
||||
|
||||
// 挂单
|
||||
function pendingOrderHandle() {
|
||||
let cart = goodsStore.cartList;
|
||||
let order = goodsStore.orderList;
|
||||
if (cart.length || order.length) {
|
||||
goodsStore.pendingCart()
|
||||
goodsStore.successClearCart();
|
||||
socket.cartInit();
|
||||
|
||||
ElMessage.success('挂单成功')
|
||||
}
|
||||
}
|
||||
|
||||
// 退菜
|
||||
async function returnOrderItemHandle() {
|
||||
@@ -348,18 +359,20 @@ function packHandle() {
|
||||
|
||||
// 赠送打包操作
|
||||
function giftPackHandle(key) {
|
||||
if (!goodsStore.cartList[goodsStore.cartActiveIndex].id) return
|
||||
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
|
||||
if (item && item.id) {
|
||||
if (key == 'is_gift' && goodsStore.cartList[goodsStore.cartActiveIndex] == 0) {
|
||||
goodsStore.cartList[goodsStore.cartActiveIndex].discount_sale_amount = 0
|
||||
}
|
||||
|
||||
if (key == 'is_gift' && goodsStore.cartList[goodsStore.cartActiveIndex] == 0) {
|
||||
goodsStore.cartList[goodsStore.cartActiveIndex].discount_sale_amount = 0
|
||||
if (goodsStore.cartList[goodsStore.cartActiveIndex][key] == 0) {
|
||||
goodsStore.cartList[goodsStore.cartActiveIndex][key] = 1
|
||||
} else {
|
||||
goodsStore.cartList[goodsStore.cartActiveIndex][key] = 0
|
||||
}
|
||||
goodsStore.operateCart({ ...goodsStore.cartList[goodsStore.cartActiveIndex] }, 'edit')
|
||||
}
|
||||
|
||||
if (goodsStore.cartList[goodsStore.cartActiveIndex][key] == 0) {
|
||||
goodsStore.cartList[goodsStore.cartActiveIndex][key] = 1
|
||||
} else {
|
||||
goodsStore.cartList[goodsStore.cartActiveIndex][key] = 0
|
||||
}
|
||||
goodsStore.operateCart({ ...goodsStore.cartList[goodsStore.cartActiveIndex] }, 'edit')
|
||||
}
|
||||
|
||||
// 显示直接修改数量
|
||||
@@ -467,9 +480,10 @@ const noteList = ref([
|
||||
// 显示
|
||||
function showDiscountModalHandle() {
|
||||
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
|
||||
if ((item && !item.id) || item.is_temporary || item.is_gift) return
|
||||
// 存在商品并且不能为临时菜
|
||||
showDiscountModal.value = true
|
||||
if ((item && item.id) && (!item.is_temporary || !item.is_gift)) {
|
||||
// 存在商品并且不能为临时菜
|
||||
showDiscountModal.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤价格输入
|
||||
@@ -519,24 +533,10 @@ function discountFormSubmit() {
|
||||
}
|
||||
/**单品打折 end */
|
||||
|
||||
/**免厨打印 start */
|
||||
async function kitchenPrint() {
|
||||
try {
|
||||
const res = await orderPrint({
|
||||
isPrint: props.item.isPrint ? 0 : 1,
|
||||
shopId: props.item.shopId,
|
||||
cartId: props.item.id
|
||||
})
|
||||
emit('confirm', { isTemporary: true })
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
/**免厨打印 end */
|
||||
|
||||
// 删除
|
||||
function deleteHandle() {
|
||||
if (goodsStore.cartList[goodsStore.cartActiveIndex].id) {
|
||||
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
|
||||
if (item && item.id) {
|
||||
goodsStore.deleteCartItem()
|
||||
}
|
||||
}
|
||||
@@ -605,7 +605,7 @@ function packFormSubmit() {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
gap: 8px;
|
||||
|
||||
.item {
|
||||
width: 70px;
|
||||
|
||||
Reference in New Issue
Block a user