mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-05-06 23:54:40 +08:00
feat(商品评价管理): 添加商品名称搜索功能和评论置顶功能
- 在商品评价页面中新增商品名称搜索框 - 在评论列表中添加是否置顶的显示和操作功能 - 实现评论置顶状态的更新逻辑
This commit is contained in:
@@ -30,6 +30,11 @@ export const updateMemberReview = (id, params) => {
|
||||
return getRequest(`/member/evaluation/updateStatus/${id}`, params);
|
||||
};
|
||||
|
||||
// 修改评价置顶状态
|
||||
export const updateMemberReviewTop = (id, params) => {
|
||||
return putRequest(`/member/evaluation/updateTop/${id}`, params);
|
||||
};
|
||||
|
||||
// 添加或修改
|
||||
export const insertOrUpdateSpec = (params) => {
|
||||
return postRequest("/memberNoticeSenter/insertOrUpdate", params);
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
<Form-item label="会员名称" prop="memberName">
|
||||
<Input type="text" v-model="searchForm.memberName" placeholder="请输入会员名称" clearable style="width: 240px"/>
|
||||
</Form-item>
|
||||
<Form-item label="商品名称" prop="goodsName">
|
||||
<Input type="text" v-model="searchForm.goodsName" placeholder="请输入商品名称" clearable style="width: 240px"/>
|
||||
</Form-item>
|
||||
<Button @click="handleSearch" type="primary" class="search-btn" icon="ios-search">搜索</Button>
|
||||
</Form>
|
||||
</Row>
|
||||
@@ -113,6 +116,7 @@ export default {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 1, // 当前页数
|
||||
pageSize: 20, // 页面大小
|
||||
goodsName: "",
|
||||
sort: "createTime", // 默认排序字段
|
||||
order: "desc", // 默认排序方式
|
||||
startDate: "", // 起始时间
|
||||
@@ -134,6 +138,30 @@ export default {
|
||||
align: "left",
|
||||
tooltip: true,
|
||||
},
|
||||
{
|
||||
title: "评论内容",
|
||||
key: "content",
|
||||
minWidth: 220,
|
||||
align: "left",
|
||||
tooltip: true,
|
||||
},
|
||||
{
|
||||
title: "是否置顶",
|
||||
key: "top",
|
||||
align: "center",
|
||||
width: 100,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: params.row.top ? "red" : "default",
|
||||
},
|
||||
},
|
||||
params.row.top ? "已置顶" : "未置顶"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "评价",
|
||||
key: "grade",
|
||||
@@ -149,27 +177,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "物流评分",
|
||||
key: "deliveryScore",
|
||||
render: (h, params) => {
|
||||
return h('div',params.row.deliveryScore || 5 + '星')
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "服务评分",
|
||||
key: "deliveryScore",
|
||||
render: (h, params) => {
|
||||
return h('div',params.row.serviceScore || 5 + '星')
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "描述评分",
|
||||
key: "deliveryScore",
|
||||
render: (h, params) => {
|
||||
return h('div',params.row.descriptionScore || 5 + '星')
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "评价时间",
|
||||
key: "createTime",
|
||||
@@ -186,7 +193,7 @@ export default {
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
width: 150,
|
||||
width: 220,
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
render: (h, params) => {
|
||||
@@ -217,6 +224,32 @@ export default {
|
||||
},
|
||||
"|"
|
||||
),
|
||||
h(
|
||||
"a",
|
||||
{
|
||||
style: {
|
||||
color: "#2d8cf0",
|
||||
cursor: "pointer",
|
||||
textDecoration: "none",
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.updateTop(params.row);
|
||||
},
|
||||
},
|
||||
},
|
||||
params.row.top ? "取消置顶" : "置顶评论"
|
||||
),
|
||||
h(
|
||||
"span",
|
||||
{
|
||||
style: {
|
||||
margin: "0 8px",
|
||||
color: "#dcdee2",
|
||||
},
|
||||
},
|
||||
"|"
|
||||
),
|
||||
h(
|
||||
"Poptip",
|
||||
{
|
||||
@@ -288,6 +321,25 @@ export default {
|
||||
this.init();
|
||||
});
|
||||
},
|
||||
// 置顶评论
|
||||
updateTop(v) {
|
||||
const top = !v.top;
|
||||
API_Member.updateMemberReviewTop(v.id, { top }).then((res) => {
|
||||
if (res.success) {
|
||||
this.data = this.data.map((item) => {
|
||||
if (item.goodsId !== v.goodsId) {
|
||||
return item;
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
top: item.id === v.id ? top : false,
|
||||
};
|
||||
});
|
||||
this.$Message.success(top ? "置顶成功!" : "取消置顶成功!");
|
||||
this.init();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取列表
|
||||
getDataList() {
|
||||
this.loading = true;
|
||||
|
||||
Reference in New Issue
Block a user