优化打印效果
This commit is contained in:
parent
5d96435125
commit
b550cf3fd8
|
|
@ -2,4 +2,4 @@
|
||||||
ENV = production
|
ENV = production
|
||||||
|
|
||||||
# 线上环境接口地址
|
# 线上环境接口地址
|
||||||
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/api/'
|
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/'
|
||||||
|
|
@ -1,38 +1,11 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
const electron = require("electron");
|
const electron = require("electron");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
function printUtils(params) {
|
|
||||||
return new Promise(async (resolvePrint, rejectPrint) => {
|
|
||||||
let subMainWindow = new electron.BrowserWindow({
|
|
||||||
// show: false,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true,
|
|
||||||
// For electron >= 4.0.0
|
|
||||||
contextIsolation: false,
|
|
||||||
webSecurity: false,
|
|
||||||
enableRemoteModule: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
subMainWindow.loadFile(path.join(__dirname, "../public/print.html"));
|
|
||||||
subMainWindow.webContents.on("did-finish-load", async (res) => {
|
|
||||||
subMainWindow.webContents.openDevTools();
|
|
||||||
console.log("网页加载完成", res);
|
|
||||||
subMainWindow.webContents.send("getParams", params);
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
electron.ipcMain.on("printStart", () => {
|
|
||||||
console.log("开始打印");
|
|
||||||
subMainWindow.webContents.print({
|
|
||||||
silent: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
electron.app.whenReady().then(() => {
|
electron.app.whenReady().then(() => {
|
||||||
const win = new electron.BrowserWindow({
|
const win = new electron.BrowserWindow({
|
||||||
title: "银收客",
|
title: "银收客",
|
||||||
width: 1200,
|
width: 1024,
|
||||||
height: 800,
|
height: 768,
|
||||||
fullscreenable: true,
|
fullscreenable: true,
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
simpleFullscreen: true,
|
simpleFullscreen: true,
|
||||||
|
|
@ -48,7 +21,6 @@ electron.app.whenReady().then(() => {
|
||||||
} else {
|
} else {
|
||||||
win.loadFile(path.resolve(__dirname, "../dist/index.html"));
|
win.loadFile(path.resolve(__dirname, "../dist/index.html"));
|
||||||
}
|
}
|
||||||
win.webContents.openDevTools();
|
|
||||||
electron.app.on("activate", () => {
|
electron.app.on("activate", () => {
|
||||||
if (electron.BrowserWindow.getAllWindows().length === 0) {
|
if (electron.BrowserWindow.getAllWindows().length === 0) {
|
||||||
createWindow();
|
createWindow();
|
||||||
|
|
@ -57,8 +29,29 @@ electron.app.whenReady().then(() => {
|
||||||
electron.ipcMain.on("quitHandler", (_, msg) => {
|
electron.ipcMain.on("quitHandler", (_, msg) => {
|
||||||
electron.app.quit();
|
electron.app.quit();
|
||||||
});
|
});
|
||||||
electron.ipcMain.on("printerInfoSync", async (event, params) => {
|
const printWin = new electron.BrowserWindow({
|
||||||
await printUtils(params);
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
// 集成网页和 Node.js,也就是在渲染进程中,可以调用 Node.js 方法
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (process.env.VITE_DEV_SERVER_URL) {
|
||||||
|
printWin.loadFile(path.join(__dirname, "../public/print.html"));
|
||||||
|
} else {
|
||||||
|
printWin.loadFile(path.resolve(__dirname, "../dist/print.html"));
|
||||||
|
}
|
||||||
|
printWin.webContents.openDevTools();
|
||||||
|
electron.ipcMain.on("printerInfoSync", (event, params) => {
|
||||||
|
console.log(JSON.parse(params));
|
||||||
|
printWin.webContents.send("getParams", params);
|
||||||
|
});
|
||||||
|
electron.ipcMain.on("printStart", () => {
|
||||||
|
console.log("开始打印");
|
||||||
|
printWin.webContents.print({
|
||||||
|
silent: true
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
electron.app.on("window-all-closed", () => {
|
electron.app.on("window-all-closed", () => {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import { app, BrowserWindow, ipcMain } from "electron";
|
import { app, BrowserWindow, ipcMain } from "electron";
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { printUtils } from './printUtils'
|
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
title: "银收客",
|
title: "银收客",
|
||||||
width: 1200,
|
width: 1024,
|
||||||
height: 800,
|
height: 768,
|
||||||
fullscreenable: true,
|
fullscreenable: true,
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
simpleFullscreen: true,
|
simpleFullscreen: true,
|
||||||
|
|
@ -22,10 +21,10 @@ app.whenReady().then(() => {
|
||||||
if (process.env.VITE_DEV_SERVER_URL) {
|
if (process.env.VITE_DEV_SERVER_URL) {
|
||||||
win.loadURL(process.env.VITE_DEV_SERVER_URL);
|
win.loadURL(process.env.VITE_DEV_SERVER_URL);
|
||||||
// 使用vite开发服务的url路径访问应用
|
// 使用vite开发服务的url路径访问应用
|
||||||
|
// win.webContents.openDevTools();
|
||||||
} else {
|
} else {
|
||||||
win.loadFile(path.resolve(__dirname, '../dist/index.html')); // 打包后使用文件路径访问应用
|
win.loadFile(path.resolve(__dirname, '../dist/index.html')); // 打包后使用文件路径访问应用
|
||||||
}
|
}
|
||||||
win.webContents.openDevTools();
|
|
||||||
|
|
||||||
app.on("activate", () => {
|
app.on("activate", () => {
|
||||||
// 在 macOS 系统内, 如果没有已开启的应用窗口
|
// 在 macOS 系统内, 如果没有已开启的应用窗口
|
||||||
|
|
@ -39,8 +38,36 @@ app.whenReady().then(() => {
|
||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('printerInfoSync', async (event, params) => {
|
// 创建打印小票子窗口
|
||||||
await printUtils(params)
|
const printWin = new BrowserWindow({
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
// 集成网页和 Node.js,也就是在渲染进程中,可以调用 Node.js 方法
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (process.env.VITE_DEV_SERVER_URL) {
|
||||||
|
// 加载打印的html文件
|
||||||
|
printWin.loadFile(path.join(__dirname, "../public/print.html"));
|
||||||
|
} else {
|
||||||
|
printWin.loadFile(path.resolve(__dirname, '../dist/print.html')); // 打包后使用文件路径访问应用
|
||||||
|
}
|
||||||
|
|
||||||
|
printWin.webContents.openDevTools()
|
||||||
|
|
||||||
|
ipcMain.on('printerInfoSync', (event, params) => {
|
||||||
|
console.log(JSON.parse(params))
|
||||||
|
printWin.webContents.send('getParams', params)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 执行打印操作
|
||||||
|
ipcMain.on('printStart', () => {
|
||||||
|
console.log('开始打印')
|
||||||
|
printWin.webContents.print({
|
||||||
|
silent: true
|
||||||
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
import { BrowserWindow, ipcMain } from 'electron';
|
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
export function printUtils(params) {
|
|
||||||
return new Promise(async (resolvePrint, rejectPrint) => {
|
|
||||||
let subMainWindow = new BrowserWindow({
|
|
||||||
// show: false,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true, // For electron >= 4.0.0
|
|
||||||
contextIsolation: false,
|
|
||||||
webSecurity: false,
|
|
||||||
enableRemoteModule: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 加载打印的html文件
|
|
||||||
subMainWindow.loadFile(path.join(__dirname, "../public/print.html"));
|
|
||||||
|
|
||||||
subMainWindow.webContents.on('did-finish-load', async (res) => {
|
|
||||||
subMainWindow.webContents.openDevTools();
|
|
||||||
console.log('网页加载完成', res)
|
|
||||||
subMainWindow.webContents.send('getParams', params)
|
|
||||||
return
|
|
||||||
let data = []
|
|
||||||
return renderPrintDocument(subMainWindow, data)
|
|
||||||
.then(async (result) => {
|
|
||||||
// let width = Math.ceil((result.width) * 264.5833);
|
|
||||||
let height = Math.ceil((result.height + 60) * 264.5833);
|
|
||||||
console.info('height', result, height);
|
|
||||||
subMainWindow.webContents.print({
|
|
||||||
silent: true,
|
|
||||||
margins: {
|
|
||||||
marginType: 'none'
|
|
||||||
},
|
|
||||||
printBackground: false,
|
|
||||||
deviceName: '',
|
|
||||||
copies: 1,
|
|
||||||
}, (success) => {
|
|
||||||
if (success) {
|
|
||||||
resolvePrint({ type: 'success' })
|
|
||||||
}
|
|
||||||
subMainWindow.close();
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch(err => console.warn(33, err))
|
|
||||||
})
|
|
||||||
ipcMain.on('printStart', () => {
|
|
||||||
console.log('开始打印')
|
|
||||||
subMainWindow.webContents.print({
|
|
||||||
silent: true
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
@ -7,69 +7,40 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Print preview</title>
|
<title>Print preview</title>
|
||||||
<style>
|
<style>
|
||||||
@page {
|
@media print {
|
||||||
size: auto;
|
h1 {
|
||||||
}
|
font-size: 1.5em;
|
||||||
|
text-align: center;
|
||||||
html {
|
font-weight: bold;
|
||||||
padding-bottom: 100px;
|
}
|
||||||
}
|
@page {
|
||||||
|
size: auto;
|
||||||
.title_wrap {
|
margin-top: 50px;
|
||||||
font-weight: bold;
|
margin-bottom: 50px;
|
||||||
display: flex;
|
}
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 50px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.min_title {
|
|
||||||
font-size: 18px;
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item {
|
|
||||||
padding: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item.b {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.img {
|
|
||||||
width: 100%;
|
|
||||||
display: block;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<section id="app">
|
<section id="app">
|
||||||
<RS:2><L><CB>####### 6 ######</CB></L><BR>
|
<section>---------------------</section>
|
||||||
<RS:2><C>*沙县小吃*</C><BR>
|
<section>---------------------</section>
|
||||||
<RS:2><CB>--已在线支付--</CB><BR>
|
<section>---------------------</section>
|
||||||
<RS:2><C>----------------</C><BR>
|
<section>---------------------</section>
|
||||||
送达时间: 2021-01-04 13:28:50<BR>
|
<section>---------------------</section>
|
||||||
送达时间: 2021-01-04 12:28:50<BR>
|
<section>---------------------</section>
|
||||||
订单编号: 1200897812792015996<BR>
|
<center><em>{{data.shop_name}}</em></center>
|
||||||
-------01号篮子------<BR>
|
<section v-for="item in data.carts" :key="item.id">
|
||||||
<L>爆炒肥肠 x2 80.0</L><BR>
|
{{item.name}} x{{item.number}} {{item.salePrice}}
|
||||||
<L>蚂蚁上树 x1 12.3</L><BR>
|
<br />
|
||||||
[会员减配送费: 0.0]<BR>
|
</section>
|
||||||
<RS:1>[商家承担的配送费: 1.0]<BR>
|
<section>---------------------</section>
|
||||||
配送费: ¥1.0<BR>
|
<section>---------------------</section>
|
||||||
<B>实付: ¥43.3</B><BR>
|
<section>---------------------</section>
|
||||||
<B>手机号: 13012345678</B><BR>
|
<section>---------------------</section>
|
||||||
<RS:2><B>仲恺高新区惠风西3路1号</B><BR>
|
<section>---------------------</section>
|
||||||
备 注: 不要辣椒<BR>
|
<section>---------------------</section>
|
||||||
发票抬头: 惠州市博实结科技有限公司<BR>
|
|
||||||
<LOGO>
|
|
||||||
<CUT>
|
|
||||||
</section>
|
</section>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const { ipcRenderer } = require("electron");
|
const { ipcRenderer } = require("electron");
|
||||||
|
|
@ -85,9 +56,10 @@
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
ipcRenderer.on("getParams", (event, arg) => {
|
ipcRenderer.on("getParams", (event, arg) => {
|
||||||
|
console.log(arg);
|
||||||
data.value = JSON.parse(arg);
|
data.value = JSON.parse(arg);
|
||||||
|
ipcRenderer.send("printStart");
|
||||||
});
|
});
|
||||||
ipcRenderer.send("printStart");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ router.beforeEach((to, from) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--r: 24;
|
--r:24;
|
||||||
--g: 124;
|
--g: 124;
|
||||||
--b: 170;
|
--b: 170;
|
||||||
--r-lighter: calc(var(--r) + (255 - var(--r)) * 0.2);
|
--r-lighter: calc(var(--r) + (255 - var(--r)) * 0.2);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ const menus = ref([
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
color: #999;
|
color: #999;
|
||||||
font-size: 22px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,26 +105,30 @@ function payTypeChange(index, item) {
|
||||||
// 结算支付
|
// 结算支付
|
||||||
async function confirmOrder() {
|
async function confirmOrder() {
|
||||||
try {
|
try {
|
||||||
if (money.value < props.amount) return
|
if (payList.value[payActive.value].payType == 'scanCode') {
|
||||||
payLoading.value = true
|
scanModalRef.value.show()
|
||||||
switch (payList.value[payActive.value].payType) {
|
} else {
|
||||||
case 'deposit':
|
if (money.value < props.amount) return
|
||||||
await accountPay({
|
payLoading.value = true
|
||||||
orderId: props.orderId,
|
switch (payList.value[payActive.value].payType) {
|
||||||
memberId: 1
|
case 'deposit':
|
||||||
})
|
await accountPay({
|
||||||
break;
|
orderId: props.orderId,
|
||||||
case 'cash':
|
memberId: 1
|
||||||
await cashPay({
|
})
|
||||||
orderId: props.orderId
|
break;
|
||||||
})
|
case 'cash':
|
||||||
break;
|
await cashPay({
|
||||||
default:
|
orderId: props.orderId
|
||||||
break;
|
})
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ElMessage.success('支付成功')
|
||||||
|
emit('paySuccess')
|
||||||
|
payLoading.value = false
|
||||||
}
|
}
|
||||||
ElMessage.success('支付成功')
|
|
||||||
emit('paySuccess')
|
|
||||||
payLoading.value = false
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
payLoading.value = false
|
payLoading.value = false
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="operation_wrap">
|
<div class="operation_wrap">
|
||||||
<div class="item" @click="numberChange('sub')">
|
<div class="item" :class="{ disabled: props.item.number <= 1 || !props.item.id }" @click="numberChange('sub')">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<SemiSelect />
|
<SemiSelect />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="search_wrap">
|
<div class="search_wrap">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<el-input placeholder="商品名称或首字母简称" prefix-icon="Search" v-model="commdityName" style="width: 400px;"
|
<el-input placeholder="商品名称或首字母简称" prefix-icon="Search" v-model="commdityName" clearable
|
||||||
clearable @input="inputChange"></el-input>
|
@input="inputChange"></el-input>
|
||||||
</div>
|
</div>
|
||||||
<el-button :icon="shopListType == 'text' ? 'PictureRounded' : 'PriceTag'"
|
<el-button :icon="shopListType == 'text' ? 'PictureRounded' : 'PriceTag'"
|
||||||
@click="changeShopListType"></el-button>
|
@click="changeShopListType"></el-button>
|
||||||
|
|
@ -299,59 +299,57 @@ defineExpose({
|
||||||
width: 20%;
|
width: 20%;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
border: 1px solid #ececec;
|
border: 1px solid #ececec;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dot {
|
.dot {
|
||||||
padding: 0 14px;
|
padding: 0 14px;
|
||||||
background-color: var(--el-color-danger);
|
background-color: var(--el-color-danger);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
right: 4px;
|
right: 4px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cover {
|
|
||||||
width: 100%;
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
padding: 0 10px;
|
|
||||||
height: 50px;
|
|
||||||
margin-top: 20px;
|
|
||||||
|
|
||||||
span {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.empty {
|
.cover {
|
||||||
height: 50px;
|
width: 100%;
|
||||||
}
|
height: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
.price {
|
.name {
|
||||||
padding: 10px 20px;
|
padding: 0 10px;
|
||||||
background-color: var(--primary-color);
|
height: 50px;
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
color: #fff;
|
font-weight: bold;
|
||||||
font-weight: bold;
|
}
|
||||||
font-size: 18px;
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ import { ipcRenderer } from 'electron'
|
||||||
|
|
||||||
const emit = defineEmits('paySuccess')
|
const emit = defineEmits('paySuccess')
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(true)
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
cart: {
|
cart: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
|
@ -101,7 +101,7 @@ function printHandle() {
|
||||||
remark: props.remark,
|
remark: props.remark,
|
||||||
orderId: props.orderId
|
orderId: props.orderId
|
||||||
}
|
}
|
||||||
ipcRenderer.sendSync('printerInfoSync', JSON.stringify(data))
|
ipcRenderer.send('printerInfoSync', JSON.stringify(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单已支付
|
// 订单已支付
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<div class="number" @click="takeFoodCodeRef.show()">
|
<div class="number" @click="takeFoodCodeRef.show()">
|
||||||
<el-text class="t">{{ masterId }}</el-text>
|
<el-text class="t">{{ masterId }}</el-text>
|
||||||
</div>
|
</div>
|
||||||
<div class="select_user" @click="membershow = true">
|
<!-- <div class="select_user" @click="membershow = true">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<UserFilled />
|
<UserFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<el-icon class="arrow">
|
<el-icon class="arrow">
|
||||||
<ArrowRight />
|
<ArrowRight />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="shop_operation">
|
<div class="shop_operation">
|
||||||
<div class="shop_list">
|
<div class="shop_list">
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
@click="createOrderHandle">
|
@click="createOrderHandle">
|
||||||
<div class="js">
|
<div class="js">
|
||||||
<el-text class="t">¥{{ cartInfo.totalAmount }}</el-text>
|
<el-text class="t">¥{{ cartInfo.totalAmount }}</el-text>
|
||||||
<el-text class="t" style="margin-left: 250px;">
|
<el-text class="t" style="margin-left: 30px">
|
||||||
<span v-if="!createOrderLoading">结算</span>
|
<span v-if="!createOrderLoading">结算</span>
|
||||||
<span v-else>下单中...</span>
|
<span v-else>下单中...</span>
|
||||||
</el-text>
|
</el-text>
|
||||||
|
|
@ -142,7 +142,6 @@ const createOrderLoading = ref(false)
|
||||||
|
|
||||||
// 取餐码
|
// 取餐码
|
||||||
const masterId = ref('')
|
const masterId = ref('')
|
||||||
const uuid = ref('')
|
|
||||||
|
|
||||||
// 挂单量
|
// 挂单量
|
||||||
const pendingCartNum = ref(0)
|
const pendingCartNum = ref(0)
|
||||||
|
|
@ -212,7 +211,8 @@ async function delCartHandle(params) {
|
||||||
masterId: params.masterId,
|
masterId: params.masterId,
|
||||||
cartId: params.id
|
cartId: params.id
|
||||||
})
|
})
|
||||||
queryCartAjax()
|
await queryCartAjax()
|
||||||
|
cartListActive.value = 0
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
|
|
@ -226,6 +226,7 @@ function giftPackHandle(key, item) {
|
||||||
|
|
||||||
// 打包全选
|
// 打包全选
|
||||||
const allSelectedHandle = async () => {
|
const allSelectedHandle = async () => {
|
||||||
|
if (!cartList.value.length) return
|
||||||
allSelected.value = !allSelected.value
|
allSelected.value = !allSelected.value
|
||||||
await packall({
|
await packall({
|
||||||
shopId: store.userInfo.shopId,
|
shopId: store.userInfo.shopId,
|
||||||
|
|
@ -258,7 +259,8 @@ async function addCart(params, type = 'add') {
|
||||||
isPack: params.isPack || false,
|
isPack: params.isPack || false,
|
||||||
isGift: params.isGift || false,
|
isGift: params.isGift || false,
|
||||||
cartId: type == 'add' ? '' : params.id,
|
cartId: type == 'add' ? '' : params.id,
|
||||||
uuid: params.uuid || store.userInfo.uuid
|
uuid: params.uuid || store.userInfo.uuid,
|
||||||
|
type: type
|
||||||
})
|
})
|
||||||
masterId.value = res
|
masterId.value = res
|
||||||
goodsRef.value.updateData()
|
goodsRef.value.updateData()
|
||||||
|
|
@ -287,11 +289,11 @@ async function queryCartAjax() {
|
||||||
// 获取取餐码
|
// 获取取餐码
|
||||||
async function createCodeAjax() {
|
async function createCodeAjax() {
|
||||||
try {
|
try {
|
||||||
const res = await createCode({
|
// const res = await createCode({
|
||||||
shopId: store.userInfo.shopId
|
// shopId: store.userInfo.shopId
|
||||||
})
|
// })
|
||||||
masterId.value = res.code
|
// masterId.value = res.code
|
||||||
// masterId.value = '#13'
|
masterId.value = '#50'
|
||||||
queryCartAjax()
|
queryCartAjax()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|
@ -305,7 +307,7 @@ onMounted(() => {
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.cart_wrap {
|
.cart_wrap {
|
||||||
width: 550px;
|
flex: 1.5;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -519,7 +521,7 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop_manage {
|
.shop_manage {
|
||||||
flex: 1;
|
flex: 2;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue