123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <template>
- <view class="container">
- <scroll-view class="message-list-box" scroll-y="true" @scrolltolower="handleLoadMore()">
- <view style="padding-top: 20px;" v-if="assessList.length<=0">
- <u-divider color="#909399" border-color="#909399">没有更多了</u-divider>
- </view>
- <view class="assess-row" v-for="(item, index1) in assessList" :key="index1">
- <image class="assess-head" :src="item.headimg"></image>
- <view class="assess-info">
- <view class="assess-name">{{item.nickname}}</view>
- <view class="assess-date">{{item.evaluateTime}}</view>
- <view class="assess-sore-box">
- <u-rate v-model="item.score" active-color="#FFAE21" disabled></u-rate>
- </view>
- <view class="assess-text">{{item.evaluateContent}}</view>
- <view class="assess-img-box">
- <image class="img-col" v-for="(site, index2) in item.evaluateImgs" :key="index2" :src="site.imgUrl" @tap="_previewImage(site.imgUrl,i)"></image>
- </view>
- </view>
- <view class="shop-reply-box" v-if="item.replyContent">
- <view class="shop-head">
- <view class="iconfont icondianpu"></view>
- <view class="shop-name">店家回复</view>
- </view>
- <view class="shop-reply">{{item.replyContent}}</view>
- </view>
- </view>
- </scroll-view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- data() {
- return {
- goodId: '',
- pageIndex: 1,
- isOver: false,
- assessList: [],
- preview: false
- }
- },
- onLoad(options) {
- this.goodId = options.goodId
- },
- onShow() {
- if (!this.preview) {
- this.pageIndex = 1
- this.assessList = []
- this.getMessageList('refresh')
- }
- },
- onPullDownRefresh() {
- this.pageIndex = 1
- this.assessList = []
- this.getMessageList('refresh')
- },
- methods: {
- // 懒加载
- handleLoadMore() {
- if (!this.isOver) {
- this.pageIndex++
- this.getMessageList()
- }
- },
- // 获取全部留言
- getMessageList(type) {
- NET.request(API.getAssessList + this.goodId + '/' + this.pageIndex + '/10', {}, 'GET').then(res => {
- if (type == 'refresh') {
- uni.stopPullDownRefresh();
- }
- this.isOver = res.data.list.length != 10
- this.assessList = this.assessList.concat(res.data.list)
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.data.msg,
- type: 'warning',
- })
- })
- },
- // 图片预览
- _previewImage(image,index) {
- this.preview = true
- var imgArr = [];
- imgArr.push(image);
- //预览图片
- uni.previewImage({
- urls: imgArr,
- current: imgArr[index]
- });
- }
- }
- }
- </script>
- <style lang="less" scoped>
- page {
- width: 100%;
- height: 100%;
- }
- .container {
- width: 100%;
- height: 100%;
- float: left;
- position: relative;
- .message-list-box {
- width: 100%;
- height: 100%;
- float: left;
- .assess-row {
- width: calc(100% - 30px);
- margin: 0 15px;
- float: left;
- border-top: 1px solid #F6F6F6;
- padding: 12px 0;
- .assess-head {
- width: 50px;
- height: 50px;
- float: left;
- object-fit: cover;
- border-radius: 50%;
- }
- .assess-info {
- width: calc(100% - 62px);
- margin-left: 12px;
- float: left;
- .assess-name {
- height: 18px;
- float: left;
- line-height: 18px;
- font-size: 15px;
- font-family: PingFang SC;
- font-weight: bold;
- color: #343434;
- }
- .assess-date {
- height: 18px;
- float: right;
- line-height: 18px;
- font-size: 12px;
- font-family: PingFang SC;
- font-weight: bold;
- color: #666666;
- }
- .assess-sore-box {
- width: 100%;
- height: 16px;
- float: left;
- margin: 6px 0;
- }
- .assess-text {
- width: 100%;
- float: left;
- font-size: 12px;
- font-family: PingFang SC;
- font-weight: bold;
- color: #666666;
- line-height: 16px;
- margin: 8px 0 10px 0;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- word-wrap: break-word;
- }
- .assess-img-box {
- width: 100%;
- float: left;
- display: flex;
- .img-col {
- height: 60px;
- width: 60px;
- object-fit: cover;
- margin: 0 10px 10px 0;
- }
- }
- }
- .shop-reply-box {
- width: 100%;
- float: left;
- background: #F5F5F5;
- border-radius: 5px;
- margin-top: 10px;
- .shop-head {
- width: 100%;
- height: 36px;
- float: left;
- box-sizing: border-box;
- padding: 10px 12px;
- .icondianpu {
- width: 16px;
- height: 16px;
- float: left;
- color: #52A63A;
- font-size: 20px;
- margin-right: 8px;
- }
- .shop-name {
- height: 16px;
- float: left;
- font-size: 15px;
- font-family: PingFang SC;
- color: #52A63A;
- line-height: 16px;
- }
- }
- .shop-reply {
- width: 100%;
- float: left;
- box-sizing: border-box;
- padding: 0 12px 12px 12px;
- font-size: 12px;
- font-family: PingFang SC;
- color: #666666;
- line-height: 16px;
- }
- }
- }
- .assess-row:first-child {
- border-top: none;
- }
- }
- }
- </style>
|