修复点餐页面购物车初始化时未拿到商品信息导致判断是否可用限时折扣有误问题
This commit is contained in:
@@ -308,8 +308,7 @@
|
||||
) {
|
||||
youhuiReset();
|
||||
}
|
||||
if (Message.operate_type == 'bulk_edit') {
|
||||
}
|
||||
if (Message.operate_type == 'bulk_edit') {}
|
||||
return Message;
|
||||
}
|
||||
|
||||
@@ -319,24 +318,27 @@
|
||||
|
||||
let cartsSocket = null;
|
||||
cartStore.goodsInit();
|
||||
const socketInitPar = {
|
||||
const socketInitPar = reactive({
|
||||
type: "shopping",
|
||||
operate_type: "init",
|
||||
table_code: uni.cache.get("tableCode"),
|
||||
shop_id: uni.cache.get("shopId"),
|
||||
};
|
||||
time_dis_info: null
|
||||
});
|
||||
|
||||
|
||||
|
||||
function socketInit() {
|
||||
cartsSocket = useWebSocket();
|
||||
cartStore.socketSendMsg=(data)=>{
|
||||
cartStore.socketSendMsg = (data) => {
|
||||
cartsSocket.sendMessage({
|
||||
...data,
|
||||
table_code: uni.cache.get("tableCode"),
|
||||
shop_id: uni.cache.get("shopId"),
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
cartsSocket.connect(socketInitPar, onMessage);
|
||||
}
|
||||
const noPayStatus = {
|
||||
@@ -1097,8 +1099,8 @@
|
||||
Object.assign(listinfo, res);
|
||||
getOrderInfoAfterCalcInit(res);
|
||||
}
|
||||
|
||||
const limitTimeDiscountRes=ref(null)
|
||||
|
||||
const limitTimeDiscountRes = ref(null)
|
||||
async function init(opt) {
|
||||
await storeuser.actionsproductqueryProduct();
|
||||
|
||||
@@ -1120,16 +1122,16 @@
|
||||
if (res && typeof res == "object") {
|
||||
setOrder(res);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
const limitRes = await limitTimeDiscountapi.getConfig({
|
||||
shopId: uni.cache.get('shopId')
|
||||
});
|
||||
if (limitRes && typeof limitRes == 'object') {
|
||||
limitTimeDiscountRes.value = limitRes;
|
||||
|
||||
|
||||
} else {
|
||||
limitTimeDiscountRes.value = null;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//获取店铺信息
|
||||
@@ -1265,7 +1267,14 @@
|
||||
});
|
||||
|
||||
watch(() => cartStore.limitTimeDiscount, (newval, oldval) => {
|
||||
|
||||
|
||||
})
|
||||
|
||||
watch(()=>cartStore.limitTimeDiscount,(newval)=>{
|
||||
socketInitPar.time_dis_info=newval
|
||||
},{
|
||||
deep:true,
|
||||
immediate:true
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -1289,7 +1298,8 @@
|
||||
) ?
|
||||
1 :
|
||||
0;
|
||||
if (canUseLimitTimeDiscount != cart.isTimeDiscount) {
|
||||
const is_time_discount = cart.isTimeDiscount || cart.is_time_discount
|
||||
if (canUseLimitTimeDiscount != is_time_discount) {
|
||||
newData.history.push({
|
||||
id: cart.id,
|
||||
is_time_discount: canUseLimitTimeDiscount,
|
||||
@@ -1307,7 +1317,9 @@
|
||||
) ?
|
||||
1 :
|
||||
0;
|
||||
if (canUseLimitTimeDiscount != cart.isTimeDiscount) {
|
||||
|
||||
const is_time_discount = cart.isTimeDiscount || cart.is_time_discount
|
||||
if (canUseLimitTimeDiscount != is_time_discount) {
|
||||
newData.cart.push({
|
||||
id: cart.id,
|
||||
is_time_discount: canUseLimitTimeDiscount,
|
||||
@@ -1318,8 +1330,8 @@
|
||||
if (newData.history.length <= 0 && newData.cart.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('bulk_edit',{
|
||||
|
||||
console.log('bulk_edit', {
|
||||
...socketInitPar,
|
||||
operate_type: "bulk_edit",
|
||||
data: newData,
|
||||
|
||||
Reference in New Issue
Block a user