From d5ae33317608866ca14710b6cb9809bee9aa3934 Mon Sep 17 00:00:00 2001 From: Agent Date: Sun, 29 Mar 2026 06:39:48 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=9C=BA=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=EF=BC=8C=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85=E8=B0=83=E7=94=A8=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 6 + src/pages/index/index.vue | 4 + src/pages/order/detail.vue | 25 ++- src/pages/printer/list.vue | 377 +++++++++++++++++++++++++++++++++++++ 4 files changed, 410 insertions(+), 2 deletions(-) create mode 100644 src/pages/printer/list.vue diff --git a/src/pages.json b/src/pages.json index 91f7d32..61c7d78 100644 --- a/src/pages.json +++ b/src/pages.json @@ -96,6 +96,12 @@ "navigationBarTitleText": "客户列表" } }, + { + "path": "pages/printer/list", + "style": { + "navigationBarTitleText": "打印机管理" + } + }, { "path": "pages/category/index", "style": { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 3d9a044..f6d4204 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -74,6 +74,10 @@ 种类管理 + + 打印 + 打印机 + 库存管理 diff --git a/src/pages/order/detail.vue b/src/pages/order/detail.vue index 220e53e..033b6f9 100644 --- a/src/pages/order/detail.vue +++ b/src/pages/order/detail.vue @@ -210,8 +210,29 @@ export default { }) }, printOrder() { - uni.showToast({ title: '打印功能开发中', icon: 'none' }) - // TODO: 实现打印功能 + uni.showModal({ + title: '确认打印', + content: '确定要打印此订单小票吗?', + success: async (res) => { + if (res.confirm) { + try { + const token = uni.getStorageSync('token') + const res = await uni.request({ + url: `${getApp().globalData.apiBaseUrl}/printers/print/${this.orderId}`, + method: 'POST', + header: { 'Authorization': `Bearer ${token}` } + }) + if (res.data.code === 0) { + uni.showToast({ title: '打印成功', icon: 'success' }) + } else { + uni.showToast({ title: res.data.message || '打印失败', icon: 'none' }) + } + } catch (e) { + uni.showToast({ title: '打印失败', icon: 'none' }) + } + } + } + }) } } } diff --git a/src/pages/printer/list.vue b/src/pages/printer/list.vue new file mode 100644 index 0000000..844f3ed --- /dev/null +++ b/src/pages/printer/list.vue @@ -0,0 +1,377 @@ + + + + + \ No newline at end of file