This commit is contained in:
@@ -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' })
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user