You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

433 lines
8.8 KiB

<template>
<view class="page1">
<view class="title">
<view class="title-sreach">
<view class="back-btn" @tap="back" :style="{'top': menuButtonInfo.top +'px'}">
<uni-icons type="left" size="28"></uni-icons>
</view>
<view class="title-name" :style="{'padding-top': menuButtonInfo.top +'px'}">
商家评价
</view>
</view>
</view>
<view class="content">
<view class="shop-rate">
<view class="rate-left">
<view class="rate-num">
{{shopItem.shopScore}}
</view>
<view class="rate-star">
<uni-rate :disabled="true" size="20" disabledColor="rgba(255, 184, 84, 1)" :value="shopItem.shopScore" />
</view>
</view>
</view>
<view class="">
<view class="menu-list">
<view class="menu1" @tap="checkTab(index)" v-for="(item,index) in menuList" :key="index"
:style="{'font-size':item.checked?'40rpx':'30rpx','color':item.checked?'rgba(0, 35, 28, 1)':'#777','width':index == 0?'80px':'90px'}">
<view :style="{'width':index == 0?'80px':'90px'}" style="text-align: left;">
{{item.name}}({{item.num}})
</view>
<img v-if="item.checked" class="checked-img"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4bb5fc7725cb4a7a84d1d3a15f05b39c.png"
alt="" />
</view>
</view>
</view>
<view class="evaluate-list" v-for="(item,index) in shopComments" :key="index">
<view class="eval-title">
<view class="eval-icon">
<img :src="item.createByIcon"
alt="" />
</view>
<view class="eval-name">
<view class="name1">
{{item.createByName}}
</view>
<view class="eval-time">
{{item.createTime}}
</view>
</view>
</view>
<view class="eval-content">
<view class="eval-text">
{{item.remark}}
</view>
<view class="eval-img">
<img @tap="largeImg" :src="item.picture" alt="">
</view>
<view class="reply-card" :class="{'expanded': isExpanded}" v-for="(item1,index1) in item.comments" :key="index1">
<!-- 标题行商家回复 + 展开/收起按钮 -->
<view class="reply-header">
<!-- 回复内容区域动态类控制展开/折叠 -->
<view class="reply-content" :class="{ collapsed: !isExpanded, expanded: isExpanded }">
<text>{{item1.createByName}} : {{ item1.remark }}</text>
</view>
<view class="reply-expand-btn" @click="toggleReply">
<text v-if="!isExpanded">展开</text>
<text v-else>收起</text>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 查看大图弹出层 -->
<uni-popup ref="imgPopup" background-color="#fff">
<view class="img-popup-content">
<img :src="bigImg" alt="" style="width: 100%;height: 100%;">
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
isExpanded: false,
replyText: '感谢您的评价,希望可以带给您更好的体验。我们会继续努力,优化服务,欢迎再次光临!如果您有任何建议,也欢迎随时告诉我们。感谢您的支持与喜爱!',
menuButtonInfo: {},
isPintuan: true,
bigImg: '',
shopItem:{},
pageNum:1,
searchAll:true,
total:0,
shopComments:[],
searchForm:{
shopId:'',
pageNum: 1,
score:0,
picture:0,
pageSize: '10'
},
menuList: [{
name: '全部',
num: 0,
checked: true
}, {
name: '有图/视频',
num: '',
checked: false
}, {
name: '中差评',
num: '',
checked: false
}]
}
},
components: {
},
onLoad(option) {
this.shopItem = JSON.parse(option.item)
this.getshopComments(this.shopItem.id)
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
},
methods: {
getshopComments(id){
let that = this
this.searchForm.shopId = id
that.tui.request("/app/comment/getCommentList", "POST", this.searchForm, false, false).then((res) => {
if (res.code == 200) {
if (that.pageNum == 1) {
that.shopComments = res.result.records
} else {
that.shopComments = [...that.shopComments, ...res.result.records]
}
that.$forceUpdate()
if(this.searchAll){
that.menuList[0].num = res.result.total
}
} else {
that.tui.toast(res.message)
return
}
uni.hideLoading()
}).catch((res) => {})
},
toggleReply() {
this.isExpanded = !this.isExpanded;
},
checkTab(index) {
for (let i = 0; i < this.menuList.length; i++) {
if (i == index) {
this.menuList[i].checked = true
} else {
this.menuList[i].checked = false
}
}
if(index == 0){
this.searchForm.picture = 0
this.searchForm.score = 0
}else if(index ==1){
this.searchAll = false
this.searchForm.picture = 1
this.searchForm.score = 0
}else{
this.searchAll = false
this.searchForm.picture = 0
this.searchForm.score = 1
}
this.getshopComments(this.shopItem.id)
},
//查看大图
largeImg(img) {
this.bigImg = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/00b1f011787c4549bbea650d95a4eb39.png'
this.$refs.imgPopup.open()
},
back() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss">
page {
width: 100%;
height: 100%;
font-size: 24rpx;
background: #F5F8F5;
color: #00231C;
}
.page1 {
width: 100%;
height: 100%;
font-size: 24rpx;
position: relative;
}
.title {
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat;
width: 100%;
height: 54%;
}
.title-sreach {
width: 100%;
display: flex;
height: 200rpx;
position: relative;
}
.back-btn {
position: absolute;
bottom: 0;
left: 0;
}
.title-name {
padding-top: 55px;
font-size: 36rpx;
font-weight: 700;
flex: 1;
text-align: center;
}
.content {
position: absolute;
top: 100px;
width: 95%;
margin-left: 2.5%;
}
.shop-rate {
display: flex;
padding-bottom: 15px;
}
.rate-left {
display: flex;
flex: 1;
}
.rate-num {
font-size: 43px;
font-weight: 700;
background: linear-gradient(90deg, rgba(255, 77, 0, 1), rgba(255, 184, 84, 1));
background-clip: text;
color: transparent;
}
.rate-right {
display: flex;
width: 80px;
height: 50px;
line-height: 20px;
font-size: 18px;
text-align: center;
font-weight: 700;
border-left: 1px solid #eee;
}
.rate-star {
height: 50px;
padding: 16px 10px;
}
.right1 {
margin: 10px 0 0 5%;
width: 45%;
}
.menu-list {
height: 50px;
width: 100%;
display: flex;
overflow-y: hidden;
padding-top: 15px;
border-top: 1px solid #eee;
}
.checked-img {
width: 100%;
height: 10px;
position: absolute;
bottom: 0;
left: 0;
}
.menu1 {
width: 90px;
height: 35px;
position: relative;
margin-right: 10px;
line-height: 35px;
flex: 1;
}
.evaluate-list {
margin-top: 20px;
}
.eval-title {
width: 100%;
height: 40px;
display: flex;
}
.eval-icon {
height: 40px;
width: 40px;
img {
width: 100%;
height: 100%;
background-size: 100%;
}
}
.eval-name {
margin-left: 10px;
}
.name1 {
font-size: 14px;
line-height: 25px;
font-weight: 700;
}
.eval-rate {
display: flex;
margin: 10px 0 0 50px;
height: 24px;
line-height: 20px;
}
.eval-content {
margin-left: 50px;
font-size: 14px;
color: #777;
line-height: 24px;
}
.eval-img {
display: flex;
width: 100%;
overflow-x: scroll;
margin-top: 10px;
img {
width: 50px;
height: 50px;
background-size: 100%;
margin-right: 10px;
}
}
/* 卡片整体样式(可根据需要调整外间距) */
.reply-card {
border-radius: 12rpx;
background-color: #eee;
width: 100%;
box-sizing: border-box;
margin-top:10px;
}
/* 标题行:左标签 + 右按钮 */
.reply-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
}
.reply-label {
font-size: 28rpx;
font-weight: 500;
color: #333;
}
.reply-expand-btn {
font-size: 12px;
padding: 4rpx 12rpx;
}
/* 回复内容基础样式 */
.reply-content {
font-size: 13px;
color: #555;
padding: 12rpx;
transition: all 0.2s;
height: 35px;
flex: 1;
}
/* 折叠状态:单行省略 */
.reply-content.collapsed {
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
/* 展开状态:固定高度100px,可滚动 */
.reply-content.expanded {
display: block;
height: 100px;
/* 固定高度100px */
overflow-y: auto;
/* 内容超长时滚动 */
/* 重置折叠相关属性 */
-webkit-line-clamp: unset;
-webkit-box-orient: unset;
text-overflow: clip;
}
/* 滚动条美化(可选) */
.reply-content.expanded::-webkit-scrollbar {
width: 6px;
}
.reply-content.expanded::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 10px;
}
</style>