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.

268 lines
5.5 KiB

2 years ago
<template>
<view class="container-main">
<view class="header-box">
<view class="enterprise-header">
<view class="enterprise-img">
<image :src="baseImgUrl+'/liao-ning/icon_qyzhcx.png'" mode=""></image>
</view>
<view class="enterprise-name">
<view class="name-text">{{query.productName || params.enterpriseName}}</view>
<view class="score">
<uni-rate allow-half :value="gradeNum" :size="18" color="#C4CCD8" activeColor="#ED7043"
readonly />
<text v-if="gradeNum == 0"></text>
<text v-else>{{gradeNum}}</text>
</view>
</view>
</view>
<scroll-view scroll-y class="pingjia-list" @scrolltolower='reachBottom()'>
<view class="list-title">
评价({{total}})
</view>
<view class="list-item" v-for="(item,index) in list" :key="index">
<view class="item-title">
<view class="item-user">{{item.writer}}</view>
<view class="item-pf">
<text
style="color: #34373B;font-size: 28rpx;font-weight: 400;margin-right: 10rpx;">打分</text>
<uni-rate allow-half :value="item.grade" :size="15" color="#C4CCD8" activeColor="#ED7043"
readonly />
</view>
</view>
<view class="item-article">
{{item.content}}
</view>
<view class="item-time">
发布于 {{item.createTime.slice(0,10)}}
</view>
</view>
<u-loadmore :status="status" :load-text="loadText" color="#C4CCD8" font-size="24" />
</scroll-view>
</view>
</view>
</template>
<script>
import {
getAppraise
} from "@/api/shianliaoning/enterpriseSEARCH.js"
//查询企业的评分
import {
enterpriseGrade,
} from '@/api/shianliaoning/enterpriseSEARCH.js'
export default {
components: {},
data() {
return {
baseImgUrl: getApp().globalData.config.iamgeBaseUrl,
list: [],
total: 0,
//产品查询参数
query: {
productId: '',
productName: '',
pageSize: 10,
pageNum: 1,
type: 1,
},
//企业查询参数
params: {
code: '',
enterpriseName: '',
pageSize: 10,
pageNum: 1,
type: 2,
},
flag: true,
loadText: {
nomore: '已经到底了~',
loading: '努力加载中'
},
status: 'nomore',
statusFlag: false,
//评分
gradeNum: 0
};
},
onLoad(e) {
if (e.gradeNum) {
this.query.productName = e.productName
this.query.productId = e.productId
this.gradeNum = e.gradeNum
this.getList(this.query)
uni.setNavigationBarTitle({
title: '产品评价详情'
});
} else {
this.params.code = uni.getStorageSync('USER_DATA').userDto.code
this.params.enterpriseName = uni.getStorageSync('USER_DATA').userDto.enterpriseName
enterpriseGrade(this.params.code).then(res => {
this.gradeNum = res.data
})
console.log(this.params);
this.getList(this.params)
uni.setNavigationBarTitle({
title: '主体评价详情'
});
}
},
methods: {
//触底加载
reachBottom() {
if (this.query.productName != '') {
if (this.total > this.list.length) {
if (this.statusFlag) {
return
}
this.query.pageNum++
this.getList(this.query)
}
}else{
if (this.total > this.list.length) {
if (this.statusFlag) {
return
}
this.params.pageNum++
this.getList(this.params)
}
}
},
//下拉加载效果
reachStart() {
this.statusFlag = true
this.status = 'loading'
},
//下拉结束效果
reachEnd() {
this.statusFlag = false
this.status = 'nomore'
},
getList(e) {
this.reachStart()
console.log(e);
getAppraise(e).then((res) => {
this.flag = false
console.log(res);
this.list = [...this.list, ...res.rows]
this.total = res.total
this.reachEnd()
})
},
},
}
</script>
<style lang="scss" scoped>
.container-main {
box-sizing: border-box;
padding: 20rpx;
// padding-bottom: 130rpx;
.enterprise-header {
background: #FFFFFF;
border-radius: 16rpx;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 20rpx;
.enterprise-img {
height: 100rpx;
width: 100rpx;
image {
height: 100%;
width: 100%;
display: block;
}
}
.enterprise-name {
flex: 1;
box-sizing: border-box;
padding-left: 20rpx;
.name-text {
font-size: 36rpx;
font-weight: 550;
color: #34373B;
margin-bottom: 15rpx;
}
.score {
display: flex;
align-items: center;
text {
margin-left: 20rpx;
font-size: 26rpx;
font-weight: 600;
color: #ED7043;
}
}
}
}
.pingjia-list {
margin-top: 20rpx;
height: 80vh;
background-color: #FFFFFF;
border-radius: 16rpx;
box-sizing: border-box;
padding: 30rpx;
.list-title {
font-size: 36rpx;
font-weight: 520;
color: #34373B;
margin-bottom: 20rpx;
}
.list-item {
box-sizing: border-box;
padding: 30rpx 0;
border-bottom: 1rpx solid #DCE3EC;
.item-title {
display: flex;
align-items: center;
justify-content: space-between;
.item-user {
font-size: 30rpx;
color: #3976F1;
font-weight: 400;
}
.item-pf {
display: flex;
align-items: center;
}
}
.item-article {
margin: 20rpx 0;
font-size: 28rpx;
font-weight: 400;
color: #34373B;
}
.item-time {
font-size: 26rpx;
font-weight: 400;
color: #9DA2AB;
}
}
.lastItem {
border: 0;
padding-bottom: 0;
}
}
}
</style>