123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <template name="evaluate">
- <!-- 供应商信息 -->
- <view class="evaluate clearfix">
- <view class="evaluate-header">评价({{evaluateList.length}})</view>
- <view class="evaluate-empty" v-if="isEmpty">该商品暂无评价</view>
- <view class="evaluate-list" v-else>
- <scroll-view scroll-y :style="{'height':scrollHeight+'px'}" @scrolltolower="scrolltolower">
- <view class="row-list" v-for="(item, index) in evaluateList" :key="index">
- <view class="list-title">
- <view class="name">{{item.name}}</view>
- <view class="stars">
- <uni-stars :stars="item.score2" :icon-class='iconClass' :icon-color='iconColor' :font-size='36' :width-info="178"></uni-stars>
- </view>
- </view>
- <view class="list-content">
- {{item.commentContent}}
- </view>
- <view class="list-time">
- <text>{{item.postTime }}</text>
- </view>
- </view>
- <!--加载loadding-->
- <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
- <tui-nomore :visible="!pullUpOn" bgcolor="#FFFFFF" :text='nomoreText'></tui-nomore>
- <!--加载loadding-->
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import authorize from '@/common/authorize.js'
-
- export default{
- name:'evaluate',
- props:{
- queryProductid: {
- // Unistars类型
- type: Number,
- default: 0
- }
- },
- data() {
- return{
- evaluateList:[],
- iconClass:'icon-aixin',
- iconColor:'#FF7800',
- isEmpty:false,
- pageNum:1,
- pageSize:10,
- hasNextPage:false,
- loadding: false,
- pullUpOn: true,
- nomoreText: '上拉显示更多',
- productID:'',
- scrollHeight: '',
- }
- },
- created() {
- this.productID = this.queryProductid
- this.infoEvaluate()
- this.setScrollHeight();
- },
- methods:{
- infoEvaluate(){
- this.ProductService.GetProductEvaluate({productID:this.productID,pageNum:this.pageNum,pageSize:this.pageSize}).then(response =>{
- let responseData = response.data
- if(responseData.results&&responseData.results.length > 0){
- this.isEmpty = false
- this.hasNextPage = responseData.hasNextPage
- this.evaluateList =responseData.results
- this.pullFlag = false;
- setTimeout(()=>{this.pullFlag = true;},500)
- if(this.hasNextPage){
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- }else{
- this.pullUpOn = true
- this.loadding = false
- this.nomoreText = '已至底部'
- }
- }else{
- this.isEmpty = true
- }
- }).catch(error =>{
- this.$util.msg(error.msg,2000)
- })
- },
- getOnReachBottomData(){
- this.pageNum+=1
- let params = {productID:this.productID,pageNum:this.pageNum,pageSize:this.pageSize}
- this.ProductService.GetProductEvaluate(params).then(response =>{
- let responseData = response.data
- if(responseData.results&&responseData.results.length > 0){
- this.hasNextPage = responseData.hasNextPage
- this.evaluateList = this.evaluateList.concat(responseData.results)
- this.pullFlag = false;// 防上拉暴滑
- setTimeout(()=>{this.pullFlag = true;},500)
- if(this.hasNextPage){
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- }else{
- this.pullUpOn = false
- this.loadding = false
- this.nomoreText = '已至底部'
- }
- }
- }).catch(error =>{
- this.$util.msg(error.msg,2000)
- })
- },
- scrolltolower() {
- if(this.hasNextPage){
- this.loadding = true
- this.pullUpOn = true
- this.getOnReachBottomData(this.currentTab);
- }
- },
- setScrollHeight() {
- const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
- this.windowHeight = windowHeight - 1;
- this.scrollHeight = windowHeight - 1;
- }
- },
-
- }
- </script>
- <style lang="scss">
- .evaluate{
- background: #FFFFFF;
- width: 100%;
- .scoll-y {
- height: 100%;
- }
- .evaluate-empty{
- width: 702rpx;
- height: 100rpx;
- line-height: 100rpx;
- padding: 0 24rpx;
- font-size: $font-size-28;
- color: #999999;
- text-align: center;
- }
- .evaluate-header{
- width: 702rpx;
- height: 88rpx;
- line-height: 88rpx;
- padding: 0 24rpx;
- font-size: $font-size-32;
- color: $text-color;
- border-bottom: 1px solid #F2F2F2;
- text-align: left;
- }
- .evaluate-list{
- width: 702rpx;
- height: auto;
- padding: 24rpx;
- .row-list{
- width: 100%;
- height: auto;
- float: left;
- padding: 15rpx 0;
- border-bottom: 1px solid #F2F2F2;
- &:last-child{
- margin-bottom: 30rpx;
- }
- .list-title{
- height: 40rpx;
- line-height: 40rpx;
- font-size: $font-size-28;
- color: $text-color;
- padding: 20rpx 0;
- .name{
- float: left;
- margin-right: 30rpx;
- }
- .stars{
- width: 178rpx;
- float: right;
- }
- }
- .list-content{
- width: 100%;
- min-height: 80rpx;
- height: auto;
- font-size: $font-size-24;
- line-height: 30rpx;
- text-align: justify;
- padding: 10rpx 0;
- color: #999999;
- }
- .list-time{
- width: 100%;
- height: 40rpx;
- font-size: $font-size-24;
- line-height: 40rpx;
- text-align: right;
- color: #999999;
- }
- }
- }
- }
- </style>
|