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