feat: 统一了商品详情购买需知的组件
This commit is contained in:
106
components/GoodDetail/index.vue
Normal file
106
components/GoodDetail/index.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="goodsData.commodityPurchaseInstruction" class="use-notice">
|
||||
<ModuleTitle
|
||||
v-if="showTitle"
|
||||
:title="goodsData.commodityPurchaseInstruction.templateTitle"
|
||||
/>
|
||||
<view
|
||||
class="use-notice-content"
|
||||
v-for="(moduleItem, index) in goodsData.commodityPurchaseInstruction
|
||||
.commodityPurchaseInstructionModuleEntityList"
|
||||
:key="index"
|
||||
>
|
||||
<view
|
||||
class="module-item"
|
||||
:class="{
|
||||
'border-bottom':
|
||||
index <
|
||||
goodsData.commodityPurchaseInstruction
|
||||
.commodityPurchaseInstructionModuleEntityList.length -
|
||||
1,
|
||||
}"
|
||||
>
|
||||
<view class="module-icon">
|
||||
<uni-icons fontFamily="znicons" size="20" color="#333">{{
|
||||
zniconsMap[moduleItem.moduleIcon]
|
||||
}}</uni-icons>
|
||||
<text class="module-title">{{ moduleItem.moduleTitle }}</text>
|
||||
</view>
|
||||
<text class="module-desc">{{ moduleItem.moduleContent }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<zero-markdown-view
|
||||
v-else
|
||||
:markdown="goodsData.commodityTip"
|
||||
:aiMode="true"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
||||
import { zniconsMap } from "@/static/fonts/znicons.js";
|
||||
import { defineProps } from "vue";
|
||||
|
||||
// Props定义
|
||||
const props = defineProps({
|
||||
goodsData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@font-face {
|
||||
font-family: znicons;
|
||||
src: url("@/static/fonts/znicons.ttf");
|
||||
}
|
||||
|
||||
// 使用须知样式
|
||||
.use-notice {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.use-notice-content {
|
||||
.module-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
padding: 12px 0;
|
||||
|
||||
.module-icon {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-right: 8px;
|
||||
flex-shrink: 0;
|
||||
|
||||
.module-title {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.module-desc {
|
||||
flex: 1;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -29,42 +29,8 @@
|
||||
:nights="selectedDate.totalDays"
|
||||
/>
|
||||
|
||||
<view v-if="goodsData.commodityPurchaseInstruction" class="use-notice">
|
||||
<ModuleTitle
|
||||
:title="goodsData.commodityPurchaseInstruction.templateTitle"
|
||||
/>
|
||||
<view
|
||||
class="use-notice-content"
|
||||
v-for="(moduleItem, index) in goodsData.commodityPurchaseInstruction
|
||||
.commodityPurchaseInstructionModuleEntityList"
|
||||
:key="index"
|
||||
>
|
||||
<view
|
||||
class="module-item"
|
||||
:class="{
|
||||
'border-bottom':
|
||||
index <
|
||||
goodsData.commodityPurchaseInstruction
|
||||
.commodityPurchaseInstructionModuleEntityList.length -
|
||||
1,
|
||||
}"
|
||||
>
|
||||
<view class="module-icon">
|
||||
<uni-icons fontFamily="znicons" size="20" color="#333">{{
|
||||
zniconsMap[moduleItem.moduleIcon]
|
||||
}}</uni-icons>
|
||||
<text class="module-title">{{ moduleItem.moduleTitle }}</text>
|
||||
</view>
|
||||
<text class="module-desc">{{ moduleItem.moduleContent }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<zero-markdown-view
|
||||
v-else
|
||||
:markdown="goodsData.commodityTip"
|
||||
:aiMode="true"
|
||||
/>
|
||||
<!-- 商品详情组件 -->
|
||||
<GoodDetail :goodsData="goodsData" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@@ -107,12 +73,11 @@ import {
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import ImageSwiper from "@/components/ImageSwiper/index.vue";
|
||||
import GoodInfo from "./components/GoodInfo/index.vue";
|
||||
import ModuleTitle from "@/components/ModuleTitle/index.vue";
|
||||
import GoodConfirm from "./components/GoodConfirm/index.vue";
|
||||
import Calender from "@/components/Calender/index.vue";
|
||||
import { zniconsMap } from "@/static/fonts/znicons.js";
|
||||
import LocationCard from "@/components/LocationCard/index.vue";
|
||||
import DateSelector from "./components/DateSelector/index.vue";
|
||||
import GoodDetail from "@/components/GoodDetail/index.vue";
|
||||
|
||||
const calendarVisible = ref(false);
|
||||
const goodsData = ref({});
|
||||
@@ -314,8 +279,4 @@ const handleDateSelect = (data) => {
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "./styles/index.scss";
|
||||
@font-face {
|
||||
font-family: znicons;
|
||||
src: url("@/static/fonts/znicons.ttf");
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
<template>
|
||||
<view class="notice-info mb12">
|
||||
<view class="notice-title"> 购买须知 </view>
|
||||
|
||||
<zero-markdown-view
|
||||
:markdown="orderData.commodityTip"
|
||||
:fontSize="14"
|
||||
:aiMode="true"
|
||||
/>
|
||||
<GoodDetail :goodsData="orderData" :showTitle="false" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps } from "vue";
|
||||
import GoodDetail from "@/components/GoodDetail/index.vue";
|
||||
|
||||
const props = defineProps({
|
||||
orderData: {
|
||||
|
||||
Reference in New Issue
Block a user