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