商品详情布局修改

This commit is contained in:
yanwenlong
2023-09-17 00:26:33 +08:00
parent 46a66c8884
commit ebeaae1927
2 changed files with 801 additions and 88 deletions

View File

@@ -8,101 +8,147 @@
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000"
style="width: 100%;height: 100%;">
<swiper-item v-for="(item,index) in swiperlist" :key="index" style="width: 100%;height: 100%;">
<image :src="item" mode="scaleToFill" style="width: 100%;height: 100%;"></image>
<image :src="item" mode="aspectFit" style="width: 100%;height: 100%;"></image>
</swiper-item>
</swiper>
</view>
<view class="commodityContent">
<view class="commodityPrice">
<span></span><em>{{productInfo.price}}</em>
<span class="oldPrice " v-if="productInfo.activityPrice">原价{{productInfo.activityPrice}}</span>
<span style="font-size: 28rpx;"></span><em>{{productInfo.price}}</em>
<span class="oldPrice " v-if="productInfo.activityPrice">原价<span style="font-size: 20rpx;padding-left:10rpx;"></span>{{productInfo.activityPrice}}</span>
</view>
<view class="commodityyName">
{{productInfo.productName}}
<span v-if="productInfo.productStock==0" style="color: #aaa;font-size:26rpx;">无货</span>
<view><text class="SoldNumber">已售<span>{{productInfo.sumSales}}</span></text></view>
<view><text class="SoldNumber">已售<span style="padding-left:10rpx;">{{productInfo.sumSales}}</span></text></view>
</view>
<view class="pingjia" v-if="listenList && listenList.length > 0 && listenList[0]">
<view class="">
<view style="font-weight: 600;margin-bottom: 30rpx;">商品包含</view>
<!-- <view class="icon-del rotate"></view> -->
</view>
<!-- 商品包含 -->
<view v-if="listenList && listenList.length > 0 && listenList[0]">
<view class="spbh" v-for="item in listenList" :key="item.id">
<view class="flexbox aligncenter" @click="previewImage(item.images)">
<view class="spbhimg">
<image :src="item.images" mode="aspectFit"></image>
</view>
<text class="username nowrap ">{{item.name}}</text>
</view>
</view>
</view>
<view class="quesheng" v-else>
<text>暂无评价~</text>
</view>
</view>
<view class="contentButton">
<u-tabs :scrollable="false" :list="contentButtonList" @click="contentButtonClick"></u-tabs>
<u-tabs :scrollable="false" :list="contentButtonList" @click="contentButtonClick"
:activeStyle="{
color: '#303133',
fontWeight: 'bold',
fontSize: '28rpx'
}"
:inactiveStyle="{
color: '#606266',
fontSize: '28rpx'
}"></u-tabs>
</view>
<!-- 详情 + 评价1 -->
<view v-if="contentShow == 0">
<view class="tingshuList" v-if="listenList.length > 0">
<h4>赠送听书权益</h4>
<view class="item flexbox" v-for="item in listenList" :key="item.id" style="vertical-align: middle;">
<text style="margin-top: 10rpx; padding-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.canListen == 'true'" name="volume" color="#71d5a1" size="24" @click="goToListen(item.id)"></u-icon>
<u-icon v-else name="volume" color="#71d5a1" size="24" @click="goToListenNone(item.id)"></u-icon>
<view class="pingjia">
<!-- <h4></h4> -->
<view class="" v-if="listenList.length > 0 && listenList[0]" style="margin:0rpx 0rpx 30rpx;">
<view class="">
<view style="font-weight: 600;margin-bottom: 30rpx;color:#71d5a1;">赠送听书权益</view>
</view>
<view class="item flexbox aligncenter" v-for="item in listenList" :key="item.id" style="padding-bottom:10rpx;">
<view class="spbhimg" @click="previewImage(item.images)">
<image :src="item.images" mode="aspectFit"></image>
</view>
<text style="padding-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.canListen == 'true'" name="volume" color="#71d5a1" size="24" @click="goToListen(item.id)"></u-icon>
<u-icon v-else name="volume" color="#71d5a1" size="24" @click="goToListenNone(item.id)"></u-icon>
</view>
</view>
<view class="">
<view style="font-weight: 600;margin:0rpx 0rpx 30rpx;">商品详情</view>
</view>
<view class="bookInfo" >
<u-row customStyle="margin-bottom: 10px">
<u-col ><span>书名{{productInfo.productName}}</span></u-col>
</u-row>
<u-row customStyle="margin-bottom: 10px">
<u-col v-if="productInfo.author"><span>作者{{productInfo.author}}</span></u-col>
</u-row>
<u-row customStyle="margin-bottom: 10px">
<u-col span="12" v-if="productInfo.publisher"><span>出版社{{productInfo.publisher}}</span></u-col>
</u-row>
<u-row customStyle="margin-bottom: 10px">
<u-col span="12" v-if="productInfo.pubDate"><span>出版时间{{ productInfo.pubDate | formatDate }}</span></u-col>
</u-row>
<u-row customStyle="margin-bottom: 10px">
<u-col span="6" v-if="productInfo.format"><span>开本{{productInfo.format}}</span></u-col>
<u-col span="6" v-if="productInfo.pageNum"><span>页数{{productInfo.pageNum}}</span></u-col>
</u-row>
<u-row customStyle="margin-bottom: 10px">
<u-col span="6" v-if="productInfo.quality"><span>内文用纸材质{{productInfo.quality}}</span></u-col>
</u-row>
</view>
<!-- <view class="commodityIntroduce" v-html="productInfo.productDetails"> -->
<view class="commodityIntroduce" >
<view v-if="productInfo.productDetails" >
<rich-text v-if="productInfo.productDetails" class="xiangqing" :nodes="productInfo.productDetails|formatRichText"></rich-text>
</view>
</view>
</view>
<view class="bookInfo" >
<u-row customStyle="margin-bottom: 10px">
<u-col ><span>书名{{productInfo.productName}}</span></u-col>
</u-row>
<u-row customStyle="margin-bottom: 10px">
<u-col v-if="productInfo.author"><span>作者{{productInfo.author}}</span></u-col>
</u-row>
<u-row>
<u-col span="6" v-if="productInfo.publisher"><span>出版社{{productInfo.publisher}}</span></u-col>
<u-col span="6" v-if="productInfo.pubDate"><span>出版时间{{ productInfo.pubDate | formatDate }}</span></u-col>
</u-row>
<u-row>
<u-col span="6" v-if="productInfo.format"><span>开本{{productInfo.format}}</span></u-col>
<u-col span="6" v-if="productInfo.pageNum"><span>页数{{productInfo.pageNum}}</span></u-col>
</u-row>
<u-row>
<u-col span="6" v-if="productInfo.quality"><span>内文用纸材质{{productInfo.quality}}</span></u-col>
</u-row>
<!-- <view class="pingjia quesheng" v-else>
<text>暂无详情~</text>
</view> -->
</view>
<!-- <view class="commodityIntroduce" v-html="productInfo.productDetails"> -->
<view class="commodityIntroduce" >
<view v-if="productInfo.productDetails" >
<rich-text v-if="productInfo.productDetails" class="xiangqing" :nodes="productInfo.productDetails|formatRichText"></rich-text>
<view class="pingjia" v-else>
<view class="">
<view style="font-weight: 600;margin-bottom: 30rpx;">评价({{commentsList?commentsList.length:0}})</view>
<!-- <view class="icon-del rotate"></view> -->
</view>
</view>
</view>
<view v-else >
<!-- 商品评价 -->
<view class="" v-if="commentsList && commentsList.length > 0">
<view class="pingjiaBox" v-for="(item, index) in commentsList" :key="index">
<view class="flexbox">
<view class="touxiang">
<image :src="item.avatar" mode="aspectFit"></image>
<text class="username nowrap ">{{item.name}}</text>
</view>
<view class="contentBox">
<view class="mb30">
<view class="pingjiaBox" v-for="(item, index) in commentsList" :key="index">
<view class="flexbox aligncenter">
<view class="touxiang">
<image :src="item.avatar" mode="aspectFit"></image>
<text class="username nowrap ">{{item.name}}</text>
</view>
<view class="mb30" style="padding: 6rpx 0rpx 0rpx 20rpx;">
<span :class="['star',item.starlevel >= 1 ? 'starLight':'starGray']"></span>
<span :class="['star',item.starlevel >= 2 ? 'starLight':'starGray']"></span>
<span :class="['star',item.starlevel >= 3 ? 'starLight':'starGray']"></span>
<span :class="['star',item.starlevel >= 4 ? 'starLight':'starGray']"></span>
<span :class="['star',item.starlevel >= 5 ? 'starLight':'starGray']"></span>
</view>
</view>
</view>
<view class="contentBox">
<div class="pjimgs flexbox">
<view class="item" v-for="(item1,index) in item.images">
<image v-if="item1.length > 10" @click="previewImage(item1)" :src="item1" mode="aspectFill" style="width:100%; height: 50px;"></image>
</view>
</div>
<view class="content" v-html="item.phtml"></view>
<text class="time">{{item.createdate}}</text>
</view>
</view>
<!-- 显示追平 -->
<view class="zhuiping item" v-if="item.zphtml != ''" style="padding-left: 50px;">
<h5 style="color: #dbdbdb; margin:10px;">追评内容</h5>
<view class="flexbox">
<view class="contentBox">
<view class="content" v-html="item.zphtml"></view>
<text class="time">{{item.followUpdate}}</text>
</view>
</view>
<!-- 显示追平 -->
<view class="zhuiping item" v-if="item.zphtml != ''" style="padding-left: 60rpx;">
<h5 style="color: #dbdbdb;padding: 30rpx 10rpx 10rpx 0rpx;">追评内容</h5>
<view class="flexbox">
<view class="contentBox">
<view class="content" v-html="item.zphtml"></view>
<text class="time">{{item.followUpdate}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="quesheng" v-else>
<text>暂无评价~</text>
</view>
@@ -478,31 +524,62 @@ formatRichText (html) { //控制小程序中图片大小
h4{color: #5fb386; font-size: 40rpx; margin-bottom: 20rpx;}
text{color: #444; font-size: 32rpx; padding-left: 20rpx;}
}
.pjimgs{ margin: 10px 0;flex-wrap: wrap; display: flex; justify-content: space-between;
.item{width: 23%; margin-right: 10px;
image{ }
.pjimgs{ margin: 0;flex-wrap: wrap; display: flex; justify-content: space-between;
.item{
width: 23%;
padding-right: 20rpx;
margin-top: 10rpx;
image{
border-radius: 15rpx;
}
}
}
.star{display: inline-block; width: 20px; height: 20px; margin-right: 10rpx;}
.star{display: inline-block; width: 15px; height: 15px; margin-right: 6rpx;}
.starGray{ background : url(../../static/icon/star_greey.png) no-repeat; background-size: contain; }
.starLight{ background : url(../../static/icon/star_light.png) no-repeat; background-size: contain;}
.quesheng{text-align: center; margin-top: 100rpx; color: #8b8a91;}
.quesheng{text-align: center; margin-top: 0rpx; color: #8b8a91;}
.pingjia{
background-color: #f5f5f5;
border-radius: 20rpx;
// margin-top: 20rpx;
padding: 30rpx 30rpx 20rpx;
}
.pingjiaBox{color: #555; margin-bottom: 20rpx;}
.flexbox{display: flex;}
.contentBox{width: calc(100% - 50px);box-sizing: border-box; padding-left: 20rpx;
.content{font-size: 28rpx; line-height: 40rpx;}
.time{font-size: 24rpx; color: #999; margin-top: 6rpx; float: right;}
.contentBox{width: 100%;box-sizing: border-box; padding: 0rpx 10rpx 30rpx 6rpx;
.content{font-size: 28rpx; line-height: 40rpx;margin-top: 10rpx;}
.time{font-size: 24rpx; color: #999; padding-top: 6rpx; float: right;}
}
.spbh{
padding-bottom: 10rpx;
font-size: 26rpx;
}
.spbhimg{
width:40px; overflow: hidden; text-align: center;
image{
width:40px !important;
padding: 3px;
height: 40px !important;
border: 1px solid #eee;
border-radius: 6rpx;
overflow: hidden;
}
.username{font-size: 24rpx; color: #999; margin-top: 6rpx; }
}
.nowrap {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
.touxiang{width:50px; overflow: hidden; text-align: center;
image{width:50px !important; padding: 3px; height: 50px !important; border: 1px solid #eee; border-radius: 64px; overflow: hidden;;}
.touxiang{width:40px; overflow: hidden; text-align: center;
image{width:40px !important; padding: 3px; height: 40px !important; border: 1px solid #eee; border-radius: 64px; overflow: hidden;;}
.username{font-size: 24rpx; color: #999; margin-top: 6rpx; }
}
.aligncenter{
align-items: center;
}
.xiangqing {
overflow: hidden; overflow-x: hidden;
img{display: block; max-width: 100%;}
@@ -519,15 +596,16 @@ formatRichText (html) { //控制小程序中图片大小
font-size: 24rpx;
color: #999;
margin-top: 16rpx;
font-weight: 400;
}
.bookInfo {
padding: 20px 10px;
line-height: 30rpx;
background-color: #fff;
// padding: 20px 10px;
// line-height: 30rpx;
// background-color: #fff;
font-size: 26rpx;
color: #555;
border-radius: 20rpx 20rpx 0 0
// border-radius: 20rpx 20rpx 0 0
}
.header {
@@ -538,7 +616,7 @@ formatRichText (html) { //控制小程序中图片大小
}
.contentButton {
margin: 10px 0;
// margin: 10px 0;
}
.swiperBox {
@@ -548,28 +626,32 @@ formatRichText (html) { //控制小程序中图片大小
}
.commodityContent {
margin: 30rpx 20rpx 10rpx 20rpx;
background-color: #fff;
padding: 30rpx 30rpx 10rpx 30rpx;
height: auto;
font-size: 26rpx;
.commodityPrice {
background-image: linear-gradient(0deg, #f7fffc 0%, #def0ea 100%);
border-top: 1px solid #fff;
// background-image: linear-gradient(0deg, #f7fffc 0%, #def0ea 100%);
// border-top: 1px solid #fff;
// background-color: #f7faf9;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
// border-top-left-radius: 20rpx;
// border-top-right-radius: 20rpx;
color: #ffa200;
padding: 20rpx 20rpx 40rpx 20rpx;
padding: 0rpx 0rpx 0rpx 16rpx;
em {
font-size: 74rpx;
font-size: 40rpx;
font-style: normal;
}
.oldPrice {
margin-left: 10rpx;
font-size: 32rpx;
color: #999;
background-color: #ff000013;;
padding: 4rpx 14rpx;
border-radius: 20rpx;
margin-left: 20rpx;
font-size: 28rpx;
color: #ff0000;
}
}
@@ -577,6 +659,7 @@ formatRichText (html) { //控制小程序中图片大小
margin-top: -20rpx;
padding: 30rpx 20rpx 40rpx 20rpx;
font-size: 40rpx;
font-weight: 600;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
background-color: #fff;
@@ -584,8 +667,8 @@ formatRichText (html) { //控制小程序中图片大小
.commodityIntroduce {
font-size: 30rpx;
background-color: #fff;
padding: 0 20rpx 30rpx 20rpx;
// background-color: #fff;
// padding: 0 20rpx 30rpx 20rpx;
}
}