新增退单支付密码、会员充值支付密码

This commit is contained in:
gyq 2024-07-11 14:31:15 +08:00
parent a70fa744b2
commit 2a09a3fd5b
5 changed files with 1277 additions and 852 deletions

View File

@ -1 +1,171 @@
"use strict";const i=require("path"),e=require("electron");let a;e.app.whenReady().then(()=>{a=new e.BrowserWindow({title:"银收客",width:1024,height:768,fullscreenable:!0,fullscreen:!process.env.VITE_DEV_SERVER_URL,simpleFullscreen:!0,frame:!!process.env.VITE_DEV_SERVER_URL,webPreferences:{nodeIntegration:!0,contextIsolation:!1}}),process.env.VITE_DEV_SERVER_URL?a.loadURL(process.env.VITE_DEV_SERVER_URL):a.loadFile(i.resolve(__dirname,"../dist/index.html")),e.app.on("activate",()=>{e.BrowserWindow.getAllWindows().length===0&&createWindow()}),e.ipcMain.on("quitHandler",(t,n)=>{e.app.quit()}),e.ipcMain.on("getPrintList",()=>{a.webContents.getPrintersAsync().then(t=>{a.webContents.send("printList",t)})});const o=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?o.loadFile(i.join(__dirname,"../public/print.html")):o.loadFile(i.resolve(__dirname,"../dist/print.html")),e.ipcMain.on("printerInfoSync",(t,n)=>{o.webContents.send("getParams",n)}),e.ipcMain.on("printStart",(t,n)=>{console.log(n);let r=JSON.parse(n).deviceName;o.webContents.print({silent:!0,deviceName:r,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const s=new e.BrowserWindow({show:!1,width:464,height:1726,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?s.loadFile(i.join(__dirname,"../public/work_print.html")):s.loadFile(i.resolve(__dirname,"../dist/work_print.html")),e.ipcMain.on("printerWorkSync",(t,n)=>{s.webContents.send("getParams",n)}),e.ipcMain.on("printWorkStart",(t,n)=>{let r=JSON.parse(n).deviceName;s.webContents.print({silent:!0,deviceName:r,pageSize:{width:58e3,height:216e3},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})});const l=new e.BrowserWindow({show:!1,width:320,height:240,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?l.loadFile(i.join(__dirname,"../public/tag_print.html")):l.loadFile(i.resolve(__dirname,"../dist/tag_print.html")),e.ipcMain.on("printerTagSync",(t,n)=>{console.log(n),l.webContents.send("getParams",n)}),e.ipcMain.on("printTagStart",(t,n)=>{let r=JSON.parse(n).deviceName;l.webContents.print({silent:!0,deviceName:r,pageSize:{width:4e4,height:3e4},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})})});e.app.on("window-all-closed",()=>{process.platform!=="darwin"&&e.app.quit()}); "use strict";
const path = require("path");
const electron = require("electron");
let win;
electron.app.whenReady().then(() => {
win = new electron.BrowserWindow({
title: "银收客",
width: 1024,
height: 768,
fullscreenable: true,
fullscreen: process.env.VITE_DEV_SERVER_URL ? false : true,
simpleFullscreen: true,
frame: process.env.VITE_DEV_SERVER_URL ? true : false,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
win.loadURL(process.env.VITE_DEV_SERVER_URL);
} else {
win.loadFile(path.resolve(__dirname, "../dist/index.html"));
}
electron.app.on("activate", () => {
if (electron.BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
electron.ipcMain.on("quitHandler", (_, msg) => {
electron.app.quit();
});
electron.ipcMain.on("getPrintList", () => {
win.webContents.getPrintersAsync().then((res) => {
win.webContents.send("printList", res);
});
});
const printWin = new electron.BrowserWindow({
show: false,
width: 464,
height: 1726,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
printWin.loadFile(path.join(__dirname, "../public/print.html"));
} else {
printWin.loadFile(path.resolve(__dirname, "../dist/print.html"));
}
electron.ipcMain.on("printerInfoSync", (event, arg) => {
printWin.webContents.send("getParams", arg);
});
electron.ipcMain.on("printStart", (event, arg) => {
console.log(arg);
const _parmas = JSON.parse(arg);
let name = _parmas.deviceName;
printWin.webContents.print({
silent: true,
deviceName: name,
pageSize: {
width: 58e3,
height: 216e3
},
scaleFactor: 80,
landscape: false,
margins: {
marginType: "none",
top: 0,
bottom: 0,
left: 0,
right: 0
},
dpi: {
horizontal: 203,
vertical: 203
}
});
});
const workPrintWin = new electron.BrowserWindow({
show: false,
width: 464,
height: 1726,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
workPrintWin.loadFile(path.join(__dirname, "../public/work_print.html"));
} else {
workPrintWin.loadFile(path.resolve(__dirname, "../dist/work_print.html"));
}
electron.ipcMain.on("printerWorkSync", (event, arg) => {
workPrintWin.webContents.send("getParams", arg);
});
electron.ipcMain.on("printWorkStart", (event, arg) => {
const _parmas = JSON.parse(arg);
let name = _parmas.deviceName;
workPrintWin.webContents.print({
silent: true,
deviceName: name,
pageSize: {
width: 58e3,
height: 216e3
},
scaleFactor: 80,
landscape: false,
margins: {
marginType: "none",
top: 0,
bottom: 0,
left: 0,
right: 0
},
dpi: {
horizontal: 203,
vertical: 203
}
});
});
const tagPrintWin = new electron.BrowserWindow({
show: false,
width: 320,
height: 240,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
tagPrintWin.loadFile(path.join(__dirname, "../public/tag_print.html"));
} else {
tagPrintWin.loadFile(path.resolve(__dirname, "../dist/tag_print.html"));
}
electron.ipcMain.on("printerTagSync", (event, arg) => {
console.log(arg);
tagPrintWin.webContents.send("getParams", arg);
});
electron.ipcMain.on("printTagStart", (event, arg) => {
const _parmas = JSON.parse(arg);
let name = _parmas.deviceName;
tagPrintWin.webContents.print({
silent: true,
deviceName: name,
pageSize: {
width: 4e4,
height: 3e4
},
scaleFactor: 80,
landscape: false,
margins: {
marginType: "none",
top: 0,
bottom: 0,
left: 0,
right: 0
},
dpi: {
horizontal: 203,
vertical: 203
}
});
});
});
electron.app.on("window-all-closed", () => {
if (process.platform !== "darwin")
electron.app.quit();
});

View File

@ -29,10 +29,10 @@ export function orderorderDetail(params) {
* @param {*} params * @param {*} params
* @returns * @returns
*/ */
export function payreturnOrder(data) { export function payreturnOrder(data, pwd) {
return request({ return request({
method: "post", method: "post",
url: "pay/returnOrder", url: `pay/returnOrder?pwd=${pwd}`,
data, data,
}); });
} }

View File

@ -13,7 +13,9 @@
</div> </div>
<div class="t1" v-else> <div class="t1" v-else>
<span class="title">会员:</span> <span class="title">会员:</span>
<span class="num">{{ props.userInfo.id && props.userInfo.telephone }}</span> <span class="num">{{
props.userInfo.id && props.userInfo.telephone
}}</span>
</div> </div>
<div class="t2"> <div class="t2">
<span>已付:0.00</span> <span>已付:0.00</span>
@ -23,8 +25,13 @@
</div> </div>
<div class="number_wrap"> <div class="number_wrap">
<div class="menus"> <div class="menus">
<div class="item" :class="{ active: payActive == index }" v-for="(item, index) in payList" :key="item.id" <div
@click="payTypeChange(index, item)"> class="item"
:class="{ active: payActive == index }"
v-for="(item, index) in payList"
:key="item.id"
@click="payTypeChange(index, item)"
>
<div class="icon"> <div class="icon">
<el-image :src="item.icon" class="img"></el-image> <el-image :src="item.icon" class="img"></el-image>
</div> </div>
@ -39,7 +46,12 @@
</div> </div>
<div class="keybord_wrap"> <div class="keybord_wrap">
<div class="left"> <div class="left">
<div class="item" v-for="item in 9" :key="item" @click="amountInput(`${item}`)"> <div
class="item"
v-for="item in 9"
:key="item"
@click="amountInput(`${item}`)"
>
{{ item }} {{ item }}
</div> </div>
<div class="item" @click="amountInput('.')">.</div> <div class="item" @click="amountInput('.')">.</div>
@ -57,30 +69,50 @@
</div> </div>
</div> </div>
</div> </div>
<scanModal ref="scanModalRef" fast :amount="money" :selecttype="props.type" :orderId="props.userInfo.id" <scanModal
@success="scanCodeSuccess" /> ref="scanModalRef"
fast
:amount="money"
:selecttype="props.type"
:orderId="props.userInfo.id"
@success="scanCodeSuccess"
/>
<takeFoodCode
ref="takeFoodCodeRef"
title="支付密码"
type="password"
placeholder="请输入支付密码"
@success="passwordSuccess"
/>
</template> </template>
<script setup> <script setup>
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { queryPayType, quickPay } from "@/api/pay"; import { queryPayType, quickPay } from "@/api/pay";
import { queryMembermember, createMembermember, membermemberScanPay, accountPaymember } from '@/api/member/index.js' import {
queryMembermember,
createMembermember,
membermemberScanPay,
accountPaymember,
} from "@/api/member/index.js";
import { useUser } from "@/store/user.js"; import { useUser } from "@/store/user.js";
import { clearNoNum } from "@/utils"; import { clearNoNum } from "@/utils";
import scanModal from "@/components/payCard/scanModal.vue"; import scanModal from "@/components/payCard/scanModal.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import takeFoodCode from "@/components/takeFoodCode.vue";
const takeFoodCodeRef = ref(null);
const props = defineProps({ const props = defineProps({
type: { type: {
type: [String, Number], type: [String, Number],
default: 0 // 1 2 default: 0, // 1 2
}, },
userInfo: { userInfo: {
type: Object, type: Object,
default: {} default: {},
} },
}) });
const store = useUser(); const store = useUser();
@ -115,9 +147,28 @@ function payTypeChange(index, item) {
payActive.value = index; payActive.value = index;
} }
//
async function passwordSuccess(e) {
try {
payLoading.value = true;
await accountPaymember({
shopId: store.userInfo.shopId,
memberId: props.userInfo.id,
amount: money.value,
pwd: e,
});
payLoading.value = false;
ElMessage.success("支付成功");
emit("paySuccess");
} catch (error) {
payLoading.value = false;
console.log(error);
}
}
// //
async function confirmOrder() { async function confirmOrder() {
if (payLoading.value) return if (payLoading.value) return;
try { try {
if (payList.value[payActive.value].payType == "scanCode") { if (payList.value[payActive.value].payType == "scanCode") {
if (money.value <= 0) { if (money.value <= 0) {
@ -130,29 +181,26 @@ async function confirmOrder() {
ElMessage.error("请输入大于0的金额"); ElMessage.error("请输入大于0的金额");
return; return;
} }
payLoading.value = true;
switch (payList.value[payActive.value].payType) { switch (payList.value[payActive.value].payType) {
case "cash": // case "cash": //
if (props.type == 0) { if (props.type == 0) {
payLoading.value = true;
await quickPay({ await quickPay({
amount: money.value, amount: money.value,
authCode: "", authCode: "",
payType: payList.value[payActive.value].payType, payType: payList.value[payActive.value].payType,
}); });
payLoading.value = false;
ElMessage.success("支付成功");
emit("paySuccess");
} else { } else {
await accountPaymember({ //
shopId: store.userInfo.shopId, takeFoodCodeRef.value.show();
memberId: props.userInfo.id,
amount: money.value
})
} }
break; break;
default: default:
break; break;
} }
payLoading.value = false;
ElMessage.success("支付成功");
emit("paySuccess");
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -337,7 +385,9 @@ onMounted(() => {
flex: 1; flex: 1;
display: grid; display: grid;
grid-template-columns: 1fr 1fr 1fr; grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: var(--item-height) var(--item-height) var(--item-height) var(--item-height); grid-template-rows: var(--item-height) var(--item-height) var(--item-height) var(
--item-height
);
gap: var(--el-font-size-base); gap: var(--el-font-size-base);
.item { .item {

View File

@ -1,74 +1,78 @@
<!-- 取餐号组件 --> <!-- 取餐号组件 -->
<template> <template>
<el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne"> <el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne">
<el-input v-model="number" :placeholder="props.placeholder" readonly></el-input> <el-input :type="props.type" v-model="number" :placeholder="props.placeholder" readonly></el-input>
<div class="keybord_wrap"> <div class="keybord_wrap">
<div v-for="item in 9" :key="item"> <div v-for="item in 9" :key="item">
<el-button plain type="info" style="width: 100%;" @click="inputHandle(item)">{{ item }}</el-button> <el-button plain type="info" style="width: 100%" @click="inputHandle(item)">{{ item }}</el-button>
</div> </div>
<div> <div>
<el-button plain type="info" disabled style="width: 100%;">.</el-button> <el-button plain type="info" disabled style="width: 100%">.</el-button>
</div> </div>
<div> <div>
<el-button plain type="info" style="width: 100%;" @click="inputHandle(0)">0</el-button> <el-button plain type="info" style="width: 100%" @click="inputHandle(0)">0</el-button>
</div> </div>
<div> <div>
<el-button plain type="info" icon="CloseBold" style="width: 100%;" @click="delHandle"></el-button> <el-button plain type="info" icon="CloseBold" style="width: 100%" @click="delHandle"></el-button>
</div> </div>
</div> </div>
<div class="footer"> <div class="footer">
<el-button type="primary" style="width: 100%;" @click="confirmHandle">确认</el-button> <el-button type="primary" style="width: 100%" @click="confirmHandle">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from "vue";
const props = defineProps({ const props = defineProps({
type: {
type: String,
default: "text",
},
title: { title: {
type: String, type: String,
default: '标题' default: "标题",
}, },
placeholder: { placeholder: {
type: String, type: String,
default: '提示' default: "提示",
} },
}) });
const dialogVisible = ref(false) const dialogVisible = ref(false);
const number = ref('') const number = ref("");
const emit = defineEmits(['success']) const emit = defineEmits(["success"]);
function show() { function show() {
dialogVisible.value = true dialogVisible.value = true;
} }
function opne() { function opne() {
number.value = '' number.value = "";
} }
// //
function inputHandle(n) { function inputHandle(n) {
number.value += n number.value += n;
} }
// //
function delHandle() { function delHandle() {
if (!number.value) return if (!number.value) return;
number.value = number.value.substring(0, number.value.length - 1) number.value = number.value.substring(0, number.value.length - 1);
} }
// //
function confirmHandle() { function confirmHandle() {
emit('success', number.value) emit("success", number.value);
dialogVisible.value = false dialogVisible.value = false;
} }
defineExpose({ defineExpose({
show show,
}) });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,134 +1,247 @@
<template> <template>
<div class="orderbox"> <div class="orderbox">
<div class="orderbox_left"> <div class="orderbox_left">
<el-tabs v-model="ordereData.status" class="demo-tabs" @tab-click="handleClick"> <el-tabs
v-model="ordereData.status"
class="demo-tabs"
@tab-click="handleClick"
>
<el-tab-pane label="全部" name=""> <el-tab-pane label="全部" name="">
<div class="demo_tabs_div"> <div class="demo_tabs_div">
<el-input v-model="ordereData.orderNo" placeholder="请输入订单号查询" @input="inputChange" clearable <el-input
@focus=" v-model="ordereData.orderNo"
global.updateData(false)" @blur="global.updateData(true)" /> placeholder="请输入订单号查询"
@input="inputChange"
clearable
@focus="global.updateData(false)"
@blur="global.updateData(true)"
/>
<!-- <el-button style="margin-left: 10px;" type="primary" @click="onSubmit">搜索</el-button> --> <!-- <el-button style="margin-left: 10px;" type="primary" @click="onSubmit">搜索</el-button> -->
</div> </div>
<add :loading="loadingboxshow" :ordereData="ordereData" @emititemboxshow="emititemboxshow" <add
v-if="ordereData.list.length"> :loading="loadingboxshow"
:ordereData="ordereData"
@emititemboxshow="emititemboxshow"
v-if="ordereData.list.length"
>
</add> </add>
<div v-else style="width: 100%; text-align: center; margin: 30px 0;">暂无数据</div> <div v-else style="width: 100%; text-align: center; margin: 30px 0">
<el-pagination v-if="ordereData.list.length" layout="prev, pager, next, jumper" 暂无数据
style="margin-top: 20px;" :total="Number(ordereData.total)" </div>
@current-change="handleCurrentChange" /> <el-pagination
v-if="ordereData.list.length"
layout="prev, pager, next, jumper"
style="margin-top: 20px"
:total="Number(ordereData.total)"
@current-change="handleCurrentChange"
/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="销售" name="closed"> <el-tab-pane label="销售" name="closed">
<add :ordereData="ordereData" @emititemboxshow="emititemboxshow" v-if="ordereData.list.length"> <add
:ordereData="ordereData"
@emititemboxshow="emititemboxshow"
v-if="ordereData.list.length"
>
</add> </add>
<div v-else style="width: 100%; text-align: center; margin: 30px 0;">暂无数据</div> <div v-else style="width: 100%; text-align: center; margin: 30px 0">
<el-pagination v-if="ordereData.list.length" layout="prev, pager, next, jumper" 暂无数据
style="margin-top: 20px;" :total="Number(ordereData.total)" </div>
@current-change="handleCurrentChange" /> <el-pagination
v-if="ordereData.list.length"
layout="prev, pager, next, jumper"
style="margin-top: 20px"
:total="Number(ordereData.total)"
@current-change="handleCurrentChange"
/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="退单" name="refund"> <el-tab-pane label="退单" name="refund">
<add :ordereData="ordereData" @emititemboxshow="emititemboxshow" v-if="ordereData.list.length"> <add
:ordereData="ordereData"
@emititemboxshow="emititemboxshow"
v-if="ordereData.list.length"
>
</add> </add>
<div v-else style="width: 100%; text-align: center; margin: 30px 0;">暂无数据</div> <div v-else style="width: 100%; text-align: center; margin: 30px 0">
<el-pagination v-if="ordereData.list.length" layout="prev, pager, next, jumper" 暂无数据
style="margin-top: 20px;" :total="Number(ordereData.total)" </div>
@current-change="handleCurrentChange" /> <el-pagination
v-if="ordereData.list.length"
layout="prev, pager, next, jumper"
style="margin-top: 20px"
:total="Number(ordereData.total)"
@current-change="handleCurrentChange"
/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="快捷收银" name="cash"> <el-tab-pane label="快捷收银" name="cash">
<cashTable /> <cashTable />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
<div class="orderbox_right" v-if="itemboxshow" v-loading="orderDetaildata.loading" :loading="loadingboxshow"> <div
class="orderbox_right"
v-if="itemboxshow"
v-loading="orderDetaildata.loading"
:loading="loadingboxshow"
>
<div class="orderbox_right_top"> <div class="orderbox_right_top">
<span>堂食订单</span> <span>堂食订单</span>
<el-icon :size="32" style="color: var(--primary-color) ;" @click="itemboxshow = false"> <el-icon
:size="32"
style="color: var(--primary-color)"
@click="itemboxshow = false"
>
<CircleCloseFilled /> <CircleCloseFilled />
</el-icon> </el-icon>
</div> </div>
<div class="tableDataclass"> <div class="tableDataclass">
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">订单号</span><span class="nunber">{{ orderDetaildata.orderNo }}</span> <span class="span">订单号</span
><span class="nunber">{{ orderDetaildata.orderNo }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">收银员</span><span class="nunber">{{ orderDetaildata.userName }}</span> <span class="span">收银员</span
><span class="nunber">{{ orderDetaildata.userName }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">创建时间</span><span class="nunber">{{ dayjs( <span class="span">创建时间</span
orderDetaildata.createdAt).format("YYYY-MM-DD HH:mm:ss") }}</span> ><span class="nunber">{{
dayjs(orderDetaildata.createdAt).format("YYYY-MM-DD HH:mm:ss")
}}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">终端</span><span class="nunber">{{ orderDetaildata.zdNo }}</span> <span class="span">终端</span
><span class="nunber">{{ orderDetaildata.zdNo }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">会员</span><span class="nunber">{{ orderDetaildata.memberName }}</span> <span class="span">会员</span
><span class="nunber">{{ orderDetaildata.memberName }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">台桌</span><span class="nunber">{{ orderDetaildata.tableId }}</span> <span class="span">台桌</span
><span class="nunber">{{ orderDetaildata.tableId }}</span>
</div> </div>
<div class="orderbox_right_item"> <div class="orderbox_right_item">
<span class="span">流水号</span><span class="nunber">{{ orderDetaildata.masterId }}</span> <span class="span">流水号</span
><span class="nunber">{{ orderDetaildata.masterId }}</span>
</div> </div>
<div class="orderbox_right_top" style="margin-top: 20px; border-bottom: 2px solid #ccc;"> <div
class="orderbox_right_top"
style="margin-top: 20px; border-bottom: 2px solid #ccc"
>
<span>合计</span> <span>合计</span>
<span>{{ orderDetaildata.orderAmount }}</span> <span>{{ orderDetaildata.orderAmount }}</span>
</div> </div>
<div class="orderbox_right_top" style="margin-top: 20px; border-bottom: 2px solid #ccc;"> <div
<span style="font-size: 16px;" v-if="orderDetaildata.status == 'pending'">挂单</span> class="orderbox_right_top"
<span style="font-size: 16px; color: red;" style="margin-top: 20px; border-bottom: 2px solid #ccc"
v-if="orderDetaildata.status == 'refund' && orderDetaildata.orderType == 'return'">退单</span> >
<span style="font-size: 16px; color:#21c36b;" <span
v-if="orderDetaildata.orderType != 'return' && (orderDetaildata.status == 'refund' || orderDetaildata.status == 'closed')">订单完成</span> style="font-size: 16px"
v-if="orderDetaildata.status == 'pending'"
>挂单</span
>
<span
style="font-size: 16px; color: red"
v-if="
orderDetaildata.status == 'refund' &&
orderDetaildata.orderType == 'return'
"
>退单</span
>
<span
style="font-size: 16px; color: #21c36b"
v-if="
orderDetaildata.orderType != 'return' &&
(orderDetaildata.status == 'refund' ||
orderDetaildata.status == 'closed')
"
>订单完成</span
>
</div> </div>
<div class="orderbox_right_top" style="margin-top: 20px;"> <div class="orderbox_right_top" style="margin-top: 20px">
<span>商品明细</span> <span>商品明细</span>
<span>{{ orderDetaildata.detailList.length }}</span> <span>{{ orderDetaildata.detailList.length }}</span>
</div> </div>
<div class="orderbox_right_list" style="margin-top: 20px;"> <div class="orderbox_right_list" style="margin-top: 20px">
<div>商品</div> <div>商品</div>
<div>数量</div> <div>数量</div>
<div>单价</div> <div>单价</div>
<div>小计</div> <div>小计</div>
</div> </div>
<div class="orderbox_right_list_item" style="margin-top: 20px;" <div
v-for="(item, index) in orderDetaildata.detailList" :key="index"> class="orderbox_right_list_item"
style="margin-top: 20px"
v-for="(item, index) in orderDetaildata.detailList"
:key="index"
>
<div>{{ item.productName }} {{ item.productSkuName }}</div> <div>{{ item.productName }} {{ item.productSkuName }}</div>
<div style="text-align: center;">{{ item.num }}</div> <div style="text-align: center">{{ item.num }}</div>
<div style="text-align: center;">{{ item.price }}</div> <div style="text-align: center">{{ item.price }}</div>
<div v-if="item.status == 'refund'"><span <div v-if="item.status == 'refund'">
style="border: 2px solid red; color: red; padding: 4px 2px;">已退</span></div> <span style="border: 2px solid red; color: red; padding: 4px 2px"
>已退</span
>
</div>
<div v-else>{{ item.priceAmount }}</div> <div v-else>{{ item.priceAmount }}</div>
</div> </div>
<div :style="{ 'height': reforderboxrightbuttonheight + 'px' }"></div> <div :style="{ height: reforderboxrightbuttonheight + 'px' }"></div>
</div> </div>
<div class="orderbox_right_button" ref="reforderboxrightbutton"> <div class="orderbox_right_button" ref="reforderboxrightbutton">
<div class="orderbox_right_buttonbutton"> <div class="orderbox_right_buttonbutton">
<el-button style="width: 100%;" type="warning" :loading="callLoading" @click="callNumberHandle"> <el-button
style="width: 100%"
type="warning"
:loading="callLoading"
@click="callNumberHandle"
>
叫号 叫号
</el-button> </el-button>
</div> </div>
<div class="orderbox_right_buttonbutton"> <div class="orderbox_right_buttonbutton">
<el-button style="width: 100%;" <el-button
v-if="orderDetaildata.orderType != 'return' && (orderDetaildata.status == 'refund' || orderDetaildata.status == 'closed')" style="width: 100%"
type="primary" @click="recharge = true">退单</el-button> v-if="
orderDetaildata.orderType != 'return' &&
(orderDetaildata.status == 'refund' ||
orderDetaildata.status == 'closed')
"
type="primary"
@click="recharge = true"
>退单</el-button
>
</div> </div>
<div class="orderbox_right_buttonbutton"> <div class="orderbox_right_buttonbutton">
<el-button @click="print('normal')" style="flex: 1;">重打收银打票</el-button> <el-button @click="print('normal')" style="flex: 1"
<el-button @click="print('label')" style="flex: 1;">重打标签小票</el-button> >重打收银打票</el-button
>
<el-button @click="print('label')" style="flex: 1"
>重打标签小票</el-button
>
</div> </div>
</div> </div>
</div> </div>
<div class="orderbox_rightbox" v-else> <div class="orderbox_rightbox" v-else>
<div class="orderbox_rightbox_top"> <div class="orderbox_rightbox_top">
<div <div
style="padding: 6px; background:#187ead; border-radius:50%;width: 50px;height: 50px; display: flex; align-items: center; justify-content: center;"> style="
padding: 6px;
background: #187ead;
border-radius: 50%;
width: 50px;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
"
>
<el-icon :size="30" color="#fff"> <el-icon :size="30" color="#fff">
<Document /> <Document />
</el-icon> </el-icon>
</div> </div>
<div class="orderbox_rightbox_top_div"> <div class="orderbox_rightbox_top_div">
<div>今日普通订单</div> <div>今日普通订单</div>
<div style="font-size:14px;">今日本终端处理的订单</div> <div style="font-size: 14px">今日本终端处理的订单</div>
</div> </div>
</div> </div>
<!-- <div class="orderbox_rightbox_top"> <!-- <div class="orderbox_rightbox_top">
@ -156,12 +269,23 @@
</div> </div>
</div> --> </div> -->
</div> </div>
<el-dialog v-model="recharge" title="退单" width="800" :before-close="handlerecharge"> <el-dialog
v-model="recharge"
title="退单"
width="800"
:before-close="handlerecharge"
>
<div class="recharge_footer"> <div class="recharge_footer">
<div class="recharge_footer_item"> <div class="recharge_footer_item">
<el-input v-model="remark" style="width: 100%" :rows="2" type="textarea" placeholder="请输入退单原因" <el-input
@focus=" v-model="remark"
global.updateData(false)" @blur="global.updateData(true)" /> style="width: 100%"
:rows="2"
type="textarea"
placeholder="请输入退单原因"
@focus="global.updateData(false)"
@blur="global.updateData(true)"
/>
<div class="recharge_footer_items" @click="remark = '顾客取消'"> <div class="recharge_footer_items" @click="remark = '顾客取消'">
<div>顾客取消</div> <div>顾客取消</div>
</div> </div>
@ -180,11 +304,11 @@
</div> </div>
<div class="recharge_footer_itemright"> <div class="recharge_footer_itemright">
<div class="recharge_footer_itemright_top"> <div class="recharge_footer_itemright_top">
<div>单号{{ orderDetaildata.orderNo }}</div>
<div> <div>
单号{{ orderDetaildata.orderNo }} 下单时间{{
</div> dayjs(orderDetaildata.createdAt).format("YYYY-MM-DD HH:mm:ss")
<div> }}
下单时间{{ dayjs(orderDetaildata.createdAt).format("YYYY-MM-DD HH:mm:ss") }}
</div> </div>
<div> <div>
<span>金额{{ orderDetaildata.orderAmount }}</span> <span>金额{{ orderDetaildata.orderAmount }}</span>
@ -198,24 +322,41 @@
</div> </div>
<div class="recharge_footer_itemright_botton"> <div class="recharge_footer_itemright_botton">
<div class="recharge_footer_itemright_botton_top"> <div class="recharge_footer_itemright_botton_top">
<el-checkbox @change="changezong" v-model="changechecked" size="large" /><span <el-checkbox
style="margin-left: 10px;">全选共项目</span> @change="changezong"
v-model="changechecked"
size="large"
/><span style="margin-left: 10px"></span>
</div> </div>
<div class="recharge_footer_itemright_botton_item" <div
v-for="(item, index) in orderDetaildata.detailList" :key="index"> class="recharge_footer_itemright_botton_item"
v-for="(item, index) in orderDetaildata.detailList"
:key="index"
>
<div class="recharge_footer_itemright_botton_itemone"> <div class="recharge_footer_itemright_botton_itemone">
<el-checkbox @change="changezong(item, index, 1, 'quan')" <el-checkbox
:disabled="item.status == 'refund' ? true : false" v-model="item.checked" @change="changezong(item, index, 1, 'quan')"
size="large" /> :disabled="item.status == 'refund' ? true : false"
<span style="margin-left: 10px;">{{ item.productName }}</span> v-model="item.checked"
size="large"
/>
<span style="margin-left: 10px">{{ item.productName }}</span>
</div> </div>
<div class="recharge_footer_itemright_botton_itemtow"> <div class="recharge_footer_itemright_botton_itemtow">
<!-- {{ item.num }} --> <!-- {{ item.num }} -->
<el-input-number v-model="item.num" :min="1" size="small" <el-input-number
:disabled="item.status == 'refund' ? true : false" :max="item.maxnum" v-model="item.num"
@change="(currentValue, oldValue) => changezong(item, index, 1, 'num', currentValue, oldValue)" :min="1"
@focus=" size="small"
global.updateData(false)" @blur="global.updateData(true)" /> :disabled="item.status == 'refund' ? true : false"
:max="item.maxnum"
@change="
(currentValue, oldValue) =>
changezong(item, index, 1, 'num', currentValue, oldValue)
"
@focus="global.updateData(false)"
@blur="global.updateData(true)"
/>
<!-- @change="changezong(item, index, 1, 'num')" --> <!-- @change="changezong(item, index, 1, 'num')" -->
</div> </div>
<div class="recharge_footer_itemright_botton_itemthere"> <div class="recharge_footer_itemright_botton_itemthere">
@ -225,13 +366,20 @@
</div> </div>
<div class="recharge_footer_itemright_botton_box"> <div class="recharge_footer_itemright_botton_box">
<div class="recharge_footer_itemright_botton_boxone"> <div class="recharge_footer_itemright_botton_boxone">
<div class="recharge_footer_itemright_botton_boxoneabsolute">退单金额</div> <div class="recharge_footer_itemright_botton_boxoneabsolute">
<div class="recharge_footer_itemright_botton_boxonetext">{{ refundamount > 0 ? refundamount 退单金额
: '0.00' }}</div> </div>
<div class="recharge_footer_itemright_botton_boxonetext">
{{ refundamount > 0 ? refundamount : "0.00" }}
</div>
</div> </div>
<div class="recharge_footer_itemright_botton_boxtow"> <div class="recharge_footer_itemright_botton_boxtow">
<el-button type="primary" style="width: 100%; height: 100%;" :loading="buttonloading" <el-button
@click="payreturnOrderclick"> type="primary"
style="width: 100%; height: 100%"
:loading="buttonloading"
@click="payreturnOrderclick"
>
<span v-if="!buttonloading">支付退回</span> <span v-if="!buttonloading">支付退回</span>
<span v-else>支付退回...</span> <span v-else>支付退回...</span>
</el-button> </el-button>
@ -241,89 +389,119 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
<takeFoodCode
ref="takeFoodCodeRef"
title="支付密码"
type="password"
placeholder="请输入支付密码"
@success="passwordSuccess"
/>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, reactive } from 'vue' import { ref, onMounted, reactive } from "vue";
import { ElMessage, dayjs } from 'element-plus' import { ElMessage, dayjs } from "element-plus";
import { useUser } from "@/store/user.js" import { useUser } from "@/store/user.js";
import lodash from 'lodash' import lodash from "lodash";
import { orderfindOrder, orderorderDetail, payreturnOrder, cloudPrinterprint, sendMessage } from '@/api/order/index.js' import {
import add from '@/views/order/components/add.vue' orderfindOrder,
import cashTable from '@/views/order/components/cashTable.vue' orderorderDetail,
import { clearNoNum } from '@/utils' payreturnOrder,
cloudPrinterprint,
sendMessage,
} from "@/api/order/index.js";
import add from "@/views/order/components/add.vue";
import cashTable from "@/views/order/components/cashTable.vue";
import { clearNoNum } from "@/utils";
import { useGlobal } from '@/store/global.js' import { useGlobal } from "@/store/global.js";
const global = useGlobal()
const store = useUser() import takeFoodCode from "@/components/takeFoodCode.vue";
const itemboxshow = ref(false) const takeFoodCodeRef = ref(null);
import { usePrint } from '@/store/print.js' const global = useGlobal();
const printStore = usePrint()
import { ipcRenderer } from 'electron' const store = useUser();
const itemboxshow = ref(false);
import { usePrint } from "@/store/print.js";
const printStore = usePrint();
import { ipcRenderer } from "electron";
const reforderboxrightbutton = ref(null); //ref const reforderboxrightbutton = ref(null); //ref
const reforderboxrightbuttonheight = ref(null)// const reforderboxrightbuttonheight = ref(null); //
const handleClick = (Name) => {//teb const handleClick = (Name) => {
ordereData.status = Name.props.name //teb
asyncorderfindOrder() ordereData.status = Name.props.name;
} asyncorderfindOrder();
};
const recharge = ref(false)//退 const recharge = ref(false); //退
const handlerecharge = () => { //退 const handlerecharge = () => {
recharge.value = !recharge.value //退
} recharge.value = !recharge.value;
};
const buttonloading = ref() //loading const buttonloading = ref(); //loading
const payreturnOrderclick = lodash.debounce(async () => { // //
buttonloading.value = true async function passwordSuccess(pwd) {
if (refundamount.value == 0) {
buttonloading.value = false
ElMessage.error('退款金额不能为0')
return false
}
try { try {
let arr = orderDetaildata.value.detailList.map(item => { buttonloading.value = true;
if (item.checked && item.status == 'closed') { let arr = orderDetaildata.value.detailList.map((item) => {
if (item.checked && item.status == "closed") {
var obj = { var obj = {
id: item.id, id: item.id,
orderId: orderDetaildata.value.id, orderId: orderDetaildata.value.id,
remark: remark.value, remark: remark.value,
num: item.num num: item.num,
};
} }
} return obj;
return obj });
}) arr = arr.filter((item) => {
arr = arr.filter(item => { return item && item }) return item && item;
});
if (arr.length != 0) { if (arr.length != 0) {
await payreturnOrder(arr) await payreturnOrder(arr, pwd);
changechecked.value = false changechecked.value = false;
recharge.value = false recharge.value = false;
itemboxshow.value = false itemboxshow.value = false;
refundamount.value = 0 refundamount.value = 0;
ElMessage.success('退款成功!') ElMessage.success("退款成功!");
buttonloading.value = false buttonloading.value = false;
asyncorderfindOrder() asyncorderfindOrder();
} else { } else {
buttonloading.value = false buttonloading.value = false;
ElMessage.error('以没有退款项目!') ElMessage.error("以没有退款项目!");
} }
} catch (error) { } catch (error) {
buttonloading.value = false buttonloading.value = false;
}
} }
}, 500)
const payreturnOrderclick = lodash.debounce(
async () => {
//
if (refundamount.value == 0) {
buttonloading.value = false;
ElMessage.error("退款金额不能为0");
return false;
}
takeFoodCodeRef.value.show();
},
500,
{ leading: true, trailing: false }
);
// / // /
const print = lodash.throttle(async function (e) { const print = lodash.throttle(
async function (e) {
try { try {
if (e == 'label') { if (e == "label") {
// checkLabelPrint(printLabelOrder.value) // checkLabelPrint(printLabelOrder.value)
const data = { const data = {
shop_name: store.userInfo.merchantName, shop_name: store.userInfo.merchantName,
@ -332,182 +510,212 @@ const print = lodash.throttle(async function (e) {
outNumber: printLabelOrder.value.outNumber, outNumber: printLabelOrder.value.outNumber,
createdAt: dayjs(printLabelOrder.value.createdAt).format( createdAt: dayjs(printLabelOrder.value.createdAt).format(
"YYYY-MM-DD HH:mm:ss" "YYYY-MM-DD HH:mm:ss"
) ),
} };
printLabelOrder.value.skuInfos.map(item => { printLabelOrder.value.skuInfos.map((item) => {
data.carts.push( data.carts.push({
{
categoryId: item.categoryId, categoryId: item.categoryId,
name: item.productName, name: item.productName,
number: item.num, number: item.num,
skuName: item.productSkuName skuName: item.productSkuName,
} });
) });
})
// console.log('', data); // console.log('', data);
printStore.labelPrint(data) printStore.labelPrint(data);
} else { } else {
await cloudPrinterprint({ await cloudPrinterprint({
type: e, type: e,
orderId: orderDetaildata.value.id, orderId: orderDetaildata.value.id,
ispre: false ispre: false,
}) });
ElMessage({ ElMessage({
message: '成功打票', message: "成功打票",
type: 'success', type: "success",
}) });
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}, 1500, { leading: true, trailing: false }) },
1500,
{ leading: true, trailing: false }
);
const loadingboxshow = ref(false); const loadingboxshow = ref(false);
// //
const printLabelOrder = ref('') const printLabelOrder = ref("");
const emititemboxshow = async (e) => { // const emititemboxshow = async (e) => {
//
// console.log('emititemboxshow', e); // console.log('emititemboxshow', e);
printLabelOrder.value = e printLabelOrder.value = e;
loadingboxshow.value = true loadingboxshow.value = true;
try { try {
let res = await orderorderDetail({ let res = await orderorderDetail({
shopId: store.userInfo.shopId, shopId: store.userInfo.shopId,
id: e.id id: e.id,
}) });
itemboxshow.value = true itemboxshow.value = true;
loadingboxshow.value = false loadingboxshow.value = false;
orderDetaildata.value = res orderDetaildata.value = res;
if (reforderboxrightbutton.value) { // if (reforderboxrightbutton.value) {
reforderboxrightbuttonheight.value = reforderboxrightbutton.value.offsetHeight; //
reforderboxrightbuttonheight.value =
reforderboxrightbutton.value.offsetHeight;
} }
orderDetaildata.value.detailList.forEach((e) => { orderDetaildata.value.detailList.forEach((e) => {
e.checked = false e.checked = false;
e.zongprice = e.priceAmount / e.num e.zongprice = e.priceAmount / e.num;
e.maxnum = e.num - e.returnNum // e.maxnum = e.num - e.returnNum; //
}) });
changechecked.value = false // changechecked.value = false; //
refundamount.value = 0 //退0 refundamount.value = 0; //退0
} catch (error) { } catch (error) {
loadingboxshow.value = false loadingboxshow.value = false;
}
} }
};
const remark = ref('')// const remark = ref(""); //
const changechecked = ref(false) // const changechecked = ref(false); //
const refundamount = ref(0)//退 const refundamount = ref(0); //退
const changezong = (e, b, c, d, currentValue, oldValue) => { const changezong = (e, b, c, d, currentValue, oldValue) => {
console.log(e) console.log(e);
if (c == 1) { if (c == 1) {
if (d == 'num' && e.checked) { if (d == "num" && e.checked) {
orderDetaildata.value.detailList.forEach((item, a, b) => { orderDetaildata.value.detailList.forEach((item, a, b) => {
if (item.id == e.id) { if (item.id == e.id) {
if (currentValue > oldValue) { if (currentValue > oldValue) {
refundamount.value = (Number(refundamount.value) + (Number(currentValue - oldValue) * Number(item.zongprice))).toFixed(2) refundamount.value = (
Number(refundamount.value) +
Number(currentValue - oldValue) * Number(item.zongprice)
).toFixed(2);
} else { } else {
refundamount.value = (Number(refundamount.value) + (Number(currentValue - oldValue) * Number(item.zongprice))).toFixed(2) refundamount.value = (
Number(refundamount.value) +
Number(currentValue - oldValue) * Number(item.zongprice)
).toFixed(2);
} }
} }
}) });
} }
if (d == 'quan') {// if (d == "quan") {
//
if (e.checked) { if (e.checked) {
console.log(Number(refundamount.value), Number(e.num) * Number(e.zongprice)) console.log(
refundamount.value = ((Number(refundamount.value) + (Number(e.num) * Number(e.zongprice)))).toFixed(2) Number(refundamount.value),
Number(e.num) * Number(e.zongprice)
);
refundamount.value = (
Number(refundamount.value) +
Number(e.num) * Number(e.zongprice)
).toFixed(2);
} else { } else {
refundamount.value = ((Number(refundamount.value) - (Number(e.num) * Number(e.zongprice)))).toFixed(2) refundamount.value = (
Number(refundamount.value) -
Number(e.num) * Number(e.zongprice)
).toFixed(2);
} }
} }
if (orderDetaildata.value.detailList.every(item => item.checked == true)) {// if (
changechecked.value = true orderDetaildata.value.detailList.every((item) => item.checked == true)
) {
//
changechecked.value = true;
} else { } else {
changechecked.value = false changechecked.value = false;
} }
} else { } else {
refundamount.value = 0 refundamount.value = 0;
orderDetaildata.value.detailList.forEach((e, a, b) => { orderDetaildata.value.detailList.forEach((e, a, b) => {
if (changechecked.value) { if (changechecked.value) {
if (e.status == 'refund') { if (e.status == "refund") {
e.checked = false e.checked = false;
} else { } else {
e.checked = true e.checked = true;
refundamount.value = clearNoNum({ value: JSON.stringify(Number(refundamount.value) + (Number(e.num) * Number(e.zongprice))) }) refundamount.value = clearNoNum({
value: JSON.stringify(
Number(refundamount.value) + Number(e.num) * Number(e.zongprice)
),
});
} }
} else { } else {
e.checked = false e.checked = false;
refundamount.value = 0 refundamount.value = 0;
}
})
} }
});
} }
};
const orderDetaildata = ref({// const orderDetaildata = ref({
//
// loading // loading
}) });
const ordereData = reactive({// const ordereData = reactive({
//
list: [], list: [],
size: 10, size: 10,
page: 1, page: 1,
status: '', status: "",
total: '', total: "",
orderNo: '', orderNo: "",
}) });
const asyncorderfindOrder = async () => {// const asyncorderfindOrder = async () => {
//
try { try {
let res = await orderfindOrder({ let res = await orderfindOrder({
shopId: store.userInfo.shopId, shopId: store.userInfo.shopId,
status: ordereData.status, status: ordereData.status,
size: ordereData.size, size: ordereData.size,
page: ordereData.page, page: ordereData.page,
orderNo: ordereData.orderNo orderNo: ordereData.orderNo,
}) });
ordereData.total = res.total ordereData.total = res.total;
ordereData.list = res.list ordereData.list = res.list;
} catch (error) { } catch (error) {
// ElMessage({ // ElMessage({
// message: '', // message: '',
// type: 'error', // type: 'error',
// }) // })
} }
} };
const handleCurrentChange = (val) => { // const handleCurrentChange = (val) => {
//
// ordereData.page = 1 // ordereData.page = 1
ordereData.page = val ordereData.page = val;
asyncorderfindOrder() asyncorderfindOrder();
} };
const inputChange = lodash.debounce(function () { // const inputChange = lodash.debounce(function () {
asyncorderfindOrder() //
}, 500) asyncorderfindOrder();
}, 500);
// //
const callLoading = ref(false) const callLoading = ref(false);
const callNumberHandle = async () => { const callNumberHandle = async () => {
try { try {
callLoading.value = true callLoading.value = true;
const res = await sendMessage({ const res = await sendMessage({
orderId: orderDetaildata.value.id orderId: orderDetaildata.value.id,
}) });
callLoading.value = false callLoading.value = false;
ElMessage.success('叫号成功') ElMessage.success("叫号成功");
} catch (error) { } catch (error) {
callLoading.value = false callLoading.value = false;
console.log(error); console.log(error);
} }
} };
onMounted(() => { onMounted(() => {
// resetMembrform.value = { ...membrform.value } // resetMembrform.value = { ...membrform.value }
asyncorderfindOrder() asyncorderfindOrder();
}) });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -548,7 +756,7 @@ onMounted(() => {
} }
:deep(.el-tabs__active-bar)::after { :deep(.el-tabs__active-bar)::after {
content: ''; content: "";
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 50%; left: 50%;
@ -621,12 +829,9 @@ onMounted(() => {
height: 70px; height: 70px;
justify-content: space-around; justify-content: space-around;
align-items: flex-end; align-items: flex-end;
} }
} }
} }
} }
.orderbox_rightbox { .orderbox_rightbox {
@ -658,7 +863,6 @@ onMounted(() => {
justify-content: space-around; justify-content: space-around;
} }
} }
} }
.recharge_footer { .recharge_footer {
@ -753,7 +957,6 @@ onMounted(() => {
.recharge_footer_itemright_botton_itemtow { .recharge_footer_itemright_botton_itemtow {
flex: 1; flex: 1;
} }
.recharge_footer_itemright_botton_itemthere { .recharge_footer_itemright_botton_itemthere {
@ -905,8 +1108,6 @@ onMounted(() => {
transform: translateX(-50%) !important; transform: translateX(-50%) !important;
} }
} }
} }
</style> </style>