feat: 相关商品问题修复

This commit is contained in:
duanshuwen
2025-11-06 21:10:26 +08:00
parent 2527cc5004
commit 0bbd5a912e
2 changed files with 39 additions and 21 deletions

View File

@@ -4,14 +4,17 @@
<SwipeCards :cardsData="commodityList">
<template #default="{ card }">
<view class="inner-card" @click="placeOrderHandle(card)">
<view
class="inner-card overflow-hidden"
@click="placeOrderHandle(card)"
>
<!-- 商品大图部分自适应剩余空间 -->
<view class="goods-image-wrapper">
<image
class="goods-image"
:src="card.commodityPhoto"
mode="aspectFill"
></image>
/>
<view class="goods-title">
<text class="goods-text">{{ card.commodityName }}</text>
<view class="card-price-row">
@@ -27,17 +30,17 @@
<!-- 底部相册部分固定比例或高度 -->
<view class="album-row">
<view
v-for="(item, index) in normalizedAlbums(commodityList)"
v-for="(item, index) in card.commodityPhotoList"
:key="index"
class="album-item"
>
<view v-if="item" class="album-image-wrapper">
<image
class="album-image"
:src="item.commodityPhoto"
:src="item.photoUrl"
mode="aspectFill"
/>
<view class="album-title">{{ item.commodityName }}</view>
<view class="album-title">{{ item.photoName }}</view>
</view>
</view>
</view>
@@ -48,7 +51,7 @@
</template>
<script setup>
import { defineProps } from "vue";
import { defineProps, computed } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import SwipeCards from "@/components/SwipeCards/index.vue";
@@ -60,13 +63,6 @@ const props = defineProps({
},
});
// 补齐3个的
const normalizedAlbums = (list = []) => {
const arr = list.slice(0, 3);
while (arr.length < 3) arr.push(null);
return arr;
};
// 去下单
const placeOrderHandle = (item) => {
checkToken().then(() => {