Commit f517dba2 authored by 张娇(东信)'s avatar 张娇(东信)

购物车列表ids

parent 023efd26
......@@ -127,24 +127,34 @@ const getSelectedItems = () => {
return acc.concat(selectedProducts);
}, []);
};
// 跳转到结算页面方法
function toSettle() {
const selected = getSelectedItems();
if (selected.length > 0) {
console.log('Selected items:', selected);
if (selected.length === 0) {
xma.showToast({
title: '请选择需要结算的商品!',
icon: 'none',
});
return;
}
const shopIds = selected
.map((item) => item.shopId)
.filter((value, index, self) => self.indexOf(value) === index);
if (shopIds.length > 1) {
xma.showToast({
title: '暂不支持跨店结算,请选择同一店铺的商品!',
icon: 'none',
});
} else {
const basketIds = selected.map((item) => item.basket.basketId).join(',');
console.log('Basket IDs:', basketIds);
// TODO: 跳转到结算页面
xma.navigateTo({
url: `/pages/assistingAgriculture/cart/ConfirmOrder?ids=${basketIds}`,
});
} else {
xma.showToast({
title: '请选择需要结算的商品!',
icon: 'none',
});
}
}
// 跳转店铺主页
const toStore = (item) => {
xma.navigateTo({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment