会员评价

This commit is contained in:
Yer11214
2024-10-07 16:55:27 +08:00
parent 108bb6c901
commit c106423742

View File

@@ -2,9 +2,10 @@
<div> <div>
<Card> <Card>
<Row> <Row>
<Form ref="searchForm" :model="searchForm" @keydown.enter.native="handleSearch" @submit.native.prevent inline :label-width="70" class="search-form"> <Form ref="searchForm" :model="searchForm" @keydown.enter.native="handleSearch" @submit.native.prevent inline
:label-width="70" class="search-form">
<Form-item label="会员名称" prop="memberName"> <Form-item label="会员名称" prop="memberName">
<Input type="text" v-model="searchForm.memberName" placeholder="请输入会员名称" clearable style="width: 200px"/> <Input type="text" v-model="searchForm.memberName" placeholder="请输入会员名称" clearable style="width: 200px" />
</Form-item> </Form-item>
<Button @click="handleSearch" type="primary" class="search-btn" icon="ios-search">搜索</Button> <Button @click="handleSearch" type="primary" class="search-btn" icon="ios-search">搜索</Button>
</Form> </Form>
@@ -26,8 +27,8 @@
</Table> </Table>
<Row type="flex" justify="end" class="mt_10"> <Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator
size="small" show-total show-elevator show-sizer></Page> show-sizer></Page>
</Row> </Row>
</Card> </Card>
<!-- 评价详情 --> <!-- 评价详情 -->
@@ -58,52 +59,85 @@
<ListItem> <ListItem>
<ListItemMeta :avatar="infoData.memberProfile" :title="infoData.memberName" <ListItemMeta :avatar="infoData.memberProfile" :title="infoData.memberName"
:description="infoData.content"/> :description="infoData.content" />
</ListItem> </ListItem>
<div class="score-content"> <div class="score-content">
<span>物流评分{{infoData.deliveryScore}}</span> <span>物流评分{{ infoData.deliveryScore }}</span>
<span>服务评分{{infoData.serviceScore}}</span> <span>服务评分{{ infoData.serviceScore }}</span>
<span>描述评分{{infoData.descriptionScore}}</span> <span>描述评分{{ infoData.descriptionScore }}</span>
</div> </div>
<div class="" v-if="infoData.haveImage"> <div class="" v-if="infoData.haveImage">
评价图 评价图
<div style="margin-left: 40px"> <div style="margin-left: 40px">
<template v-if="infoData.images && infoData.images.length"> <template v-if="infoData.images && infoData.images.length">
<img style="width: 100px;height: 110px;margin-left: 2px" <img style="width: 100px;height: 110px;margin-left: 2px"
v-for="(img,index) in infoData.images.split(',')" :src="img" v-for="(img, index) in infoData.images.split(',')" :src="img" alt="" :key="index" />
alt="" :key="index"/>
</template> </template>
</div> </div>
</div> </div>
</List> </List>
</div> </div>
<div > <div class="mt_10">
<Form ref="form" :model="replyForm" :label-width="100"> <Form ref="form" :model="replyForm" :label-width="100">
<FormItem prop="reply" label="平台回复"> <FormItem prop="reply" label="平台回复">
<Input :disabled="infoData.reply" show-word-limit v-model="replyForm.reply" type="textarea"/> <Input :disabled="infoData.replyStatus" show-word-limit v-model="replyForm.reply" type="textarea" />
</FormItem> </FormItem>
<FormItem prop="reply" label="回复图片"> <FormItem prop="reply" label="回复图片">
<vuedraggable :animation="200" :list="replyForm.replyImage">
<div v-for="(item, __index) in replyForm.replyImage" :key="__index" class="demo-upload-list">
<template>
<img :src="item" />
<div class="demo-upload-list-cover">
<div>
<Icon size="30" type="md-search" @click.native="handleViewGoodsPicture(item)"></Icon>
<Icon size="30" type="md-trash" @click.native="handleRemoveGoodsPicture(item)"></Icon>
</div>
</div>
</template>
</div>
</vuedraggable>
<Button v-if="!infoData.replyStatus" @click="openPicModel">上传图片</Button>
</FormItem> </FormItem>
</Form> </Form>
</div> </div>
</div> </div>
</div> </div>
<div slot="footer">
<Button @click="infoFlag = false">取消</Button>
<Button type="error" :loading="modalLoading" @click="reply">提交</Button>
</div>
</Modal>
<Modal v-model="picModelFlag" width="1200px" @on-ok="confirmUrls">
<ossManage ref="ossManage" :isComponent="true" :initialize="picModelFlag" @callback="callbackSelected"
@selected="(list) => { selectedImage = list }" />
</Modal>
<Modal v-model="goodsPictureVisible" title="View Image">
<img v-if="goodsPictureVisible" :src="previewGoodsPicture" style="width: 100%" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import * as API_Member from "@/api/member"; import * as API_Member from "@/api/member";
import vuedraggable from "vuedraggable";
import ossManage from "@/views/sys/oss-manage/ossManage";
import { replyMemberComment } from '@/api/shops'
export default { export default {
name: "goods-review", // 会员评价 name: "goods-review", // 会员评价
components: {
vuedraggable,
ossManage
},
data() { data() {
return { return {
replyForm:{ modalLoading:false,
reply:'', picModelFlag: false,
replyImage:[] previewGoodsPicture: "",
replyForm: {
reply: '',
replyImage: []
}, },
infoData: {}, // 商品信息 infoData: {}, // 商品信息
infoFlag: false, // 评价展示 infoFlag: false, // 评价展示
@@ -118,6 +152,8 @@ export default {
startDate: "", // 起始时间 startDate: "", // 起始时间
endDate: "", // 终止时间 endDate: "", // 终止时间
}, },
goodsPictureVisible: false,
selectedImage: [],
columns: [ columns: [
// 表头 // 表头
{ {
@@ -141,11 +177,11 @@ export default {
width: 90, width: 90,
render: (h, params) => { render: (h, params) => {
if (params.row.grade == "GOOD") { if (params.row.grade == "GOOD") {
return h("Tag", {props: {color: "green",},}, "好评"); return h("Tag", { props: { color: "green", }, }, "好评");
} else if (params.row.grade == "MODERATE") { } else if (params.row.grade == "MODERATE") {
return h("Tag", {props: {color: "orange",},}, "中评"); return h("Tag", { props: { color: "orange", }, }, "中评");
} else { } else {
return h("Tag", {props: {color: "red",},}, "差评"); return h("Tag", { props: { color: "red", }, }, "差评");
} }
} }
}, },
@@ -153,21 +189,21 @@ export default {
title: "物流评分", title: "物流评分",
key: "deliveryScore", key: "deliveryScore",
render: (h, params) => { render: (h, params) => {
return h('div',params.row.deliveryScore || 5 + '星') return h('div', params.row.deliveryScore || 5 + '星')
}, },
}, },
{ {
title: "服务评分", title: "服务评分",
key: "deliveryScore", key: "deliveryScore",
render: (h, params) => { render: (h, params) => {
return h('div',params.row.serviceScore || 5 + '星') return h('div', params.row.serviceScore || 5 + '星')
}, },
}, },
{ {
title: "描述评分", title: "描述评分",
key: "deliveryScore", key: "deliveryScore",
render: (h, params) => { render: (h, params) => {
return h('div',params.row.descriptionScore || 5 + '星') return h('div', params.row.descriptionScore || 5 + '星')
}, },
}, },
{ {
@@ -245,10 +281,57 @@ export default {
}; };
}, },
methods: { methods: {
// 回复
async reply(){
try {
if(!this.replyForm.reply){
this.$Message.warning('请输入回复内容')
return
}
this.modalLoading = true
const params = JSON.parse(JSON.stringify(this.replyForm))
params.replyImage = params.replyImage.join(",")
params.id = this.infoData.id
const res = await replyMemberComment(this.infoData.id,params)
if(res.success){
this.modalLoading = false
this.$Message.success('回复成功')
this.infoFlag = false
this.init()
}
} catch (error) {
this.modalLoading = false
}
},
// 查看商品大图
handleViewGoodsPicture(url) {
this.previewGoodsPicture = url;
this.goodsPictureVisible = true;
},
// 移除商品图片
handleRemoveGoodsPicture(file) {
this.replyForm.replyImage =
this.replyForm.replyImage.filter((i) => i !== file);
},
// 图片选择后回调
callbackSelected(val) {
this.picModelFlag = false;
this.replyForm.replyImage.push(val.url);
},
openPicModel() {
this.$refs.ossManage.selectImage = true;
this.picModelFlag = true
},
confirmUrls() {
},
// 切换查看switch // 切换查看switch
changeSwitchView(val) { changeSwitchView(val) {
let status = val; let status = val;
API_Member.updateMemberReview(this.infoData.id, {status}).then( API_Member.updateMemberReview(this.infoData.id, { status }).then(
(res) => { (res) => {
this.$Message.success("修改成功!"); this.$Message.success("修改成功!");
this.init(); this.init();
@@ -263,7 +346,6 @@ export default {
changePage(v) { changePage(v) {
this.searchForm.pageNumber = v; this.searchForm.pageNumber = v;
this.getDataList(); this.getDataList();
this.clearSelectAll();
}, },
// 分页 改变页数 // 分页 改变页数
changePageSize(v) { changePageSize(v) {
@@ -279,7 +361,7 @@ export default {
//列表直接选择页面是否展示 //列表直接选择页面是否展示
changeSwitch(v) { changeSwitch(v) {
let status = v.status; let status = v.status;
API_Member.updateMemberReview(v.id, {status: status}).then((res) => { API_Member.updateMemberReview(v.id, { status: status }).then((res) => {
this.init(); this.init();
}); });
}, },
@@ -303,6 +385,8 @@ export default {
API_Member.getMemberInfoReview(v.id).then((res) => { API_Member.getMemberInfoReview(v.id).then((res) => {
if (res.result) { if (res.result) {
this.infoData = res.result; this.infoData = res.result;
this.replyForm.reply = res.result.reply;
this.replyForm.replyImage = res.result.replyImage ? res.result.replyImage.split(",") : [];
} }
}); });
}, },
@@ -341,20 +425,24 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
img { img {
vertical-align: middle; vertical-align: middle;
border-style: none; border-style: none;
} }
.product { .product {
width: 140px; width: 140px;
height: 160px; height: 160px;
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
border-radius: 3px; border-radius: 3px;
} }
.show{
label{ .show {
label {
font-size: 14px; font-size: 14px;
} }
margin-top: 15px; margin-top: 15px;
} }
@@ -366,6 +454,7 @@ label {
float: left; float: left;
margin-right: 2px; margin-right: 2px;
} }
.border-b { .border-b {
border-bottom: 1px solid #e9e9e9; border-bottom: 1px solid #e9e9e9;
width: 500px; width: 500px;
@@ -373,11 +462,68 @@ label {
position: relative; position: relative;
margin-top: 12px; margin-top: 12px;
} }
.div-height{
.div-height {
line-height: 25px; line-height: 25px;
} }
.score-content { .score-content {
margin: 5px 0; margin: 5px 0;
span{margin-right: 20px;}
span {
margin-right: 20px;
}
} }
.demo-upload-list {
width: 150px;
height: 150px;
text-align: center;
border: 1px solid transparent;
border-radius: 4px;
display: inline-block;
background: #fff;
position: relative;
margin-right: 4px;
vertical-align: bottom;
}
.demo-upload-list:hover .demo-upload-list-cover {
display: flex;
}
.demo-upload-list img {
width: 100%;
height: 100%;
}
.demo-upload-list-cover {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
justify-content: space-between;
align-items: center;
flex-direction: column;
}
.demo-upload-list:hover .demo-upload-list-cover {
display: flex;
}
.demo-upload-list-cover div {
margin-top: 50px;
width: 100%;
>i {
width: 50%;
margin-top: 8px;
color: #fff;
font-size: 20px;
cursor: pointer;
}
}
</style> </style>