cashier_desktop/public/print.html

73 lines
1.9 KiB
HTML

<!--
~ Copyright (c) 2023. Author Hubert Formin <2399270194@qq.com>
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Print preview</title>
<style>
@media print {
h1 {
font-size: 1.5em;
text-align: center;
font-weight: bold;
}
@page {
size: auto;
margin-top: 50px;
margin-bottom: 50px;
}
}
</style>
</head>
<body>
<section id="app">
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
<center><em>{{data.shop_name}}</em></center>
<section v-for="item in data.carts" :key="item.id">
{{item.name}} x{{item.number}} {{item.salePrice}}
<br />
</section>
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
<section>---------------------</section>
</section>
<script type="module">
const { ipcRenderer } = require("electron");
import {
createApp,
ref,
onMounted,
} from "../node_modules/vue/dist/vue.esm-browser.js";
createApp({
setup() {
const data = ref({});
onMounted(() => {
ipcRenderer.on("getParams", (event, arg) => {
console.log(arg);
data.value = JSON.parse(arg);
ipcRenderer.send("printStart");
});
});
return {
data,
};
},
}).mount("#app");
</script>
</body>
</html>