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

购物车列表ids

parent 0922c162
......@@ -10,7 +10,7 @@
<wd-icon v-if="shop.isChecked" name="check1"></wd-icon>
</div>
<div class="type">店铺</div>
<div class="shop-name" @click="toStore">{{ shop.shopName }}</div>
<div class="shop-name" @click="toStore(item)">{{ shop.shopName }}</div>
<wd-icon name="arrow-right" size="32rpx" style="margin-left: -15rpx"></wd-icon>
</div>
<div class="commodity-list">
......@@ -51,7 +51,7 @@
<span>{{ totalPrice / 100 }}</span>
</div>
</div>
<div class="submit" @tap="toSettle">去结算({{ totalPrice / 100 }})</div>
<div class="submit" @tap="toSettle(item)">去结算({{ totalPrice / 100 }})</div>
</div>
</div>
</template>
......@@ -114,30 +114,52 @@ const presaleSortList = (index) => {
});
});
};
// 跳转店铺主页
// const toStore = () => {
// xma.navigateTo({
// url: `/pages/assistingAgriculture/shop/index?shopId=1`,
// });
// };
const selectedItems = computed(() => {
return cartList.value.reduce((acc, shop) => {
const selectedProducts = shop.prodInfos.filter((item) => item.isChecked);
return acc.concat(selectedProducts);
}, []);
});
const getSelectedItems = () => {
return cartList.value.reduce((acc, shop) => {
const selectedProducts = shop.prodInfos.filter((item) => item.isChecked);
return acc.concat(selectedProducts);
}, []);
};
function toSettle() {
// TODO: 跳转到结算页面
const selected = getSelectedItems();
if (selected.length > 0) {
console.log('Selected items:', selected);
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({
url: '/pages/assistingAgriculture/cart/ConfirmOrder',
url: `/pages/assistingAgriculture/shop/index?shopId=1`,
});
}
};
</script>
<style lang="scss" scoped>
uni-page-body {
height: 100%;
}
.cart-wrap {
height: 100%;
background-color: #f6f6f6;
position: relative;
padding: 20rpx;
padding-bottom: 0;
padding-bottom: 220rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
......@@ -161,9 +183,8 @@ uni-page-body {
}
.shop {
background-color: #fff;
padding: 32rpx 20rpx;
padding: 32rpx 20rpx 120rpx 20rpx;
margin-bottom: 20rpx;
.shop-info {
.type {
padding: 3rpx 6rpx;
......@@ -217,7 +238,7 @@ uni-page-body {
}
}
.total {
position: absolute;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
......
......@@ -146,7 +146,10 @@ const toBuilding = (item) => {
url: `/pages/assistingAgriculture/RuralTravel/RuralTravel?categoryId=${item.categoryId}`,
});
} else {
console.log(222);
xma.showToast({
title: '正在开发中!',
icon: 'none',
});
}
};
// 跳转详情页
......
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