代客下单修改,问题修复

This commit is contained in:
2025-11-18 14:55:26 +08:00
parent 67ec915181
commit 93273b796f
17 changed files with 174 additions and 117 deletions

View File

@@ -507,6 +507,8 @@ import { createOrder, getHistoryOrder } from "@/http/api/order.js";
import { shopUserDetail } from "@/http/yskApi/shop-user.js";
import { discountActivity } from "@/http/yskApi/market/discountActivity.js";
import BigNumber from "bignumber.js";
import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js";
const models = new Map();
const modelData = reactive({
@@ -589,6 +591,28 @@ async function getDiscountActivity() {
}
}
const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例
const limitTimeDiscountRes = ref(null);
async function getLimit() {
const res = await limitTimeDiscountApi.limitTimeDiscount();
limitTimeDiscountRes.value = res.data;
if (pageData.table.tableCode) {
pageData.limitTimeDiscount = limitTimeDiscountRes.value;
websocketUtil.send(
JSON.stringify({
type: "shopping",
operate_type: "time_discount_save",
table_code: pageData.table.tableCode,
shop_id: uni.getStorageSync("shopInfo").id,
operate_type: "time_discount_save",
data: limitTimeDiscountRes.value,
})
);
console.log("limitTimeDiscount",pageData.limitTimeDiscount );
}
}
onLoad(async (opt) => {
Object.assign(option, opt);
console.log("opt====", opt);
@@ -596,6 +620,8 @@ onLoad(async (opt) => {
pageData.table.id = opt.tableId;
pageData.table.tableCode = opt.tableCode;
}
//获取限时折扣
await getLimit();
//获取满减活动
await getDiscountActivity();
pageData.shopInfo = uni.getStorageSync("shopInfo");
@@ -640,6 +666,7 @@ onUnmounted(() => {
* @param {Object} tableCode
*/
async function getHistoryOrderDetail(tableCode) {
let res = await getHistoryOrder({
tableCode: tableCode,
});
@@ -868,6 +895,9 @@ async function getTableInfo(opt) {
// 获取购物车数据
getCart();
// 获取购物车数据
if(shopInfo.registerType==='before'){
return
}
getHistoryOrderDetail(opt.tableCode);
}