Commit db22f080 by cwq0219

评价

1 parent 7b951254
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.'
const getListApi = params => {
params.method = `${defaultPath}orderGoodsComment.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
// 发布/撤销评论
const changeCommentStatusApi = params => {
params.method = `${defaultPath}orderGoodsComment.changeStatus`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 删除评论
const deleteCommentApi = params => {
params.method = `${defaultPath}orderGoodsComment.remove`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const commentDetailApi = params => {
params.method = `${defaultPath}orderGoodsComment.detail`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
export default { getListApi, changeCommentStatusApi, deleteCommentApi, commentDetailApi }
\ No newline at end of file \ No newline at end of file
<!-- 评论详情 --> <!-- 评论详情 -->
<template> <template>
<div class="edit-share marketing"> <div class="comment-detail marketing">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form> <div class="comment-container">
<div class="flex">
<img class="img-100" :src="commentInfo.customerImg" />
<span class="good-name">{{commentInfo.goodsName}}</span>
</div>
<div class="flex m-t-24">
<span class="comment-label">评分星级:</span>
<img v-for="(item, index) in starList" :key="index" class="icon-star" src="@/assets/icon-star.png"/>
</div>
<div class="flex m-t-24">
<span class="comment-label">评价内容:</span>
<span class="comment-txt">{{commentInfo.commentContent || '-'}}</span>
</div>
<div v-show="commentInfo.imgUrls" class="m-t-24">
<span class="comment-label">图片:</span>
<div class="flex" style="flex-wrap: wrap;">
<img class="img-100 comment-img" v-for="(item, index) in commentInfo.imgUrls" :key="index" :src="item"/>
</div>
</div>
</div>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="default" @click="handleCancel">返回</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -23,47 +41,10 @@ export default { ...@@ -23,47 +41,10 @@ export default {
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
routeInfo: { routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: '' id: ''
}, },
editForm: { starList : [],
// 专区类型(1发现频道,2商城专区) commentInfo: {}
zoneType: '2',
zoneName: '',
zoneImg: '',
merchantList: []
},
editRule: {
zoneName: [{ required: true, message: '请输入专区名称', trigger: 'change' }],
zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }]
},
editFormData: [
{
label: '专区名称',
name: 'zoneName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '专区图片',
name: 'zoneImg',
type: 'upload',
width: '320px',
limitSize: 10,
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
}
}
]
} }
}, },
...@@ -76,32 +57,9 @@ export default { ...@@ -76,32 +57,9 @@ export default {
methods: { methods: {
getInfo() { getInfo() {
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => { this.$apis.orderComment.commentDetailApi({ id: this.routeInfo.id }).then(res => {
// this.editForm.zoneName = res.zoneName this.commentInfo = res || {}
// this.editForm.zoneImg = res.zoneImg this.starList = new Array(this.commentInfo.starLevel)
// this.editForm.merchantList = res.merchantRefList
// this.editForm.merchantList.forEach(item => {
// item.merchantNo = item.merchantId
// })
// })
},
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
if (this.routeInfo.addOrEdit == 2) {
params.id = this.routeInfo.id
}
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.handleCancel()
// }
// })
}
}) })
}, },
handleCancel() { handleCancel() {
...@@ -112,4 +70,39 @@ export default { ...@@ -112,4 +70,39 @@ export default {
} }
} }
</script> </script>
<style scoped></style> <style>
.comment-detail .comment-container {
padding: 32px 52px;
color: #333333;
font-size: 14px;
}
.comment-detail .comment-container .flex {
justify-content: flex-start;
}
.comment-detail .comment-container .m-t-24 {
margin-top: 24px;
}
.comment-detail .comment-label {
display: inline-block;
width: 80px;
line-height: 20px;
flex-shrink: 0;
}
.comment-detail .comment-txt {
line-height: 20px;
word-break: break-all;
}
.comment-detail .good-name {
padding-left: 20px;
font-size: 16px;
font-weight: 500;
}
.comment-detail .icon-star {
width: 20px;
height: 20px;
}
.comment-detail .comment-img {
margin-top: 10px;
margin-right: 20px;
}
</style>
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="commentRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="commentRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button v-if="scope.scope.shareStatus == 0" type="text" @click="handleRevoke(scope.scope)">发布</el-button> <el-button v-if="scope.scope.commentStatus == '0'" type="text" @click="handleRevoke(scope.scope)">发布</el-button>
<el-button v-if="scope.scope.shareStatus == 1" type="text" @click="handleRevoke(scope.scope)">撤回</el-button> <el-button v-if="scope.scope.commentStatus == '1'" type="text" @click="handleRevoke(scope.scope)">撤回</el-button>
<el-button type="text" @click="handleDetail(scope.scope)">查看</el-button> <el-button type="text" @click="handleDetail(scope.scope)">查看</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</div> </div>
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
} }
], ],
// 表格 // 表格
getListApi: this.$apis.orderShare.getListApi, getListApi: this.$apis.orderComment.getListApi,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: true, tableOption: true,
...@@ -65,24 +65,26 @@ export default { ...@@ -65,24 +65,26 @@ export default {
{ {
label: '评价日期', label: '评价日期',
prop: 'createdDate', prop: 'createdDate',
width: '180', // width: '180',
formatter: cellValue => { formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss') return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
} }
}, },
{ {
label: '评价状态', label: '评价状态',
prop: 'shareSource' prop: 'commentStatus',
// formatter: cellValue => { line: 1,
// return this.baseData.sourceList.find(item => item.confId == cellValue.shareSource).confName formatter: cellValue => {
// } return this.baseData.commentStatusList.find(item => item.confId == cellValue.commentStatus).confName
}
}, },
{ {
label: '评论人', label: '评论人',
prop: 'shareStatus' prop: 'customerName',
// formatter: cellValue => { line: 1,
// return this.baseData.statusList.find(item => item.confId == cellValue.shareStatus).confName formatter: cellValue => {
// } return cellValue.customerName || '-'
}
} }
] ]
}, },
...@@ -110,8 +112,8 @@ export default { ...@@ -110,8 +112,8 @@ export default {
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm)) var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) { if (this.searchForm.createDate.length) {
params.createStartDate = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00' params.createStartDateStr = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createEndDate = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59' params.createEndDateStr = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
} }
delete params.createDate delete params.createDate
return params return params
...@@ -131,36 +133,34 @@ export default { ...@@ -131,36 +133,34 @@ export default {
type: 'warning', type: 'warning',
callback: action => { callback: action => {
if (action == 'confirm') { if (action == 'confirm') {
// this.$apis[apiModule][apiName](apiParams).then(res => { this.$apis[apiModule][apiName](apiParams).then(res => {
// this.$message({ this.$message({
// message: res.code == '0' ? '操作成功' : res.message, message: res.code == '0' ? '操作成功' : res.message,
// type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
// }) })
// if (res.code == '0') { if (res.code == '0') {
// fn && fn() fn && fn()
// this.handleSearch() this.handleSearch()
// } }
// }) })
} }
} }
}) })
}, },
// 1-新增;2-编辑
// handleEdit(addOrEdit, row) {
// addOrEdit == 1 ? this.$router.push('/orderShare/editShare/' + addOrEdit) : this.$router.push('/orderShare/editShare/' + addOrEdit + '/' + row.id)
// },
// 查看 // 查看
handleDetail(row) { handleDetail(row) {
this.$router.push('/orderComment/commentDetail/' + row.id) this.$router.push('/orderComment/commentDetail/' + row.id)
}, },
// 发布/撤回 // 发布/撤回
handleRevoke(row) { handleRevoke(row) {
this.secondConfirm('撤回', '是否确认撤回该评论?', 'orderShare', 'revokeShareRecordApi', { id: row.id }) var txt = row.commentStatus == '0' ? '发布' : '撤回'
this.secondConfirm(txt, '是否确认'+ txt +'该评论?', 'orderComment', 'changeCommentStatusApi', { id: row.id, commentStatus: row.commentStatus == '0' ? 1 : 0 })
}, },
handleDelete(row) { handleDelete(row) {
this.secondConfirm('删除', '是否确认删除该评论?', 'orderShare', 'deleteShareRecordApi', { id: row.id }) this.secondConfirm('删除', '是否确认删除该评论?', 'orderComment', 'deleteCommentApi', { id: row.id })
}, },
getOptionsList(formName, hasAll = true, refreshSigle) { getOptionsList(formName, hasAll = true, refreshSigle) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!