feat: 添加打印机管理页面,订单详情调用打印接口
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Agent
2026-03-29 06:39:48 +00:00
parent 615b688810
commit d5ae333176
4 changed files with 410 additions and 2 deletions

View File

@@ -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' })
}
}
}
})
}
}
}