diff --git a/.env.development b/.env.development index 685ec9a..eb0880d 100644 --- a/.env.development +++ b/.env.development @@ -2,7 +2,7 @@ ENV = development # 测试 -# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client' +VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client' # 阿伟 # VITE_API_URL = 'http://192.168.2.96:10587/cashier-client' @@ -11,4 +11,4 @@ ENV = development # VITE_API_URL = 'http://192.168.2.41:10587/cashier-client' # 正式 -VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client' \ No newline at end of file +# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client' \ No newline at end of file diff --git a/.env.production b/.env.production index db6faeb..fae91b2 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,7 @@ ENV = production # 线上环境接口地址 -VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/' +# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/' # 测试 -# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client' \ No newline at end of file +VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client' \ No newline at end of file diff --git a/electron/main.js b/electron/main.js index 7beed3d..72c2115 100644 --- a/electron/main.js +++ b/electron/main.js @@ -98,6 +98,60 @@ app.whenReady().then(() => { }, }); }); + + // 交班小票的窗口 + // const workPrintWin = new BrowserWindow({ + // show: true, + // width: 464, + // height: 1726, + // webPreferences: { + // nodeIntegration: true, + // contextIsolation: false, + // }, + // }); + + // if (process.env.VITE_DEV_SERVER_URL) { + // // 加载打印的html文件 + // workPrintWin.loadFile(path.join(__dirname, "../public/work_print.html")); + // } else { + // workPrintWin.loadFile(path.resolve(__dirname, "../dist/work_print.html")); // 打包后使用文件路径访问应用 + // } + + // // 接收渲染进程发送的数据 + // ipcMain.on("printerWorkSync", (event, arg) => { + // workPrintWin.webContents.send("getParams", arg); + // }); + + // // 执行交班小票的打印操作 + // ipcMain.on("printWorkStart", (event, arg) => { + // console.log(arg); + // const _parmas = JSON.parse(arg); + // // console.log(_parmas) + // let name = _parmas.deviceName; + // printWin.webContents.print({ + // silent: true, + // deviceName: name, + // pageSize: { + // width: 58000, + // height: 216000, + // }, + // scaleFactor: 80, + // landscape: false, + // margins: { + // marginType: "none", + // top: 0, + // bottom: 0, + // left: 0, + // right: 0, + // }, + // dpi: { + // horizontal: 203, + // vertical: 203, + // }, + // }); + // }); + + }); app.on("window-all-closed", () => { diff --git a/package.json b/package.json index 040bc18..07f55b3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vite-electron", "private": true, - "version": "1.2.14", + "version": "1.2.15", "main": "dist-electron/main.js", "scripts": { "dev": "chcp 65001 && vite", diff --git a/public/work_print.css b/public/work_print.css new file mode 100644 index 0000000..5eabcd6 --- /dev/null +++ b/public/work_print.css @@ -0,0 +1,79 @@ +* { + padding: 0; + margin: 0; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +body { + padding: 0 8mm; +} + +.print_view { + padding: 20px 0; +} +.print_view .title { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + margin-bottom: 4px; +} +.print_view .title.t1 { + font-size: 24px; +} +.print_view .title.t2 { + margin-bottom: 15px; +} +.print_view .row { + margin-top: 2px; + font-size: 12px; +} +.print_view .row.between { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} +.print_view .line { + margin: 10px 0; + border-bottom: 1px solid #000; +} +.print_view .table { + width: 100%; +} +.print_view .table tr { + width: 100%; + display: -webkit-box; + display: -ms-flexbox; + display: flex; +} +.print_view .table tr:not(:last-child) { + margin-bottom: 10px; +} +.print_view .table tr td { + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1; + font-size: 12px; +} +.print_view .table tr td:nth-child(1) { + -webkit-box-flex: 2; + -ms-flex: 2; + flex: 2; +} +.print_view .table tr td:not(:first-child) { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: end; + -ms-flex-pack: end; + justify-content: flex-end; +} +.print_view .table tr td .sku { + font-size: 10px; +} \ No newline at end of file diff --git a/public/work_print.html b/public/work_print.html new file mode 100644 index 0000000..06644b7 --- /dev/null +++ b/public/work_print.html @@ -0,0 +1,97 @@ + + + + + + Print preview + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/public/work_print.scss b/public/work_print.scss new file mode 100644 index 0000000..f474385 --- /dev/null +++ b/public/work_print.scss @@ -0,0 +1,71 @@ +* { + padding: 0; + margin: 0; + box-sizing: border-box; +} +body { + padding: 0 8mm; +} +.print_view { + padding: 20px 0; + + .title { + display: flex; + justify-content: center; + margin-bottom: 4px; + + &.t1 { + font-size: 24px; + } + + &.t2 { + margin-bottom: 15px; + } + } + + .row { + margin-top: 2px; + font-size: 12px; + + &.between { + display: flex; + justify-content: space-between; + } + } + + .line { + margin: 10px 0; + border-bottom: 1px solid #000; + } + + .table { + width: 100%; + + tr { + width: 100%; + display: flex; + + &:not(:last-child) { + margin-bottom: 10px; + } + + td { + flex: 1; + font-size: 12px; + + &:nth-child(1) { + flex: 2; + } + + &:not(:first-child) { + display: flex; + justify-content: flex-end; + } + + .sku { + font-size: 10px; + } + } + } + } +} diff --git a/src/api/order/index.js b/src/api/order/index.js index 5fc1719..e2dbfa4 100644 --- a/src/api/order/index.js +++ b/src/api/order/index.js @@ -62,3 +62,16 @@ export function queryQuickPay(params) { params, }); } + +/** + * 叫号 + * @param {*} params + * @returns + */ +export function sendMessage(params) { + return request({ + method: "get", + url: "/order/sendMessage", + params, + }); +} diff --git a/src/views/order/index.vue b/src/views/order/index.vue index 0ec9d69..57f4276 100644 --- a/src/views/order/index.vue +++ b/src/views/order/index.vue @@ -98,13 +98,19 @@
- 退单
- - 重打收银打票 - 重打标签小票 + + 叫号 + +
+
+ 退单 +
+
+ 重打收银打票 + 重打标签小票
@@ -234,7 +240,7 @@ import { ref, onMounted, reactive } from 'vue' import { ElMessage, dayjs } from 'element-plus' import { useUser } from "@/store/user.js" import lodash from 'lodash' -import { orderfindOrder, orderorderDetail, payreturnOrder, cloudPrinterprint } from '@/api/order/index.js' +import { orderfindOrder, orderorderDetail, payreturnOrder, cloudPrinterprint, sendMessage } from '@/api/order/index.js' import add from '@/views/order/components/add.vue' import cashTable from '@/views/order/components/cashTable.vue' import { clearNoNum } from '@/utils' @@ -427,6 +433,23 @@ const handleCurrentChange = (val) => { //页码 const inputChange = lodash.debounce(function () { //搜索手机号 asyncorderfindOrder() }, 500) + +// 叫号 +const callLoading = ref(false) +const callNumberHandle = async () => { + try { + callLoading.value = true + const res = await sendMessage({ + orderId: orderDetaildata.value.id + }) + callLoading.value = false + ElMessage.success('叫号成功') + } catch (error) { + callLoading.value = false + console.log(error); + } +} + onMounted(() => { // resetMembrform.value = { ...membrform.value } asyncorderfindOrder()