优化桌面端

This commit is contained in:
gyq
2024-05-16 16:55:55 +08:00
parent 43ccf82177
commit 6f378cc3c0
6 changed files with 141 additions and 239 deletions

View File

@@ -1,12 +1,7 @@
<!-- 结算订单 -->
<template>
<el-drawer
size="100%"
:with-header="false"
direction="btt"
v-model="dialogVisible"
>
<el-drawer size="100%" :with-header="false" direction="btt" v-model="dialogVisible">
<div class="drawer_wrap">
<div class="cart_list">
<div class="nav_wrap card">
@@ -18,9 +13,7 @@
<div class="info">
<div class="master_id">{{ props.masterId }}</div>
<div class="btm">
<span class="p"
>服务员{{ store.userInfo.shopName || "暂无" }}</span
>
<span class="p">服务员{{ store.userInfo.shopName || "暂无" }}</span>
<span class="t">{{
props.orderInfo.createdAt &&
dayjs(props.orderInfo.createdAt).format("MM-DD HH:mm")
@@ -28,10 +21,7 @@
</div>
</div>
</div>
<div
class="list_wrap card"
style="margin-top: var(--el-font-size-base)"
>
<div class="list_wrap card" style="margin-top: var(--el-font-size-base)">
<div class="item" v-for="item in props.cart" :key="item.id">
<div class="top">
<span class="name">{{ item.name }}</span>
@@ -48,11 +38,7 @@
</div>
</div>
<div class="packge_Wrap" v-if="item.isPack == 'true'">
<div
class="icon_item"
v-if="item.isPack == 'true'"
@click="giftPackHandle('isPack', item)"
>
<div class="icon_item" v-if="item.isPack == 'true'" @click="giftPackHandle('isPack', item)">
<el-icon class="icon" style="color: var(--primary-color)">
<Box />
</el-icon>
@@ -63,29 +49,15 @@
<div class="footer">
<!-- <el-button icon="Edit"></el-button> -->
<div class="button">
<el-checkbox
v-model="isPrint"
border
label="打印结算小票"
style="width: 100%"
/>
<el-checkbox v-model="isPrint" border label="打印结算小票" style="width: 100%" />
</div>
<div class="print">
<el-button
type="primary"
v-loading="printLoading"
@click="printHandle"
>打印预结单</el-button
>
<el-button type="primary" v-loading="printLoading" @click="printHandle">打印预结单</el-button>
</div>
</div>
</div>
<div class="pay_wrap">
<payCard
:amount="props.amount"
:orderId="props.orderInfo.id"
@paySuccess="paySuccess"
/>
<payCard :amount="props.amount" :orderId="props.orderInfo.id" @paySuccess="paySuccess" />
</div>
</div>
</el-drawer>
@@ -150,40 +122,41 @@ async function bySubTypeAjax() {
}
}
// 打印操作
async function printHandle() {
// try {
// if (!isPrint.value) return;
// if (printList.value.length) {
// const data = {
// shop_name: store.userInfo.merchantName,
// carts: props.cart,
// amount: props.amount,
// remark: props.remark,
// orderInfo: props.orderInfo,
// deviceName: printList.value[0].config.deviceName,
// createdAt: dayjs(props.orderInfo.createdAt).format(
// "YYYY-MM-DD HH:mm:ss"
// ),
// printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
// };
// ipcRenderer.send("printerInfoSync", JSON.stringify(data));
// } else {
// ElMessage.error("您还没有添加打印设备");
// }
// } catch (error) {
// console.log(error);
// }
try {
printLoading.value = true;
await print({
type: "normal",
ispre: true,
orderId: props.orderInfo.id,
});
printLoading.value = false;
ElMessage.success("打印成功");
if (!isPrint.value) return;
if (printList.value.length) {
const data = {
shop_name: store.userInfo.merchantName,
carts: props.cart,
amount: props.amount,
remark: props.remark,
orderInfo: props.orderInfo,
deviceName: printList.value[0].config.deviceName,
createdAt: dayjs(props.orderInfo.createdAt).format(
"YYYY-MM-DD HH:mm:ss"
),
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
};
ipcRenderer.send("printerInfoSync", JSON.stringify(data));
} else {
ElMessage.error("您还没有添加本地打印设备,将使用网络打印");
try {
printLoading.value = true;
await print({
type: "normal",
ispre: true,
orderId: props.orderInfo.id,
});
printLoading.value = false;
ElMessage.success("打印成功");
} catch (error) {
printLoading.value = false;
console.log(error);
}
}
} catch (error) {
printLoading.value = false;
console.log(error);
}
}