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.
374 lines
12 KiB
374 lines
12 KiB
<template>
|
|
<view class="backcor9">
|
|
<!-- 评分 -->
|
|
<view v-if="goods_score != null" class="score-container oh padding-main">
|
|
<view class="score tc">
|
|
<view class="cr-base">综合评分</view>
|
|
<view class="value cr-main">{{goods_score.avg || '0.0'}}</view>
|
|
</view>
|
|
<view class=" rate-top padding-horizontal-main">
|
|
<block v-if="goods_score.avg > 0">
|
|
<block v-for="(item, index) in [1,2,3,4,5]" :key="index">
|
|
<view :class="'icon-ymt star '+((index+1) <= goods_score.avg ? ' cr-main ' : '')"></view>
|
|
|
|
</block>
|
|
</block>
|
|
<text v-else class="cr-gray">暂无评分</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 列表 -->
|
|
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="30">
|
|
<view class="padding-horizontal-main goods-comment">
|
|
<view v-for="(item, index) in data_list" :key="index" class="goods-comment-item padding-main border-radius-main bg-white spacing-mb">
|
|
<view class="oh nav br-b padding-bottom-sm">
|
|
<image class="avatar dis-block flleft" :src="item.user.avatar || static_url+'default-user.png'" mode="aspectFit"></image>
|
|
<view class="base-nav flright">
|
|
<text class="va-m">{{item.user.user_name_view}}</text>
|
|
<view class=" va-m margin-left-sm rate-top">
|
|
<!-- <uni-rate :value="item.rating" :readonly="true" :is-fill="false" :size="14" /> -->
|
|
<block v-for="(item2, index2) in [1,2,3,4,5]" :key="index2">
|
|
<view :class="'icon-ymt star '+((index2+1) <= Number(item.rating) ? ' cr-main ' : '')"></view>
|
|
|
|
</block>
|
|
</view>
|
|
<view class="flright">
|
|
<text class="cr-grey">{{item.add_time_date}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="base-content oh padding-sm">
|
|
<view class="content cr-base text-size-sm">{{item.content}}</view>
|
|
|
|
<!-- 评论图片 -->
|
|
<view v-if="(item.images || null) != null && item.images.length > 0" class="images oh ">
|
|
<block v-for="(iv, ix) in item.images" :key="ix">
|
|
<image class="br radius" @tap="comment_images_show_event" :data-index="index" :data-ix="ix" :src="iv" mode="widthFix"></image>
|
|
</block>
|
|
</view>
|
|
<view v-if="(item.msg || null) != null" class="spec cr-grey ">{{item.msg}}</view>
|
|
<view v-if="item.is_reply == 1 && (item.reply || null) != null" class="reply text-size-sm">
|
|
<text class="cr-base">管理员回复:</text>
|
|
<text class="reply-desc cr-main-pair">{{item.reply}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
|
|
let listData=require("./data.json")
|
|
|
|
const app = getApp();
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
// static_url: '',
|
|
// data_list_loding_status: 1,
|
|
// data_bottom_line_status: false,
|
|
data_list: [],
|
|
data_page_total: 0,
|
|
data_page: 1,
|
|
goods_score: null,
|
|
params: null,
|
|
// progress_class: ['progress-bar-danger', 'progress-bar-warning', 'progress-bar-secondary', '', 'progress-bar-success'],
|
|
};
|
|
},
|
|
|
|
props: {
|
|
|
|
},
|
|
|
|
onLoad(params) {
|
|
//路由传递的参数
|
|
this.params=params
|
|
|
|
},
|
|
|
|
onShow() {
|
|
this.init();
|
|
|
|
// 分享菜单处理
|
|
// app.globalData.page_share_handle();
|
|
},
|
|
|
|
// 下拉刷新
|
|
// onPullDownRefresh() {
|
|
// this.setData({
|
|
// data_page: 1
|
|
// });
|
|
// this.get_data_list(1);
|
|
// },
|
|
|
|
methods: {
|
|
// 初始化
|
|
init() {
|
|
// 获取数据
|
|
this.get_goods_score();
|
|
this.get_data_list();
|
|
},
|
|
|
|
// 获取商品评分
|
|
get_goods_score() {
|
|
|
|
this.goods_score = {
|
|
"avg": 3.3,
|
|
"rate": 65,
|
|
}
|
|
|
|
|
|
},
|
|
|
|
// 获取数据列表
|
|
get_data_list(is_mandatory) {
|
|
|
|
this.data_list = listData
|
|
|
|
// 参数校验
|
|
// if ((this.params.goods_id || null) == null) {
|
|
// uni.stopPullDownRefresh();
|
|
// this.setData({
|
|
// data_bottom_line_status: false,
|
|
// data_list_loding_status: 2
|
|
// });
|
|
// } else {
|
|
// var self = this;
|
|
// // 分页是否还有数据
|
|
// if ((is_mandatory || 0) == 0) {
|
|
// if (this.data_bottom_line_status == true) {
|
|
// uni.stopPullDownRefresh();
|
|
// return false;
|
|
// }
|
|
// }
|
|
|
|
// uni.showLoading({
|
|
// title: '加载中...'
|
|
// });
|
|
// this.setData({
|
|
// data_list_loding_status: 1
|
|
// });
|
|
// uni.request({
|
|
// url: app.globalData.get_request_url("comments", "goods"),
|
|
// method: 'POST',
|
|
// data: {
|
|
// goods_id: this.params.goods_id,
|
|
// page: this.data_page
|
|
// },
|
|
// dataType: 'json',
|
|
// success: res => {
|
|
// uni.hideLoading();
|
|
// uni.stopPullDownRefresh();
|
|
|
|
// if (res.data.code == 0) {
|
|
// if (res.data.data.data.length > 0) {
|
|
// if (this.data_page <= 1) {
|
|
// var temp_data_list = res.data.data.data;
|
|
// } else {
|
|
// var temp_data_list = this.data_list || [];
|
|
// var temp_data = res.data.data.data;
|
|
// for (var i in temp_data) {
|
|
// temp_data_list.push(temp_data[i]);
|
|
// }
|
|
// }
|
|
// this.setData({
|
|
// data_list: temp_data_list,
|
|
// data_total: res.data.data.total,
|
|
// data_page_total: res.data.data.page_total,
|
|
// data_list_loding_status: 3,
|
|
// data_page: this.data_page + 1
|
|
// });
|
|
|
|
// // 是否还有数据
|
|
// this.setData({
|
|
// data_bottom_line_status: (this.data_page > 1 && this.data_page > this.data_page_total)
|
|
// });
|
|
// } else {
|
|
// this.setData({
|
|
// data_list_loding_status: 0
|
|
// });
|
|
// if (this.data_page <= 1) {
|
|
// this.setData({
|
|
// data_list: [],
|
|
// data_bottom_line_status: false
|
|
// });
|
|
// }
|
|
// }
|
|
// } else {
|
|
// this.setData({
|
|
// data_list_loding_status: 0
|
|
// });
|
|
// if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
|
// app.globalData.showToast(res.data.msg);
|
|
// }
|
|
// }
|
|
// },
|
|
// fail: () => {
|
|
// uni.hideLoading();
|
|
// uni.stopPullDownRefresh();
|
|
// this.setData({
|
|
// data_list_loding_status: 2
|
|
// });
|
|
// app.globalData.showToast('服务器请求出错');
|
|
// }
|
|
// });
|
|
// }
|
|
},
|
|
|
|
// 滚动加载
|
|
scroll_lower(e) {
|
|
this.get_data_list();
|
|
},
|
|
|
|
// 评价图片预览
|
|
comment_images_show_event(e) {
|
|
var index = e.currentTarget.dataset.index;
|
|
var ix = e.currentTarget.dataset.ix;
|
|
uni.previewImage({
|
|
current: this.data_list[index]['images'][ix],
|
|
urls: this.data_list[index]['images']
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style>
|
|
|
|
|
|
/*
|
|
* 评分
|
|
*/
|
|
.padding-horizontal-main {
|
|
padding-left: 20rpx;
|
|
padding-right: 20rpx;
|
|
}
|
|
.padding-main {
|
|
padding: 20rpx;
|
|
}
|
|
|
|
.oh {
|
|
overflow: hidden;
|
|
}
|
|
.tc {
|
|
text-align: center;
|
|
}
|
|
.cr-base {
|
|
color: #666 !important;
|
|
}
|
|
.cr-main {
|
|
color: #f6c133 !important;
|
|
}
|
|
.goods-comment-item {
|
|
padding-bottom: 10rpx;
|
|
}
|
|
.bg-white {
|
|
background-color: #fff !important;
|
|
}
|
|
.border-radius-main {
|
|
border-radius: 20rpx;
|
|
}
|
|
.padding-main {
|
|
padding: 20rpx;
|
|
}
|
|
.spacing-mb {
|
|
margin-bottom: 20rpx;
|
|
}
|
|
.padding-bottom-sm {
|
|
padding-bottom: 10rpx;
|
|
}
|
|
.br-b {
|
|
border-bottom: 1px solid #f6f6f6 !important;
|
|
}
|
|
.goods-comment-item .avatar {
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
border-radius: 50%;
|
|
border: 1px solid #e2e2e2;
|
|
}
|
|
.dis-block {
|
|
display: block !important;
|
|
}
|
|
.goods-comment-item .base-nav {
|
|
width: calc(100% - 90rpx);
|
|
line-height: 50rpx;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
.goods-comment-item .base-nav text:not(:last-child) {
|
|
margin-right: 5rpx;
|
|
}
|
|
.va-m {
|
|
vertical-align: middle;
|
|
}
|
|
text {
|
|
cursor: text;
|
|
}
|
|
.margin-left-sm {
|
|
margin-left: 10rpx;
|
|
}
|
|
.va-m {
|
|
vertical-align: middle;
|
|
}
|
|
.cr-grey {
|
|
color: #9A9A9A !important;
|
|
}
|
|
.padding-sm {
|
|
padding: 10rpx;
|
|
}
|
|
.goods-comment-item .base-content .content, .goods-comment-item .base-content .reply {
|
|
line-height: 46rpx;
|
|
}
|
|
.goods-comment-item .base-content .images{
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.images .radius{
|
|
width: 25%;
|
|
box-sizing: border-box;
|
|
padding: 0 10rpx;
|
|
border-radius: 20rpx;
|
|
margin-top: 10rpx;
|
|
}
|
|
.goods-comment-item .base-content .spec{
|
|
font-size: 24rpx;
|
|
padding: 20rpx;
|
|
}
|
|
.text-size-sm {
|
|
font-size: 26rpx !important;
|
|
}
|
|
.cr-base {
|
|
color: #666 !important;
|
|
}
|
|
/* */
|
|
.score-container{
|
|
display: flex;
|
|
height: 148rpx;
|
|
box-sizing: border-box;
|
|
}
|
|
.rate-top{
|
|
display: flex;
|
|
align-self: center;
|
|
}
|
|
.score-container .score {
|
|
width: 180rpx;
|
|
border-right: 1px solid #eee;
|
|
}
|
|
.score-container .score .value {
|
|
font-weight: bold;
|
|
font-size: 60rpx;
|
|
line-height: 60rpx;
|
|
margin-top: 10rpx;
|
|
}
|
|
/*
|
|
* 列表
|
|
*/
|
|
.scroll-box {
|
|
height: calc(100vh - 148rpx);
|
|
box-sizing: border-box;
|
|
padding-bottom: 20rpx;
|
|
|
|
}
|
|
</style> |