This commit is contained in:
gyq 2024-07-12 17:54:26 +08:00
parent 815b6e0a25
commit e00feb82ec
4 changed files with 32 additions and 41 deletions

View File

@ -2,16 +2,16 @@
ENV = production
# 正式ws
VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
#测试ws
# VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# 测试 php
VITE_API_PHP_URL = 'http://192.168.2.33:1666/index.php/api'
# 测试
# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# 线上环境接口地址
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/'
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/'

View File

@ -1,7 +1,7 @@
{
"name": "vite-electron",
"private": true,
"version": "1.3.53",
"version": "1.3.54",
"main": "dist-electron/main.js",
"scripts": {
"dev": "chcp 65001 && vite",

View File

@ -25,13 +25,8 @@
</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>
@ -46,12 +41,7 @@
</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>
@ -69,22 +59,10 @@
</div>
</div>
</div>
<scanModal
ref="scanModalRef"
fast
:amount="money"
:selecttype="props.type"
:orderId="props.userInfo.id"
@success="scanCodeSuccess"
/>
<takeFoodCode
ref="takeFoodCodeRef"
title="支付密码"
:type="2"
input-type="password"
placeholder="请输入支付密码"
@success="passwordSuccess"
/>
<scanModal ref="scanModalRef" fast :amount="money" :selecttype="props.type" :orderId="props.userInfo.id"
@success="scanCodeSuccess" />
<takeFoodCode ref="takeFoodCodeRef" title="支付密码" :type="2" input-type="password" placeholder="请输入支付密码"
@success="passwordSuccess" />
</template>
<script setup>
@ -157,7 +135,7 @@ async function passwordSuccess(e) {
shopId: store.userInfo.shopId,
memberId: props.userInfo.id,
amount: money.value,
pwd: md5(e),
// pwd: md5(e),
});
payLoading.value = false;
ElMessage.success("支付成功");
@ -197,7 +175,8 @@ async function confirmOrder() {
emit("paySuccess");
} else {
//
takeFoodCodeRef.value.show();
// takeFoodCodeRef.value.show();
passwordSuccess()
}
break;
default:
@ -387,9 +366,7 @@ 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,3 +1,4 @@
import _ from "lodash";
import { defineStore } from "pinia";
import { useUser } from "@/store/user.js";
import { usePrint } from "@/store/print.js";
@ -31,10 +32,19 @@ export const useSocket = defineStore({
// 关闭ws
close() {
console.log("关闭ws");
this.ws.close();
this.ws = null;
this.ws.close(1000);
// this.ws = null;
this.clearHeartBeat();
},
wsReconnect: _.throttle(
function () {
if (this.ws.readyState == ReconnectingWebSocket.OPEN) return;
this.ws.reconnect();
console.log("11111");
},
2000,
{ leading: true, trailing: false }
),
// 初始化
init(wsUrl = import.meta.env.VITE_API_WSS) {
this.createUUID();
@ -45,7 +55,11 @@ export const useSocket = defineStore({
printStore.init();
if (this.ws == null) {
console.log("创建新的ws连接");
this.ws = new ReconnectingWebSocket(wsUrl);
} else {
console.log("重新连接ws");
this.wsReconnect();
}
this.ws.addEventListener("open", (event) => {