优化会员支付,已会员价结算

This commit is contained in:
gyq
2025-03-19 18:29:46 +08:00
parent a101cc4fb7
commit 87e8976353
11 changed files with 177 additions and 70 deletions

View File

@@ -18,10 +18,7 @@
</div>
<div class="btm">
<span class="p">服务员{{ store.userInfo.name || "暂无" }}</span>
<!-- <span class="t">{{
props.orderInfo.createdAt &&
dayjs(props.orderInfo.createdAt).format("MM-DD HH:mm")
}}</span> -->
<span class="t">{{ dayjs().format("M月D日 HH:mm") }}</span>
</div>
</div>
</div>
@@ -88,7 +85,7 @@ import payCard from "@/components/payCard/payCard.vue";
import SettleItem from './settleItem.vue'
import { print } from "@/api/pay";
import { shopStaffInfo } from '@/api/account.js'
import { ElMessage } from "element-plus";
import { dayjs, ElMessage } from "element-plus";
import { formatPhoneNumber, getOrderByIdAjax, commOrderPrintData } from '@/utils/index.js'
import useStorage from '@/utils/useStorage.js'
import { useGlobal } from '@/store/global.js'
@@ -136,7 +133,6 @@ const props = defineProps({
}
});
const cartList = ref([])
const orderList = ref([])
const isPrint = ref(1);
const discountLoading = ref(false)
@@ -196,19 +192,24 @@ const printHandle = _.throttle(async function () {
// 打印订单标签
async function printOrderLable(isBefore = false) {
try {
if (printStore.deviceNoteList.length) {
// 使用本地打印机打印
const data = await getOrderByIdAjax(goodsStore.orderListInfo.id);
let orderId = goodsStore.orderListInfo.id
const data = await getOrderByIdAjax(orderId);
if (printStore.deviceLableList.length) {
if (!isBefore) {
// 预结算不打印标签
printStore.labelPrint(commOrderPrintData(data))
}
}
if (printStore.deviceNoteList.length) {
// 使用本地打印机打印
printStore.pushReceiptData(commOrderPrintData({ ...data, isBefore: isBefore }));
} else {
// 本地没有可用打印机使用云打印机
await orderPrint({
type: isBefore ? 1 : 0,
id: goodsStore.orderListInfo.id,
id: orderId,
});
printLoading.value = false;
ElMessage.success(`云打印${isBefore ? '预' : ''}结算单成功`);
@@ -220,10 +221,10 @@ async function printOrderLable(isBefore = false) {
// 订单已支付
function paySuccess() {
if (isPrint.value) printOrderLable()
emits('success')
dialogVisible.value = false;
ElMessage.success('支付成功')
if (isPrint.value) printOrderLable()
useStorage.del('tableCode')
socket.cartInit()
goodsStore.successClearCart()
@@ -237,9 +238,6 @@ function show(t) {
console.log(cartInfo.value);
orderList.value = [...goodsStore.cartList, ...goodsStore.orderList.map(item => item.goods).flat()]
console.log('orderList===', orderList.value);
// 每次初始化paycard
setTimeout(() => {
payCardRef.value.reset()
@@ -304,11 +302,12 @@ defineExpose({
$padding: 10px;
.master_id {
height: 77px;
font-size: calc(var(--el-font-size-base) + 10px);
border-bottom: 1px solid #ececec;
padding: $padding 0;
display: flex;
align-items: center;
flex-direction: column;
justify-content: space-between;
.member_info {
@@ -336,7 +335,7 @@ defineExpose({
.list_wrap {
padding: 0 var(--el-font-size-base);
height: calc(100vh - 200px);
height: calc(100vh - 222px);
overflow-y: auto;
}