优化结算订单

This commit is contained in:
gyq
2024-03-15 11:12:55 +08:00
parent 861e62ce15
commit 2b8910f6a1
8 changed files with 107 additions and 38 deletions

View File

@@ -14,7 +14,8 @@
<div class="master_id">{{ props.masterId }}</div>
<div class="btm">
<span class="p">服务员{{ store.userInfo.shopName || '暂无' }}</span>
<span class="t">03-01 09:05</span>
<span class="t">{{ props.orderInfo.createdAt &&
dayjs(props.orderInfo.createdAt).format('MM-DD HH:mm') }}</span>
</div>
</div>
</div>
@@ -47,12 +48,12 @@
<el-checkbox v-model="isPrint" border label="打印结算小票" style="width: 100%;" />
</div>
<div class="print">
<el-button type="primary" @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.orderId" @paySuccess="paySuccess" />
<payCard :amount="props.amount" :orderId="props.orderInfo.id" @paySuccess="paySuccess" />
</div>
</div>
</el-drawer>
@@ -62,6 +63,9 @@
import { ref } from 'vue'
import { useUser } from "@/store/user.js"
import payCard from '@/components/payCard/payCard.vue'
import { print } from '@/api/pay'
import { ElMessage } from "element-plus";
import dayjs from 'dayjs'
import { ipcRenderer } from 'electron'
@@ -69,6 +73,8 @@ const store = useUser()
const emit = defineEmits('paySuccess')
const printLoading = ref(false)
const dialogVisible = ref(false)
const props = defineProps({
cart: {
@@ -83,8 +89,8 @@ const props = defineProps({
type: String,
default: ''
},
orderId: {
type: [String, Number],
orderInfo: {
type: Object,
default: ''
},
masterId: {
@@ -95,16 +101,29 @@ const props = defineProps({
const isPrint = ref(true)
function printHandle() {
if (!isPrint.value) return
const data = {
shop_name: store.userInfo.merchantName,
carts: props.cart,
amount: props.amount,
remark: props.remark,
orderId: props.orderId
async function printHandle() {
// if (!isPrint.value) return
// const data = {
// shop_name: store.userInfo.merchantName,
// carts: props.cart,
// amount: props.amount,
// remark: props.remark,
// orderId: props.orderId
// }
// ipcRenderer.send('printerInfoSync', JSON.stringify(data))
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)
}
ipcRenderer.send('printerInfoSync', JSON.stringify(data))
}
// 订单已支付