diff --git a/src/views/canteen/order/reserveManagement/index.vue b/src/views/canteen/order/reserveManagement/index.vue index c6642f34..e4915ee5 100644 --- a/src/views/canteen/order/reserveManagement/index.vue +++ b/src/views/canteen/order/reserveManagement/index.vue @@ -223,11 +223,7 @@ - - - + @@ -551,16 +547,16 @@ - - - - - - - - - - +
+ + + +
请问是否对以下可{{ handleType }}订单进行{{ handleType }}操作?
可{{ handleType }}订单 {{ ableList.length }} 笔
{{ (index + 1) }}. @@ -708,7 +704,6 @@ export default { created() { // this.printerName = '' // this.printList = [] - this.getAreaTreeData() this.getDeptTree() this.getList() @@ -725,29 +720,37 @@ export default { }) }, updatePrinterList(printers) { - console.log("Printers from getPrinterList:", printers) - if (!Array.isArray(printers)) { - console.error('Expected an array of printers, but got:', typeof printers) - return - } - this.printList = Array.isArray(printers) - ? printers.map((item, index) => ({ - name: item.logicalName, - value: index, - })) - : [] + this.printList = printers.map(item => ({ + name: item.logicalName, + value: item.logicalName + })) console.log('Available printers:', this.printList) - console.log('Available printers size:', this.printList.length) if (this.printList.length > 0) { - console.log('Setting default printer to:', this.printList[0].value) - this.printerName = this.printList[0].value + this.printerName = this.printList[0].name } - console.log('this.printerName:', this.printerName) - console.log('this.printList:', this.printList) - this.$nextTick(() => { - // 强制更新视图 - this.$forceUpdate() - }) + // console.log("Printers from getPrinterList:", printers) + // if (!Array.isArray(printers)) { + // console.error('Expected an array of printers, but got:', typeof printers) + // return + // } + // this.printList = Array.isArray(printers) + // ? printers.map((item, index) => ({ + // name: item.logicalName, + // value: index, + // })) + // : [] + // console.log('Available printers:', this.printList) + // console.log('Available printers size:', this.printList.length) + // if (this.printList.length > 0) { + // console.log('Setting default printer to:', this.printList[0].value) + // this.printerName = this.printList[0].value + // } + // console.log('this.printerName:', this.printerName) + // console.log('this.printList:', this.printList) + // this.$nextTick(() => { + // // 强制更新视图 + // this.$forceUpdate() + // }) }, //区域树 getAreaTreeData() { @@ -1068,15 +1071,15 @@ export default { this.$modal.msgSuccess('批量核销完成') } if (this.handleType == '打印小票') { - // if (this.printList.length === 0) { - // this.$modal.msgWarning('请先开启小票打印机服务,获取打印机列表,可尝试强制刷新浏览器!') - // return - // } - // if (this.printerName === '') { - // this.$modal.msgWarning('请先选择小票打印机!') - // return - // } - const _titles = ['菜品名称', '数量', '单价', '总价'] + if (this.printList.length === 0) { + this.$modal.msgWarning('请先开启小票打印机服务,获取打印机列表,可尝试强制刷新浏览器!') + return + } + if (this.printerName === '') { + this.$modal.msgWarning('请先选择小票打印机!') + return + } + const _titles = ['菜品名称', '数量', '订单', '金额'] const _columnWidths = [20, 10, 10, 8] console.log(this.ableList) this.ableList.forEach(item => { @@ -1085,8 +1088,8 @@ export default { let row = [] row.push(it.goodsName) row.push(it.quantity) - row.push((it.salePrice / 100).toFixed(2)) - row.push((it.totalAmount / 100).toFixed(2)) + row.push((it.payableAmount / 100).toFixed(2)) + row.push((it.payableAmount / 100).toFixed(2)) _rows.push(row) }) this.PosPrinter.cleanBuffer() @@ -1105,7 +1108,7 @@ export default { .printAndFeed(2) .feedAndCut(50) //TODO 当前打印机名称是写死的,后续需要改成动态选择 目前动态页面赋值有问题 - this.prepareAndPrint('Printer1') + this.prepareAndPrint(this.printerName); }) this.$modal.msgSuccess('打印小票完成')