feat: 商品详情对接调试
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
v-for="(item, index) in thumbnails"
|
v-for="(item, index) in thumbnails"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<image :src="item.photoUrl" mode="aspectFill"></image>
|
<image :src="item.imageUrl" mode="aspectFill"></image>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
|
|
||||||
@@ -39,8 +39,8 @@
|
|||||||
:id="`thumbnail-${index}`"
|
:id="`thumbnail-${index}`"
|
||||||
@click="handleThumbnailClick(index)"
|
@click="handleThumbnailClick(index)"
|
||||||
>
|
>
|
||||||
<image :src="thumb.photoUrl" mode="aspectFill"></image>
|
<image :src="thumb.imageUrl" mode="aspectFill"></image>
|
||||||
<text>{{ thumb.photoName }}</text>
|
<text>{{ thumb.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -106,35 +106,35 @@ const swiperStyle = computed(() => {
|
|||||||
// 默认图片数据
|
// 默认图片数据
|
||||||
const defaultImages = [
|
const defaultImages = [
|
||||||
{
|
{
|
||||||
photoUrl:
|
imageUrl:
|
||||||
"https://fastly.picsum.photos/id/866/654/400.jpg?hmac=z3vI4CYrpnXEgimSlJCDwXRxEa-UDHiRwzGEyB8V-po",
|
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04006.jpg",
|
||||||
photoName: "瑶山古寨",
|
name: "瑶山古寨",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
photoUrl:
|
imageUrl:
|
||||||
"https://fastly.picsum.photos/id/284/654/400.jpg?hmac=89XRCJxYTblKIFGLOp6hJ9U0GC8BQrcnJwE5pG21NAk",
|
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04002.JPG",
|
||||||
photoName: "民俗表演",
|
name: "民俗表演",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
photoUrl:
|
imageUrl:
|
||||||
"https://fastly.picsum.photos/id/281/654/400.jpg?hmac=hcAJB7y2Xz3DVuz6S4XeQZgzaTJ_QWnxtbnaagZL6Fs",
|
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04007.jpg",
|
||||||
photoName: "特色美食",
|
name: "特色美食",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
photoUrl:
|
imageUrl:
|
||||||
"https://fastly.picsum.photos/id/435/654/400.jpg?hmac=TSVDxfo-zXbunxNQK0erSG_nmKcS20xfhbQsCAXLlHo",
|
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04014.JPG",
|
||||||
photoName: "传统服饰",
|
name: "传统服饰",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
photoUrl:
|
imageUrl:
|
||||||
"https://fastly.picsum.photos/id/737/654/400.jpg?hmac=VED05oEK3XB0Aa_DUVoZjTAf0bHjAmNYyJky4lq5vVo",
|
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04020.JPG",
|
||||||
photoName: "其他",
|
name: "其他",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// 使用传入的图片数据或默认数据
|
// 使用传入的图片数据或默认数据
|
||||||
const thumbnails = computed(() => {
|
const thumbnails = computed(() => {
|
||||||
return props.images.length ? props.images : defaultImages;
|
return props.images;
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleThumbnailClick = (index) => {
|
const handleThumbnailClick = (index) => {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 12px;
|
left: 12px;
|
||||||
right: 12px;
|
right: 12px;
|
||||||
bottom: 36px;
|
bottom: 0px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,12 @@
|
|||||||
item.toolCall.componentName === CompName.createWorkOrderCard
|
item.toolCall.componentName === CompName.createWorkOrderCard
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
<DetailCardCompontent
|
||||||
|
v-else-if="
|
||||||
|
item.toolCall.componentName === ''
|
||||||
|
"
|
||||||
|
:toolCall="item.toolCall"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@@ -140,6 +146,7 @@ import ActivityListComponent from "../module/banner/ActivityListComponent.vue";
|
|||||||
import RecommendPostsComponent from "../module/recommend/RecommendPostsComponent.vue";
|
import RecommendPostsComponent from "../module/recommend/RecommendPostsComponent.vue";
|
||||||
import AttachListComponent from "../module/attach/AttachListComponent.vue";
|
import AttachListComponent from "../module/attach/AttachListComponent.vue";
|
||||||
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
||||||
|
import DetailCardCompontent from "../module/detail/DetailCardCompontent.vue";
|
||||||
import { mainPageData } from "@/request/api/MainPageDataApi";
|
import { mainPageData } from "@/request/api/MainPageDataApi";
|
||||||
import {
|
import {
|
||||||
conversationMsgList,
|
conversationMsgList,
|
||||||
|
|||||||
35
pages/module/detail/DetailCardCompontent.vue
Normal file
35
pages/module/detail/DetailCardCompontent.vue
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<template v-if="toolCall.picture && toolCall.picture.length > 0">
|
||||||
|
<ModuleTitle :title="图片详情" />
|
||||||
|
<ImageSwiper :images="toolCall.picture" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="toolCall.commodityList">
|
||||||
|
<DetailCardGoodsContentList :commodityList="toolCall.commodityList" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { defineProps } from 'vue'
|
||||||
|
import ModuleTitle from '@/components/ModuleTitle/index.vue'
|
||||||
|
import ImageSwiper from '@/components/ImageSwiper/index.vue'
|
||||||
|
import DetailCardGoodsContentList from './DetailCardGoodsContentList.vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
toolCall: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
198
pages/module/detail/DetailCardGoodsContentList.vue
Normal file
198
pages/module/detail/DetailCardGoodsContentList.vue
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<ModuleTitle title="相关商品" />
|
||||||
|
<view class="container-scroll">
|
||||||
|
<view class="mk-card-item" v-for="(item, index) in commodityList" :key="`${item.commodityId}-${index}`">
|
||||||
|
<image class="card-img" :src="item.commodityPhoto" mode="aspectFill" />
|
||||||
|
<view class="card-content">
|
||||||
|
<view class="card-title-column">
|
||||||
|
<text class="card-title">{{ item.commodityName }}</text>
|
||||||
|
<view class="card-tags" v-for="(tag) in item.commodityTradeRuleList" :key="tag">
|
||||||
|
<text class="card-tag">{{ tag }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-for="(serviceItem, index) in item.commodityServices" :key="serviceItem.serviceTitle">
|
||||||
|
<view v-if="index < 3" class="card-desc">· {{ serviceItem.serviceTitle }}</view>
|
||||||
|
</template>
|
||||||
|
<view class="card-bottom-row">
|
||||||
|
<view class="card-price-row">
|
||||||
|
<text class="card-price-fu">¥</text>
|
||||||
|
<text class="card-price">{{ item.specificationPrice }}</text>
|
||||||
|
<text class="card-unit">/人</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<text class="card-btn" @click="placeOrderHandle(item)">下单</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import ModuleTitle from '@/components/ModuleTitle/index.vue'
|
||||||
|
import { defineProps } from 'vue'
|
||||||
|
const props = defineProps({
|
||||||
|
commodityList: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/// 去下单
|
||||||
|
const placeOrderHandle = (item) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/goods/index?commodityId=${item.commodityId}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.container {
|
||||||
|
margin-bottom: 8px 0;
|
||||||
|
|
||||||
|
.container-scroll {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
margin: 4px 0;
|
||||||
|
|
||||||
|
/* 隐藏滚动条 */
|
||||||
|
scrollbar-width: none;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mk-card-item {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: start;
|
||||||
|
width: 188px;
|
||||||
|
// height: 244px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-right: 8px;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
|
||||||
|
.card-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
left: 8px;
|
||||||
|
background: #ffe7b2;
|
||||||
|
color: #b97a00;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-img {
|
||||||
|
width: 188px;
|
||||||
|
height: 114px;
|
||||||
|
border-radius: 10px;
|
||||||
|
object-fit: cover; /* 确保图片不变形,保持比例裁剪 */
|
||||||
|
flex-shrink: 0; /* 防止图片被压缩 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-content {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10px 12px 0 12px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: start;
|
||||||
|
width: 100%;
|
||||||
|
flex: 1; /* 让内容区域占据剩余空间 */
|
||||||
|
overflow: hidden; /* 防止内容溢出 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title-column {
|
||||||
|
display: flex;
|
||||||
|
align-items: start;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #222;
|
||||||
|
width: 100%;
|
||||||
|
/* 限制标题最多显示两行 */
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
line-height: 1.4;
|
||||||
|
max-height: 2.8em; /* 2行的高度 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-tags {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: start;
|
||||||
|
padding: 6px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-tag {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #ff6600;
|
||||||
|
font-size: 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0 6px;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-desc {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #888;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-bottom-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 8px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-price-row {
|
||||||
|
.card-price-fu {
|
||||||
|
color: #ff6600;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-price {
|
||||||
|
color: #ff6600;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.card-unit {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #888;
|
||||||
|
font-weight: normal;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-btn {
|
||||||
|
background: #ff6600;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 15px;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 0 18px;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.container {
|
.container {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-scroll {
|
.container-scroll {
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ export class WebSocketManager {
|
|||||||
data: messageStr,
|
data: messageStr,
|
||||||
success: () => {
|
success: () => {
|
||||||
this.stats.messagesSent++;
|
this.stats.messagesSent++;
|
||||||
console.log("消息发送成功:", messageData);
|
//console.log("消息发送成功:", messageData);
|
||||||
},
|
},
|
||||||
fail: (error) => {
|
fail: (error) => {
|
||||||
console.error("发送消息失败:", error);
|
console.error("发送消息失败:", error);
|
||||||
@@ -356,7 +356,7 @@ export class WebSocketManager {
|
|||||||
// 标准 WebSocket 环境
|
// 标准 WebSocket 环境
|
||||||
this.ws.send(messageStr);
|
this.ws.send(messageStr);
|
||||||
this.stats.messagesSent++;
|
this.stats.messagesSent++;
|
||||||
console.log("消息发送成功:", messageData);
|
//console.log("消息发送成功:", messageData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user