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

购物车渲染

parent 58cc4489
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<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">
<div class="commodity-item flex-align-center" v-for="(item, j) in secondaryList" :key="j"> <div class="commodity-item flex-align-center" v-for="(item, j) in shop.prodInfos" :key="j">
<div <div
class="check" class="check"
:class="{ 'is-checked': item.isChecked }" :class="{ 'is-checked': item.isChecked }"
...@@ -61,6 +61,7 @@ import { ref, computed, onMounted } from 'vue'; ...@@ -61,6 +61,7 @@ import { ref, computed, onMounted } from 'vue';
import { getshoppingCartList } from '../../../api/packageDetail'; import { getshoppingCartList } from '../../../api/packageDetail';
import { categoryPresaleList } from '../../../api/assistingAgriculture/building'; import { categoryPresaleList } from '../../../api/assistingAgriculture/building';
import { quantity } from '../../../api/assistingAgriculture/shop'; import { quantity } from '../../../api/assistingAgriculture/shop';
// 计算是否全选 // 计算是否全选
const checkedAll = computed(() => { const checkedAll = computed(() => {
return cartList.value.every((item) => item.isChecked); return cartList.value.every((item) => item.isChecked);
...@@ -103,18 +104,18 @@ const changeCheckedAll = () => { ...@@ -103,18 +104,18 @@ const changeCheckedAll = () => {
}); });
}; };
// 购物车列表 // 购物车列表
const presaleSortList = (index) => { const presaleSortList = () => {
getshoppingCartList({}).then((res) => { getshoppingCartList({}).then((res) => {
cartList.value = res.data; cartList.value = res.data;
cartList.value.forEach((shop) => { cartList.value.forEach((shop) => {
secondaryList.value = shop.prodInfos; shop.prodInfos.forEach((item) => {
secondaryList.value.forEach((item) => {
item.count = item.basket.basketCount; item.count = item.basket.basketCount;
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.pic; item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.pic;
}); });
}); });
}); });
}; };
// 购物车数量修改 // 购物车数量修改
const changeQuantity = async (item) => { const changeQuantity = async (item) => {
const res = await quantity({ const res = await quantity({
...@@ -145,7 +146,7 @@ function toSettle() { ...@@ -145,7 +146,7 @@ function toSettle() {
}); });
return; return;
} }
const shopIds = selected const shopIds = cartList.value
.map((item) => item.shopId) .map((item) => item.shopId)
.filter((value, index, self) => self.indexOf(value) === index); .filter((value, index, self) => self.indexOf(value) === index);
if (shopIds.length > 1) { if (shopIds.length > 1) {
......
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