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

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
* @returns
*/
export function payreturnOrder(data) {
export function payreturnOrder(data, pwd) {
return request({
method: "post",
url: "pay/returnOrder",
url: `pay/returnOrder?pwd=${pwd}`,
data,
});
}

View File

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

View File

@ -1,74 +1,78 @@
<!-- 取餐号组件 -->
<template>
<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 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>
<el-button plain type="info" disabled style="width: 100%;">.</el-button>
<el-button plain type="info" disabled style="width: 100%">.</el-button>
</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>
<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 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>
</el-dialog>
</template>
<script setup>
import { ref } from 'vue';
import { ref } from "vue";
const props = defineProps({
type: {
type: String,
default: "text",
},
title: {
type: String,
default: '标题'
default: "标题",
},
placeholder: {
type: String,
default: '提示'
}
})
default: "提示",
},
});
const dialogVisible = ref(false)
const number = ref('')
const dialogVisible = ref(false);
const number = ref("");
const emit = defineEmits(['success'])
const emit = defineEmits(["success"]);
function show() {
dialogVisible.value = true
dialogVisible.value = true;
}
function opne() {
number.value = ''
number.value = "";
}
//
function inputHandle(n) {
number.value += n
number.value += n;
}
//
function delHandle() {
if (!number.value) return
number.value = number.value.substring(0, number.value.length - 1)
if (!number.value) return;
number.value = number.value.substring(0, number.value.length - 1);
}
//
function confirmHandle() {
emit('success', number.value)
dialogVisible.value = false
emit("success", number.value);
dialogVisible.value = false;
}
defineExpose({
show
})
show,
});
</script>
<style scoped lang="scss">

View File

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