对接订单打印小票
This commit is contained in:
@@ -9,25 +9,25 @@
|
||||
<ArrowLeftBold />
|
||||
</el-icon>
|
||||
</div>
|
||||
<!-- <div class="info">
|
||||
<div class="info">
|
||||
<div class="master_id">
|
||||
<span>{{ props.masterId }}</span>
|
||||
<span class="member_info" v-if="global.orderMemberInfo.telephone">
|
||||
会员:{{ global.orderMemberInfo.telephone }}
|
||||
<span>{{ goodsStore.orderListInfo.tableCode }}</span>
|
||||
<span class="member_info" v-if="goodsStore.vipUserInfo.id">
|
||||
会员:{{ formatPhoneNumber(goodsStore.vipUserInfo.phone) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="btm">
|
||||
<span class="p">服务员:{{ store.userInfo.loginAccount || "暂无" }}</span>
|
||||
<span class="t">{{
|
||||
<span class="p">服务员:{{ store.userInfo.name || "暂无" }}</span>
|
||||
<!-- <span class="t">{{
|
||||
props.orderInfo.createdAt &&
|
||||
dayjs(props.orderInfo.createdAt).format("MM-DD HH:mm")
|
||||
}}</span>
|
||||
}}</span> -->
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="list_wrap card" style="margin-top: var(--el-font-size-base)">
|
||||
<SettleItem :list="cartList" />
|
||||
<SettleItem :list="goodsStore.orderList.map(item => item.goods).flat()" />
|
||||
<SettleItem :list="orderList" />
|
||||
</div>
|
||||
<div class="footer">
|
||||
<!-- <el-button icon="Edit"></el-button> -->
|
||||
@@ -43,8 +43,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pay_wrap">
|
||||
<payCard :amount="goodsStore.orderListInfo.orderAmount" :discount="propsDiscount"
|
||||
:orderId="goodsStore.orderListInfo.id" @paySuccess="paySuccess" @cancelDiscount="propsDiscount = 0" />
|
||||
<payCard :amount="cartInfo.totalAmount" :discount="propsDiscount" :orderId="goodsStore.orderListInfo.id"
|
||||
@paySuccess="paySuccess" @cancelDiscount="propsDiscount = 0" />
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)">
|
||||
@@ -56,6 +56,13 @@
|
||||
<div class="tips">最低折扣比例:{{ staffDiscount }}</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠金额">
|
||||
<div>
|
||||
<el-input-number v-model="discount" :min="staffDiscount" :max="0.99" :step="0.1"
|
||||
:disabled="staffDiscount == 0" />
|
||||
<div class="tips">最低折扣比例:{{ staffDiscount }}</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="footer_wrap">
|
||||
<div class="btn">
|
||||
@@ -77,11 +84,12 @@ import payCard from "@/components/payCard/payCard.vue";
|
||||
import SettleItem from './settleItem.vue'
|
||||
import { print } from "@/api/pay";
|
||||
import { orderfindOrder, getStaffDiscount } from '@/api/order/index.js'
|
||||
import { shopStaffInfo } from '@/api/account.js'
|
||||
import { ElMessage } from "element-plus";
|
||||
import dayjs from "dayjs";
|
||||
import useStorage from '@/utils/useStorage'
|
||||
import { ipcRenderer } from "electron";
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
import { formatDecimal, formatPhoneNumber } from '@/utils/index.js'
|
||||
import receiptPrint from "@/components/lodop/receiptPrint.js";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
import { usePrint } from '@/store/print.js'
|
||||
@@ -98,10 +106,11 @@ const store = useUser();
|
||||
|
||||
const emit = defineEmits("paySuccess");
|
||||
|
||||
const printLoading = ref(false);
|
||||
const cartInfo = ref('')
|
||||
|
||||
const printLoading = ref(false);
|
||||
const showStaffDiscount = ref(false)
|
||||
const staffDiscount = ref(0)
|
||||
const staffDiscount = ref('')
|
||||
const discount = ref(0)
|
||||
const propsDiscount = ref(0)
|
||||
|
||||
@@ -130,6 +139,7 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const cartList = ref([])
|
||||
const orderList = ref([])
|
||||
const isPrint = ref(true);
|
||||
const discountLoading = ref(false)
|
||||
|
||||
@@ -137,7 +147,7 @@ const discountLoading = ref(false)
|
||||
async function showStaffDiscountHandle() {
|
||||
try {
|
||||
discountLoading.value = true
|
||||
await staffPermission('yun_xu_da_zhe')
|
||||
// await staffPermission('yun_xu_da_zhe')
|
||||
await getStaffDiscountAjax()
|
||||
discountLoading.value = false
|
||||
if (staffDiscount.value <= 0) {
|
||||
@@ -145,7 +155,7 @@ async function showStaffDiscountHandle() {
|
||||
} else {
|
||||
showStaffDiscount.value = true
|
||||
discountLoading.value = false
|
||||
global.updateData(false)
|
||||
// global.updateData(false)
|
||||
}
|
||||
} catch (error) {
|
||||
discountLoading.value = false
|
||||
@@ -156,12 +166,13 @@ async function showStaffDiscountHandle() {
|
||||
// 获取员工折扣
|
||||
async function getStaffDiscountAjax() {
|
||||
try {
|
||||
const res = await getStaffDiscount({
|
||||
orderId: props.orderInfo.id,
|
||||
staffId: store.userInfo.staffId
|
||||
})
|
||||
staffDiscount.value = res
|
||||
discount.value = res
|
||||
const res = await shopStaffInfo()
|
||||
if (res.data) {
|
||||
staffDiscount.value = res
|
||||
discount.value = res
|
||||
} else {
|
||||
Promise.reject()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
@@ -284,12 +295,17 @@ async function printOrderLable() {
|
||||
function paySuccess() {
|
||||
propsDiscount.value = 0
|
||||
dialogVisible.value = false;
|
||||
|
||||
ElMessage.success('支付成功')
|
||||
goodsStore.successClearCart()
|
||||
// printOrderLable()
|
||||
// emit("paySuccess");
|
||||
}
|
||||
|
||||
function show(t) {
|
||||
dialogVisible.value = true;
|
||||
cartInfo.value = { ...goodsStore.cartInfo }
|
||||
orderList.value = [...goodsStore.orderList.map(item => item.goods).flat()]
|
||||
if (t = 1) cartList.value = [...goodsStore.cartList];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user