This commit is contained in:
whitechiina 2026-07-20 14:13:12 +08:00
parent 79584c849d
commit e3f600eb79
5 changed files with 165 additions and 169 deletions

View File

@ -549,174 +549,170 @@
}).exec();
},
methods: {
/**
* @本地数据与当前餐厅数格式化
* */
initCategoryNum() {
this['totalPrice'] = 0;
console.log(this.GetCartList, '进入initCategoryNum');
console.log('新');
console.log(this['tabbar'], '获取tabbar');
// ,
if (this['tabbar']['length'] <= 0) return;
// console.time()
//
let shoparr = [];
let newArr = [];
let Price = 0;
let lastPrice = 0;
let cardbtPrice = 0;
this['tabbar'].map(item => {
shoparr.push(...item['foods'])
});
// id
let commodityids = shoparr.map(item => item['product_id']);
//
let list = Object.keys(this['GetCartList']);
/**
* @本地数据与当前餐厅数格式化
* */
initCategoryNum() {
this['totalPrice'] = 0;
console.log(this.GetCartList, '进入initCategoryNum');
console.log('新');
console.log(this['tabbar'], '获取tabbar');
// ,
if (this['tabbar']['length'] <= 0) return;
// console.time()
//
let shoparr = [];
let newArr = [];
let Price = 0;
this['tabbar'].map(item => {
shoparr.push(...item['foods'])
});
// id
let commodityids = shoparr.map(item => item['product_id']);
//
let list = Object.keys(this['GetCartList']);
for (let i = 0; i < list['length']; i++) {
let id = +Object.keys(this['GetCartList'])[i];
console.log(this['GetCartList'][id], "当前商品")
let index = commodityids.indexOf(id);
let item = {};
if (index != -1) {
item = {
...shoparr[index],
num: this['GetCartList'][id]['num'],
sku: this['GetCartList'][id]['sku'],
sku_code: this['GetCartList'][id]['sku_code'],
restaurant_id: this['GetShopInfor']['restaurant_id'],
adj_pay: 0,
add_price: this['GetCartList'][id]?.add_price ? (+this['GetCartList'][id]['add_price']) : 0
};
console.log(item['sku'], '当前sku');
item['adj_pay'] = (+item['product_price']) + (+item['add_price']);
Price += item['bt_price'] * item['num'];
lastPrice += item['adj_pay'] * item['num'];
// 使
cardbtPrice += item['subsidy_card_price'] * item['num'];
newArr.push(item);
console.log(this['GetCartList'][id], '是否规格商品');
if (this['GetCartList'][id]['Differentskulist'] && this['GetCartList'][id]['Differentskulist']['length'] > 0) {
console.log('多规格');
for (let j = 0; j < this['GetCartList'][id]['Differentskulist']['length']; j++) {
let _item = this['GetCartList'][id]['Differentskulist'][j];
console.log(_item, '当前规格商品');
_item = {
...shoparr[index],
num: _item['num'],
sku: _item['sku'],
sku_code: _item['sku_code'],
adj_pay: 0,
add_price: _item?.add_price ? _item['add_price'] : 0
};
_item['adj_pay'] = (+_item['product_price']) + (+_item['add_price']);
Price += _item['bt_price'] * _item['num'];
lastPrice += _item['adj_pay'] * _item['num'];
// 使
cardbtPrice += _item['subsidy_card_price'] * _item['num'];
this['GetCartList'][id]['Differentskulist'][j] = _item;
};
newArr.push(...this['GetCartList'][id]['Differentskulist']);
}
} else {
//
}
};
console.log(Price,'Price');
console.log(newArr, 'newArrnewArrnewArrnewArr');
this['MealList'] = newArr;
// item
let id = +Object.keys(this['GetCartList'])[i];
console.log(this['GetCartList'][id], "当前商品")
// // commodityidsitem
let index = commodityids.indexOf(id);
let item = {};
if (index != -1) {
item = {
...shoparr[index],
num: this['GetCartList'][id]['num'],
sku: this['GetCartList'][id]['sku'],
sku_code: this['GetCartList'][id]['sku_code'],
restaurant_id: this['GetShopInfor']['restaurant_id'],
// +
adj_pay: 0,
//
add_price:this['GetCartList'][id]?.add_price?(+this['GetCartList'][id]['add_price']):0
};
console.log(item['sku'],'当前sku');
// +
item['adj_pay'] = (+item['product_price']) + (+item['add_price']);
Price += item['adj_pay'] * item['num'];
newArr.push(item);
console.log(this['GetCartList'][id],'是否规格商品');
//
if (this['GetCartList'][id]['Differentskulist'] && this['GetCartList'][id]['Differentskulist']['length'] > 0) {
console.log('多规格');
for (let i = 0; i < this['GetCartList'][id]['Differentskulist']['length']; i++) {
let _item = this['GetCartList'][id]['Differentskulist'][i];
console.log(_item,'当前规格商品');
_item = {
...shoparr[index],
num: _item['num'],
sku: _item['sku'],
sku_code: _item['sku_code'],
//
adj_pay: 0,
//
add_price: _item?.add_price?_item['add_price']:0
};
_item['adj_pay'] = (+_item['product_price']) + (+_item['add_price']);
Price += _item['adj_pay'] * _item['num'];
this['GetCartList'][id]['Differentskulist'][i] = _item;
};
newArr.push(...this['GetCartList'][id]['Differentskulist']);
}
} else {
//
}
};
console.log(Price,'Price');
console.log(newArr, 'newArrnewArrnewArrnewArr');
this['MealList'] = newArr;
this['totalPrice'] = Price;
this['lastPrice'] = lastPrice;
this['cardbtPrice'] = cardbtPrice;
// console.timeEnd()
console.log('结束initCategoryNum');
// if(this['BrandInfor']['brand_id'] == 1 || this['BrandInfor']['brand_id'] == 2 || this['BrandInfor']['brand_id'] == 5 || this['BrandInfor']['brand_id'] == 10 || this['BrandInfor']['brand_id'] == 13){
// return
// };
// console.log(this['tabbar'], '-----------');
// // ,
// if (this['tabbar']['length'] <= 0) return;
// console.log(this.GetCartList, 'initCategoryNum');
// // console.time()
// //
// let shoparr = [];
// let newArr = [];
// let Price = 0;
// this['tabbar'].map(item => {
// shoparr.push(...item['foods'])
// });
// // id
// let commodityids = shoparr.map(item => item['product_id']);
// //
// console.log(Object.keys(this['GetCartList']), '*********');
// let list = Object.keys(this['GetCartList']);
// console.log(list, 'initCategoryNum');
// for (let i = 0; i < list['length']; i++) {
// console.log('*********');
// // item
// let id = +Object.keys(this['GetCartList'])[i];
// // // commodityidsitem
// let index = commodityids.indexOf(id);
// let item = {};
// if (index != -1) {
// item = {
// // ...this['GetCartList'][id],
// ...shoparr[index],
// num: this['GetCartList'][id]['num'],
// sku: this['GetCartList'][id]['sku'],
// sku_code: this['GetCartList'][id]['sku_code'],
// restaurant_id: this['GetShopInfor']['restaurant_id'],
// //
// pay: this['GetCartList'][id]['pay'] || 0
// };
// newArr.push(item);
// if (this['BrandInfor']['brand_id'] == 10) {
// Price += ((+item['pay']) * item['num']);
// } else {
// Price += ((+item['pay_price']) * item['num']);
// };
// //
// if (this['GetCartList'][id]['Differentskulist'] && this['GetCartList'][id]['Differentskulist'][
// 'length'
// ] > 0) {
// for (let i = 0; i < this['GetCartList'][id]['Differentskulist']['length']; i++) {
// let _item = this['GetCartList'][id]['Differentskulist'][i];
// console.log(_item);
// _item = {
// ...shoparr[index],
// num: _item['num'],
// sku: _item['sku'],
// sku_code: _item['sku_code'],
// //
// pay: _item['pay']
// };
// this['GetCartList'][id]['Differentskulist'][i] = _item;
// };
// newArr.push(...this['GetCartList'][id]['Differentskulist']);
// if (this['BrandInfor']['brand_id'] == 10) {
// Price += this['GetCartList'][id]['Differentskulist'].map(e => e['pay'] * e['num'])
// .reduce((a, b) => a + b);
// } else {
// Price += this['GetCartList'][id]['Differentskulist'].map(e => e['pay_price'] * e['num'])
// .reduce((a, b) => a + b);
// }
// }
// } else {
// //
// }
// };
// console.log(newArr, 'newArrnewArrnewArrnewArr');
// this['MealList'] = newArr;
// this['totalPrice'] = Price;
// // console.timeEnd()
// console.log('initCategoryNum');
// console.timeEnd()
console.log('结束initCategoryNum');
// if(this['BrandInfor']['brand_id'] == 1 || this['BrandInfor']['brand_id'] == 2 || this['BrandInfor']['brand_id'] == 5 || this['BrandInfor']['brand_id'] == 10 || this['BrandInfor']['brand_id'] == 13){
// return
// };
// console.log(this['tabbar'], '-----------');
// // ,
// if (this['tabbar']['length'] <= 0) return;
// console.log(this.GetCartList, 'initCategoryNum');
// // console.time()
// //
// let shoparr = [];
// let newArr = [];
// let Price = 0;
// this['tabbar'].map(item => {
// shoparr.push(...item['foods'])
// });
// // id
// let commodityids = shoparr.map(item => item['product_id']);
// //
// console.log(Object.keys(this['GetCartList']), '*********');
// let list = Object.keys(this['GetCartList']);
// console.log(list, 'initCategoryNum');
// for (let i = 0; i < list['length']; i++) {
// console.log('*********');
// // item
// let id = +Object.keys(this['GetCartList'])[i];
// // // commodityidsitem
// let index = commodityids.indexOf(id);
// let item = {};
// if (index != -1) {
// item = {
// // ...this['GetCartList'][id],
// ...shoparr[index],
// num: this['GetCartList'][id]['num'],
// sku: this['GetCartList'][id]['sku'],
// sku_code: this['GetCartList'][id]['sku_code'],
// restaurant_id: this['GetShopInfor']['restaurant_id'],
// //
// pay: this['GetCartList'][id]['pay'] || 0
// };
// newArr.push(item);
// if (this['BrandInfor']['brand_id'] == 10) {
// Price += ((+item['pay']) * item['num']);
// } else {
// Price += ((+item['pay_price']) * item['num']);
// };
// //
// if (this['GetCartList'][id]['Differentskulist'] && this['GetCartList'][id]['Differentskulist'][
// 'length'
// ] > 0) {
// for (let i = 0; i < this['GetCartList'][id]['Differentskulist']['length']; i++) {
// let _item = this['GetCartList'][id]['Differentskulist'][i];
// console.log(_item);
// _item = {
// ...shoparr[index],
// num: _item['num'],
// sku: _item['sku'],
// sku_code: _item['sku_code'],
// //
// pay: _item['pay']
// };
// this['GetCartList'][id]['Differentskulist'][i] = _item;
// };
// newArr.push(...this['GetCartList'][id]['Differentskulist']);
// if (this['BrandInfor']['brand_id'] == 10) {
// Price += this['GetCartList'][id]['Differentskulist'].map(e => e['pay'] * e['num'])
// .reduce((a, b) => a + b);
// } else {
// Price += this['GetCartList'][id]['Differentskulist'].map(e => e['pay_price'] * e['num'])
// .reduce((a, b) => a + b);
// }
// }
// } else {
// //
// }
// };
// console.log(newArr, 'newArrnewArrnewArrnewArr');
// this['MealList'] = newArr;
// this['totalPrice'] = Price;
// // console.timeEnd()
// console.log('initCategoryNum');
},

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>在线点餐</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><script src="https://h5.dhcc.wang/api/apilink-native.min.js?v=20200701"></script><link rel=stylesheet href=/privilege/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/privilege/static/js/chunk-vendors.05bba68b.js></script><script src=/privilege/static/js/index.edf786db.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><script src="https://h5.dhcc.wang/api/apilink-native.min.js?v=20200701"></script><link rel=stylesheet href=/privilege/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/privilege/static/js/chunk-vendors.05bba68b.js></script><script src=/privilege/static/js/index.842605a0.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long