view goods evaluation
This commit is contained in:
		
							parent
							
								
									b5985ce1a0
								
							
						
					
					
						commit
						8f010c634c
					
				@ -37,7 +37,7 @@ export default {
 | 
			
		||||
		content: Object,
 | 
			
		||||
		reply: Boolean,
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
	mounted() {
 | 
			
		||||
		if(this.content.hasOwnProperty('scores_two')) this.rate = this.content.scores_two;
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
 | 
			
		||||
@ -3,9 +3,9 @@
 | 
			
		||||
		<view class="label-list">
 | 
			
		||||
			<view v-for="(label, index) in evaluateSpec" :key="index" :class="{'active': current == index}" @click="current=index">{{ index + '(' + label + ')' }}</view>
 | 
			
		||||
		</view>
 | 
			
		||||
		<view class="comment-container">
 | 
			
		||||
		<view class="comment-container" v-if="isShow">
 | 
			
		||||
			<view v-for="(item, index) in evalueList" :key="index" class="itme">
 | 
			
		||||
				<comment :reply="true" :content="item"></comment>
 | 
			
		||||
				<comment :reply="true" :content="item" v-if="isShow"></comment>
 | 
			
		||||
			</view>
 | 
			
		||||
			<u-empty text="暂无评价" mode="list" v-if="!evalueList.length" margin-top="120" color="#333"></u-empty>
 | 
			
		||||
		</view>
 | 
			
		||||
@ -25,6 +25,7 @@ export default {
 | 
			
		||||
			evaluateSpec: {},
 | 
			
		||||
			loadStatus: 'loadmore',
 | 
			
		||||
			timer: true,
 | 
			
		||||
			isShow: false,
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	components: {
 | 
			
		||||
@ -50,7 +51,7 @@ export default {
 | 
			
		||||
			if(!this.timer) return false;
 | 
			
		||||
			this.loadStatus = "loading";
 | 
			
		||||
			this.page++;
 | 
			
		||||
			this.getAllEvalue({ type: this.current, load: 'more' }).then(length => {
 | 
			
		||||
			this.getAllEvalue({ type: this.current, load: 'loadmore' }).then(length => {
 | 
			
		||||
				if(length == 0) {
 | 
			
		||||
					this.page--;
 | 
			
		||||
					this.loadStatus = 'nomore';
 | 
			
		||||
@ -72,16 +73,22 @@ export default {
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		async getAllEvalue({ type, load } = {}) {
 | 
			
		||||
		async getAllEvalue({ type, load = 'reload' } = {}) {
 | 
			
		||||
			let params = {
 | 
			
		||||
				goods_id: this.id, 
 | 
			
		||||
				page: this.page,
 | 
			
		||||
			}
 | 
			
		||||
			if(type) Object.assign(params, { type: type });
 | 
			
		||||
			this.isShow = false;
 | 
			
		||||
			const res = await this.$u.api.getAllEvalue(params);
 | 
			
		||||
			if (res.errCode == 0) {
 | 
			
		||||
				if(load) this.evalueList.push(...res.data);
 | 
			
		||||
				else this.evalueList = res.data;
 | 
			
		||||
				if(load == 'loadmore') {
 | 
			
		||||
					this.evalueList.push(...res.data);
 | 
			
		||||
					this.isShow = true;
 | 
			
		||||
				} else {
 | 
			
		||||
					this.evalueList = res.data;
 | 
			
		||||
					this.isShow = true;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				this.evalueList = [];
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user