feat:商品评论接口调试
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
<view
|
||||
v-for="(tab, index) in tabs"
|
||||
:key="index"
|
||||
:class="['filter-tab', { active: activeTab === index }]"
|
||||
@click="activeTab = index"
|
||||
:class="['filter-tab', { active: activeTab === tab.value }]"
|
||||
@click="handleTabClick(tab)"
|
||||
>
|
||||
{{ tab.name }}
|
||||
</view>
|
||||
@@ -33,17 +33,20 @@
|
||||
:enhanced="true"
|
||||
:show-scrollbar="false"
|
||||
>
|
||||
<view class="eval-list" @click="handleClick(item)">
|
||||
<view class="eval-list" >
|
||||
<view
|
||||
class="eval-item"
|
||||
v-for="(item, index) in evalList"
|
||||
:key="index"
|
||||
@click="handleClick(item)"
|
||||
>
|
||||
<view class="user-info-row">
|
||||
<view class="user-avatar-name">
|
||||
<view class="avatar-wrap">
|
||||
<text class="avatar-text">李</text>
|
||||
</view>
|
||||
<image
|
||||
class="avatar-wrap"
|
||||
:src="item.userImage"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<text class="username">{{ item.userName }}</text>
|
||||
<view class="user-level">
|
||||
<up-image
|
||||
@@ -63,7 +66,7 @@
|
||||
:key="s"
|
||||
class="star-icon"
|
||||
:style="{
|
||||
color: s <= item.score ? '#7934f6' : '#e5e5e5',
|
||||
color: s <= item.rating ? '#7934f6' : '#e5e5e5',
|
||||
}"
|
||||
>★</text
|
||||
>
|
||||
@@ -73,19 +76,19 @@
|
||||
</view>
|
||||
|
||||
<view class="product-sku"
|
||||
>已购韩版FILA斐乐Running MIXR猫爪鞋黑色男女运动...</view
|
||||
>已购{{item.goodsName}}</view
|
||||
>
|
||||
|
||||
<view class="eval-content-text">
|
||||
<text
|
||||
>包装非常严实,里三层外三层的,完全不用担心运输损坏。</text
|
||||
>{{item.content}}</text
|
||||
>
|
||||
</view>
|
||||
|
||||
<view class="eval-images" >
|
||||
<view class="eval-images" v-if="item.images">
|
||||
<image
|
||||
class="eval-img"
|
||||
src="https://img.yzcdn.cn/vant/cat.jpeg"
|
||||
:src="item.images"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
@@ -98,6 +101,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getGoodsReviewsList } from "@/api/product.js";
|
||||
export default {
|
||||
name: "EvaluateDialog",
|
||||
props: {
|
||||
@@ -105,29 +109,59 @@ export default {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
evalId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
mainGraph: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeTab: 0,
|
||||
activeTab: "all",
|
||||
tabs: [
|
||||
{ name: "全部", value: "all" },
|
||||
{ name: "好评", value: "good" },
|
||||
{ name: "中/差评", value: "bad" },
|
||||
],
|
||||
evalList: [
|
||||
{ userName: "李老八", score: 5, tag: "好评", images: ["https://img.yzcdn.cn/vant/cat.jpeg", "https://img.yzcdn.cn/vant/dog.jpeg", "https://img.yzcdn.cn/vant/fox.jpeg"] },
|
||||
{ userName: "王老五", score: 4, tag: "好评", images: ["https://img.yzcdn.cn/vant/cat.jpeg", "https://img.yzcdn.cn/vant/dog.jpeg"] },
|
||||
{ userName: "张三", score: 5, tag: "好评", images: ["https://img.yzcdn.cn/vant/cat.jpeg"] },
|
||||
{ name: "好评", value: "5" },
|
||||
{ name: "中/差评", value: "4" },
|
||||
],
|
||||
evalList: [],
|
||||
};
|
||||
},
|
||||
mounted(){
|
||||
this.getGoodsReviewsList();
|
||||
},
|
||||
methods: {
|
||||
async getGoodsReviewsList() {
|
||||
const params = {
|
||||
page: 1,
|
||||
pageSize: 15,
|
||||
goodsId: this.evalId,
|
||||
};
|
||||
if (this.activeTab !== "all") {
|
||||
params.rating = this.activeTab;
|
||||
}
|
||||
const resp = await getGoodsReviewsList(params);
|
||||
if (resp && resp.bizcode === 100) {
|
||||
this.evalList = resp.data.entitys || [];
|
||||
}
|
||||
},
|
||||
handleTabClick(item) {
|
||||
this.activeTab = item.value
|
||||
this.getGoodsReviewsList();
|
||||
},
|
||||
handleClose() {
|
||||
this.$emit("close");
|
||||
},
|
||||
handleClick(item) {
|
||||
console.log('点击评价',item.goodsName);
|
||||
uni.navigateTo({
|
||||
url: "/pages/other_package/productInfo/evaluateDetail",
|
||||
url: "/pages/other_package/productInfo/evaluateDetail?evalId=" + item.id + "&mainGraph=" + this.mainGraph + "&name=" + this.name+"&goodsName="+item.goodsName,
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -214,7 +248,6 @@ export default {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #a46cfc;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
Reference in New Issue
Block a user