Refactor(云灵AI):各种列表展示通过类型逻辑对接

This commit is contained in:
lifizer
2026-04-15 23:55:47 +08:00
parent bca2513d22
commit b8413ab13f
2 changed files with 113 additions and 66 deletions
+72 -60
View File
@@ -38,7 +38,7 @@
})">播放</button> -->
<block v-if="chatMessageListLength < 1">
<view class="home-wrap">
<view class="home-focus-wrap" style="display: none;">
<view class="home-focus-wrap">
<view class="focus-guide-wrap">
<view class="guide-left">
<image
@@ -54,7 +54,7 @@
</view>
</view>
<!-- 这里实现商品轮播 -->
<view class="recommend-goods-wrap" v-if="recommendGoodsList.length > 0">
<!-- <view class="recommend-goods-wrap" v-if="recommendGoodsList.length > 0">
<swiper
class="goods-swiper"
:indicator-dots="false"
@@ -95,7 +95,7 @@
</view>
</swiper-item>
</swiper>
</view>
</view> -->
<view class="topic-wrap">
<view class="title">
<view class="title-left">大家都在问</view>
@@ -240,13 +240,68 @@
item.nodes &&
item.nodes.length &&
!item.isError &&
(item.showMoreInfo.show || item.orderList.length > 0)
(item.orderList.length > 0 ||
item.giftGoodsList.length > 0 ||
item.goodsList.length > 0 ||
item.shopList.length > 0 ||
item.prizeList.length > 0 ||
item.ichList.length > 0 ||
item.qianxianList.length > 0
)
"
class="change-list-wrap"
>
<view v-if="item.showMoreInfo.showType === '特产商品'" class="list-wrap">
<!-- 礼品 -->
<view
v-if="item.giftGoodsList.length > 0"
class="recommend-goods-wrap"
>
<swiper
class="goods-swiper"
:indicator-dots="false"
:autoplay="false"
:current="item.currentSwiperIndex"
previous-margin="120rpx"
next-margin="120rpx"
circular
@change="e => onSwiperChange(index, e)"
>
<swiper-item
v-for="(goodItem, goodIndex) in item.giftGoodsList"
:key="goodIndex"
>
<view
:class="{ 'active': item.currentSwiperIndex === goodIndex }"
class="goods-item"
@click="productItemClickHandle(goodItem)"
>
<view class="supplier">
<image
:src="webUrl + '/aiChat/icon-57.png'"
class="icon"
mode="widthFix"
/>
<text class="s-name">{{ goodItem.supplierName }}</text>
<u-icon name="arrow-right" color="#999" size="12"></u-icon>
</view>
<view class="title one-t">{{ goodItem.name }}</view>
<image :src="goodItem.img" class="p-img" mode="aspectFill" />
<view class="price">
<text class="unit">¥</text>
<text class="num">{{ goodItem.price }}</text>
</view>
<view class="actions">
<view class="btn-buy" @click.stop="productItemBuyNowClickHandle(goodItem)">立即下单</view>
<view class="btn-gift" @click.stop="productItemGiftBuyClickHandle(goodItem)">送给朋友</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
<!-- 特产商品 -->
<view v-if="item.goodsList.length > 0" class="list-wrap">
<view
v-for="(productItem, productIndex) in item.showMoreInfo.resultItems"
v-for="(productItem, productIndex) in item.goodsList"
:key="productIndex"
class="product-item"
@click="productItemClickHandle(productItem)"
@@ -268,6 +323,7 @@
</view>
</view>
</view>
<!-- 店铺 -->
<view v-if="item.shopList.length > 0" class="list-wrap">
<view
v-for="(hotel, hotelIndex) in item.shopList"
@@ -292,9 +348,10 @@
</view>
</view>
</view>
<view v-if="item.showMoreInfo.showType === '非遗文化'" class="list-wrap">
<!-- 非遗 -->
<view v-if="item.ichList.length > 0" class="list-wrap">
<view
v-for="(ich, ichIndex) in item.showMoreInfo.resultItems"
v-for="(ich, ichIndex) in item.ichList"
:key="ichIndex"
class="product-item"
@click="ichItemClickHandle(ich)"
@@ -313,9 +370,10 @@
</view>
</view>
</view>
<view v-if="item.showMoreInfo.showType === '千县名品'" class="list-wrap">
<!-- 千县 -->
<view v-if="item.qianxianList.length > 0" class="list-wrap">
<view
v-for="(qianxian, qianxianIndex) in item.showMoreInfo.resultItems"
v-for="(qianxian, qianxianIndex) in item.qianxianList"
:key="qianxianIndex"
class="product-item"
@click="qianxianItemClickHandle(qianxian)"
@@ -331,9 +389,10 @@
</view>
</view>
</view>
<view v-if="item.showMoreInfo.showType === '优惠活动'" class="list-wrap prize-list-wrap">
<!-- 抽奖 -->
<view v-if="item.prizeList.length > 0" class="list-wrap prize-list-wrap">
<view
v-for="(prize, prizeIndex) in item.showMoreInfo.resultItems"
v-for="(prize, prizeIndex) in item.prizeList"
:key="prizeIndex"
class="prize-item"
@click="prizeItemClickHandle(prize)"
@@ -345,6 +404,7 @@
/>
</view>
</view>
<!-- 订单 -->
<view v-if="item.orderList.length > 0" class="order-list-wrap">
<view
v-for="(order, orderIndex) in item.orderList"
@@ -507,51 +567,6 @@ export default {
animationStr: '',
settingInfo: {},
topicList: [],
currentSwiperIndex: 0,
recommendGoodsList: [
{
supplierName: '供应商名称',
productName: '云南枇杷花蜜',
image: 'https://resource.xdd618.com/最近喜欢上了独龙玉手镯_3_若瑜_来自小红书网页版-20250616101810.jpg',
price: '65.00',
id: 334
},
{
supplierName: '供应商名称',
productName: '云南枇杷花蜜',
image: 'https://resource.xdd618.com/最近喜欢上了独龙玉手镯_3_若瑜_来自小红书网页版-20250616101810.jpg',
price: '65.00',
id: 334
},
{
supplierName: '供应商名称',
productName: '云南枇杷花蜜',
image: 'https://resource.xdd618.com/最近喜欢上了独龙玉手镯_3_若瑜_来自小红书网页版-20250616101810.jpg',
price: '65.00',
id: 334
},
{
supplierName: '供应商名称',
productName: '云南枇杷花蜜',
image: 'https://resource.xdd618.com/最近喜欢上了独龙玉手镯_3_若瑜_来自小红书网页版-20250616101810.jpg',
price: '65.00',
id: 334
},
{
supplierName: '供应商名称',
productName: '云南枇杷花蜜',
image: 'https://resource.xdd618.com/最近喜欢上了独龙玉手镯_3_若瑜_来自小红书网页版-20250616101810.jpg',
price: '65.00',
id: 334
},
{
supplierName: '供应商名称',
productName: '云南枇杷花蜜',
image: 'https://resource.xdd618.com/最近喜欢上了独龙玉手镯_3_若瑜_来自小红书网页版-20250616101810.jpg',
price: '65.00',
id: 334
}
],
onlyOneToAddCart: false
}
},
@@ -618,9 +633,6 @@ export default {
this.createNewHandle()
}
},
onSwiperChange(e) {
this.currentSwiperIndex = e.detail.current
},
pageContainerBeforeleave() {
if (!this.chatNumber) {
if (getCurrentPages().length > 1) {