fix: 计算金额退额卡

This commit is contained in:
whitechiina 2026-07-17 18:29:12 +08:00
parent 99cd939fae
commit 24703cae4c
5 changed files with 55 additions and 59 deletions

View File

@ -585,62 +585,58 @@
let commodityids = shoparr.map(item => item['product_id']); let commodityids = shoparr.map(item => item['product_id']);
// //
let list = Object.keys(this['GetCartList']); let list = Object.keys(this['GetCartList']);
for (let i = 0; i < list['length']; i++) { for (let i = 0; i < list['length']; i++) {
// item let id = +Object.keys(this['GetCartList'])[i];
let id = +Object.keys(this['GetCartList'])[i]; console.log(this['GetCartList'][id], "当前商品")
console.log(this['GetCartList'][id], "当前商品") let index = commodityids.indexOf(id);
// // commodityidsitem let item = {};
let index = commodityids.indexOf(id); if (index != -1) {
let item = {}; item = {
if (index != -1) { ...shoparr[index],
num: this['GetCartList'][id]['num'],
item = { sku: this['GetCartList'][id]['sku'],
...shoparr[index], sku_code: this['GetCartList'][id]['sku_code'],
num: this['GetCartList'][id]['num'], restaurant_id: this['GetShopInfor']['restaurant_id'],
sku: this['GetCartList'][id]['sku'], adj_pay: 0,
sku_code: this['GetCartList'][id]['sku_code'], add_price: this['GetCartList'][id]?.add_price ? (+this['GetCartList'][id]['add_price']) : 0
restaurant_id: this['GetShopInfor']['restaurant_id'], };
// + console.log(item['sku'], '当前sku');
adj_pay: 0, item['adj_pay'] = (+item['product_price']) + (+item['add_price']);
// Price += item['bt_price'] * item['num'];
add_price:this['GetCartList'][id]?.add_price?(+this['GetCartList'][id]['add_price']):0 lastPrice += item['adj_pay'] * item['num'];
};
console.log(item['sku'],'当前sku'); // 使
// + cardbtPrice += item['subsidy_card_price'] * item['num'];
item['adj_pay'] = (+item['product_price']) + (+item['add_price']); newArr.push(item);
Price += item['bt_price'] * item['num']; console.log(this['GetCartList'][id], '是否规格商品');
lastPrice += item['adj_pay'] * item['num'];
cardbtPrice += item['subsidy_card_price'] * item['num']; if (this['GetCartList'][id]['Differentskulist'] && this['GetCartList'][id]['Differentskulist']['length'] > 0) {
newArr.push(item); console.log('多规格');
console.log(this['GetCartList'][id],'是否规格商品'); for (let j = 0; j < this['GetCartList'][id]['Differentskulist']['length']; j++) {
// let _item = this['GetCartList'][id]['Differentskulist'][j];
if (this['GetCartList'][id]['Differentskulist'] && this['GetCartList'][id]['Differentskulist']['length'] > 0) { console.log(_item, '当前规格商品');
console.log('多规格'); _item = {
for (let i = 0; i < this['GetCartList'][id]['Differentskulist']['length']; i++) { ...shoparr[index],
let _item = this['GetCartList'][id]['Differentskulist'][i]; num: _item['num'],
console.log(_item,'当前规格商品'); sku: _item['sku'],
_item = { sku_code: _item['sku_code'],
...shoparr[index], adj_pay: 0,
num: _item['num'], add_price: _item?.add_price ? _item['add_price'] : 0
sku: _item['sku'], };
sku_code: _item['sku_code'], _item['adj_pay'] = (+_item['product_price']) + (+_item['add_price']);
// Price += _item['bt_price'] * _item['num'];
adj_pay: 0, lastPrice += _item['adj_pay'] * _item['num'];
//
add_price: _item?.add_price?_item['add_price']:0 // 使
}; cardbtPrice += _item['subsidy_card_price'] * _item['num'];
_item['adj_pay'] = (+_item['product_price']) + (+_item['add_price']);
Price += _item['bt_price'] * _item['num']; this['GetCartList'][id]['Differentskulist'][j] = _item;
lastPrice += _item['adj_pay'] * _item['num']; };
cardbtPrice += item['subsidy_card_price'] * item['num']; newArr.push(...this['GetCartList'][id]['Differentskulist']);
this['GetCartList'][id]['Differentskulist'][i] = _item; }
}; } else {
newArr.push(...this['GetCartList'][id]['Differentskulist']); //
} }
} else {
//
}
}; };
console.log(Price,'Price'); console.log(Price,'Price');
console.log(newArr, 'newArrnewArrnewArrnewArr'); console.log(newArr, 'newArrnewArrnewArrnewArr');

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)')) <!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.39454503.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.bf3fc399.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