优化小票打印
This commit is contained in:
parent
cfe9f7bb36
commit
745b8675ea
|
|
@ -1,4 +1,5 @@
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import dayjs from "dayjs";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { productPage, categoryList } from "@/api/product_new.js";
|
import { productPage, categoryList } from "@/api/product_new.js";
|
||||||
import { historyOrder } from "@/api/order.js";
|
import { historyOrder } from "@/api/order.js";
|
||||||
|
|
@ -6,6 +7,7 @@ import { useUser } from "@/store/user.js";
|
||||||
import { useSocket } from "@/store/socket.js";
|
import { useSocket } from "@/store/socket.js";
|
||||||
import useStorage from "@/utils/useStorage.js";
|
import useStorage from "@/utils/useStorage.js";
|
||||||
import { formatDecimal } from "@/utils/index.js";
|
import { formatDecimal } from "@/utils/index.js";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
|
||||||
// 商品store + 购物车store
|
// 商品store + 购物车store
|
||||||
export const useGoods = defineStore("goods", {
|
export const useGoods = defineStore("goods", {
|
||||||
|
|
@ -45,8 +47,58 @@ export const useGoods = defineStore("goods", {
|
||||||
orderListInfo: "", // 历史订单信息
|
orderListInfo: "", // 历史订单信息
|
||||||
cartType: "cart", // cart order
|
cartType: "cart", // cart order
|
||||||
cartOrderItem: "",
|
cartOrderItem: "",
|
||||||
|
pendingList: useStorage.get("pendingList") || [],
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
|
// 恢复挂单
|
||||||
|
async recoverPending(item) {
|
||||||
|
let socket = useSocket();
|
||||||
|
|
||||||
|
if (this.cartList.length || this.orderList.length) {
|
||||||
|
this.pendingCart();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.orderId) {
|
||||||
|
await this.historyOrderAjax(item.tableCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
let pendingList = useStorage.get("pendingList");
|
||||||
|
let index = pendingList.findIndex(
|
||||||
|
(val) => val.tableCode == item.tableCode
|
||||||
|
);
|
||||||
|
|
||||||
|
pendingList.splice(index, 1);
|
||||||
|
useStorage.set("pendingList", pendingList);
|
||||||
|
this.pendingList = useStorage.get("pendingList");
|
||||||
|
useStorage.set("tableCode", item.tableCode);
|
||||||
|
socket.cartInit();
|
||||||
|
},
|
||||||
|
// 开始挂单
|
||||||
|
pendingCart() {
|
||||||
|
let cart = this.cartList;
|
||||||
|
let order = this.orderList;
|
||||||
|
|
||||||
|
if (cart.length || order.length) {
|
||||||
|
let pendingList = useStorage.get("pendingList") || [];
|
||||||
|
pendingList.push({
|
||||||
|
tableCode: cart[0].table_code || this.orderListInfo.tableCode,
|
||||||
|
productName: [
|
||||||
|
...cart.map((item) => item.product_name),
|
||||||
|
...order
|
||||||
|
.map((item) => item.goods)
|
||||||
|
.flat()
|
||||||
|
.map((item) => item.product_name),
|
||||||
|
].join("、"),
|
||||||
|
orderId: order.length && this.orderListInfo.id,
|
||||||
|
totalAmount: this.cartInfo.totalAmount,
|
||||||
|
pendingAt: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||||
|
});
|
||||||
|
|
||||||
|
useStorage.set("pendingList", pendingList);
|
||||||
|
this.pendingList = useStorage.get("pendingList");
|
||||||
|
useStorage.del("tableCode");
|
||||||
|
}
|
||||||
|
},
|
||||||
// 选中订单中的商品
|
// 选中订单中的商品
|
||||||
selectOrderItem(index = null, i) {
|
selectOrderItem(index = null, i) {
|
||||||
this.orderList.map((item) => {
|
this.orderList.map((item) => {
|
||||||
|
|
@ -220,7 +272,12 @@ export const useGoods = defineStore("goods", {
|
||||||
async getCartList(arr) {
|
async getCartList(arr) {
|
||||||
const store = useUser();
|
const store = useUser();
|
||||||
|
|
||||||
|
let numCount = 0;
|
||||||
|
let packCount = 0;
|
||||||
|
|
||||||
arr.map((val, index) => {
|
arr.map((val, index) => {
|
||||||
|
numCount += +val.number;
|
||||||
|
packCount += +val.pack_number;
|
||||||
val = this.completeGoodsInfo(val);
|
val = this.completeGoodsInfo(val);
|
||||||
val.active = false;
|
val.active = false;
|
||||||
if (!this.isCartInit && index == 0) {
|
if (!this.isCartInit && index == 0) {
|
||||||
|
|
@ -228,6 +285,12 @@ export const useGoods = defineStore("goods", {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (packCount > 0 && packCount == numCount) {
|
||||||
|
this.allSelected = 1;
|
||||||
|
} else {
|
||||||
|
this.allSelected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
this.cartList = arr;
|
this.cartList = arr;
|
||||||
this.isCartInit = true;
|
this.isCartInit = true;
|
||||||
|
|
||||||
|
|
@ -267,7 +330,7 @@ export const useGoods = defineStore("goods", {
|
||||||
product_id: params.productId || "",
|
product_id: params.productId || "",
|
||||||
sku_id: params.id || "",
|
sku_id: params.id || "",
|
||||||
number: params.number || 1,
|
number: params.number || 1,
|
||||||
pack_number: params.is_pack || 0,
|
pack_number: this.allSelected ? params.number : 0,
|
||||||
is_gift: params.is_gift || 0,
|
is_gift: params.is_gift || 0,
|
||||||
is_temporary: params.is_temporary || 0,
|
is_temporary: params.is_temporary || 0,
|
||||||
discount_sale_amount: params.discount_sale_amount || 0,
|
discount_sale_amount: params.discount_sale_amount || 0,
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,10 @@ export const useSocket = defineStore("socket", {
|
||||||
// 清空购物车
|
// 清空购物车
|
||||||
goodsStore.successClearCart();
|
goodsStore.successClearCart();
|
||||||
break;
|
break;
|
||||||
|
case "batch":
|
||||||
|
// 打包
|
||||||
|
this.cartInit();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -127,37 +131,12 @@ export const useSocket = defineStore("socket", {
|
||||||
}
|
}
|
||||||
} else if (data.data_type == "order") {
|
} else if (data.data_type == "order") {
|
||||||
// 收到订单消息,打印订单小票
|
// 收到订单消息,打印订单小票
|
||||||
// this.orderList.push(data.data);
|
if (!this.orderList.some((el) => el == data.data)) {
|
||||||
// this.startPrintInterval();
|
// 防止重复打印
|
||||||
|
this.orderList.push(data.data);
|
||||||
|
this.startPrintInterval();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (data.data_type == "cart" && data.operate_type == "init") {
|
|
||||||
// // 购物车消息
|
|
||||||
// goodsStore.getCartList(data.data);
|
|
||||||
// } else if (data.data_type == "order") {
|
|
||||||
// // 接收订单消息,打印小票
|
|
||||||
// if (this.log) console.log("接收消息", data);
|
|
||||||
// this.ws.send(
|
|
||||||
// JSON.stringify({
|
|
||||||
// type: "send",
|
|
||||||
// orderNo: data.orderInfo.orderNo,
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
// // 接收订单消息,打印小票
|
|
||||||
// // printBill(data)
|
|
||||||
// // 打印标签小票
|
|
||||||
// if (!this.orderList.some((el) => el == data.orderInfo.orderNo)) {
|
|
||||||
// // console.log("打印", data);
|
|
||||||
// printStore.labelPrint(data);
|
|
||||||
// printStore.pushReceiptData(data);
|
|
||||||
// this.orderList.push(data.orderInfo.orderNo);
|
|
||||||
// if (this.orderList.length > 30) {
|
|
||||||
// this.orderList.splice(0, 1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else if (data.data_type == "heartbeat") {
|
|
||||||
// if (this.log) console.log("接收心跳");
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ws.addEventListener("error", () => {
|
this.ws.addEventListener("error", () => {
|
||||||
|
|
@ -190,14 +169,15 @@ export const useSocket = defineStore("socket", {
|
||||||
const printStore = usePrint();
|
const printStore = usePrint();
|
||||||
if (this.orderListTimer !== null) return;
|
if (this.orderListTimer !== null) return;
|
||||||
this.orderListTimer = setInterval(async () => {
|
this.orderListTimer = setInterval(async () => {
|
||||||
console.log("隔2秒执行===", this.orderList);
|
|
||||||
try {
|
try {
|
||||||
if (!this.orderList.length) {
|
if (!this.orderList.length) {
|
||||||
clearInterval(this.orderListTimer);
|
clearInterval(this.orderListTimer);
|
||||||
this.orderListTimer = null;
|
this.orderListTimer = null;
|
||||||
} else {
|
} else {
|
||||||
const orderInfo = await getOrderByIdAjax(this.orderList[0]);
|
const orderInfo = await getOrderByIdAjax(this.orderList[0]);
|
||||||
|
if (orderInfo.status == "done" && orderInfo.platformType != "PC") {
|
||||||
printStore.pushReceiptData(commOrderPrintData(orderInfo));
|
printStore.pushReceiptData(commOrderPrintData(orderInfo));
|
||||||
|
}
|
||||||
this.orderList.splice(0, 1);
|
this.orderList.splice(0, 1);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -68,12 +68,12 @@
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-text class="t">删除</el-text>
|
<el-text class="t">删除</el-text>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="item" @click="props.item.id && emit('pending', props.item)">
|
<div class="item" @click="pendingOrderHandle">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<Sell />
|
<Sell />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-text class="t">挂单</el-text>
|
<el-text class="t">挂单</el-text>
|
||||||
</div> -->
|
</div>
|
||||||
<div class="item" @click="tableMergingRef.show()">
|
<div class="item" @click="tableMergingRef.show()">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<EditPen />
|
<EditPen />
|
||||||
|
|
@ -143,12 +143,12 @@
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-text class="t">退菜</el-text>
|
<el-text class="t">退菜</el-text>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="item" @click="props.item.id && emit('pending', props.item)">
|
<div class="item" @click="pendingOrderHandle">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<Sell />
|
<Sell />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-text class="t">挂单</el-text>
|
<el-text class="t">挂单</el-text>
|
||||||
</div> -->
|
</div>
|
||||||
<div class="item" @click="tableMergingRef.show()">
|
<div class="item" @click="tableMergingRef.show()">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<EditPen />
|
<EditPen />
|
||||||
|
|
@ -254,14 +254,13 @@ import { ElMessage } from 'element-plus'
|
||||||
import takeFoodCode from '@/components/takeFoodCode.vue'
|
import takeFoodCode from '@/components/takeFoodCode.vue'
|
||||||
import TableMerging from './tableMerging.vue'
|
import TableMerging from './tableMerging.vue'
|
||||||
import skuModal from '@/components/skuModal.vue'
|
import skuModal from '@/components/skuModal.vue'
|
||||||
import { useShop } from '@/store/shop.js'
|
|
||||||
import { useGoods } from '@/store/goods.js'
|
import { useGoods } from '@/store/goods.js'
|
||||||
import { inputFilterFloat, formatDecimal } from '@/utils/index.js'
|
import { inputFilterFloat, formatDecimal } from '@/utils/index.js'
|
||||||
import { updatePrice, orderPrint } from '@/api/product.js'
|
|
||||||
import { refundOrder } from '@/api/order.js'
|
import { refundOrder } from '@/api/order.js'
|
||||||
|
import { useSocket } from '@/store/socket.js'
|
||||||
|
|
||||||
const shopStore = useShop()
|
|
||||||
const goodsStore = useGoods()
|
const goodsStore = useGoods()
|
||||||
|
const socket = useSocket()
|
||||||
|
|
||||||
const tableMergingRef = ref(null)
|
const tableMergingRef = ref(null)
|
||||||
|
|
||||||
|
|
@ -282,6 +281,18 @@ const returnForm = ref({
|
||||||
num: 1
|
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() {
|
async function returnOrderItemHandle() {
|
||||||
|
|
@ -348,8 +359,8 @@ function packHandle() {
|
||||||
|
|
||||||
// 赠送打包操作
|
// 赠送打包操作
|
||||||
function giftPackHandle(key) {
|
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) {
|
if (key == 'is_gift' && goodsStore.cartList[goodsStore.cartActiveIndex] == 0) {
|
||||||
goodsStore.cartList[goodsStore.cartActiveIndex].discount_sale_amount = 0
|
goodsStore.cartList[goodsStore.cartActiveIndex].discount_sale_amount = 0
|
||||||
}
|
}
|
||||||
|
|
@ -360,6 +371,8 @@ function giftPackHandle(key) {
|
||||||
goodsStore.cartList[goodsStore.cartActiveIndex][key] = 0
|
goodsStore.cartList[goodsStore.cartActiveIndex][key] = 0
|
||||||
}
|
}
|
||||||
goodsStore.operateCart({ ...goodsStore.cartList[goodsStore.cartActiveIndex] }, 'edit')
|
goodsStore.operateCart({ ...goodsStore.cartList[goodsStore.cartActiveIndex] }, 'edit')
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示直接修改数量
|
// 显示直接修改数量
|
||||||
|
|
@ -467,9 +480,10 @@ const noteList = ref([
|
||||||
// 显示
|
// 显示
|
||||||
function showDiscountModalHandle() {
|
function showDiscountModalHandle() {
|
||||||
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
|
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
|
||||||
if ((item && !item.id) || item.is_temporary || item.is_gift) return
|
if ((item && item.id) && (!item.is_temporary || !item.is_gift)) {
|
||||||
// 存在商品并且不能为临时菜
|
// 存在商品并且不能为临时菜
|
||||||
showDiscountModal.value = true
|
showDiscountModal.value = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤价格输入
|
// 过滤价格输入
|
||||||
|
|
@ -519,24 +533,10 @@ function discountFormSubmit() {
|
||||||
}
|
}
|
||||||
/**单品打折 end */
|
/**单品打折 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() {
|
function deleteHandle() {
|
||||||
if (goodsStore.cartList[goodsStore.cartActiveIndex].id) {
|
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
|
||||||
|
if (item && item.id) {
|
||||||
goodsStore.deleteCartItem()
|
goodsStore.deleteCartItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -605,7 +605,7 @@ function packFormSubmit() {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 8px;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
width: 70px;
|
width: 70px;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog title="恢复挂起的订单" width="800" v-model="dialogVisible">
|
<el-dialog title="恢复挂起的订单" width="800" v-model="dialogVisible">
|
||||||
<div class="pending_carts">
|
<div class="pending_carts">
|
||||||
<div class="item" v-for="(item, index) in cartList" :key="index" @click="select(item)">
|
<div class="item" v-for="(item, index) in goodsStore.pendingList" :key="index" @click="select(item)">
|
||||||
<div class="time">
|
<div class="time">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<Clock />
|
<Clock />
|
||||||
|
|
@ -9,12 +9,12 @@
|
||||||
<span>{{ dayjs(item.pendingAt).format('HH:mm') }}</span>
|
<span>{{ dayjs(item.pendingAt).format('HH:mm') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<span class="name">{{ item.productName }}</span>
|
<span class="name">【{{ item.tableCode }}】{{ item.productName }}</span>
|
||||||
<span class="p">¥{{ item.totalAmount }}</span>
|
<span class="p">¥{{ formatDecimal(item.totalAmount) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="empty">
|
<div class="empty">
|
||||||
<el-empty description="暂无挂单" v-if="!cartList.length" />
|
<el-empty description="暂无挂单" v-if="!goodsStore.pendingList.length" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -23,40 +23,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { dayjs } from 'element-plus'
|
import { dayjs } from 'element-plus'
|
||||||
import { getCartList } from "@/api/product";
|
import { useGoods } from '@/store/goods.js'
|
||||||
import { useUser } from "@/store/user"
|
import { formatDecimal } from '@/utils/index.js'
|
||||||
|
|
||||||
const emit = defineEmits(['select'])
|
const goodsStore = useGoods()
|
||||||
|
|
||||||
const store = useUser()
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
|
|
||||||
const loading = ref(false)
|
|
||||||
const cartList = ref([])
|
|
||||||
|
|
||||||
// 恢复挂单
|
// 恢复挂单
|
||||||
function select(item) {
|
async function select(item) {
|
||||||
emit('select', item)
|
await goodsStore.recoverPending(item)
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
getCartListAjax()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取挂起购物车列表
|
|
||||||
async function getCartListAjax() {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
const res = await getCartList({
|
|
||||||
shopId: store.userInfo.shopId
|
|
||||||
})
|
|
||||||
cartList.value = res
|
|
||||||
loading.value = false
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<!-- 合并/转桌 -->
|
<!-- 合并/转桌 -->
|
||||||
<template>
|
<template>
|
||||||
<el-dialog title="转桌/并桌" width="700px" v-model="visible" @closed="onClose" top="10vh">
|
<el-dialog title="转桌/并桌" width="700px" v-model="visible" @closed="onClose" top="3vh">
|
||||||
<div class="scroll_y">
|
<div class="scroll_y">
|
||||||
<el-form :model="form" ref="formRef" :rules="rules" label-position="top">
|
<el-form :model="form" ref="formRef" :rules="rules" label-position="top">
|
||||||
<el-form-item label="转入台桌" prop="targetTableId">
|
<el-form-item label="转入台桌" prop="targetTableId">
|
||||||
|
|
@ -15,15 +15,24 @@
|
||||||
<el-radio :value="true" border>并桌(并台会将全部购物车商品转入)</el-radio>
|
<el-radio :value="true" border>并桌(并台会将全部购物车商品转入)</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="转入商品" prop="cartIds" v-if="!form.isFull">
|
<el-form-item label="购物车商品" v-if="!form.isFull">
|
||||||
<div v-for="item in props.data" style="width: 100%;">
|
<el-table ref="cartTableRefs" :data="goodsStore.cartList" border stripe>
|
||||||
<div>{{ `第${item.placeNum}次下单` }}</div>
|
|
||||||
<el-table ref="tableRefs" :data="item.info" border>
|
|
||||||
<el-table-column type="selection" align="center" width="50px"></el-table-column>
|
<el-table-column type="selection" align="center" width="50px"></el-table-column>
|
||||||
<el-table-column label="名称" prop="name"></el-table-column>
|
<el-table-column label="名称" prop="product_name"></el-table-column>
|
||||||
<el-table-column label="数量" prop="number"></el-table-column>
|
<el-table-column label="数量" prop="number"></el-table-column>
|
||||||
<el-table-column label="规格" prop="skuName"></el-table-column>
|
<el-table-column label="规格" prop="sku_name"></el-table-column>
|
||||||
<el-table-column label="价格" prop="salePrice"></el-table-column>
|
<el-table-column label="价格" prop="lowPrice"></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="已下单商品" prop="cartIds" v-if="!form.isFull">
|
||||||
|
<div v-for="item in goodsStore.orderList" style="width: 100%;">
|
||||||
|
<div>{{ `第${item.orderNum}次下单` }}</div>
|
||||||
|
<el-table ref="orderTableRefs" :data="item.goods" border stripe>
|
||||||
|
<el-table-column type="selection" align="center" width="50px"></el-table-column>
|
||||||
|
<el-table-column label="名称" prop="product_name"></el-table-column>
|
||||||
|
<el-table-column label="数量" prop="number"></el-table-column>
|
||||||
|
<el-table-column label="规格" prop="sku_name"></el-table-column>
|
||||||
|
<el-table-column label="价格" prop="lowPrice"></el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -41,29 +50,20 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { shopTable } from '@/api/account.js'
|
|
||||||
import { queryShopTable } from '@/api/table.js'
|
|
||||||
import { orderSwitcht } from '@/api/product.js'
|
import { orderSwitcht } from '@/api/product.js'
|
||||||
|
import { useGoods } from '@/store/goods.js'
|
||||||
import { useUser } from "@/store/user.js"
|
import { useUser } from "@/store/user.js"
|
||||||
import { useGlobal } from '@/store/global.js'
|
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { shopTable } from "@/api/account.js";
|
||||||
const store = useUser()
|
|
||||||
const global = useGlobal()
|
|
||||||
|
|
||||||
const visible = ref(false)
|
|
||||||
|
|
||||||
const props = reactive({
|
|
||||||
data: []
|
|
||||||
})
|
|
||||||
|
|
||||||
const emits = defineEmits(['success'])
|
const emits = defineEmits(['success'])
|
||||||
|
|
||||||
const tableRefs = ref([])
|
const store = useUser()
|
||||||
|
const goodsStore = useGoods()
|
||||||
const list = ref([])
|
const visible = ref(false)
|
||||||
|
const cartTableRefs = ref(null)
|
||||||
|
const orderTableRefs = ref(null)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const formRef = ref(null)
|
const formRef = ref(null)
|
||||||
const resetForm = ref({})
|
const resetForm = ref({})
|
||||||
|
|
@ -111,10 +111,8 @@ const tableList = ref([])
|
||||||
async function queryShopTableAjax() {
|
async function queryShopTableAjax() {
|
||||||
try {
|
try {
|
||||||
const res = await shopTable({
|
const res = await shopTable({
|
||||||
areaId: store.userInfo.shopId,
|
|
||||||
tableCode: '',
|
|
||||||
status: 'using',
|
status: 'using',
|
||||||
name: ''
|
isBind: true
|
||||||
})
|
})
|
||||||
tableList.value = res.records
|
tableList.value = res.records
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -144,7 +142,7 @@ function confirmHandle() {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
|
||||||
// 更新台桌信息
|
// 更新台桌信息
|
||||||
global.setOrderTable(tableList.value.find(item => item.qrcode == form.value.targetTableId))
|
// 在这里做点什么
|
||||||
|
|
||||||
visible.value = false
|
visible.value = false
|
||||||
|
|
||||||
|
|
@ -162,8 +160,7 @@ function onClose() {
|
||||||
formRef.value.resetFields()
|
formRef.value.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
function show(data) {
|
function show() {
|
||||||
props.data = data
|
|
||||||
visible.value = true
|
visible.value = true
|
||||||
queryShopTableAjax()
|
queryShopTableAjax()
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +178,7 @@ onMounted(() => {
|
||||||
$btmH: 50px;
|
$btmH: 50px;
|
||||||
|
|
||||||
.scroll_y {
|
.scroll_y {
|
||||||
height: 50vh;
|
height: 68vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-bottom: $btmH;
|
padding-bottom: $btmH;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<TakeawayBox />
|
<TakeawayBox />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-text class="t">({{ pendingCartNum }})</el-text>
|
<el-text class="t">({{ goodsStore.pendingList.length }})</el-text>
|
||||||
</div>
|
</div>
|
||||||
<div class="number" @click="SelectVipUserRef.show()">
|
<div class="number" @click="SelectVipUserRef.show()">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
|
|
@ -106,7 +106,8 @@
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="num-wrap">
|
<div class="num-wrap">
|
||||||
<div class="num_wrap_top">
|
<div class="num_wrap_top">
|
||||||
<div class="left" @click="allSelectedHandle" v-if="store.shopInfo.eatModel.includes('take-out')">
|
<div class="left" @click="allSelectedHandle"
|
||||||
|
v-if="store.shopInfo && store.shopInfo.eatModel.includes('take-out')">
|
||||||
<div class="selected">
|
<div class="selected">
|
||||||
<div class="selected_round" v-if="!goodsStore.allSelected"></div>
|
<div class="selected_round" v-if="!goodsStore.allSelected"></div>
|
||||||
<el-icon class="icon" v-else>
|
<el-icon class="icon" v-else>
|
||||||
|
|
@ -118,7 +119,7 @@
|
||||||
<div class="left" v-else></div>
|
<div class="left" v-else></div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
共<el-text>
|
共<el-text>
|
||||||
{{ goodsStore.cartInfo.total }}件
|
{{ formatDecimal(goodsStore.cartInfo.total, 2, true) }}件
|
||||||
</el-text>,¥{{ formatDecimal(goodsStore.cartInfo.totalAmount || 0) }}
|
</el-text>,¥{{ formatDecimal(goodsStore.cartInfo.totalAmount || 0) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -167,7 +168,7 @@
|
||||||
<!-- 快捷收银 -->
|
<!-- 快捷收银 -->
|
||||||
<fastCashier ref="fastCashierRef" type="0" />
|
<fastCashier ref="fastCashierRef" type="0" />
|
||||||
<!-- 挂起订单 -->
|
<!-- 挂起订单 -->
|
||||||
<pendingCartModal ref="pendingCartModalRef" @select="pendingCartHandle" />
|
<pendingCartModal ref="pendingCartModalRef" />
|
||||||
<!-- 检查版本升级 -->
|
<!-- 检查版本升级 -->
|
||||||
<updateDialog />
|
<updateDialog />
|
||||||
<!-- 选择会员 -->
|
<!-- 选择会员 -->
|
||||||
|
|
@ -195,13 +196,12 @@ import { createOrder } from '@/api/order.js'
|
||||||
import goods from "@/views/home/components/goods.vue";
|
import goods from "@/views/home/components/goods.vue";
|
||||||
import member from "@/views/member/index.vue";
|
import member from "@/views/member/index.vue";
|
||||||
import { useUser } from '@/store/user.js'
|
import { useUser } from '@/store/user.js'
|
||||||
|
import { useSocket } from '@/store/socket.js'
|
||||||
|
|
||||||
const SelectVipUserRef = ref(null)
|
const SelectVipUserRef = ref(null)
|
||||||
|
|
||||||
const goodsStore = useGoods()
|
const goodsStore = useGoods()
|
||||||
const global = useGlobal()
|
const socket = useSocket()
|
||||||
|
|
||||||
|
|
||||||
const membershow = ref(false);
|
const membershow = ref(false);
|
||||||
const store = useUser();
|
const store = useUser();
|
||||||
const remarkRef = ref(null);
|
const remarkRef = ref(null);
|
||||||
|
|
@ -320,18 +320,15 @@ const allSelectedHandle = async () => {
|
||||||
} else {
|
} else {
|
||||||
goodsStore.allSelected = 1
|
goodsStore.allSelected = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (goodsStore.cartList.length) {
|
||||||
|
goodsStore.operateCart({
|
||||||
|
table_code: goodsStore.cartList[0].table_code,
|
||||||
|
is_pack: goodsStore.allSelected
|
||||||
|
}, 'batch')
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 购物车选中
|
|
||||||
function selectCartItemHandle(index) {
|
|
||||||
goodsStore.selectCartItemHandle(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清除本地会员/台桌信息
|
|
||||||
function clearMember() {
|
|
||||||
global.setOrderMember({})
|
|
||||||
global.setOrderTable({})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示转桌/并桌
|
// 显示转桌/并桌
|
||||||
function showTableMerging() {
|
function showTableMerging() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer v-model="isShow" direction="rtl" size="60%">
|
<el-drawer v-model="isShow" direction="rtl" size="70%">
|
||||||
<template #header>
|
<template #header>
|
||||||
<h4>订单号:{{ item.orderNo }}</h4>
|
<h4>订单号:{{ item.orderNo }}</h4>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -24,9 +24,10 @@
|
||||||
<el-radio-button label="自定义" :value="3" />
|
<el-radio-button label="自定义" :value="3" />
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<div class="amount">
|
<div class="amount">
|
||||||
<el-input v-model="customAmount" v-if="refundType == 3" style="width: 250px;"
|
<el-input v-model="customAmount" v-if="refundType == 3" style="width: 370px;height: 42px;"
|
||||||
placeholder="请输入退款金额" @input="inputChange">
|
placeholder="请输入退款金额" @input="inputChange">
|
||||||
<template #prepend>¥</template>
|
<template #prepend>¥</template>
|
||||||
|
<template #append>最多可退¥{{ formatDecimal(item.payAmount - item.refundAmount, 2) }}</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
退款金额:¥{{ formatDecimal(refundType == 1 ? item.originAmount - item.refundAmount : amount) }}
|
退款金额:¥{{ formatDecimal(refundType == 1 ? item.originAmount - item.refundAmount : amount) }}
|
||||||
|
|
@ -97,10 +98,10 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
<div class="ipt">
|
<div class="ipt">
|
||||||
<el-input type="textarea" v-model="remark" placeholder="请输入退单原因" />
|
<el-input type="textarea" rows="4" v-model="remark" placeholder="请输入退单原因" />
|
||||||
</div>
|
</div>
|
||||||
<div class="remark_tag">
|
<div class="remark_tag">
|
||||||
<div class="item" v-for="(item, index) in remarkTagList" :key="index" @click="remark = item">
|
<div class="item" v-for="(item, index) in remarkTagList" :key="index" @click="addRmarkHandle(item)">
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -394,13 +395,22 @@ function refundTypeChange(val) {
|
||||||
function inputChange(n) {
|
function inputChange(n) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (n > item.value.payAmount - item.value.refundAmount) {
|
if (n > item.value.payAmount - item.value.refundAmount) {
|
||||||
customAmount.value = formatDecimal(item.value.payAmount - item.value.refundAmount, 2, true)
|
customAmount.value = formatDecimal(item.value.payAmount - item.value.refundAmount, 2)
|
||||||
} else {
|
} else {
|
||||||
customAmount.value = inputFilterFloat(n)
|
customAmount.value = inputFilterFloat(n)
|
||||||
}
|
}
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加备注
|
||||||
|
function addRmarkHandle(item) {
|
||||||
|
if (remark.value.length) {
|
||||||
|
remark.value += `,${item}`
|
||||||
|
} else {
|
||||||
|
remark.value = item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
show
|
show
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="empty">
|
<div class="empty" v-if="!tableList.length">
|
||||||
<el-empty description="空空如也~" v-if="!tableList.length" />
|
<el-empty description="空空如也~" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination background v-model:current-page="query.page" :pager-count="5"
|
||||||
|
layout=" pager, jumper, total" :total="query.total"
|
||||||
|
@current-change="shopTableAjax"></el-pagination>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right_card card">
|
<div class="right_card card">
|
||||||
|
|
@ -61,17 +66,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { queryShopArea, queryShopTable } from '@/api/table'
|
|
||||||
import { shopArea, shopTable } from "@/api/account.js";
|
import { shopArea, shopTable } from "@/api/account.js";
|
||||||
|
|
||||||
import countCard from '@/views/table/components/countCard.vue'
|
import countCard from '@/views/table/components/countCard.vue'
|
||||||
import tableInfo from '@/views/table/components/tableInfo.vue'
|
import tableInfo from '@/views/table/components/tableInfo.vue'
|
||||||
|
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useUser } from "@/store/user.js"
|
|
||||||
import { dayjs } from 'element-plus'
|
import { dayjs } from 'element-plus'
|
||||||
const store = useUser()
|
|
||||||
|
|
||||||
|
|
||||||
const tabActive = ref(0)
|
const tabActive = ref(0)
|
||||||
const tabAreas = ref([
|
const tabAreas = ref([
|
||||||
|
|
@ -93,6 +92,11 @@ const tabAreas = ref([
|
||||||
// }
|
// }
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const query = ref({
|
||||||
|
page: 1,
|
||||||
|
size: 12,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
// 区域列表
|
// 区域列表
|
||||||
const areaList = ref([])
|
const areaList = ref([])
|
||||||
|
|
@ -158,12 +162,15 @@ async function shopTableAjax() {
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const res = await shopTable({
|
const res = await shopTable({
|
||||||
|
page: query.value.page,
|
||||||
|
size: query.value.size,
|
||||||
areaId: area.value,
|
areaId: area.value,
|
||||||
tableCode: '',
|
tableCode: '',
|
||||||
name: '',
|
name: '',
|
||||||
status: tabAreas.value[tabActive.value].type,
|
status: tabAreas.value[tabActive.value].type,
|
||||||
})
|
})
|
||||||
tableList.value = res.records
|
tableList.value = res.records
|
||||||
|
query.value.total = +res.totalRow
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
@ -180,6 +187,12 @@ onMounted(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.pagination {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding-top: var(--el-font-size-base);
|
||||||
|
}
|
||||||
|
|
||||||
.cart_wrap {
|
.cart_wrap {
|
||||||
flex: 2;
|
flex: 2;
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +257,7 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.overflow_y {
|
.overflow_y {
|
||||||
height: calc(100vh - 160px);
|
height: calc(100vh - 220px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,7 +265,7 @@ onMounted(() => {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr 1fr 1fr;
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
||||||
grid-template-rows: auto;
|
grid-template-rows: auto;
|
||||||
gap: var(--el-font-size-base);
|
gap: 10px;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
$closedColor: #aeb8c9;
|
$closedColor: #aeb8c9;
|
||||||
|
|
@ -317,7 +330,7 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab_cont {
|
.tab_cont {
|
||||||
height: 120px;
|
height: 112px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue