新增标签打印
This commit is contained in:
@@ -1,20 +1,36 @@
|
||||
<template>
|
||||
<el-button @click="chooseSerial">打印</el-button>
|
||||
<!-- <el-button @click="chooseSerial">获取串口列表</el-button> -->
|
||||
<el-button @click="printTag">打印标签</el-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ipcRenderer } from 'electron'
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
// 打印标签小票
|
||||
const printTag = () => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify({
|
||||
deviceName: 'Xprinter XP-365B123'
|
||||
}))
|
||||
}
|
||||
|
||||
//选择串口设备
|
||||
const chooseSerial = async () => {
|
||||
let printNum = localStorage.getItem('printNum')
|
||||
if (!printNum) {
|
||||
printNum = 1
|
||||
localStorage.setItem('printNum', printNum)
|
||||
} else {
|
||||
printNum++
|
||||
localStorage.setItem('printNum', printNum)
|
||||
}
|
||||
ipcRenderer.send('printStart', printNum)
|
||||
// let printNum = localStorage.getItem('printNum')
|
||||
// if (!printNum) {
|
||||
// printNum = 1
|
||||
// localStorage.setItem('printNum', printNum)
|
||||
// } else {
|
||||
// printNum++
|
||||
// localStorage.setItem('printNum', printNum)
|
||||
// }
|
||||
// ipcRenderer.send('printStart', printNum)
|
||||
ipcRenderer.send('getSerialPort')
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
ipcRenderer.on('seriaportList', (e, a) => {
|
||||
console.log('seriaportList', a);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -6,8 +6,8 @@
|
||||
<span>{{ dayjs(item.create_time).format("YYYY-MM-DD HH:mm:ss") }}</span>
|
||||
</div>
|
||||
<div class="dialog_footer_right">
|
||||
<span :class="{ active: checkIn(item.biz_code) }">
|
||||
<template v-if="checkIn(item.biz_code)">+</template>
|
||||
<span :class="{ active: item.type == '+' }">
|
||||
<template v-if="item.type == '+'">+</template>
|
||||
<template v-else>-</template>
|
||||
¥{{ formatDecimal(item.amount) }}
|
||||
</span>
|
||||
@@ -29,13 +29,6 @@ const props = defineProps({
|
||||
default: {}
|
||||
}
|
||||
})
|
||||
|
||||
// 检测是否包含In
|
||||
function checkIn(str) {
|
||||
let reg = RegExp(/In/)
|
||||
return str.match(reg)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user