对接订单打印小票

This commit is contained in:
gyq
2025-03-05 09:35:34 +08:00
parent 573dd88b24
commit db3fc1f6dc
22 changed files with 838 additions and 206 deletions

View File

@@ -9,19 +9,41 @@
<el-text class="t">({{ pendingCartNum }})</el-text>
</div>
<div class="number" @click="SelectVipUserRef.show()">
<el-icon class="icon">
<UserFilled />
</el-icon>
<el-text class="t">选择会员</el-text>
<div class="left">
<el-icon class="icon">
<UserFilled />
</el-icon>
<template v-if="!goodsStore.vipUserInfo.id">
<el-text class="t">选择会员</el-text>
</template>
<template v-else>
<div class="user_info" @click="goodsStore.vipUserInfo = ''">
<!-- <el-text class="n">{{ goodsStore.vipUserInfo.nickName }}</el-text> -->
<el-text class="p">{{ formatPhoneNumber(goodsStore.vipUserInfo.phone) }}</el-text>
</div>
</template>
</div>
<div class="icon_wrap">
<div class="u_icon" v-if="!goodsStore.vipUserInfo.id">
<el-icon class="i">
<ArrowRight />
</el-icon>
</div>
<div class="u_icon" v-else @click.stop="clearVipUserHandle">
<el-icon class="i">
<Close />
</el-icon>
</div>
</div>
</div>
<div class="select_user" @click="quickCashHandle">
<!-- <div class="select_user" @click="quickCashHandle">
<div class="left">
<el-icon class="icon" style="color: var(--el-color-warning);">
<WalletFilled />
</el-icon>
<el-text class="t">快捷收银</el-text>
</div>
</div>
</div> -->
<!-- <div class="select_user">
<div class="left">
<el-icon class="icon">
@@ -62,7 +84,10 @@
<el-empty description="请选择商品" />
</div>
<div class="order_list_wrap">
<div class="order_title" v-if="goodsStore.orderList.length">历史下单</div>
<div class="order_title" :class="{ border: !goodsStore.cartList.length }"
v-if="goodsStore.orderList.length">
历史下单
</div>
<div class="order_list_item" v-for="(arr, index) in goodsStore.orderList" :key="index">
<div class="order_num">{{ `${arr.orderNum}次下单` }}</div>
<CartItem type="order" :border="false" :item="item" :index="index" :i="i" :key="item.id"
@@ -105,18 +130,14 @@
<div class="btn" v-if="store.shopInfo.registerType == 'after'">
<el-button type="primary" style="width: 100%;" :disabled="!goodsStore.cartList.length"
v-loading="createOrderLoading" @click="createOrderHandle(0)">
<template v-if="!createOrderLoading">
仅下单</template>
<template v-else>下单中...</template>
仅下单
</el-button>
</div>
<div class="btn">
<el-button type="primary" style="width: 100%;"
:disabled="!goodsStore.cartList.length && !goodsStore.orderList.length" v-loading="createOrderLoading"
@click="createOrderHandle(1)">
<template v-if="!createOrderLoading">
去结算</template>
<template v-else>下单中...</template>
去结算
</el-button>
</div>
</div>
@@ -171,7 +192,7 @@ import pendingCartModal from "@/views/home/components/pendingCartModal.vue";
import tableMerging from '@/views/home/components/tableMerging.vue'
import CartItem from './components/cartItem.vue'
import useStorage from '@/utils/useStorage'
import { formatDecimal } from '@/utils/index.js'
import { formatDecimal, formatPhoneNumber } from '@/utils/index.js'
import { useGoods } from '@/store/goods.js'
import { queryShopInfo, staffPermission } from '@/api/user.js'
@@ -253,13 +274,12 @@ async function createOrderHandle(t = 0) {
if (t == 1) {
settleAccountRef.value.show(t)
} else {
goodsStore.historyOrderAjax(res.tableCode)
}
// 订单已生成,清除购物车
goodsStore.clearCart()
// 清除购物车,更新历史订单
goodsStore.updateOrderList()
} else {
goodsStore.calcCartInfo()
settleAccountRef.value.show(t)
}
} catch (error) {
@@ -320,6 +340,13 @@ function showTableMerging() {
let data = cartList.value.filter(item => item.placeNum)
tableMergingRef.value.show(data)
}
// 清除会员与会员价
function clearVipUserHandle() {
goodsStore.vipUserInfo = ''
goodsStore.showVipPrice = false
goodsStore.calcCartInfo()
}
</script>
<style scoped lang="scss">
@@ -336,7 +363,10 @@ function showTableMerging() {
font-size: 14px;
color: #999;
padding: 10px 0;
border-top: 1px solid #ececec;
&.border {
border-top: 1px solid #ececec;
}
}
.order_num {
@@ -383,8 +413,31 @@ function showTableMerging() {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
justify-content: space-between;
background-color: var(--el-color-info-light-7);
padding: 0 10px;
.left {
display: flex;
align-items: center;
}
.icon_wrap {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
.u_icon {
font-size: 20px;
color: #999;
.i {
display: flex;
}
}
}
.icon {
color: var(--el-color-primary);
@@ -395,6 +448,27 @@ function showTableMerging() {
font-size: var(--el-font-size-base);
margin-left: 4px;
}
.user_info {
flex: 1;
display: flex;
align-items: flex-start;
justify-content: flex-start;
flex-direction: column;
.n {
width: 100%;
flex: 1;
font-size: 14px;
}
.p {
width: 83px;
flex: 1;
color: #999;
font-size: 14px;
}
}
}
.select_user {