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

购物车列表ids

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