代合合并
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,7 @@
|
||||
</rechargeFree>
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<paymentMethodes ref="paymentMethodref" :orderVIP="orderVIP" @groupChange="groupChange"
|
||||
<paymentMethodes ref="paymentMethodref" :shopUserInfo="orderVIP" @groupChange="groupChange"
|
||||
:disablePayType="disablePayType" :changeFreeenable="isBwc" v-model="paymentmethod"
|
||||
v-if="listinfo.status == 'unpaid' || !listinfo.id">
|
||||
<template #bottom>
|
||||
@@ -203,6 +203,7 @@
|
||||
useWebSocket
|
||||
} from "@/stores/carts-websocket.js";
|
||||
import * as chatApi from "@/http/php/chat";
|
||||
import * as rechargeApi from '@/common/api/market/recharge.js'
|
||||
|
||||
import MsgListItem from '@/components/msg-list-item/msg-list-item.vue'
|
||||
|
||||
@@ -858,8 +859,6 @@
|
||||
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();
|
||||
@@ -1011,7 +1010,6 @@
|
||||
// 更新数据
|
||||
if (orderVIP.value) {
|
||||
orderVIP.value = uni.cache.get("orderVIP");
|
||||
paymentMethodref.value.orderVIPfun(uni.cache.get("orderVIP"));
|
||||
if (listinfo.id && ordershopUserInfo.value.registerType != "before") {
|
||||
orderorderInfo();
|
||||
}
|
||||
@@ -1034,7 +1032,7 @@
|
||||
console.log("跳转到加菜页面");
|
||||
const arr= getCurrentPages()
|
||||
console.log(arr);
|
||||
if(arr[arr.length-1]&&arr[arr.length-1].route=='pages/product/index'){
|
||||
if(arr.length>=2&&arr[arr.length-2]&&arr[arr.length-2].route=='pages/product/index'){
|
||||
back();
|
||||
}else{
|
||||
uni.cache.set('tableCode',listinfo.tableCode)
|
||||
@@ -1113,10 +1111,11 @@
|
||||
}
|
||||
|
||||
const limitTimeDiscountRes = ref(null)
|
||||
const rechargeConfig=ref(null)
|
||||
async function init(opt) {
|
||||
await storeuser.actionsproductqueryProduct();
|
||||
|
||||
console.log("init");
|
||||
const res1= await storeuser.actionsproductqueryProduct();
|
||||
orderVIP.value=res1
|
||||
console.log('orderVIP',orderVIP.value)
|
||||
cartStore.clearOrderConfig();
|
||||
Object.assign(options, opt);
|
||||
listinfo.id = options.orderId;
|
||||
@@ -1146,10 +1145,23 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//获取台桌信息
|
||||
let tableRes = await getTableInfo({
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
console.log("tableRes", tableRes);
|
||||
listinfo.tableName = tableRes?tableRes.name:'';
|
||||
|
||||
//获取店铺信息
|
||||
const shopInfoRes = await APIusershopInfodetail({
|
||||
shopId: options.shopId,
|
||||
});
|
||||
//智慧充值
|
||||
const rechargeConfigRes=await rechargeApi.config({shopId: options.shopId})
|
||||
if(rechargeConfigRes&&typeof rechargeConfigRes ==='object'){
|
||||
rechargeConfig.value=rechargeConfigRes
|
||||
}
|
||||
//获取积分配置
|
||||
pointsApi.pointsConfig().then(res => {
|
||||
cartStore.setPointDeductionRule(res);
|
||||
@@ -1274,6 +1286,9 @@
|
||||
if (!isCanUseCharge.value) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
if(rechargeConfig.value&&!rechargeConfig.value.isEnable){
|
||||
arr.add("余额支付");
|
||||
}
|
||||
|
||||
return Array.from(arr);
|
||||
});
|
||||
|
||||
@@ -583,7 +583,6 @@
|
||||
console.log(uni.cache.get('orderVIP'))
|
||||
orderVIP.value = uni.cache.get('orderVIP')
|
||||
ordershopUserInfo.value = orderVIP.value.shopInfo
|
||||
paymentMethodref.value.orderVIPfun(uni.cache.get('orderVIP'))
|
||||
if (orderId.value) {
|
||||
orderorderInfo()
|
||||
}
|
||||
|
||||
@@ -1685,11 +1685,10 @@
|
||||
// 返回商品对应sku数据
|
||||
|
||||
function cartInit(arr) {
|
||||
|
||||
const result = []
|
||||
console.log('cartInitArr', arr);
|
||||
console.log('allGoodsArr', allGoodsArr);
|
||||
cartStore.carts = arr.map(v => {
|
||||
const goods = allGoodsArr.find(g => g.id == v.product_id)
|
||||
const goods = cartStore.allGoodsArr.find(g => g.id == v.product_id)
|
||||
const goodsSkuList = goods ? goods.skuList : []
|
||||
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
||||
const memberPrice = findSku ? findSku.memberPrice : 0
|
||||
@@ -1699,6 +1698,13 @@
|
||||
}, cartStore.limitTimeDiscount, shopInfo,
|
||||
shopUserInfo.value, 'product_id');
|
||||
if (!goods) {
|
||||
console.log('删除未匹配到的商品', {
|
||||
id: v.id,
|
||||
operate_type: "del",
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
type: "shopping",
|
||||
})
|
||||
useSocket.sendMessage({
|
||||
id: v.id,
|
||||
operate_type: "del",
|
||||
@@ -1747,7 +1753,7 @@
|
||||
isLoading.value = false;
|
||||
return false;
|
||||
}
|
||||
console.log('product index 收到消息', Message);
|
||||
|
||||
// 检查消息是否已经处理过
|
||||
if (processedMessageIds.has(Message.msg_id)) {
|
||||
return;
|
||||
@@ -2184,11 +2190,11 @@
|
||||
}
|
||||
return currentTime >= startTime && currentTime <= endTime;
|
||||
});
|
||||
let allGoodsArr = []
|
||||
const allGoodsArr = ref([])
|
||||
// 列表请求
|
||||
const productqueryProduct = async () => {
|
||||
cartStore.goodsIsloading = false;
|
||||
allGoodsArr = []
|
||||
allGoodsArr.value=[]
|
||||
try {
|
||||
shopProductList.hots = await productminiApphotsquery();
|
||||
shopProductList.productInfo = await APIgroupquery();
|
||||
@@ -2200,38 +2206,46 @@
|
||||
setTimeout(() => {
|
||||
uni.pro.switchTab('index/index');
|
||||
}, 1000);
|
||||
return; // 出错直接返回,避免后续逻辑
|
||||
}
|
||||
|
||||
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
|
||||
//TODO handle the exception
|
||||
//第一步:将所有商品的 cartNumber 初始化为 0
|
||||
shopProductList.productInfo.forEach((group) => {
|
||||
group.productList.forEach(async (product) => {
|
||||
product.isSaleTimeshow = await isProductAvailable(product.days, product
|
||||
.startTime, product.endTime);
|
||||
|
||||
allGoodsArr.push(product)
|
||||
|
||||
// 第一步:处理productInfo(替换forEach为for...of,支持await)
|
||||
for (const group of shopProductList.productInfo) {
|
||||
for (const product of group.productList) {
|
||||
product.cartNumber = 0;
|
||||
// 等待异步函数执行完成后,再push
|
||||
product.isSaleTimeshow = await isProductAvailable(
|
||||
product.days,
|
||||
product.startTime,
|
||||
product.endTime
|
||||
);
|
||||
allGoodsArr.value.push(product);
|
||||
cartStore.setGoodsMap(product.id, product);
|
||||
});
|
||||
});
|
||||
shopProductList.hots.forEach(async (i) => {
|
||||
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
|
||||
allGoodsArr.push(i)
|
||||
cartStore.setGoodsMap(i.id, i);
|
||||
});
|
||||
console.log('shopProductList', shopProductList);
|
||||
}
|
||||
}
|
||||
|
||||
// 第二步:处理hots(同理替换forEach为for...of)
|
||||
for (const i of shopProductList.hots) {
|
||||
i.cartNumber = 0;
|
||||
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
|
||||
allGoodsArr.value.push(i);
|
||||
cartStore.setGoodsMap(i.id, i);
|
||||
}
|
||||
|
||||
// 此时所有异步操作完成,allGoodsArr已有数据
|
||||
// console.log('allGoodsArr', allGoodsArr);
|
||||
// console.log('shopProductList', shopProductList);
|
||||
console.log('cartStore.carts', cartStore.carts)
|
||||
cartStore.allGoodsArr=allGoodsArr.value
|
||||
if (cartStore.carts.length > 0) {
|
||||
cartInit(cartStore.carts)
|
||||
cartInit(cartStore.carts);
|
||||
}
|
||||
|
||||
cartStore.goodsIsloading = true;
|
||||
scrollTopSize.value = 0;
|
||||
topArr.value = [];
|
||||
// userStore.actionsAPIuser()
|
||||
// 数据可以更新
|
||||
isDataLoaded.value = true;
|
||||
// 历史订单
|
||||
Historicalorders();
|
||||
updateProductQuantities();
|
||||
} else {
|
||||
|
||||
@@ -60,6 +60,9 @@
|
||||
<text v-if="item.bizCode == 'cashback'">
|
||||
消费返现
|
||||
</text>
|
||||
<text v-if="item.bizCode == 'cashback_refund'">
|
||||
消费返现扣减
|
||||
</text>
|
||||
<text v-if="item.bizCode == 'freeIn'">
|
||||
霸王餐充值
|
||||
</text>
|
||||
|
||||
Reference in New Issue
Block a user