jsk 小票打印机提交

This commit is contained in:
jiask 2025-11-21 10:41:40 +08:00
parent 73308c98ee
commit b2fcf4ae4f
1 changed files with 51 additions and 48 deletions

View File

@ -223,11 +223,7 @@
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" width="80"/>
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="用户手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" width="120">
<template scope="scope">
<span>{{ hidePhone(scope.row.phoneNumber) }}</span>
</template>
</el-table-column>
<el-table-column label="用户手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="所属组织" align="center" prop="deptFullName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="所属食堂" align="center" prop="canteenName" :show-overflow-tooltip="true" width="120"/>
@ -551,16 +547,16 @@
<!-- 提醒对话框 -->
<el-dialog :title="handleType+'提醒'" :visible.sync="openRemind" width="40%" append-to-body>
<!-- <div>-->
<!-- <el-select v-model="printerName" clearable collapse-tags style="width: 220px">-->
<!-- <el-option-->
<!-- v-for="item in printList"-->
<!-- :key="item.value"-->
<!-- :label="item.name"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </div>-->
<div>
<el-select v-model="printerName" clearable collapse-tags style="width: 220px">
<el-option
v-for="item in printList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</div>
<div class="remind-question">请问是否对以下可{{ handleType }}订单进行{{ handleType }}操作</div>
<div class="remind-title">{{ handleType }}订单 {{ ableList.length }} </div>
<div v-for="(item,index) in ableList" :key="item.orderId">{{ (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('打印小票完成')