优化退款密码
This commit is contained in:
parent
2d2a014bc4
commit
86c8ca6472
|
|
@ -1,115 +1 @@
|
||||||
"use strict";
|
"use strict";const s=require("path"),e=require("electron"),a=require("os");let n;e.app.whenReady().then(()=>{n=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?n.loadURL(process.env.VITE_DEV_SERVER_URL):n.loadFile(s.resolve(__dirname,"../dist/index.html")),e.app.on("activate",()=>{e.BrowserWindow.getAllWindows().length===0&&createWindow()}),e.ipcMain.on("quitHandler",(t,o)=>{n=null,e.app.exit()}),e.ipcMain.on("getPrintList",()=>{n.webContents.getPrintersAsync().then(t=>{n.webContents.send("printList",t)})}),e.ipcMain.on("getOSmacSync",()=>{let t="";a.networkInterfaces().WLAN?(t=a.networkInterfaces().WLAN[0].mac,console.log("wlan.mac===",t)):(t=a.networkInterfaces().以太网[0].mac,console.log("以太网.mac===",t)),n.webContents.send("getOSmacRes",t)});const i=new e.BrowserWindow({show:!1,width:360,height:240,webPreferences:{nodeIntegration:!0,contextIsolation:!1}});process.env.VITE_DEV_SERVER_URL?i.loadFile(s.join(__dirname,"../public/tag_print.html")):i.loadFile(s.resolve(__dirname,"../dist/tag_print.html")),e.ipcMain.on("printerTagSync",(t,o)=>{console.log(o),i.webContents.send("getParams",o)}),e.ipcMain.on("printTagStart",(t,o)=>{let l=JSON.parse(o).deviceName;i.webContents.print({silent:!0,deviceName:l,pageSize:{width:45e3,height:3e4},scaleFactor:80,landscape:!1,margins:{marginType:"none",top:0,bottom:0,left:0,right:0},dpi:{horizontal:203,vertical:203}})}),e.app.requestSingleInstanceLock()?e.app.on("second-instance",(t,o,r)=>{n&&(n.isMinimized()&&n.restore(),n.focus(),n.show())}):e.app.quit(),n.on("close",t=>{t.preventDefault(),n.webContents.send("showCloseDialog")})});e.app.on("window-all-closed",()=>{process.platform!=="darwin"&&e.app.quit()});
|
||||||
const path = require("path");
|
|
||||||
const electron = require("electron");
|
|
||||||
const os = require("os");
|
|
||||||
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) => {
|
|
||||||
win = null;
|
|
||||||
electron.app.exit();
|
|
||||||
});
|
|
||||||
electron.ipcMain.on("getPrintList", () => {
|
|
||||||
win.webContents.getPrintersAsync().then((res) => {
|
|
||||||
win.webContents.send("printList", res);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
electron.ipcMain.on("getOSmacSync", () => {
|
|
||||||
let mac = "";
|
|
||||||
if (os.networkInterfaces().WLAN) {
|
|
||||||
mac = os.networkInterfaces().WLAN[0].mac;
|
|
||||||
console.log("wlan.mac===", mac);
|
|
||||||
} else {
|
|
||||||
mac = os.networkInterfaces()["以太网"][0].mac;
|
|
||||||
console.log("以太网.mac===", mac);
|
|
||||||
}
|
|
||||||
win.webContents.send("getOSmacRes", mac);
|
|
||||||
});
|
|
||||||
const tagPrintWin = new electron.BrowserWindow({
|
|
||||||
show: false,
|
|
||||||
width: 360,
|
|
||||||
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: 45e3,
|
|
||||||
height: 3e4
|
|
||||||
},
|
|
||||||
scaleFactor: 80,
|
|
||||||
landscape: false,
|
|
||||||
margins: {
|
|
||||||
marginType: "none",
|
|
||||||
top: 0,
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0
|
|
||||||
},
|
|
||||||
dpi: {
|
|
||||||
horizontal: 203,
|
|
||||||
vertical: 203
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
const gotTheLock = electron.app.requestSingleInstanceLock();
|
|
||||||
if (!gotTheLock) {
|
|
||||||
electron.app.quit();
|
|
||||||
} else {
|
|
||||||
electron.app.on("second-instance", (event, commandLine, workingDirectory) => {
|
|
||||||
if (win) {
|
|
||||||
if (win.isMinimized())
|
|
||||||
win.restore();
|
|
||||||
win.focus();
|
|
||||||
win.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
win.on("close", (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
win.webContents.send("showCloseDialog");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
electron.app.on("window-all-closed", () => {
|
|
||||||
if (process.platform !== "darwin")
|
|
||||||
electron.app.quit();
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vite-electron",
|
"name": "vite-electron",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.4.18",
|
"version": "1.4.20",
|
||||||
"main": "dist-electron/main.js",
|
"main": "dist-electron/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "chcp 65001 && vite",
|
"dev": "chcp 65001 && vite",
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ export function queryMembermember(params) {
|
||||||
return request({
|
return request({
|
||||||
method: "get",
|
method: "get",
|
||||||
url: "member/queryMember",
|
url: "member/queryMember",
|
||||||
params
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export function createMembermember(data) {
|
export function createMembermember(data) {
|
||||||
return request({
|
return request({
|
||||||
method: "post",
|
method: "post",
|
||||||
url: "member/createMember",
|
url: "member/createMember",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -28,7 +28,7 @@ export function memberqueryMemberAccount(params) {
|
||||||
return request({
|
return request({
|
||||||
method: "get",
|
method: "get",
|
||||||
url: "member/queryMemberAccount",
|
url: "member/queryMemberAccount",
|
||||||
params
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,7 +40,7 @@ export function accountPaymember(data) {
|
||||||
return request({
|
return request({
|
||||||
method: "post",
|
method: "post",
|
||||||
url: "member/accountPay",
|
url: "member/accountPay",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -52,6 +52,19 @@ export function membermemberScanPay(data) {
|
||||||
return request({
|
return request({
|
||||||
method: "post",
|
method: "post",
|
||||||
url: "member/memberScanPay",
|
url: "member/memberScanPay",
|
||||||
data
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值退款
|
||||||
|
* @param {*} params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function returnFlow(params) {
|
||||||
|
return request({
|
||||||
|
method: "get",
|
||||||
|
url: "member/returnFlow",
|
||||||
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,30 @@ export function login(data) {
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取版本
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function findVersion() {
|
||||||
|
return request({
|
||||||
|
method: "post",
|
||||||
|
url: "login/findVersion",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取是否显示密码
|
||||||
|
* @param {*} params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function queryPwdInfo() {
|
||||||
|
let userInfo = JSON.parse(localStorage.getItem("userInfo"));
|
||||||
|
return request({
|
||||||
|
method: "get",
|
||||||
|
url: "/shopInfo/queryPwdInfo",
|
||||||
|
params: {
|
||||||
|
shopId: userInfo.shopId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<scanModal ref="scanModalRef" fast :amount="money" :selecttype="props.type" :orderId="props.userInfo.id"
|
<scanModal ref="scanModalRef" fast :amount="money" :money="money" :selecttype="props.type" :orderId="props.userInfo.id"
|
||||||
@success="scanCodeSuccess" />
|
@success="scanCodeSuccess" />
|
||||||
<takeFoodCode ref="takeFoodCodeRef" title="支付密码" :type="2" input-type="password" placeholder="请输入支付密码"
|
<takeFoodCode ref="takeFoodCodeRef" title="支付密码" :type="2" input-type="password" placeholder="请输入支付密码"
|
||||||
@success="passwordSuccess" />
|
@success="passwordSuccess" />
|
||||||
|
|
@ -78,6 +78,7 @@ import { useUser } from "@/store/user.js";
|
||||||
import { clearNoNum } from "@/utils";
|
import { clearNoNum } from "@/utils";
|
||||||
import md5 from "js-md5";
|
import md5 from "js-md5";
|
||||||
|
|
||||||
|
import { queryPwdInfo } from '@/api/user.js'
|
||||||
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";
|
import takeFoodCode from "@/components/takeFoodCode.vue";
|
||||||
|
|
@ -128,14 +129,14 @@ function payTypeChange(index, item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取支付密码
|
// 获取支付密码
|
||||||
async function passwordSuccess(e) {
|
async function passwordSuccess(e = '') {
|
||||||
try {
|
try {
|
||||||
payLoading.value = true;
|
payLoading.value = true;
|
||||||
await accountPaymember({
|
await accountPaymember({
|
||||||
shopId: store.userInfo.shopId,
|
shopId: store.userInfo.shopId,
|
||||||
memberId: props.userInfo.id,
|
memberId: props.userInfo.id,
|
||||||
amount: money.value,
|
amount: money.value,
|
||||||
pwd: md5(e),
|
pwd: e ? md5(e) : '',
|
||||||
});
|
});
|
||||||
payLoading.value = false;
|
payLoading.value = false;
|
||||||
ElMessage.success("支付成功");
|
ElMessage.success("支付成功");
|
||||||
|
|
@ -175,8 +176,15 @@ async function confirmOrder() {
|
||||||
emit("paySuccess");
|
emit("paySuccess");
|
||||||
} else {
|
} else {
|
||||||
// 会员充值
|
// 会员充值
|
||||||
|
|
||||||
|
let res = await queryPwdInfo()
|
||||||
|
if (res.isMemberIn == 1) {
|
||||||
takeFoodCodeRef.value.show();
|
takeFoodCodeRef.value.show();
|
||||||
// passwordSuccess()
|
} else {
|
||||||
|
passwordSuccess()
|
||||||
|
}
|
||||||
|
// takeFoodCodeRef.value.show();
|
||||||
|
// // passwordSuccess()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import icon from "@/assets/icon_scan.png";
|
import icon from "@/assets/icon_scan.png";
|
||||||
import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay, queryScanPay } from "@/api/pay";
|
import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay, queryScanPay } from "@/api/pay";
|
||||||
import { useUser } from "@/store/user.js";
|
import { useUser } from "@/store/user.js";
|
||||||
|
|
@ -117,8 +117,8 @@ async function submitHandle() {
|
||||||
memberId: props.orderId,
|
memberId: props.orderId,
|
||||||
amount: props.amount,
|
amount: props.amount,
|
||||||
authCode: scanCode.value,
|
authCode: scanCode.value,
|
||||||
payAmount: props.money < props.amount ? props.money : '',
|
// payAmount: props.money < props.amount ? props.money : '',
|
||||||
discountAmount: props.money < props.amount ? formatDecimal(props.amount - props.money) : ''
|
// discountAmount: props.money < props.amount ? formatDecimal(props.amount - props.money) : ''
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (props.fast) {
|
if (props.fast) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
</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%" :loading="loading" @click="confirmHandle">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -69,6 +69,7 @@ function delHandle() {
|
||||||
number.value = number.value.substring(0, number.value.length - 1);
|
number.value = number.value.substring(0, number.value.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
// 确认
|
// 确认
|
||||||
function confirmHandle() {
|
function confirmHandle() {
|
||||||
if (!number.value) return
|
if (!number.value) return
|
||||||
|
|
@ -77,8 +78,12 @@ function confirmHandle() {
|
||||||
ElMessage.error('请输入正确的密码')
|
ElMessage.error('请输入正确的密码')
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
loading.value = true
|
||||||
emit("success", number.value);
|
emit("success", number.value);
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.value = false
|
||||||
|
}, 1000)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit("success", number.value);
|
emit("success", number.value);
|
||||||
|
|
|
||||||
|
|
@ -89,28 +89,31 @@
|
||||||
<el-text class="t">打包(¥{{ cartInfo.packAmount || 0 }})</el-text>
|
<el-text class="t">打包(¥{{ cartInfo.packAmount || 0 }})</el-text>
|
||||||
</div>
|
</div>
|
||||||
<div class="num-wrap">
|
<div class="num-wrap">
|
||||||
<el-text>共{{ cartInfo.productNum || 0 }}种商品,{{
|
<!-- 共{{ cartInfo.productNum || 0 }}种商品 -->
|
||||||
|
共<el-text>{{
|
||||||
cartInfo.productSum || 0
|
cartInfo.productSum || 0
|
||||||
}}件</el-text>
|
}}件</el-text>,¥{{ formatDecimal(cartInfo.totalAmount || 0) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="btm">
|
<div class="btm">
|
||||||
<el-button icon="Edit" @click="remarkRef.show()"></el-button>
|
<el-button icon="Edit" @click="remarkRef.show()"></el-button>
|
||||||
<div class="button">
|
<div class="button">
|
||||||
<el-button type="primary" style="width: 100%" :disabled="!cartList.length" v-loading="createOrderLoading"
|
<div class="btn" v-if="global.tableInfo.id">
|
||||||
@click="createOrderHandle">
|
<el-button type="primary" style="width: 100%;" :disabled="!cartList.length"
|
||||||
|
@click="createOrderHandle(0)">仅下单</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="btn">
|
||||||
|
<el-button type="primary" style="width: 100%;" :disabled="!cartList.length" v-loading="createOrderLoading"
|
||||||
|
@click="createOrderHandle(1)">
|
||||||
<template v-if="!createOrderLoading">
|
<template v-if="!createOrderLoading">
|
||||||
<template v-if="!global.tableInfo.id">
|
去结算</template>
|
||||||
结算
|
|
||||||
</template>
|
|
||||||
<template v-else>下单</template>
|
|
||||||
(¥{{ cartInfo.totalAmount || 0 }})</template>
|
|
||||||
<template v-else>下单中...</template>
|
<template v-else>下单中...</template>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="shop_manage card">
|
<div class="shop_manage card">
|
||||||
<!-- 分类/商品列表 -->
|
<!-- 分类/商品列表 -->
|
||||||
<goods ref="goodsRef" :masterId="masterId" @success="addCart" />
|
<goods ref="goodsRef" :masterId="masterId" @success="addCart" />
|
||||||
|
|
@ -151,6 +154,7 @@ import settleAccount from "@/views/home/components/settleAccount.vue";
|
||||||
import fastCashier from "@/views/home/components/fastCashier.vue";
|
import fastCashier from "@/views/home/components/fastCashier.vue";
|
||||||
import pendingCartModal from "@/views/home/components/pendingCartModal.vue";
|
import pendingCartModal from "@/views/home/components/pendingCartModal.vue";
|
||||||
import useStorage from '@/utils/useStorage'
|
import useStorage from '@/utils/useStorage'
|
||||||
|
import { formatDecimal } from '@/utils/index.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createCart,
|
createCart,
|
||||||
|
|
@ -199,7 +203,7 @@ const masterId = ref("");
|
||||||
const pendingCartNum = ref(0);
|
const pendingCartNum = ref(0);
|
||||||
|
|
||||||
// 生成订单
|
// 生成订单
|
||||||
async function createOrderHandle() {
|
async function createOrderHandle(t = 0) {
|
||||||
try {
|
try {
|
||||||
createOrderLoading.value = true;
|
createOrderLoading.value = true;
|
||||||
const res = await createOrder({
|
const res = await createOrder({
|
||||||
|
|
@ -207,11 +211,12 @@ async function createOrderHandle() {
|
||||||
shopId: store.userInfo.shopId,
|
shopId: store.userInfo.shopId,
|
||||||
remark: remark.value,
|
remark: remark.value,
|
||||||
vipUserId: global.orderMemberInfo.id || '',
|
vipUserId: global.orderMemberInfo.id || '',
|
||||||
tableId: global.tableInfo.qrcode || ''
|
tableId: global.tableInfo.qrcode || '',
|
||||||
|
type: t
|
||||||
});
|
});
|
||||||
createOrderLoading.value = false;
|
createOrderLoading.value = false;
|
||||||
|
|
||||||
if (global.tableInfo.id) {
|
if (global.tableInfo.id && t == 0) {
|
||||||
ElMessage.success('下单成功')
|
ElMessage.success('下单成功')
|
||||||
global.setOrderTable({})
|
global.setOrderTable({})
|
||||||
createCodeAjax(1)
|
createCodeAjax(1)
|
||||||
|
|
@ -653,6 +658,12 @@ onMounted(() => {
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
gap: var(--el-font-size-base);
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.js {
|
.js {
|
||||||
.t {
|
.t {
|
||||||
|
|
|
||||||
|
|
@ -1,290 +1,27 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- <el-button @click="chooseSerial">获取串口列表</el-button> -->
|
<el-button>button</el-button>
|
||||||
<el-button @click="initWebSocket()">连接ws</el-button>
|
|
||||||
<el-button @click="dakai()"></el-button>
|
|
||||||
<!-- 打印二维码 -->
|
|
||||||
<rintermodelindex ref="rintermodelindexref" :form="form" @somethingDone="handleSomethingDone"></rintermodelindex>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import _ from 'lodash'
|
import { onMounted } from 'vue'
|
||||||
import { bySubType } from "@/api/device";
|
import { findVersion } from '@/api/user.js'
|
||||||
import { ElMessage } from "element-plus";
|
import packageData from "../../../package.json";
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { ipcRenderer } from 'electron'
|
|
||||||
import { onMounted, ref } from 'vue';
|
|
||||||
import { useUser } from "@/store/user.js";
|
|
||||||
import useStorage from '@/utils/useStorage'
|
|
||||||
import rintermodelindex from '@/components/lodop/index.vue'
|
|
||||||
const store = useUser();
|
|
||||||
|
|
||||||
const rintermodelindexref = ref()//打印机ref
|
async function findVersionAjax() {
|
||||||
// 打印成功回调
|
|
||||||
const handleSomethingDone = () => {
|
|
||||||
console.log('打印成功回调成功')
|
|
||||||
}
|
|
||||||
const form = ref({
|
|
||||||
article: '1',
|
|
||||||
type: '2',
|
|
||||||
|
|
||||||
})
|
|
||||||
const dakai = () => {
|
|
||||||
rintermodelindexref.value.centerDialogVisibleshow() //打开二维码打印
|
|
||||||
rintermodelindexref.value.initialization()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 小票打印机列表
|
|
||||||
const printList = ref([]);
|
|
||||||
// 标签打印机列表
|
|
||||||
const printLabelList = ref([]);
|
|
||||||
const localPrintList = ref([])
|
|
||||||
|
|
||||||
// 获取打印机状态
|
|
||||||
async function bySubTypeAjax() {
|
|
||||||
try {
|
try {
|
||||||
const res1 = await bySubType({
|
const res = await findVersion()
|
||||||
shopId: store.userInfo.shopId,
|
let reg = /\./g;
|
||||||
contentType: "local",
|
// console.log('res.version', res.version.replace(reg, ''));
|
||||||
subType: "cash",
|
// console.log('packageData.version', packageData.version.replace(reg, ''));
|
||||||
});
|
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url) {
|
||||||
const res2 = await bySubType({
|
console.log('有版本更新');
|
||||||
shopId: store.userInfo.shopId,
|
}
|
||||||
contentType: "local",
|
|
||||||
subType: "label",
|
|
||||||
});
|
|
||||||
printList.value = res1;
|
|
||||||
printLabelList.value = res2;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取本地打印机列表
|
|
||||||
function getPrintList() {
|
|
||||||
ipcRenderer.send("getPrintList");
|
|
||||||
ipcRenderer.on("printList", (event, arg) => {
|
|
||||||
localPrintList.value = arg;
|
|
||||||
// console.log(localPrintList.value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查本地打印机是否能正常使用
|
|
||||||
function checkLocalPrint(deviceName) {
|
|
||||||
let print = ''
|
|
||||||
for (let item of localPrintList.value) {
|
|
||||||
if (item.name == deviceName) {
|
|
||||||
print = item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!print.name) {
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打印小票
|
|
||||||
function printBill(props) {
|
|
||||||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
|
||||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
|
||||||
} else {
|
|
||||||
const data = {
|
|
||||||
shop_name: store.userInfo.merchantName,
|
|
||||||
carts: props.carts,
|
|
||||||
amount: props.amount,
|
|
||||||
remark: props.remark,
|
|
||||||
orderInfo: props.orderInfo,
|
|
||||||
deviceName: printList.value[0].config.deviceName,
|
|
||||||
createdAt: dayjs(props.orderInfo.createdAt).format(
|
|
||||||
"YYYY-MM-DD HH:mm:ss"
|
|
||||||
),
|
|
||||||
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
||||||
};
|
|
||||||
ipcRenderer.send("printerInfoSync", JSON.stringify(data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测是否打印标签小票
|
|
||||||
function checkLabelPrint(props) {
|
|
||||||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
|
||||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
|
||||||
} else {
|
|
||||||
let pids = printLabelList.value[0].config.categoryList.map(item => item.id)
|
|
||||||
let labelList = []
|
|
||||||
props.carts.map(item => {
|
|
||||||
if (pids.some(el => el == item.categoryId)) {
|
|
||||||
for (let i = 0; i < item.number; i++) {
|
|
||||||
labelList.push(
|
|
||||||
{
|
|
||||||
outNumber: props.outNumber,
|
|
||||||
name: item.name,
|
|
||||||
skuName: item.skuName,
|
|
||||||
masterId: props.orderInfo.tableName,
|
|
||||||
deviceName: printLabelList.value[0].config.deviceName,
|
|
||||||
createdAt: dayjs(props.createdAt).format('YYYY-MM-DD HH:mm:ss')
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
printLabel(labelList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打印标签
|
|
||||||
let labelCount = ref(0)
|
|
||||||
let labelPrintTimer = ref(null)
|
|
||||||
function printLabel(list) {
|
|
||||||
console.log(list);
|
|
||||||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
|
||||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
|
||||||
} else {
|
|
||||||
labelPrintTimer.value = setInterval(() => {
|
|
||||||
// console.log('labelCount', labelCount.value);
|
|
||||||
list[labelCount.value].count = `${list.length - labelCount.value}/${list.length}`
|
|
||||||
ipcRenderer.send('printerTagSync', JSON.stringify(list[labelCount.value]))
|
|
||||||
labelCount.value++
|
|
||||||
if (labelCount.value > list.length - 1) {
|
|
||||||
clearInterval(labelPrintTimer.value)
|
|
||||||
labelPrintTimer.value = null
|
|
||||||
labelCount.value = 0
|
|
||||||
}
|
|
||||||
}, 1000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let ws = ref(null)
|
|
||||||
let wsIsClose = ref(false)
|
|
||||||
// 初始化websocket
|
|
||||||
function initWebSocket(wsUrl = 'wss://wxcashiertest.sxczgkj.cn/client') {
|
|
||||||
ws.value = new WebSocket(wsUrl);
|
|
||||||
console.log("websocket:", ws.value);
|
|
||||||
|
|
||||||
ws.value.onopen = function () {
|
|
||||||
console.log('wss连接成功');
|
|
||||||
// 清除心跳
|
|
||||||
clearInterval(heartbeatTimer.value)
|
|
||||||
heartbeatTimer.value = null
|
|
||||||
startheartbeat()
|
|
||||||
|
|
||||||
// 清除重连
|
|
||||||
clearInterval(reConnectTimer.value)
|
|
||||||
reConnectTimer.value = null
|
|
||||||
reConnectCount.value = 0
|
|
||||||
|
|
||||||
ws.value.send(JSON.stringify({
|
|
||||||
type: "connect",
|
|
||||||
shopId: store.userInfo.shopId,
|
|
||||||
clientId: useStorage.get('uuid')
|
|
||||||
}))
|
|
||||||
};
|
|
||||||
|
|
||||||
// 接收消息
|
|
||||||
ws.value.onmessage = function (e) {
|
|
||||||
// websocketonmessage(e);
|
|
||||||
let data = JSON.parse(e.data)
|
|
||||||
if (data.type == 'order') {
|
|
||||||
console.log('接收消息', data);
|
|
||||||
// 接收订单消息,打印小票
|
|
||||||
// printBill(data)
|
|
||||||
|
|
||||||
// 检测是否需要打印标签小票
|
|
||||||
checkLabelPrint(data)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 连接发生错误
|
|
||||||
ws.value.onerror = function () {
|
|
||||||
console.log("WebSocket连接发生错误");
|
|
||||||
|
|
||||||
// 清除心跳
|
|
||||||
clearInterval(heartbeatTimer.value)
|
|
||||||
heartbeatTimer.value = null
|
|
||||||
|
|
||||||
// 手动关闭后不在执行自动连接任务
|
|
||||||
if (!wsIsClose.value) reConnect(wsUrl);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 关闭
|
|
||||||
ws.value.onclose = function (e) {
|
|
||||||
console.log('ws关闭了', e);
|
|
||||||
|
|
||||||
// 清除心跳
|
|
||||||
clearInterval(heartbeatTimer.value)
|
|
||||||
heartbeatTimer.value = null
|
|
||||||
|
|
||||||
// 手动关闭后不在执行自动连接任务
|
|
||||||
if (!wsIsClose.value) reConnect(wsUrl);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 启动心跳连接
|
|
||||||
let heartbeatTimer = ref(null)
|
|
||||||
function startheartbeat() {
|
|
||||||
heartbeatTimer.value = setInterval(() => {
|
|
||||||
ws.value.send(JSON.stringify({ type: 'heartbeat' }))
|
|
||||||
}, 10000)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重连最大次数5次
|
|
||||||
let reConnectCount = ref(0)
|
|
||||||
let reConnectTimer = ref(null)
|
|
||||||
function reConnect(wsUrl) {
|
|
||||||
if (reConnectTimer.value != null) return
|
|
||||||
reConnectTimer.value = setInterval(() => {
|
|
||||||
// 自动连接超过5次不在连接,需手动出发
|
|
||||||
console.log('reConnectCount.value===', reConnectCount.value);
|
|
||||||
if (reConnectCount.value >= 5) {
|
|
||||||
console.log('重连超过5次,不在连接');
|
|
||||||
clearInterval(reConnectTimer.value)
|
|
||||||
reConnectTimer.value = null
|
|
||||||
reConnectCount.value = 0
|
|
||||||
wsIsClose.value = true
|
|
||||||
ws.value.close()
|
|
||||||
} else {
|
|
||||||
reConnectCount.value++
|
|
||||||
initWebSocket(wsUrl)
|
|
||||||
}
|
|
||||||
}, 5000)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 打印标签小票
|
|
||||||
const printTag = () => {
|
|
||||||
ipcRenderer.send('printerTagSync', JSON.stringify({
|
|
||||||
deviceName: 'Xprinter XP-365B123'
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
//选择串口设备
|
|
||||||
const chooseSerial = async () => {
|
|
||||||
// let printNum = localStorage.getItem('printNum')
|
|
||||||
// if (!printNum) {
|
|
||||||
// printNum = 1
|
|
||||||
// localStorage.setItem('printNum', printNum)
|
|
||||||
// } else {
|
|
||||||
// printNum++
|
|
||||||
// localStorage.setItem('printNum', printNum)
|
|
||||||
// }
|
|
||||||
// ipcRenderer.send('printStart', printNum)
|
|
||||||
// ipcRenderer.send('getSerialPort')
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
ipcRenderer.on('seriaportList', (e, a) => {
|
findVersionAjax()
|
||||||
console.log('seriaportList', a);
|
|
||||||
})
|
|
||||||
|
|
||||||
getPrintList();
|
|
||||||
bySubTypeAjax();
|
|
||||||
initWebSocket()
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
|
<el-dialog v-model="visableDialog" title="余额明细" width="500">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="dialog_footer" v-for="(item, index) in props.flowingwater.list" :key="index">
|
<div class="box1" v-loading="tableData.loading">
|
||||||
|
<div class="dialog_footer" v-for="(item, index) in tableData.list" :key="index">
|
||||||
<div class="dialog_footer_left">
|
<div class="dialog_footer_left">
|
||||||
<span>{{ item.biz_name }}</span>
|
<span>{{ item.biz_name }}</span>
|
||||||
<span>{{ dayjs(item.create_time).format("YYYY-MM-DD HH:mm:ss") }}</span>
|
<span>{{ dayjs(item.create_time).format("YYYY-MM-DD HH:mm:ss") }}</span>
|
||||||
|
|
@ -13,28 +15,173 @@
|
||||||
</span>
|
</span>
|
||||||
<span>余额:¥{{ formatDecimal(item.balance) }}</span>
|
<span>余额:¥{{ formatDecimal(item.balance) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="btm" style="width: 80px;">
|
||||||
|
<el-button type="primary"
|
||||||
|
v-if="item.biz_code == 'scanMemberIn' || item.biz_code == 'cashMemberIn'"
|
||||||
|
@click="showRefundHandle(item)" :disabled="item.is_return == 1">
|
||||||
|
<template v-if="item.is_return == 0">退款</template>
|
||||||
|
<template v-if="item.is_return == 1">已退</template>
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-empty description="暂无数据" v-if="!props.flowingwater.list.length" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<el-empty description="暂无数据" v-if="!tableData.list.length" />
|
||||||
|
</div>
|
||||||
|
<div class="page_wrap">
|
||||||
|
<el-pagination v-model:current-page="tableData.page" background layout="prev, pager, next, total"
|
||||||
|
:total="tableData.total" @current-change="memberqueryMemberAccountAjax" />
|
||||||
|
</div>
|
||||||
|
<el-dialog v-model="showDialog" title="会员充值退款">
|
||||||
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100">
|
||||||
|
<el-form-item label="退款金额" prop="amount">
|
||||||
|
<el-input-number v-model="form.amount" :min="1" :max="refundItem.amount"
|
||||||
|
placeholder="请输入退款金额" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="退款说明">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入退款说明" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div style="padding: 0 20px 20px;">
|
||||||
|
<el-button @click="showDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="loading" @click="refundHandle">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
<takeFoodCode ref="takeFoodCodeRef" title="退款密码" :type="2" input-type="password" placeholder="请输入退款密码"
|
||||||
|
@success="passwordSuccess" />
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import md5 from "js-md5";
|
||||||
import { dayjs } from 'element-plus'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
|
import { dayjs, ElMessage } from 'element-plus'
|
||||||
import { formatDecimal } from '@/utils/index'
|
import { formatDecimal } from '@/utils/index'
|
||||||
|
import { returnFlow, memberqueryMemberAccount } from '@/api/member/index.js'
|
||||||
|
import { queryPwdInfo } from '@/api/user.js'
|
||||||
|
import takeFoodCode from "@/components/takeFoodCode.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const memberId = ref('')
|
||||||
flowingwater: {
|
|
||||||
type: Object,
|
const visableDialog = ref(false)
|
||||||
default: {}
|
|
||||||
|
const tableData = reactive({
|
||||||
|
page: 1,
|
||||||
|
total: 0,
|
||||||
|
loading: false,
|
||||||
|
list: []
|
||||||
|
})
|
||||||
|
|
||||||
|
// 会员流水
|
||||||
|
async function memberqueryMemberAccountAjax() {
|
||||||
|
try {
|
||||||
|
tableData.loading = true
|
||||||
|
let res = await memberqueryMemberAccount({
|
||||||
|
memberId: memberId.value,
|
||||||
|
page: tableData.page,
|
||||||
|
pageSize: 10
|
||||||
|
})
|
||||||
|
tableData.loading = false
|
||||||
|
tableData.total = res.total
|
||||||
|
tableData.list = res.list
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits(['refund'])
|
||||||
|
|
||||||
|
const takeFoodCodeRef = ref(null)
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const form = reactive({
|
||||||
|
amount: 1,
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
const rules = reactive({
|
||||||
|
amount: [
|
||||||
|
{
|
||||||
|
trigger: 'blur',
|
||||||
|
required: true,
|
||||||
|
message: '请输入退款金额'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
const loading = ref(false)
|
||||||
|
const refundItem = ref({})
|
||||||
|
const formRef = ref(null)
|
||||||
|
|
||||||
|
function showRefundHandle(item) {
|
||||||
|
refundItem.value = item
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 线上充值退款
|
||||||
|
function refundHandle() {
|
||||||
|
formRef.value.validate(async valid => {
|
||||||
|
try {
|
||||||
|
if (valid) {
|
||||||
|
loading.value = true
|
||||||
|
let res = await queryPwdInfo()
|
||||||
|
loading.value = false
|
||||||
|
if (res.isMemberReturn == 1) {
|
||||||
|
takeFoodCodeRef.value.show();
|
||||||
|
} else {
|
||||||
|
passwordSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
loading.value = false
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 得到退款密码
|
||||||
|
async function passwordSuccess(e = '') {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
const res = await returnFlow({
|
||||||
|
flowId: refundItem.value.id,
|
||||||
|
remark: form.remark,
|
||||||
|
amount: form.amount,
|
||||||
|
pwd: e ? md5(e) : '',
|
||||||
|
})
|
||||||
|
ElMessage.success('退款成功')
|
||||||
|
form.amount = 1
|
||||||
|
form.remark = ''
|
||||||
|
showDialog.value = false
|
||||||
|
loading.value = false
|
||||||
|
emits('refund')
|
||||||
|
memberqueryMemberAccountAjax()
|
||||||
|
} catch (error) {
|
||||||
|
loading.value = false
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function show(id) {
|
||||||
|
memberId.value = id
|
||||||
|
visableDialog.value = true
|
||||||
|
memberqueryMemberAccountAjax()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.box {
|
.box {
|
||||||
height: 400px;
|
|
||||||
overflow: auto;
|
.box1 {
|
||||||
|
height: 350px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page_wrap {
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.dialog_footer:nth-child(1) {
|
.dialog_footer:nth-child(1) {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
|
@ -43,12 +190,12 @@ const props = defineProps({
|
||||||
.dialog_footer {
|
.dialog_footer {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 1px solid #ececec;
|
border-bottom: 1px solid #ececec;
|
||||||
padding-bottom: 6px;
|
padding-bottom: 6px;
|
||||||
|
|
||||||
.dialog_footer_left {
|
.dialog_footer_left {
|
||||||
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
|
@ -67,9 +214,11 @@ const props = defineProps({
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog_footer_right {
|
.dialog_footer_right {
|
||||||
|
width: 150px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
|
padding-right: 20px;
|
||||||
|
|
||||||
span:nth-child(1) {
|
span:nth-child(1) {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
<div class="orderbox_right_top_item_tow">{{ tableData.list.length != 0 ?
|
<div class="orderbox_right_top_item_tow">{{ tableData.list.length != 0 ?
|
||||||
tableData.list[datarow].levelConsume : '无' }}</div>
|
tableData.list[datarow].levelConsume : '无' }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="orderbox_right_top_item" @click="stored = true">
|
<div class="orderbox_right_top_item" @click="dialogRef.show(tableData.list[datarow].id)">
|
||||||
<div class="orderbox_right_top_item_one">
|
<div class="orderbox_right_top_item_one">
|
||||||
<el-icon :size="24" style="color:#00b58d ;">
|
<el-icon :size="24" style="color:#00b58d ;">
|
||||||
<Box />
|
<Box />
|
||||||
|
|
@ -94,10 +94,7 @@
|
||||||
<el-button style="width: 60%;" type="primary">确认</el-button>
|
<el-button style="width: 60%;" type="primary">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<add ref="dialogRef" @refund="refundSuccess" @page-change="MemberAccount" />
|
||||||
<el-dialog v-model="stored" title="余额明细" width="500" :before-close="handleClose">
|
|
||||||
<add :flowingwater='flowingwater' />
|
|
||||||
</el-dialog>
|
|
||||||
<el-dialog v-model="memberaddshow" title="添加会员" width="600" :before-close="memberaddshowclose"
|
<el-dialog v-model="memberaddshow" title="添加会员" width="600" :before-close="memberaddshowclose"
|
||||||
@open="membrform = { ...resetMembrform }">
|
@open="membrform = { ...resetMembrform }">
|
||||||
<el-form ref="formRef" :rules="rules" :model="membrform" label-width="70px" hide-required-asterisk>
|
<el-form ref="formRef" :rules="rules" :model="membrform" label-width="70px" hide-required-asterisk>
|
||||||
|
|
@ -194,6 +191,9 @@ const stored = ref(false)//储值余额
|
||||||
const handleClose = async () => {
|
const handleClose = async () => {
|
||||||
stored.value = !stored.value
|
stored.value = !stored.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dialogRef = ref(null)
|
||||||
|
|
||||||
const emit = defineEmits('paySuccess')
|
const emit = defineEmits('paySuccess')
|
||||||
|
|
||||||
function paySuccess() {
|
function paySuccess() {
|
||||||
|
|
@ -238,6 +238,12 @@ const payCarddialogVisible = ref(false)
|
||||||
|
|
||||||
const orderId = ref('')
|
const orderId = ref('')
|
||||||
|
|
||||||
|
// 退款成功
|
||||||
|
function refundSuccess() {
|
||||||
|
asyncqueryMembermember()
|
||||||
|
MemberAccount()
|
||||||
|
}
|
||||||
|
|
||||||
const confirmEvent = async () => {//子组件 确认按钮
|
const confirmEvent = async () => {//子组件 确认按钮
|
||||||
orderId.value = tableData.list[datarow.value].id
|
orderId.value = tableData.list[datarow.value].id
|
||||||
payCarddialogVisible.value = true
|
payCarddialogVisible.value = true
|
||||||
|
|
@ -262,15 +268,15 @@ const confirmEvent = async () => {//子组件 确认按钮
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
const MemberAccount = async () => {//获取流水
|
const MemberAccount = async (page = 1) => {//获取流水
|
||||||
try {
|
try {
|
||||||
let res = await memberqueryMemberAccount({
|
let res = await memberqueryMemberAccount({
|
||||||
memberId: tableData.list[datarow.value].id,
|
memberId: tableData.list[datarow.value].id,
|
||||||
page: 1,
|
page: page,
|
||||||
pageSize: 10
|
pageSize: 10
|
||||||
})
|
})
|
||||||
flowingwater.total = res.total
|
flowingwater.total = res.total
|
||||||
flowingwater.list = res.list
|
// flowingwater.list = res.list
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,8 @@
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
<takeFoodCode ref="takeFoodCodeRef" title="支付密码" type="password" placeholder="请输入支付密码" @success="passwordSuccess" />
|
<takeFoodCode ref="takeFoodCodeRef" title="支付密码" type="2" inputType="password" placeholder="请输入支付密码"
|
||||||
|
@success="passwordSuccess" />
|
||||||
<invoice ref="invoiceRef" @load-complete="invoiceLoading = false" />
|
<invoice ref="invoiceRef" @load-complete="invoiceLoading = false" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -323,6 +324,7 @@ import {
|
||||||
cloudPrinterprint,
|
cloudPrinterprint,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
} from "@/api/order/index.js";
|
} from "@/api/order/index.js";
|
||||||
|
import { queryPwdInfo } from '@/api/user.js'
|
||||||
import add from "@/views/order/components/add.vue";
|
import add from "@/views/order/components/add.vue";
|
||||||
import cashTable from "@/views/order/components/cashTable.vue";
|
import cashTable from "@/views/order/components/cashTable.vue";
|
||||||
import { clearNoNum, formatDecimal } from "@/utils";
|
import { clearNoNum, formatDecimal } from "@/utils";
|
||||||
|
|
@ -404,15 +406,15 @@ async function passwordSuccess(pwd) {
|
||||||
return item && item;
|
return item && item;
|
||||||
});
|
});
|
||||||
if (arr.length != 0) {
|
if (arr.length != 0) {
|
||||||
await payreturnOrder(arr, md5(pwd), isOnline.value);
|
// await payreturnOrder(arr, md5(pwd), isOnline.value);
|
||||||
// await payreturnOrder(arr, '', isOnline.value);
|
await payreturnOrder(arr, pwd ? md5(pwd) : '', isOnline.value);
|
||||||
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();
|
await asyncorderfindOrder();
|
||||||
} else {
|
} else {
|
||||||
buttonloading.value = false;
|
buttonloading.value = false;
|
||||||
ElMessage.error("没有退款项目!");
|
ElMessage.error("没有退款项目!");
|
||||||
|
|
@ -432,8 +434,13 @@ const payreturnOrderclick = lodash.debounce(
|
||||||
ElMessage.error("退款金额不能为0!");
|
ElMessage.error("退款金额不能为0!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let res = await queryPwdInfo()
|
||||||
|
if (res.isReturn == 1) {
|
||||||
takeFoodCodeRef.value.show();
|
takeFoodCodeRef.value.show();
|
||||||
// passwordSuccess()
|
} else {
|
||||||
|
passwordSuccess()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
500,
|
500,
|
||||||
{ leading: true, trailing: false }
|
{ leading: true, trailing: false }
|
||||||
|
|
@ -518,6 +525,7 @@ const print = lodash.throttle(
|
||||||
}
|
}
|
||||||
} else if (e == 'refund') {
|
} else if (e == 'refund') {
|
||||||
if (printStore.deviceNoteList.length) {
|
if (printStore.deviceNoteList.length) {
|
||||||
|
console.log('本地打退票');
|
||||||
normalPrintLoading.value = true
|
normalPrintLoading.value = true
|
||||||
const data = {
|
const data = {
|
||||||
shop_name: store.userInfo.shopName,
|
shop_name: store.userInfo.shopName,
|
||||||
|
|
@ -549,6 +557,8 @@ const print = lodash.throttle(
|
||||||
normalPrintLoading.value = false
|
normalPrintLoading.value = false
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
|
console.log('云打退票');
|
||||||
|
|
||||||
// 云打票
|
// 云打票
|
||||||
await cloudPrinterprint({
|
await cloudPrinterprint({
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,26 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow_y" v-loading="loading">
|
<div class="overflow_y" v-loading="loading">
|
||||||
<div class="tab_list">
|
<div class="tab_list">
|
||||||
<div class="item" :class="{ active: tableItemActive == index }"
|
<div class="item"
|
||||||
|
:class="{ active: tableItemActive == index, using: item.status == 'using', closed: item.status == 'closed' }"
|
||||||
v-for="(item, index) in tableList" :key="item.id" @click="slectTableHandle(index, item)">
|
v-for="(item, index) in tableList" :key="item.id" @click="slectTableHandle(index, item)">
|
||||||
<div class="tab_title" :class="`${item.status}`">
|
<div class="tab_title" :class="`${item.status}`">
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<span>0/{{ item.maxCapacity }}</span>
|
<span>0/{{ item.maxCapacity }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab_cont">
|
<div class="tab_cont">
|
||||||
<el-icon class="icon">
|
<el-icon class="icon" v-if="item.status != 'using'">
|
||||||
<CircleClose />
|
<CircleClose />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
<div class="using" v-else>
|
||||||
|
<div class="t1">开台中</div>
|
||||||
|
<!-- <div class="t2">
|
||||||
|
<el-icon>
|
||||||
|
<Timer />
|
||||||
|
</el-icon>
|
||||||
|
<span>{{ countTime(item.updatedAt) }}</span>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -58,6 +68,7 @@ import tableInfo from '@/views/table/components/tableInfo.vue'
|
||||||
|
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useUser } from "@/store/user.js"
|
import { useUser } from "@/store/user.js"
|
||||||
|
import { dayjs } from 'element-plus'
|
||||||
const store = useUser()
|
const store = useUser()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,6 +110,12 @@ function tabChange(item, index) {
|
||||||
queryShopTableAjax()
|
queryShopTableAjax()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 计算当前的时间差
|
||||||
|
function countTime(t) {
|
||||||
|
let ctime = dayjs().valueOf()
|
||||||
|
return dayjs(ctime - t).format('H小时m分')
|
||||||
|
}
|
||||||
|
|
||||||
// 支付成功,刷新状态
|
// 支付成功,刷新状态
|
||||||
async function paySuccess() {
|
async function paySuccess() {
|
||||||
await queryShopTableAjax()
|
await queryShopTableAjax()
|
||||||
|
|
@ -241,9 +258,28 @@ onMounted(() => {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 2px solid #fff;
|
border: 2px solid #fff;
|
||||||
|
$usingColor: #D2441F;
|
||||||
|
$subColor: #3274D5;
|
||||||
|
$closedColor: #aeb8c9;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
border-color: var(--primary-color);
|
border-color: $subColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.using {
|
||||||
|
&.active {
|
||||||
|
border-color: $usingColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.closed {
|
||||||
|
.tab_title {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
border-color: $closedColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
@ -260,19 +296,19 @@ onMounted(() => {
|
||||||
background-color: #999;
|
background-color: #999;
|
||||||
|
|
||||||
&.subscribe {
|
&.subscribe {
|
||||||
background-color: var(--el-color-success);
|
background-color: $subColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.closed {
|
&.closed {
|
||||||
background-color: #999;
|
background-color: $closedColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.idle {
|
&.idle {
|
||||||
background-color: var(--primary-color);
|
background-color: $subColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.using {
|
&.using {
|
||||||
background-color: var(--el-color-success);
|
background-color: $usingColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.opening {
|
&.opening {
|
||||||
|
|
@ -295,6 +331,27 @@ onMounted(() => {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.using {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
|
||||||
|
.t2 {
|
||||||
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 2px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue