对接支付优惠
This commit is contained in:
@@ -9,10 +9,16 @@
|
||||
<div class="d_content">
|
||||
<div class="d_list">
|
||||
<el-form :model="form" label-position="left" label-width="60%">
|
||||
<el-form-item label="设备名称">
|
||||
<el-input v-model="form.name" placeholder="请输入设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="打印机品牌">
|
||||
<el-input v-model="form.contentType" placeholder="请输入打印机品牌"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="设备尺寸">
|
||||
<el-select v-model="form.config.width">
|
||||
<el-option label="58mm" value="58"></el-option>
|
||||
<el-option label="80mm" value="80"></el-option>
|
||||
<el-select v-model="form.receiptSize">
|
||||
<el-option label="58mm" value="58mm"></el-option>
|
||||
<el-option label="80mm" value="80mm"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型">
|
||||
@@ -22,15 +28,12 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择设备">
|
||||
<el-select v-model="form.config.deviceName">
|
||||
<el-select v-model="form.address">
|
||||
<el-option :label="item.name" :value="item.name" v-for="item in printList" :key="item.name"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称">
|
||||
<el-input v-model="form.name" placeholder="请输入设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="打印份数">
|
||||
<el-select v-model="form.config.printerNum">
|
||||
<!-- <el-form-item label="打印份数">
|
||||
<el-select v-model="form.printQty">
|
||||
<el-option :label="item" :value="item" v-for="item in 4" :key="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -56,13 +59,15 @@
|
||||
<el-select v-model="form.config.feet">
|
||||
<el-option :label="`${item}行`" :value="`${item}`" v-for="item in feets" :key="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="menu_wrap">
|
||||
<div class="print_view">
|
||||
<div class="title t1">{{ printData.shop_name }}</div>
|
||||
<div class="title t2">预结算单【{{ printData.orderInfo.masterId }}】</div>
|
||||
<div class="title t2">
|
||||
预结算单【{{ printData.orderInfo.masterId }}】
|
||||
</div>
|
||||
<div class="row">订单号:{{ printData.orderInfo.orderNo }}</div>
|
||||
<div class="row">交易时间:{{ printData.createdAt }}</div>
|
||||
<div class="row">收银员:{{ printData.loginAccount }}</div>
|
||||
@@ -96,17 +101,17 @@
|
||||
<div class="line"></div>
|
||||
<div class="row">备注:{{ printData.remark }}</div>
|
||||
<div class="row">打印时间:{{ printData.printTime }}</div>
|
||||
<div class="btn_wrap">
|
||||
<div class="btn">
|
||||
<el-button plain style="width: 100%" :loading="printDataLoading" @click="printHandle">
|
||||
打印测试小票
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%" :loading="loading" @click="submitHandle">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn_wrap">
|
||||
<div class="btn">
|
||||
<el-button plain style="width: 100%" :loading="printDataLoading" @click="printHandle">
|
||||
打印测试小票
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%" :loading="loading" @click="submitHandle">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -115,15 +120,15 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs'
|
||||
import dayjs from "dayjs";
|
||||
import { ipcRenderer } from "electron";
|
||||
import { onMounted, reactive, ref } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { tbPrintMachinePost, tbPrintMachineDetail } from "@/api/device";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { Loading } from "element-plus/es/components/loading/src/service";
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { printerAdd, printerDetail } from "@/api/account.js";
|
||||
|
||||
const printStore = usePrint();
|
||||
const store = useUser();
|
||||
@@ -136,59 +141,57 @@ const feets = ref([0, 1, 2, 3, 4, 5, 8]);
|
||||
const loading = ref(false);
|
||||
const form = ref({
|
||||
id: "",
|
||||
contentType: "",
|
||||
connectionType: "USB",
|
||||
config: {
|
||||
deviceName: "",
|
||||
width: "58", // 设备尺寸毫米mm
|
||||
printerNum: 1, //打印份数
|
||||
categoryList: [], // 商品分类
|
||||
model: "normal", // 出品模式,
|
||||
feet: "2",
|
||||
autoCut: 0,
|
||||
printSub: 1,
|
||||
},
|
||||
name: "小票打印机",
|
||||
subType: "cash", // 打印类型
|
||||
status: 1,
|
||||
sort: "",
|
||||
shopId: store.userInfo.shopId,
|
||||
name: '', // 设备名称
|
||||
connectionType: 'USB', // 现在打印机支持USB 和 网络、蓝牙
|
||||
address: '', // 打印机名称
|
||||
port: '', // 端口
|
||||
subType: 'cash', // 打印类型(分类)label标签cash小票kitchen出品
|
||||
contentType: '', // 打印机品牌
|
||||
categoryIds: [], // 打印分类Id
|
||||
categoryList: [], // 分类
|
||||
sort: '',
|
||||
receiptSize: '58mm', // 小票尺寸 58mm 80mm
|
||||
classifyPrint: 1, // 分类打印 0-所有 1-部分分类 2-部分商品
|
||||
printQty: '', // 打印数量 c1m1^2 = 顾客+商家[2张] m1^1 = 商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张]
|
||||
printMethod: 'all', // 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」queue-仅打印排队取号
|
||||
printType: [], // 打印类型,JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
|
||||
status: 1
|
||||
});
|
||||
|
||||
const printDataLoading = ref(false)
|
||||
const printDataLoading = ref(false);
|
||||
const printData = reactive({
|
||||
shop_name: store.userInfo.shopName,
|
||||
loginAccount: store.userInfo.loginAccount,
|
||||
shop_name: '',
|
||||
loginAccount: '',
|
||||
isBefore: true,
|
||||
carts: [
|
||||
{
|
||||
id: 1,
|
||||
name: '【测试】娃哈哈矿泉水',
|
||||
skuName: '500ml',
|
||||
salePrice: '1.0',
|
||||
number: '10',
|
||||
totalAmount: '10'
|
||||
name: "【测试】娃哈哈矿泉水",
|
||||
skuName: "500ml",
|
||||
salePrice: "1.0",
|
||||
number: "10",
|
||||
totalAmount: "10",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '【测试】柠檬奶茶',
|
||||
skuName: '加冰、加珍珠',
|
||||
salePrice: '10',
|
||||
number: '2',
|
||||
totalAmount: '20'
|
||||
}
|
||||
name: "【测试】柠檬奶茶",
|
||||
skuName: "加冰、加珍珠",
|
||||
salePrice: "10",
|
||||
number: "2",
|
||||
totalAmount: "20",
|
||||
},
|
||||
],
|
||||
amount: '30.00',
|
||||
discountAmount: '30.00',
|
||||
amount: "30.00",
|
||||
discountAmount: "30.00",
|
||||
discount: 0,
|
||||
remark: '给我多放点辣椒,谢谢老板',
|
||||
remark: "给我多放点辣椒,谢谢老板",
|
||||
orderInfo: {
|
||||
masterId: '#002',
|
||||
orderNo: '202404021023542223445'
|
||||
masterId: "#002",
|
||||
orderNo: "202404021023542223445",
|
||||
},
|
||||
deviceName: '',
|
||||
createdAt: '2024-04-02 10:15',
|
||||
printTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
deviceName: "",
|
||||
createdAt: "2024-04-02 10:15",
|
||||
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||
});
|
||||
|
||||
// 获取打印机列表
|
||||
@@ -201,33 +204,33 @@ function getPrintList() {
|
||||
|
||||
// 测试打印
|
||||
function printHandle() {
|
||||
if (!form.value.config.deviceName) {
|
||||
if (!form.value.address) {
|
||||
ElMessage.warning("请选择打印设备");
|
||||
return;
|
||||
}
|
||||
printDataLoading.value = true
|
||||
printData.deviceName = form.value.config.deviceName
|
||||
printData.printTime = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||
printStore.pushReceiptData(printData, false)
|
||||
printDataLoading.value = true;
|
||||
printData.shop_name = store.shopInfo.shopName
|
||||
printData.loginAccount = store.userInfo.name
|
||||
printData.deviceName = form.value.address;
|
||||
printData.printTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
||||
printStore.pushReceiptData(printData, false);
|
||||
setTimeout(() => {
|
||||
printDataLoading.value = false
|
||||
}, 1500)
|
||||
printDataLoading.value = false;
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
// 提交打印机
|
||||
async function submitHandle() {
|
||||
try {
|
||||
if (!form.value.config.deviceName) {
|
||||
if (!form.value.address) {
|
||||
ElMessage.warning("请选择打印设备");
|
||||
return;
|
||||
}
|
||||
Loading.value = true;
|
||||
await tbPrintMachinePost(form.value, form.value.id ? "put" : "post");
|
||||
await printerAdd(form.value, form.value.id ? "put" : "post");
|
||||
Loading.value = false;
|
||||
ElMessage.success(form.value.id ? "编辑成功" : "添加成功");
|
||||
|
||||
printStore.init();
|
||||
|
||||
router.back();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -235,9 +238,9 @@ async function submitHandle() {
|
||||
}
|
||||
|
||||
// 查询打印机详情
|
||||
async function tbPrintMachineDetailAjax() {
|
||||
async function tbPrintMachineDetailAjax(id) {
|
||||
try {
|
||||
const res = await tbPrintMachineDetail(route.query.id);
|
||||
const res = await printerDetail({ id: id });
|
||||
form.value = res;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -245,6 +248,9 @@ async function tbPrintMachineDetailAjax() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
printData.shop_name = store.shopInfo.shopName
|
||||
printData.loginAccount = store.userInfo.name
|
||||
|
||||
getPrintList();
|
||||
if (route.query.id) {
|
||||
tbPrintMachineDetailAjax(route.query.id);
|
||||
@@ -282,13 +288,26 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.menu_wrap {
|
||||
flex: 1.5;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
margin-left: 15px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 0 15px;
|
||||
|
||||
.btn_wrap {
|
||||
display: flex;
|
||||
gap: var(--el-font-size-base);
|
||||
padding: var(--el-font-size-base) 0;
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.print_view {
|
||||
flex: 1;
|
||||
padding: 20px 0;
|
||||
|
||||
.title {
|
||||
@@ -314,15 +333,6 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.btn_wrap {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
padding: 20px 0;
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
margin: 10px 0;
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
<div class="d_content">
|
||||
<div class="d_list">
|
||||
<el-form :model="form" label-position="left" label-width="60%">
|
||||
<!-- <el-form-item label="设备尺寸">
|
||||
<el-select v-model="form.config.width">
|
||||
<el-option label="58mm" value="58"></el-option>
|
||||
<el-option label="80mm" value="80"></el-option>
|
||||
<el-form-item label="设备名称">
|
||||
<el-input v-model="form.name" placeholder="请输入设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备尺寸">
|
||||
<el-select v-model="form.receiptSize">
|
||||
<el-option label="58mm" value="58mm"></el-option>
|
||||
<el-option label="80mm" value="80mm"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型">
|
||||
<el-select v-model="form.connectionType">
|
||||
<el-option label="USB" value="USB"></el-option>
|
||||
@@ -22,30 +25,16 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择设备">
|
||||
<el-select v-model="form.config.deviceName">
|
||||
<el-select v-model="form.address">
|
||||
<el-option :label="item.name" :value="item.name" v-for="item in printList" :key="item.name"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称">
|
||||
<el-input v-model="form.name" placeholder="请输入设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="打印份数">
|
||||
<el-select v-model="form.config.printerNum">
|
||||
<el-option :label="item" :value="item" v-for="item in 4" :key="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品模式">
|
||||
<el-select v-model="form.config.model">
|
||||
<el-option label="普通出单" value="normal"></el-option>
|
||||
<el-option label="分类出单" value="category"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类">
|
||||
<div style="cursor: pointer" @click="classifyRef.show()">
|
||||
<span style="color: #409eff" v-for="item in form.config.categoryList">
|
||||
{{ item.name }},
|
||||
<span style="color: #409eff" v-if="form.categoryList.length">
|
||||
{{form.categoryList.map(item => item.name).join(',')}}
|
||||
</span>
|
||||
<span style="color: #e65d6e" v-if="!form.config.categoryList.length">
|
||||
<span style="color: #e65d6e" v-else>
|
||||
请选择分类
|
||||
</span>
|
||||
</div>
|
||||
@@ -78,7 +67,7 @@
|
||||
<div class="print_view">
|
||||
<canvas class="ewm" ref="canvasRef"></canvas>
|
||||
<div class="header">
|
||||
<img class="logo" :src="shopInfo.info.ticketLogo" />
|
||||
<img class="logo" :src="printData.ticketLogo" />
|
||||
<!-- <span class="title">双屿Pisces</span> -->
|
||||
</div>
|
||||
<div class="number_wrap">
|
||||
@@ -107,7 +96,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<classify ref="classifyRef" @success="(e) => (form.config.categoryList = e)" />
|
||||
<classify ref="classifyRef" @success="(e) => (form.categoryList = e)" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -116,21 +105,19 @@ import { ipcRenderer } from "electron";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { ElMessage, dayjs } from "element-plus";
|
||||
import { tbPrintMachinePost, tbPrintMachineDetail } from "@/api/device";
|
||||
import { printerAdd, printerDetail } from "@/api/account.js";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { Loading } from "element-plus/es/components/loading/src/service";
|
||||
import classify from "@/components/classify/index.vue";
|
||||
import QRCode from 'qrcode'
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { useShop } from "@/store/shop.js";
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
|
||||
const goodsStore = useGoods()
|
||||
const printStore = usePrint();
|
||||
|
||||
const store = useUser();
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const shopInfo = useShop();
|
||||
|
||||
const classifyRef = ref(null);
|
||||
const printList = ref([]);
|
||||
@@ -138,23 +125,21 @@ const feets = ref([0, 1, 2, 3, 4, 5, 8]);
|
||||
const loading = ref(false);
|
||||
const form = ref({
|
||||
id: "",
|
||||
contentType: "",
|
||||
connectionType: "USB",
|
||||
config: {
|
||||
deviceName: "",
|
||||
width: "40", // 设备尺寸毫米mm
|
||||
printerNum: 1, //打印份数
|
||||
categoryList: [], // 商品分类
|
||||
model: "normal", // 出品模式,
|
||||
feet: "2",
|
||||
autoCut: 0,
|
||||
printSub: 1,
|
||||
},
|
||||
name: "标签打印机",
|
||||
subType: "label", // 打印类型
|
||||
status: 1,
|
||||
sort: "",
|
||||
shopId: store.userInfo.shopId,
|
||||
name: '', // 设备名称
|
||||
connectionType: 'USB', // 现在打印机支持USB 和 网络、蓝牙
|
||||
address: '', // 打印机名称
|
||||
port: '', // 端口
|
||||
subType: 'label', // 打印类型(分类)label标签cash小票kitchen出品
|
||||
contentType: '', // 打印机品牌
|
||||
categoryIds: [], // 打印分类Id
|
||||
categoryList: [], // 分类
|
||||
sort: '',
|
||||
receiptSize: '58mm', // 小票尺寸 58mm 80mm
|
||||
classifyPrint: 1, // 分类打印 0-所有 1-部分分类 2-部分商品
|
||||
printQty: '', // 打印数量 c1m1^2 = 顾客+商家[2张] m1^1 = 商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张]
|
||||
printMethod: 'all', // 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」queue-仅打印排队取号
|
||||
printType: [], // 打印类型,JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
|
||||
status: 1
|
||||
});
|
||||
|
||||
const canvasRef = ref(null)
|
||||
@@ -165,7 +150,7 @@ const printData = ref({
|
||||
skuName: '测试、加珍珠',
|
||||
masterId: '#A9',
|
||||
createdAt: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
ticketLogo: shopInfo.info.ticketLogo,
|
||||
ticketLogo: store.shopInfo.ticketLogo,
|
||||
})
|
||||
|
||||
// 获取打印机列表
|
||||
@@ -178,11 +163,11 @@ function getPrintList() {
|
||||
|
||||
// 测试打印
|
||||
const printHandle = _.throttle(function () {
|
||||
if (!form.value.config.deviceName) {
|
||||
if (!form.value.address) {
|
||||
ElMessage.error("请选择打印设备");
|
||||
return;
|
||||
}
|
||||
printData.value.deviceName = form.value.config.deviceName
|
||||
printData.value.deviceName = form.value.address
|
||||
ipcRenderer.send(
|
||||
"printerTagSync",
|
||||
JSON.stringify(printData.value)
|
||||
@@ -192,12 +177,13 @@ const printHandle = _.throttle(function () {
|
||||
// 提交打印机
|
||||
async function submitHandle() {
|
||||
try {
|
||||
if (!form.value.config.deviceName) {
|
||||
if (!form.value.address) {
|
||||
ElMessage.warning("请选择打印设备");
|
||||
return;
|
||||
}
|
||||
Loading.value = true;
|
||||
await tbPrintMachinePost(form.value, form.value.id ? "put" : "post");
|
||||
form.value.categoryIds = form.value.categoryList.map(item => item.id)
|
||||
await printerAdd(form.value, form.value.id ? "put" : "post");
|
||||
Loading.value = false;
|
||||
ElMessage.success(form.value.id ? "编辑成功" : "添加成功");
|
||||
printStore.init();
|
||||
@@ -210,9 +196,21 @@ async function submitHandle() {
|
||||
// 查询打印机详情
|
||||
async function tbPrintMachineDetailAjax() {
|
||||
try {
|
||||
const res = await tbPrintMachineDetail(route.query.id);
|
||||
const res = await printerDetail({ id: route.query.id });
|
||||
form.value = res;
|
||||
printData.value.deviceName = res.config.deviceName
|
||||
|
||||
let arr = []
|
||||
goodsStore.originCategoryList.map(item => {
|
||||
res.categoryList.map(val => {
|
||||
if (item.id == val) {
|
||||
arr.push({
|
||||
id: item.id,
|
||||
name: item.name
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
form.value.categoryList = arr
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="name">{{ item.name }}</div>
|
||||
<div class="xh">{{ item.config.deviceName }}</div>
|
||||
<div class="xh">{{ item.address }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
@@ -114,20 +114,14 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
tbPrintMachineGet,
|
||||
tbPrintMachineDelete,
|
||||
tbPrintMachinePost,
|
||||
} from "@/api/device";
|
||||
import { printerList, printerAdd } from '@/api/account.js'
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import icons from "./icons";
|
||||
import { usePrint } from "@/store/print.js";
|
||||
|
||||
const printStore = usePrint();
|
||||
const store = useUser();
|
||||
|
||||
const router = useRouter();
|
||||
const list = ref([]);
|
||||
@@ -142,7 +136,7 @@ const deviceRoute = ref({
|
||||
|
||||
async function statusChange(e, item) {
|
||||
try {
|
||||
await tbPrintMachinePost(item, "put");
|
||||
await printerAdd(item, "put");
|
||||
tbPrintMachineGetAjax();
|
||||
printStore.init();
|
||||
} catch (error) {
|
||||
@@ -160,7 +154,7 @@ function showDelete(item) {
|
||||
async function tbPrintMachineDeleteAjax() {
|
||||
try {
|
||||
delLoading.value = true;
|
||||
await tbPrintMachineDelete({ id: deleteId.value });
|
||||
await printerAdd({ id: deleteId.value }, 'delete');
|
||||
delLoading.value = false;
|
||||
dialogVisible.value = false;
|
||||
ElMessage.success("删除成功");
|
||||
@@ -174,12 +168,8 @@ async function tbPrintMachineDeleteAjax() {
|
||||
// 获取打印机列表
|
||||
async function tbPrintMachineGetAjax() {
|
||||
try {
|
||||
const res = await tbPrintMachineGet({
|
||||
shopId: store.userInfo.shopId,
|
||||
page: 0,
|
||||
pageSize: 100,
|
||||
});
|
||||
list.value = res.list;
|
||||
const res = await printerList();
|
||||
list.value = res.records;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- 结算订单 -->
|
||||
<template>
|
||||
<el-drawer size="100%" :with-header="false" direction="btt" v-model="dialogVisible" @closed="drawerClose">
|
||||
<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">
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="master_id">
|
||||
<span>{{ goodsStore.orderListInfo.tableCode }}</span>
|
||||
<span>{{ goodsStore.orderListInfo.tableCode || store.shopInfo.shopName }}</span>
|
||||
<span class="member_info" v-if="goodsStore.vipUserInfo.id">
|
||||
会员:{{ formatPhoneNumber(goodsStore.vipUserInfo.phone) }}
|
||||
</span>
|
||||
@@ -26,8 +26,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="list_wrap card" style="margin-top: var(--el-font-size-base)">
|
||||
<SettleItem :list="cartList" />
|
||||
<!-- <SettleItem :list="cartList" /> -->
|
||||
<SettleItem :list="orderList" />
|
||||
<SettleItem
|
||||
:list="[{ id: 'tableFee', product_name: '客座费', number: goodsStore.tableInfo.num, lowPrice: store.shopInfo.tableFee }]"
|
||||
v-if="!store.shopInfo.isTableFee && goodsStore.tableInfo.name && (goodsStore.cartList.length || goodsStore.orderList.length)" />
|
||||
</div>
|
||||
<div class="footer">
|
||||
<!-- <el-button icon="Edit"></el-button> -->
|
||||
@@ -43,11 +46,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="pay_wrap">
|
||||
<payCard :amount="cartInfo.totalAmount" :discount="propsDiscount" :orderId="goodsStore.orderListInfo.id"
|
||||
@paySuccess="paySuccess" @cancelDiscount="propsDiscount = 0" />
|
||||
<payCard ref="payCardRef" :orderList="orderList" :amount="cartInfo.totalAmount"
|
||||
:orderId="goodsStore.orderListInfo.id" @paySuccess="paySuccess" />
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)">
|
||||
<!-- <el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)">
|
||||
<el-form>
|
||||
<el-form-item label="折扣比例">
|
||||
<div>
|
||||
@@ -72,25 +75,21 @@
|
||||
<el-button type="primary" style="width: 100%;" @click="discountConfirm">确认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-dialog> -->
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import _ from 'lodash'
|
||||
import { onMounted, ref } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useUser } from "@/store/user.js";
|
||||
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, formatPhoneNumber } from '@/utils/index.js'
|
||||
import receiptPrint from "@/components/lodop/receiptPrint.js";
|
||||
import { formatPhoneNumber, getOrderByIdAjax, commOrderPrintData } from '@/utils/index.js'
|
||||
import useStorage from '@/utils/useStorage.js'
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
import { usePrint } from '@/store/print.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
@@ -112,7 +111,6 @@ const printLoading = ref(false);
|
||||
const showStaffDiscount = ref(false)
|
||||
const staffDiscount = ref('')
|
||||
const discount = ref(0)
|
||||
const propsDiscount = ref(0)
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const props = defineProps({
|
||||
@@ -178,106 +176,25 @@ async function getStaffDiscountAjax() {
|
||||
}
|
||||
}
|
||||
|
||||
// 确认折扣
|
||||
function discountConfirm() {
|
||||
if (discount.value >= staffDiscount.value) {
|
||||
propsDiscount.value = discount.value
|
||||
}
|
||||
showStaffDiscount.value = false
|
||||
}
|
||||
|
||||
// 关闭结算弹窗
|
||||
function drawerClose() {
|
||||
propsDiscount.value = 0
|
||||
}
|
||||
|
||||
// 预打印操作
|
||||
const printHandle = _.throttle(async function () {
|
||||
try {
|
||||
if (!isPrint.value) return;
|
||||
printLoading.value = true;
|
||||
const data = {
|
||||
shop_name: store.userInfo.shopName,
|
||||
loginAccount: store.userInfo.loginAccount,
|
||||
isBefore: true,
|
||||
carts: cartList.value,
|
||||
amount: formatDecimal(props.amount),
|
||||
discountAmount: propsDiscount.value > 0 ? formatDecimal(props.amount * propsDiscount.value) : formatDecimal(props.amount),
|
||||
discount: formatDecimal(propsDiscount.value * 10, 1, true),
|
||||
remark: props.remark,
|
||||
orderInfo: props.orderInfo,
|
||||
createdAt: dayjs(props.orderInfo.createdAt).format("YYYY-MM-DD HH:mm:ss"),
|
||||
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||
};
|
||||
printStore.labelPrint(data)
|
||||
setTimeout(() => {
|
||||
printLoading.value = false;
|
||||
}, 1500)
|
||||
if (printStore.deviceNoteList.length) {
|
||||
printStore.pushReceiptData(data)
|
||||
} else {
|
||||
await print({
|
||||
type: "normal",
|
||||
ispre: true,
|
||||
orderId: props.orderInfo.id,
|
||||
});
|
||||
printLoading.value = false;
|
||||
ElMessage.success("打印成功");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
printLoading.value = true
|
||||
await printOrderLable(true)
|
||||
setTimeout(() => {
|
||||
printLoading.value = false
|
||||
}, 1000)
|
||||
}, 1500, { leading: true, trailing: false })
|
||||
|
||||
// 打印订单标签
|
||||
async function printOrderLable() {
|
||||
async function printOrderLable(isBefore = false) {
|
||||
try {
|
||||
if (!isPrint.value) return
|
||||
const res = await orderfindOrder({
|
||||
shopId: store.userInfo.shopId,
|
||||
status: '',
|
||||
size: 10,
|
||||
page: 1,
|
||||
orderNo: props.orderInfo.orderNo
|
||||
})
|
||||
|
||||
const printLabelOrder = res.list[0]
|
||||
|
||||
const data = {
|
||||
shop_name: store.userInfo.shopName,
|
||||
loginAccount: store.userInfo.loginAccount,
|
||||
carts: [],
|
||||
amount: formatDecimal(printLabelOrder.orderAmount),
|
||||
discountAmount: printLabelOrder.discountRatio > 0 ? formatDecimal(printLabelOrder.orderAmount - printLabelOrder.discountAmount) : formatDecimal(printLabelOrder.orderAmount),
|
||||
discount: formatDecimal(printLabelOrder.discountRatio * 10, 1, true) || 0,
|
||||
remark: printLabelOrder.remark,
|
||||
orderInfo: printLabelOrder,
|
||||
outNumber: printLabelOrder.outNumber,
|
||||
createdAt: dayjs(printLabelOrder.createdAt).format(
|
||||
"YYYY-MM-DD HH:mm:ss"
|
||||
),
|
||||
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||
}
|
||||
printLabelOrder.skuInfos.map(item => {
|
||||
data.carts.push(
|
||||
{
|
||||
categoryId: item.categoryId,
|
||||
name: item.productName,
|
||||
number: item.num,
|
||||
skuName: item.productSkuName,
|
||||
salePrice: formatDecimal(item.price),
|
||||
totalAmount: formatDecimal(item.num * item.price),
|
||||
proGroupInfo: item.proGroupInfo
|
||||
}
|
||||
)
|
||||
})
|
||||
// 打印标签
|
||||
printStore.labelPrint(data)
|
||||
|
||||
if (printStore.deviceNoteList.length) {
|
||||
// 打印小票
|
||||
printStore.pushReceiptData(data)
|
||||
// 使用本地打印机打印
|
||||
const data = await getOrderByIdAjax(goodsStore.orderListInfo.id);
|
||||
printStore.labelPrint(commOrderPrintData(data))
|
||||
printStore.pushReceiptData(commOrderPrintData({ ...data, isBefore: isBefore }));
|
||||
} else {
|
||||
// 本地没有可用打印机使用云打印机
|
||||
await print({
|
||||
type: "normal",
|
||||
ispre: true,
|
||||
@@ -293,20 +210,29 @@ async function printOrderLable() {
|
||||
|
||||
// 订单已支付
|
||||
function paySuccess() {
|
||||
propsDiscount.value = 0
|
||||
dialogVisible.value = false;
|
||||
|
||||
ElMessage.success('支付成功')
|
||||
printOrderLable()
|
||||
useStorage.del('tableCode')
|
||||
goodsStore.successClearCart(!cartList.length)
|
||||
// printOrderLable()
|
||||
// emit("paySuccess");
|
||||
}
|
||||
|
||||
|
||||
const payCardRef = ref(null)
|
||||
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];
|
||||
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()
|
||||
}, 100)
|
||||
// if (t = 1) cartList.value = [...goodsStore.cartList];
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
||||
@@ -82,7 +82,6 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted } from 'vue'
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -91,10 +90,6 @@ const props = defineProps({
|
||||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
console.log('SettleItem===', props.list);
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -88,6 +88,9 @@
|
||||
v-if="goodsStore.orderList.length">
|
||||
历史下单
|
||||
</div>
|
||||
<CartItem
|
||||
:item="{ product_name: '客座费', number: goodsStore.tableInfo.num, lowPrice: store.shopInfo.tableFee, memberPrice: store.shopInfo.tableFee }"
|
||||
v-if="!store.shopInfo.isTableFee && goodsStore.tableInfo.name && (goodsStore.cartList.length || goodsStore.orderList.length)" />
|
||||
<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,7 +108,7 @@
|
||||
<div class="num_wrap_top">
|
||||
<div class="left" @click="allSelectedHandle" v-if="store.shopInfo.eatModel.includes('take-out')">
|
||||
<div class="selected">
|
||||
<div class="selected_round" v-if="!allSelected"></div>
|
||||
<div class="selected_round" v-if="!goodsStore.allSelected"></div>
|
||||
<el-icon class="icon" v-else>
|
||||
<CircleCheckFilled />
|
||||
</el-icon>
|
||||
@@ -168,19 +171,12 @@
|
||||
<!-- 检查版本升级 -->
|
||||
<updateDialog />
|
||||
<!-- 选择会员 -->
|
||||
<SelectVipUser ref="SelectVipUserRef" />
|
||||
<SelectVipUser ref="SelectVipUserRef" @success="selectUser" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "home",
|
||||
};
|
||||
</script>
|
||||
<script setup>
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { ref } from "vue";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
|
||||
import SelectVipUser from "@/components/selectVipUser.vue";
|
||||
import updateDialog from '@/components/updateDialog.vue'
|
||||
import remarkModal from "@/components/remarkModal.vue";
|
||||
@@ -191,23 +187,18 @@ import fastCashier from "@/views/home/components/fastCashier.vue";
|
||||
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, formatPhoneNumber } from '@/utils/index.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
|
||||
import { queryShopInfo, staffPermission } from '@/api/user.js'
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
import { createOrder } from '@/api/order.js'
|
||||
|
||||
// 商品列表
|
||||
import goods from "@/views/home/components/goods.vue";
|
||||
import member from "@/views/member/index.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useUser } from '@/store/user.js'
|
||||
|
||||
const SelectVipUserRef = ref(null)
|
||||
|
||||
|
||||
const goodsStore = useGoods()
|
||||
|
||||
const global = useGlobal()
|
||||
|
||||
|
||||
@@ -220,9 +211,6 @@ const pendingCartModalRef = ref(null);
|
||||
const settleAccountRef = ref(null);
|
||||
const fastCashierRef = ref(null);
|
||||
const tableMergingRef = ref(null)
|
||||
|
||||
const allSelected = ref(false);
|
||||
|
||||
const remark = ref("");
|
||||
const cartListActive = ref(0);
|
||||
const cartListActiveItem = ref({})
|
||||
@@ -234,6 +222,14 @@ const orderInfo = ref({});
|
||||
const createOrderLoading = ref(false);
|
||||
|
||||
|
||||
function selectUser(row) {
|
||||
goodsStore.vipUserInfo = { ...row }
|
||||
if (store.shopInfo.isMemberPrice && row.isVip) {
|
||||
goodsStore.showVipPrice = true
|
||||
goodsStore.calcCartInfo()
|
||||
}
|
||||
}
|
||||
|
||||
// 挂单量
|
||||
const pendingCartNum = ref(0);
|
||||
|
||||
@@ -255,19 +251,18 @@ async function createOrderHandle(t = 0) {
|
||||
orderId: goodsStore.orderListInfo.id || '', // 订单id
|
||||
shopId: store.shopInfo.id, // 店铺id
|
||||
seatNum: goodsStore.tableInfo.num || 0, // 用餐人数
|
||||
seatAmount: goodsStore.cartInfo.tableFee, // 餐位费
|
||||
packFee: goodsStore.cartInfo.packFee, // 打包费
|
||||
originAmount: formatDecimal(+goodsStore.cartInfo.totalAmount, 2, true), // 订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
tableCode: goodsStore.cartList[0].table_code, // 台桌号
|
||||
dineMode: allSelected.value ? store.shopInfo.eatModel.split(',')[1] : store.shopInfo.eatModel.split(',')[0], // 用餐方式
|
||||
dineMode: goodsStore.allSelected ? store.shopInfo.eatModel.split(',')[1] : store.shopInfo.eatModel.split(',')[0], // 用餐方式
|
||||
remark: remark.value, // 备注
|
||||
placeNum: (goodsStore.orderListInfo.placeNum || 0) + 1, // 下单次数
|
||||
waitCall: 0,//是否叫号
|
||||
userId: '', // 会员用户id
|
||||
vipPrice: 0, // 会员价
|
||||
waitCall: 0, // 是否叫号
|
||||
userId: goodsStore.vipUserInfo.userId, // 会员用户id
|
||||
}
|
||||
|
||||
createOrderLoading.value = true;
|
||||
goodsStore.calcCartInfo()
|
||||
const res = await createOrder(data)
|
||||
// 设置订单信息
|
||||
goodsStore.orderListInfo = res
|
||||
@@ -279,7 +274,6 @@ async function createOrderHandle(t = 0) {
|
||||
// 清除购物车,更新历史订单
|
||||
goodsStore.updateOrderList()
|
||||
} else {
|
||||
goodsStore.calcCartInfo()
|
||||
settleAccountRef.value.show(t)
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -321,7 +315,11 @@ function giftPackHandle(key, item) {
|
||||
|
||||
// 打包全选
|
||||
const allSelectedHandle = async () => {
|
||||
allSelected.value = !allSelected.value;
|
||||
if (goodsStore.allSelected) {
|
||||
goodsStore.allSelected = 0
|
||||
} else {
|
||||
goodsStore.allSelected = 1
|
||||
}
|
||||
};
|
||||
|
||||
// 购物车选中
|
||||
|
||||
@@ -145,9 +145,7 @@ const submitHandle = () => {
|
||||
loading.value = true;
|
||||
store
|
||||
.userlogin(form)
|
||||
.then(async (res) => {
|
||||
console.log(res);
|
||||
|
||||
.then(async (res) => {
|
||||
// 登录成功后保存商户号
|
||||
// useStorage.set('merchantLoginAccount', form.username)
|
||||
ElMessage.success("登录成功");
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="退款金额" prop="amount">
|
||||
<el-input-number v-model="form.amount" :min="0.01" :max="form.max" placeholder="请输入退款金额" />
|
||||
<el-input-number v-model="form.amount" :max="form.max" placeholder="请输入退款金额" />
|
||||
<div class="tips" v-if="refundItem.giftAmount - refundItem.giftRefundAmount > 0">
|
||||
注意:一旦退款,赠送金额{{ refundItem.giftAmount }}也将全额退还</div>
|
||||
注意:一旦退款,优先扣除赠送金额</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="退款说明">
|
||||
<el-input v-model="form.remark" placeholder="请输入退款说明" />
|
||||
|
||||
@@ -23,11 +23,7 @@
|
||||
<div class="item">小计</div>
|
||||
</div>
|
||||
<div class="table_content">
|
||||
<div
|
||||
class="table_row"
|
||||
v-for="item in orderInfo.cartList"
|
||||
:key="item.id"
|
||||
>
|
||||
<div class="table_row" v-for="item in orderInfo.cartList" :key="item.id">
|
||||
<div v-if="item.productType == 'package'">
|
||||
<div class="flex">
|
||||
<div class="item">
|
||||
@@ -37,11 +33,7 @@
|
||||
{{ formatDecimal(item.payAmount) }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex"
|
||||
v-for="val in item.proGroupInfo"
|
||||
:key="val.proId"
|
||||
>
|
||||
<div class="flex" v-for="val in item.proGroupInfo" :key="val.proId">
|
||||
<div class="item">>{{ val.proName }}</div>
|
||||
<div class="item">0.00</div>
|
||||
<div class="item">{{ val.number }}</div>
|
||||
@@ -84,21 +76,12 @@
|
||||
<template #footer>
|
||||
<div class="drawer_footer">
|
||||
<div class="btn">
|
||||
<el-button
|
||||
style="width: 100%"
|
||||
:loading="printLoading"
|
||||
@click="printHandle('label')"
|
||||
>
|
||||
<el-button style="width: 100%" :loading="printLoading" @click="printHandle('label')">
|
||||
打印标签
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button
|
||||
type="primary"
|
||||
style="width: 100%"
|
||||
:loading="printLoading"
|
||||
@click="printHandle('normal')"
|
||||
>
|
||||
<el-button type="primary" style="width: 100%" :loading="printLoading" @click="printHandle('normal')">
|
||||
打印小票
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -111,13 +94,11 @@
|
||||
import { ref } from "vue";
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { getOrderById } from "@/api/order.js";
|
||||
import {
|
||||
formatDecimal,
|
||||
getOrderByIdAjax,
|
||||
commOrderPrintData,
|
||||
} from "@/utils/index.js";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const userStore = useUser();
|
||||
const printStore = usePrint();
|
||||
@@ -135,6 +116,10 @@ function printHandle(type) {
|
||||
// 打印订单小票
|
||||
printStore.pushReceiptData(commOrderPrintData(orderInfo.value));
|
||||
break;
|
||||
case "label":
|
||||
// 打印标签小票
|
||||
printStore.labelPrint(commOrderPrintData(orderInfo.value));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -164,52 +149,66 @@ defineExpose({
|
||||
padding-top: 20px;
|
||||
padding-bottom: 50px;
|
||||
color: #333;
|
||||
|
||||
.header {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.line {
|
||||
margin: 14px 0;
|
||||
border-bottom: 1px dashed #666;
|
||||
}
|
||||
|
||||
.blod {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.row {
|
||||
margin-top: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.between {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table {
|
||||
--itemWidth: 45px;
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.item {
|
||||
&:nth-child(1) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
width: var(--itemWidth);
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
width: var(--itemWidth);
|
||||
}
|
||||
|
||||
&:nth-child(4) {
|
||||
width: var(--itemWidth);
|
||||
}
|
||||
}
|
||||
|
||||
.table_head {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.table_row {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
<div class="cart_list">
|
||||
<div class="item" v-for="item in cartList" :key="item.id">
|
||||
<div class="top">
|
||||
<span class="name">{{ item.name }}</span>
|
||||
<span class="n">x{{ item.number }}</span>
|
||||
<span class="p">¥{{ item.salePrice }}</span>
|
||||
<span class="name">{{ item.productName }}</span>
|
||||
<span class="n">x{{ item.num }}</span>
|
||||
<span class="p">¥{{ item.price }}</span>
|
||||
</div>
|
||||
<div class="tag_wrap" v-if="item.skuName">
|
||||
<div class="tag" v-for="item in item.skuName.split(',')">
|
||||
@@ -93,6 +93,7 @@ import settleAccount from "@/views/home/components/settleAccount.vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { clearTable } from '@/api/table.js'
|
||||
import { useGoods } from "@/store/goods.js";
|
||||
import { getOrderByIdAjax } from '@/utils/index.js'
|
||||
|
||||
const goodsStore = useGoods()
|
||||
const router = useRouter()
|
||||
@@ -173,22 +174,14 @@ async function getOrderDetail() {
|
||||
try {
|
||||
if (props.tableInfo.orderId) {
|
||||
payLoading.value = true
|
||||
const res = await orderDetail({
|
||||
shopId: store.userInfo.shopId,
|
||||
id: props.tableInfo.orderId
|
||||
})
|
||||
const res = await getOrderByIdAjax(props.tableInfo.orderId)
|
||||
|
||||
console.log(res);
|
||||
|
||||
payLoading.value = false
|
||||
orderInfo.value = res
|
||||
|
||||
cartList.value = res.detailList.map(item => {
|
||||
let obj = {
|
||||
name: item.productName,
|
||||
number: item.num,
|
||||
salePrice: item.price,
|
||||
skuName: item.productSkuName
|
||||
}
|
||||
return obj
|
||||
})
|
||||
cartList.value = res.cartList
|
||||
}
|
||||
} catch (error) {
|
||||
payLoading.value = false
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class="box_content_left_top_item">
|
||||
<div class="box_content_left_top_item_top">
|
||||
<div style="color:#ff5252; font-size: 30px;">
|
||||
{{ infoData.orderNum || 0 }}
|
||||
{{ infoData.orderCount || 0 }}
|
||||
</div>
|
||||
<div style="margin-top: 6px; color: #666;">
|
||||
总订单
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
<div class="box_content_left_top_item_top">
|
||||
<div style="color:#ff5252; font-size: 30px;">
|
||||
¥{{ formatDecimal(infoData.amount || 0) }}
|
||||
¥{{ formatDecimal(infoData.handAmount || 0) }}
|
||||
</div>
|
||||
<div style="margin-top: 6px; color: #666;">
|
||||
营业额
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
<div class="box_content_left_top_item_botton">
|
||||
<div style=" font-size: 20px;">
|
||||
¥{{ formatDecimal(infoData.returnAmount || 0) }}
|
||||
¥{{ formatDecimal(infoData.refundAmount || 0) }}
|
||||
</div>
|
||||
<div style="margin-top: 6px;">
|
||||
退款金额
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content_left_bottom">
|
||||
<el-table :data="infoData.detailList" border style="width: 100%;" height="360px">
|
||||
<el-table :data="infoData.detailList" border style="width: 100%;" height="382px">
|
||||
<el-table-column prop="productName" label="商品名称" />
|
||||
<el-table-column prop="skuName" label="规格名称" />
|
||||
<el-table-column prop="num" label="商品数量" />
|
||||
@@ -73,6 +73,14 @@
|
||||
</div>
|
||||
<div class="box_content_right">
|
||||
<div class="top">
|
||||
<div class="box_content_right_tiem">
|
||||
<div class="box_content_right_tiemleft">
|
||||
店铺:
|
||||
</div>
|
||||
<div class="box_content_right_tiemright">
|
||||
{{ infoData.shopName }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content_right_tiem">
|
||||
<div class="box_content_right_tiemleft">
|
||||
上岗时间:
|
||||
@@ -86,38 +94,39 @@
|
||||
交班时间:
|
||||
</div>
|
||||
<div class="box_content_right_tiemright">
|
||||
{{ dayjs(infoData.loginOutTime).format("YYYY-MM-DD HH:mm:ss") }}
|
||||
{{ dayjs(infoData.handoverTime).format("YYYY-MM-DD HH:mm:ss") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content_right_tiem">
|
||||
<!-- <div class="box_content_right_tiem">
|
||||
<div class="box_content_right_tiemleft">
|
||||
终端名称:
|
||||
</div>
|
||||
<div class="box_content_right_tiemright">
|
||||
{{ infoData.equipment || '无' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content_right_tiem">
|
||||
</div> -->
|
||||
<!-- <div class="box_content_right_tiem">
|
||||
<div class="box_content_right_tiemleft">
|
||||
备用金:
|
||||
</div>
|
||||
<div class="box_content_right_tiemright">
|
||||
{{ infoData.pettyCash || '无' }}
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="box_content_right_tiem">
|
||||
<div class="box_content_right_tiemleft">
|
||||
收营员:
|
||||
</div>
|
||||
<div class="box_content_right_tiemright">
|
||||
{{ infoData.userName || '无' }}
|
||||
{{ infoData.staffName || '无' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="is_shop">
|
||||
<div class="button">
|
||||
<el-checkbox v-model="isPrint" border label="是否打印商品销售数据" style="width: 100%" />
|
||||
<el-checkbox v-model="isPrint" :true-value="1" :false-value="0" border
|
||||
label="是否打印商品销售数据" style="width: 100%" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content_right_tiembutton" :loading="loading" @click="exit">
|
||||
@@ -133,40 +142,29 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ipcRenderer } from "electron";
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage, dayjs } from 'element-plus'
|
||||
import { tglogout } from '@/api/group.js'
|
||||
import { shopInfoqueryDuty, loginlogout, handoverData, handoverprint } from '@/api/work/index.js'
|
||||
import useStorage from '@/utils/useStorage'
|
||||
import { handoverTotal, handover, handoverData, handoverNetworkPrint } from '@/api/account.js'
|
||||
import { useRouter } from "vue-router";
|
||||
import { bySubType } from "@/api/device";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { useSocket } from "@/store/socket.js";
|
||||
import { formatDecimal } from '@/utils/index.js'
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
|
||||
const printStore = usePrint();
|
||||
|
||||
const socket = useSocket();
|
||||
|
||||
const store = useUser();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const dialogVisible = ref(false) //交班
|
||||
//详情数据
|
||||
const infoData = ref({})
|
||||
const loading = ref(false);
|
||||
|
||||
const isPrint = ref(true)
|
||||
const isPrint = ref(1)
|
||||
|
||||
// 查看交班记录
|
||||
async function checkRecord() {
|
||||
try {
|
||||
const res = await staffPermission('yun_xu_cha_kan_suo_you_jiao_ban_ji_lu')
|
||||
// await staffPermission('yun_xu_cha_kan_suo_you_jiao_ban_ji_lu')
|
||||
router.push('/workrecord')
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -176,84 +174,46 @@ async function checkRecord() {
|
||||
// 开始交班
|
||||
const exit = async () => {
|
||||
try {
|
||||
await staffPermission('yun_xu_jiao_ban')
|
||||
|
||||
let data = {}
|
||||
// 获取交班打印小票数据
|
||||
data = await handoverData({
|
||||
id: infoData.value.id
|
||||
})
|
||||
|
||||
// await staffPermission('yun_xu_jiao_ban')
|
||||
const res = await handover(isPrint.value)
|
||||
const data = await handoverData(res)
|
||||
if (printStore.deviceNoteList.length) {
|
||||
loading.value = true;
|
||||
|
||||
// 使用本地打印机 打印交班数据
|
||||
data.printTime = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||
data.printShop = isPrint.value
|
||||
printStore.printWork(data)
|
||||
|
||||
// return
|
||||
await loginlogout({
|
||||
status: 1
|
||||
})
|
||||
|
||||
useStorage.del('userInfo')
|
||||
useStorage.del('token')
|
||||
useStorage.del('douyin')
|
||||
useStorage.del('categorysActive')
|
||||
useStorage.del('updateFlag')
|
||||
|
||||
ElMessage.success("交班成功");
|
||||
setTimeout(() => {
|
||||
router.replace({
|
||||
name: "login",
|
||||
});
|
||||
}, 1000);
|
||||
loading.value = false;
|
||||
} else {
|
||||
console.log('云打印交班数据');
|
||||
loading.value = true;
|
||||
|
||||
await tglogout()
|
||||
|
||||
// 退出登录
|
||||
await loginlogout({
|
||||
status: 1
|
||||
})
|
||||
|
||||
// 打印交班数据
|
||||
await handoverprint({
|
||||
id: infoData.value.id,
|
||||
isprintProduct: isPrint.value
|
||||
})
|
||||
|
||||
// useStorage.clear()
|
||||
useStorage.del('userInfo')
|
||||
useStorage.del('token')
|
||||
useStorage.del('douyin')
|
||||
useStorage.del('categorysActive')
|
||||
useStorage.del('updateFlag')
|
||||
ElMessage.success("交班成功");
|
||||
setTimeout(() => {
|
||||
router.replace({
|
||||
name: "login",
|
||||
});
|
||||
}, 1000);
|
||||
loading.value = false;
|
||||
// 使用云打印机 打印交班数据
|
||||
await handoverNetworkPrint(data.id)
|
||||
}
|
||||
socket.close()
|
||||
logoutHandle()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
async function logoutHandle() {
|
||||
try {
|
||||
loading.value = true;
|
||||
await store.logout()
|
||||
ElMessage.success("交班成功");
|
||||
setTimeout(() => {
|
||||
router.replace({
|
||||
name: "login",
|
||||
});
|
||||
}, 1000);
|
||||
} catch (error) {
|
||||
console.log('退出失败');
|
||||
}
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
// 获取交班打印数据前置
|
||||
const infoshopInfoqueryDutys = async () => {
|
||||
try {
|
||||
let res = await shopInfoqueryDuty({
|
||||
page: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
let res = await handoverTotal()
|
||||
infoData.value = res
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -269,11 +229,6 @@ function show() {
|
||||
defineExpose({
|
||||
show
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// getPrintList()
|
||||
// bySubTypeAjax()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -286,7 +241,7 @@ onMounted(() => {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
padding: 6px 10px;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
color: #161718;
|
||||
text-decoration: none;
|
||||
|
||||
@@ -1,75 +1,75 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="box_top" @click="clickrecord">
|
||||
<div class="box_top_left" @click="router.back()">
|
||||
<el-icon size="20">
|
||||
<ArrowLeft />
|
||||
</el-icon>
|
||||
<div class="box_top_right">
|
||||
交班记录
|
||||
<div class="contenr_wrap" style="flex: 1;">
|
||||
<div class="box">
|
||||
<div class="box_top" @click="clickrecord">
|
||||
<div class="box_top_left" @click="router.back()">
|
||||
<el-icon size="20">
|
||||
<ArrowLeft />
|
||||
</el-icon>
|
||||
<div class="box_top_right">
|
||||
交班记录
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content">
|
||||
<div class="box_content_left">
|
||||
<div class="box_content_left_top">
|
||||
<div class="box_content_left_top_item">
|
||||
<div class="box_content_left_top_item_top">
|
||||
<div>
|
||||
{{ infoData.total }}
|
||||
<div class="box_content">
|
||||
<div class="box_content_left">
|
||||
<div class="box_content_left_top">
|
||||
<div class="box_content_left_top_item">
|
||||
<div class="box_content_left_top_item_top">
|
||||
<div>
|
||||
{{ infoData.total }}
|
||||
</div>
|
||||
<div>
|
||||
交班数
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
交班数
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content_left_top_item_top">
|
||||
<div>
|
||||
{{ infoData.amount }}
|
||||
</div>
|
||||
<div>
|
||||
总收款
|
||||
<div class="box_content_left_top_item_top">
|
||||
<div>
|
||||
{{ infoData.amount }}
|
||||
</div>
|
||||
<div>
|
||||
总收款
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box_content_left_bouttom">
|
||||
<div class="box_content_left_bouttomox">
|
||||
<div class="box_content_left_bouttom_item" v-for="(item, index) in infoData.pageInfo.list"
|
||||
:key="index">
|
||||
<div class="wbox_content_left_bouttom_item_top">
|
||||
<div>
|
||||
{{ dayjs(item.loginTime).format("YYYY-MM-DD HH:mm:ss") }}
|
||||
<div class="box_content_left_bouttom">
|
||||
<div class="box_content_left_bouttomox">
|
||||
<div class="box_content_left_bouttom_item" v-for="(item, index) in infoData.list"
|
||||
:key="index">
|
||||
<div class="wbox_content_left_bouttom_item_top">
|
||||
<div>
|
||||
{{ item.loginTime }}
|
||||
</div>
|
||||
<div>
|
||||
¥{{ item.handAmount }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
¥{{ item.amount }}
|
||||
<div class="wbox_content_left_bouttom_item_topone">
|
||||
<div style="display: flex;">
|
||||
<span>收营员:</span>
|
||||
<span style="font-weight: bold;">{{ item.staffName }}</span>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<span>总订单数:</span>
|
||||
<span style="font-weight: bold;">{{ item.orderCount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wbox_content_left_bouttom_item_topone">
|
||||
<div style="display: flex;">
|
||||
<span>收营员:</span>
|
||||
<span style="font-weight: bold;">{{ item.userName }}</span>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<span>总订单数:</span>
|
||||
<span style="font-weight: bold;">{{ item.orderNum }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wbox_content_left_bouttom_item_topone">
|
||||
<div style="display: flex;">
|
||||
<span>起止时间:</span>
|
||||
<span style="font-weight: bold;"> {{
|
||||
dayjs(item.loginTime).format("YYYY-MM-DD HH:mm:ss") }}</span>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<span>备用金:</span>
|
||||
<span style="font-weight: bold;">{{ item.pettyCash }}</span>
|
||||
<div class="wbox_content_left_bouttom_item_topone">
|
||||
<div style="display: flex;">
|
||||
<span>起止时间:</span>
|
||||
<span style="font-weight: bold;"> {{ item.loginTime }}</span>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<span>挂账金额</span>
|
||||
<span style="font-weight: bold;">{{ item.creditAmount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="box_content_right">
|
||||
<!-- <div class="box_content_right">
|
||||
<div class="box_content_right_tiem">
|
||||
<div class="box_content_right_tiemleft">
|
||||
上岗时间:
|
||||
@@ -114,36 +114,43 @@
|
||||
关班/退出
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { reactive, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { shopinfoqueryDutyFlow } from '@/api/work/index.js'
|
||||
import { handoverRecordPage } from '@/api/account.js'
|
||||
import { useUser } from "@/store/user.js"
|
||||
import { ElMessage, dayjs } from 'element-plus'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const store = useUser()
|
||||
const record = ref(true)//交班记录
|
||||
//详情数据
|
||||
const infoData = ref({
|
||||
pageInfo: {
|
||||
list: []
|
||||
}
|
||||
const infoData = reactive({
|
||||
list: [],
|
||||
total: 0,
|
||||
amount: 0
|
||||
})
|
||||
|
||||
// 获取交班总记录
|
||||
const infoshopInfoqueryDuty = async () => {
|
||||
let res = await shopinfoqueryDutyFlow({
|
||||
shopId: store.userInfo.shopId,
|
||||
let res = await handoverRecordPage({
|
||||
page: 1,
|
||||
pageSize: 10
|
||||
size: 99999
|
||||
})
|
||||
infoData.value = res
|
||||
console.log(infoData.value)
|
||||
infoData.list = res.records
|
||||
infoData.total = +res.totalRow
|
||||
|
||||
let amount = 0
|
||||
|
||||
res.records.map(item => {
|
||||
amount += item.handAmount
|
||||
})
|
||||
|
||||
infoData.amount = amount
|
||||
}
|
||||
onMounted(() => {
|
||||
infoshopInfoqueryDuty()
|
||||
@@ -152,7 +159,7 @@ onMounted(() => {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.box {
|
||||
width: 100%;
|
||||
width: 100vw;
|
||||
padding: 16px;
|
||||
height: 100vh;
|
||||
background-color: #efefef;
|
||||
@@ -162,8 +169,8 @@ onMounted(() => {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
padding: 6px 10px;
|
||||
border-radius: 6px;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
/* 取消下划线效果 */
|
||||
|
||||
.box_top_left {
|
||||
@@ -191,7 +198,7 @@ onMounted(() => {
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6px;
|
||||
border-radius: 10px;
|
||||
// padding: 30px 20px;
|
||||
|
||||
.box_content_left_top {
|
||||
|
||||
Reference in New Issue
Block a user