feat; 数据字段对接
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<view class="flex w-full gap-[12px]">
|
<view class="flex w-full gap-[12px]">
|
||||||
<view
|
<view
|
||||||
v-for="goods in goodsList"
|
v-for="goods in goodsList"
|
||||||
:key="goods.commodityId"
|
:key="goods.resource?.payload?.commodityId"
|
||||||
class="flex h-[88px]"
|
class="flex h-[88px]"
|
||||||
:class="{
|
:class="{
|
||||||
'w-full': !hasMultipleGoods,
|
'w-full': !hasMultipleGoods,
|
||||||
@@ -19,23 +19,23 @@
|
|||||||
<view
|
<view
|
||||||
class="h-[88px] w-[88px] shrink-0 overflow-hidden rounded-[16px] bg-[#eef8f2] shadow-[0_4px_18px_rgba(31,110,74,0.08)]"
|
class="h-[88px] w-[88px] shrink-0 overflow-hidden rounded-[16px] bg-[#eef8f2] shadow-[0_4px_18px_rgba(31,110,74,0.08)]"
|
||||||
>
|
>
|
||||||
<image class="h-full w-full" :src="goods.image" mode="aspectFill" />
|
<image class="h-full w-full" :src="goods.resource?.payload?.commodityPhoto" mode="aspectFill" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="box-border flex h-full min-w-0 flex-1 flex-col rounded-[16px] bg-white px-[12px] py-[8px] shadow-[0_4px_18px_rgba(31,110,74,0.08)]"
|
class="box-border flex h-full min-w-0 flex-1 flex-col rounded-[16px] bg-white px-[12px] py-[8px] shadow-[0_4px_18px_rgba(31,110,74,0.08)]"
|
||||||
>
|
>
|
||||||
<text class="block truncate text-[14px] font-semibold leading-[22px] text-[#1f2937]">
|
<text class="block truncate text-[14px] font-semibold leading-[22px] text-[#1f2937]">
|
||||||
{{ goods.title }}
|
{{ goods.resource?.payload?.commodityName }}
|
||||||
</text>
|
</text>
|
||||||
<text class="mt-[2px] block truncate text-[11px] leading-[18px] text-[#9ca3af]">
|
<text class="mt-[2px] block truncate text-[11px] leading-[18px] text-[#9ca3af]">
|
||||||
{{ goods.description }}
|
{{ goods.resource?.payload?.commodityDescription }}
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<view class="mt-auto flex items-end justify-between gap-[8px]">
|
<view class="mt-auto flex items-end justify-between gap-[8px]">
|
||||||
<view class="min-w-0 flex-1 truncate font-bold text-[#111827]">
|
<view class="min-w-0 flex-1 truncate font-bold text-[#111827]">
|
||||||
<text class="text-[14px]">¥</text>
|
<text class="text-[14px]">¥</text>
|
||||||
<text class="text-[20px] leading-[28px]">{{ goods.price }}</text>
|
<text class="text-[20px] leading-[28px]">{{ goods.resource?.payload?.specificationPrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
<button
|
<button
|
||||||
class="m-0 flex h-[26px] shrink-0 items-center justify-center rounded-full bg-[#20cf6d] px-[12px] text-[14px] leading-none text-white after:border-0"
|
class="m-0 flex h-[26px] shrink-0 items-center justify-center rounded-full bg-[#20cf6d] px-[12px] text-[14px] leading-none text-white after:border-0"
|
||||||
@@ -52,30 +52,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
const goodsList = ref([
|
const props = defineProps({
|
||||||
{
|
list: {
|
||||||
commodityId: "xiaoqikong-rafting",
|
type: Array,
|
||||||
image: "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/xiaoqi/tickets/product-boat-rafting.jpg",
|
default: () => [],
|
||||||
title: "卧龙潭漂游",
|
|
||||||
description: "含防水袋 · 全程约 30 分钟",
|
|
||||||
price: "69.0",
|
|
||||||
},
|
},
|
||||||
{
|
});
|
||||||
commodityId: "xiaoqikong-classic",
|
|
||||||
image: "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/xiaoqi/tickets/product-classic-forest-path.jpg",
|
const goodsList = computed(() => props.list);
|
||||||
title: "小七孔经典畅游",
|
|
||||||
description: "含门票及观光车 · 随买随用",
|
|
||||||
price: "188.0",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const hasMultipleGoods = computed(() => goodsList.value.length > 1);
|
const hasMultipleGoods = computed(() => goodsList.value.length > 1);
|
||||||
|
|
||||||
const handleBuy = (goods) => {
|
const handleBuy = (goods) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/goods/index?commodityId=${encodeURIComponent(goods.commodityId)}`,
|
url: `/pages/goods/index?commodityId=${encodeURIComponent(goods.resource?.payload?.commodityId)}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -23,10 +23,13 @@
|
|||||||
<CardSwiper v-if="discoveryCards.length > 0" :list="discoveryCards" @didSelectItem="handleCardClick" />
|
<CardSwiper v-if="discoveryCards.length > 0" :list="discoveryCards" @didSelectItem="handleCardClick" />
|
||||||
<ExploreCards v-if="exploreCards.length > 0" :list="exploreCards" @didSelectItem="handleCardClick" />
|
<ExploreCards v-if="exploreCards.length > 0" :list="exploreCards" @didSelectItem="handleCardClick" />
|
||||||
|
|
||||||
<DiscoveryPhotoToolCard @didSelectItem="handleToolCardClick" @didSelectOption="handleToolOptionClick" />
|
<DiscoveryPhotoToolCard v-if="discoveryPhotoToolData" :item="discoveryPhotoToolData"
|
||||||
<DiscoveryAudioToolCard @didSelectItem="handleToolCardClick" />
|
@didSelectItem="handleToolCardClick" @didSelectOption="handleToolOptionClick" />
|
||||||
<DiscoveryGuideMapToolCard @didSelectItem="handleToolCardClick" />
|
<DiscoveryAudioToolCard v-if="discoveryAudioToolData" :item="discoveryAudioToolData"
|
||||||
<DiscoveryGoodsCard />
|
@didSelectItem="handleToolCardClick" />
|
||||||
|
<DiscoveryGuideMapToolCard v-if="discoveryGuideMapToolData" :item="discoveryGuideMapToolData"
|
||||||
|
@didSelectItem="handleToolCardClick" />
|
||||||
|
<DiscoveryGoodsCard v-if="discoveryGoodsData.length > 0" :list="discoveryGoodsData" />
|
||||||
|
|
||||||
<QuickQuestions v-if="discoveryQuickQuestions.length > 0" :list="discoveryQuickQuestions"
|
<QuickQuestions v-if="discoveryQuickQuestions.length > 0" :list="discoveryQuickQuestions"
|
||||||
@didSelectItem="handleQuickQuestionClick" />
|
@didSelectItem="handleQuickQuestionClick" />
|
||||||
@@ -65,7 +68,10 @@ const discoveryTabs = ref([]);
|
|||||||
const discoveryCards = ref([]);
|
const discoveryCards = ref([]);
|
||||||
const exploreCards = ref([]);
|
const exploreCards = ref([]);
|
||||||
const discoveryQuickQuestions = ref([]);
|
const discoveryQuickQuestions = ref([]);
|
||||||
const discoveryResourceCenterItems = ref([]);
|
const discoveryPhotoToolData = ref(null);
|
||||||
|
const discoveryAudioToolData = ref(null);
|
||||||
|
const discoveryGuideMapToolData = ref(null);
|
||||||
|
const discoveryGoodsData = ref([]);
|
||||||
const emit = defineEmits(["content-scroll"]);
|
const emit = defineEmits(["content-scroll"]);
|
||||||
|
|
||||||
/// 是否是主景区引导页 默认是 true,点击主景区后为 false
|
/// 是否是主景区引导页 默认是 true,点击主景区后为 false
|
||||||
@@ -85,7 +91,10 @@ const handleMainPanoramaClick = () => {
|
|||||||
discoveryCards.value = [];
|
discoveryCards.value = [];
|
||||||
exploreCards.value = [];
|
exploreCards.value = [];
|
||||||
discoveryQuickQuestions.value = [];
|
discoveryQuickQuestions.value = [];
|
||||||
discoveryResourceCenterItems.value = [];
|
discoveryPhotoToolData.value = null;
|
||||||
|
discoveryAudioToolData.value = null;
|
||||||
|
discoveryGuideMapToolData.value = null;
|
||||||
|
discoveryGoodsData.value = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -183,11 +192,16 @@ const queryQuickQuestionData = async (tabId) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 按资源集编码读取当前生效快照
|
/// 按资源集编码读取当前生效快照
|
||||||
const loadResourceCenterDataList = async (resourceSetCode) => {
|
const loadResourceCenterDataList = async (setCode) => {
|
||||||
if (!resourceSetCode) return;
|
if (!setCode) return;
|
||||||
const res = await resourceCenterData({ resourceSetCode });
|
const res = await resourceCenterData({ setCode });
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
discoveryResourceCenterItems.value = res.data;
|
const discoveryResourceItems = res.data.items || [];
|
||||||
|
// AUDIO POI COMMODITY COMPONENT
|
||||||
|
discoveryPhotoToolData.value = discoveryResourceItems.find(item => item.resource?.type === 'COMPONENT') || null;
|
||||||
|
discoveryAudioToolData.value = discoveryResourceItems.find(item => item.resource?.type === 'AUDIO') || null;
|
||||||
|
discoveryGuideMapToolData.value = discoveryResourceItems.find(item => item.resource?.type === 'POI') || null;
|
||||||
|
discoveryGoodsData.value = discoveryResourceItems.filter(item => item.resource?.type === 'COMMODITY') || [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user