问题修复
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
ref="payPasswordref"
|
||||
:isShow="ispws"
|
||||
@inputComplete="(e) => accountPayevent(e)"
|
||||
@close="ispws = false"
|
||||
@close="pwdClose"
|
||||
/>
|
||||
<!-- 私域引流配置 -->
|
||||
<OrderFinshModal v-model="showDrainage"></OrderFinshModal>
|
||||
@@ -228,7 +228,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { back } from "@/utils/uniapp.js";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { onLoad ,onUnload} from "@dcloudio/uni-app";
|
||||
import ChargeVue from "./components/charge.vue";
|
||||
import { pay } from "@/utils/pay.js";
|
||||
import OrderFinshModal from "@/components/order-finish-modal.vue";
|
||||
@@ -263,6 +263,19 @@ import {
|
||||
import { useCartsStore } from "@/stores/carts.js";
|
||||
import { useWebSocket } from "@/stores/carts-websocket.js";
|
||||
|
||||
function pwdClose() {
|
||||
ispws.value = false;
|
||||
pay_unlock();
|
||||
}
|
||||
|
||||
onUnload(()=> {
|
||||
console.log("onUnload");
|
||||
closeSocket();
|
||||
})
|
||||
onBackPress(()=> {
|
||||
console.log("返回拦截");
|
||||
closeSocket();
|
||||
})
|
||||
function onback() {
|
||||
closeSocket();
|
||||
console.log("返回");
|
||||
@@ -306,18 +319,24 @@ async function onMessage(Message) {
|
||||
youhuiReset();
|
||||
}
|
||||
if (Message.operate_type == "cleanup") {
|
||||
listinfo.totalCost = 0;
|
||||
console.log("onMessage:cleanup", Message);
|
||||
console.log("onMessage:options", options);
|
||||
console.log("onMessage:listinfo", listinfo);
|
||||
youhuiReset();
|
||||
if (listinfo.id) {
|
||||
let res = await APIgetOrderById({
|
||||
orderId: listinfo.id,
|
||||
});
|
||||
if (listinfo.id || options.tableCode) {
|
||||
let res = listinfo.id
|
||||
? await APIgetOrderById({
|
||||
orderId: listinfo.id,
|
||||
})
|
||||
: await APIhistoryOrder({
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
|
||||
console.log("onMessage:APIgetOrderById", res);
|
||||
Object.assign(listinfo, res);
|
||||
if (res) {
|
||||
orderRemarker.value = res.remark;
|
||||
// cartStore.carts=[];
|
||||
// cartStore.setOldOrder(res)
|
||||
cartStore.setOldOrder(res);
|
||||
}
|
||||
if (noPayStatus[res.status]) {
|
||||
uni.showToast({
|
||||
@@ -437,14 +456,18 @@ const freeCheck = ref(false);
|
||||
let backtimer = null;
|
||||
let historyTotalPrices = 0;
|
||||
// * 获取订单详情接口
|
||||
const orderorderInfo = async () => {
|
||||
const orderorderInfo = async (isNpwGetOrderDetail = false) => {
|
||||
console.log("listinfo.id", listinfo.id);
|
||||
|
||||
if (!listinfo.id && !options.tableCode) {
|
||||
return;
|
||||
}
|
||||
if (isPayBefor() && !listinfo.id) {
|
||||
return;
|
||||
if (!isNpwGetOrderDetail) {
|
||||
if (isPayBefor() && !listinfo.id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let res = listinfo.id
|
||||
? await APIgetOrderById({
|
||||
orderId: listinfo.id,
|
||||
@@ -838,10 +861,36 @@ const istoricalorders = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
//开始锁单
|
||||
function start_lock_order() {
|
||||
clearInterval(payStatusTimer);
|
||||
pay_lock();
|
||||
payStatusTimer = setInterval(() => {
|
||||
pay_lock();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// * 去支付
|
||||
const goToPay = async (payParams) => {
|
||||
console.log("goToPay:payParams", payParams);
|
||||
|
||||
const canPayRes = await search_pay_lock();
|
||||
const canPay = canPayRes.status == 1 ? true : false;
|
||||
if (!canPay) {
|
||||
uni.showToast({
|
||||
title: "有人正在付款中!",
|
||||
icon: "none",
|
||||
});
|
||||
const shopUserInfo = uni.cache.get("shopUserInfo");
|
||||
console.log("shopUserInfo", shopUserInfo);
|
||||
console.log("listinfo", listinfo);
|
||||
if (shopUserInfo) {
|
||||
if (shopUserInfo.userId == listinfo.userId) {
|
||||
pay_unlock();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 余额支付
|
||||
if (payParams.payType == "accountPay") {
|
||||
if (orderVIP.value.payPwd == "") {
|
||||
@@ -861,6 +910,7 @@ const goToPay = async (payParams) => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
start_lock_order();
|
||||
if (userInfo.usePayPwd) {
|
||||
ispws.value = true;
|
||||
return;
|
||||
@@ -868,30 +918,10 @@ const goToPay = async (payParams) => {
|
||||
accountPayevent();
|
||||
return;
|
||||
}
|
||||
|
||||
const canPayRes = await search_pay_lock();
|
||||
const canPay = canPayRes.status == 1 ? true : false;
|
||||
if (!canPay) {
|
||||
uni.showToast({
|
||||
title: "有人正在付款中!",
|
||||
icon: "none",
|
||||
});
|
||||
const shopUserInfo = uni.cache.get("shopUserInfo");
|
||||
console.log("shopUserInfo", shopUserInfo);
|
||||
console.log("listinfo", listinfo);
|
||||
if (shopUserInfo) {
|
||||
if (shopUserInfo.userId == listinfo.userId) {
|
||||
pay_unlock();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
console.log("canPay:goToPay:payParams", payParams);
|
||||
|
||||
pay_lock();
|
||||
payStatusTimer = setInterval(() => {
|
||||
pay_lock();
|
||||
}, 1000);
|
||||
start_lock_order();
|
||||
|
||||
console.log("霸王餐前payParams", payParams);
|
||||
if (payParams.isBwc) {
|
||||
payParams.checkOrderPay.orderId = listinfo.id;
|
||||
@@ -968,7 +998,7 @@ const accountPayevent = async (pwd) => {
|
||||
ispws.value = false;
|
||||
payParams.checkOrderPay.userId = uni.cache.get("userInfo").id;
|
||||
payParams.checkOrderPay.orderId = listinfo.id;
|
||||
|
||||
payParams.pwd = pwd;
|
||||
try {
|
||||
const isPaySuccess = await storeMemberpay.balancePayOrder(payParams);
|
||||
if (isPaySuccess) {
|
||||
@@ -976,10 +1006,13 @@ const accountPayevent = async (pwd) => {
|
||||
title: "支付成功",
|
||||
icon: "none",
|
||||
});
|
||||
pay_unlock();
|
||||
|
||||
paySucessCallback();
|
||||
}
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
pay_unlock();
|
||||
}
|
||||
orderorderInfo();
|
||||
};
|
||||
@@ -1028,10 +1061,6 @@ let options = {};
|
||||
function toJiacai() {
|
||||
console.log("跳转到加菜页面");
|
||||
back();
|
||||
return;
|
||||
uni.navigateTo({
|
||||
url: "/pages/product/index",
|
||||
});
|
||||
}
|
||||
const packfee = computed(() => {
|
||||
return cartStore.orderCostSummary.packFee;
|
||||
@@ -1067,6 +1096,7 @@ const navTitle = computed(() => {
|
||||
//支付成功后的处理
|
||||
function paySucessCallback() {
|
||||
console.log("paySucessCallback");
|
||||
cartsSocket.closeSocket();
|
||||
showDrainage.value = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user