| | |
| | | <el-bus-crud ref="crud" v-bind="tableConfig"> |
| | | <template #table="{ list }"> |
| | | <template v-if="list && list.length > 0"> |
| | | <evaluation-table :list="list" @detail="onDetail" @handle="onHandle" @delete="onDelete" @show="onShow" @hide="onHide"/> |
| | | <evaluation-table |
| | | :list="list" |
| | | @detail="onDetail" |
| | | @handle="onHandle" |
| | | @delete="onDelete" |
| | | @show="onShow" |
| | | @hide="onHide" |
| | | /> |
| | | </template> |
| | | <el-bus-empty v-else /> |
| | | </template> |
| | |
| | | { |
| | | title: '评价详情', |
| | | readonly: true, |
| | | showButton: false, |
| | | dialogAttrs: { |
| | | width: '70%', |
| | | closeOnClickModal: true, |
| | | customClass: 'evaluation-drawer-wrapper', |
| | | }, |
| | | form: [ |
| | | { |
| | | label: '订单编号:', |
| | | id: 'orderId', |
| | | id: 'orderNo', |
| | | type: 'input', |
| | | readonly: true, |
| | | }, |
| | |
| | | el: { |
| | | listType: 'picture-card', |
| | | limitSize: 2, |
| | | valueType: 'string', |
| | | }, |
| | | forceDisabled: true, |
| | | }, |
| | | { |
| | | label: '商品等级:', |
| | |
| | | { |
| | | label: '评论显示状态:', |
| | | id: 'showFlag', |
| | | type: 'input', |
| | | component: 'simple-text', |
| | | readonly: true, |
| | | el: (row) => ({ |
| | | type: 'primary', |
| | | text: row.showFlag === 0 ? '显示' : '隐藏', |
| | | }), |
| | | forceDisabled: true, |
| | | }, |
| | | { |
| | | label: '评价内容:', |
| | |
| | | listType: 'picture-card', |
| | | limit: 1, |
| | | limitSize: 2, |
| | | valueType: 'string', |
| | | }, |
| | | inputFormat: (row) => { |
| | | if ('commentImages' in row) { |
| | | return row.commentImages |
| | | ? JSON.parse(row.commentImages).map((i) => ({ url: i })) |
| | | : [] |
| | | } |
| | | }, |
| | | commonFormat: true, |
| | | forceDisabled: true, |
| | | }, |
| | | ] |
| | | ], |
| | | }, |
| | | { |
| | | title: '回复评价', |
| | |
| | | title: '评价列表', |
| | | } |
| | | }, |
| | | methods:{ |
| | | onHandle(item) { |
| | | this.evaluationId = item.id |
| | | this.$refs.crud.$refs.extraDialog[1].show({ |
| | | comment: item.comment, |
| | | }) |
| | | methods: { |
| | | onHandle(item) { |
| | | this.evaluationId = item.id |
| | | this.$refs.crud.$refs.extraDialog[1].show({ |
| | | comment: item.comment, |
| | | }) |
| | | }, |
| | | async onDetail(item) { |
| | | const {code, data} = await this.$elBusHttp.request( |
| | | 'flower/api/v2/flower-comment/list', |
| | | {params: {id: item.id}} |
| | | ) |
| | | if (code === 0) { |
| | | const row = data[0]; |
| | | this.$refs.crud.$refs.extraDialog[0].show(row) |
| | | |
| | | } |
| | | }, |
| | | async onDetail(item) { |
| | | const { code, data } = await this.$elBusHttp.request( |
| | | 'flower/api/v2/flower-comment/list', |
| | | { params: { id: item.id } } |
| | | ) |
| | | if (code === 0) { |
| | | const row = data[0] |
| | | this.$refs.crud.$refs.extraDialog[0].show(row) |
| | | } |
| | | }, |
| | | async onDelete(item) { |
| | | try { |
| | | await this.$elBusUtil.confirm( |
| | | `确定要删除这个商品吗?` |
| | | ) |
| | | const {code} = await this.$elBusHttp.request( |
| | | await this.$elBusUtil.confirm(`确定要删除这个商品吗?`) |
| | | const { code } = await this.$elBusHttp.request( |
| | | 'flower/api/v2/flower-comment/' + item.id + '', |
| | | { |
| | | method: 'delete', |
| | |
| | | }, |
| | | async onShow(item) { |
| | | try { |
| | | await this.$elBusUtil.confirm( |
| | | `确定要显示这个评价吗?` |
| | | ) |
| | | const {code} = await this.$elBusHttp.request( |
| | | await this.$elBusUtil.confirm(`确定要显示这个评价吗?`) |
| | | const { code } = await this.$elBusHttp.request( |
| | | 'flower/api/v2/flower-comment/show/' + item.id + '', |
| | | { |
| | | method: 'put', |
| | | data: {showFalg: 0}, |
| | | data: { showFalg: 0 }, |
| | | } |
| | | ) |
| | | if (code === 0) { |
| | |
| | | |
| | | async onHide(item) { |
| | | try { |
| | | await this.$elBusUtil.confirm( |
| | | `确定要隐藏这个评价吗?` |
| | | ) |
| | | const {code} = await this.$elBusHttp.request( |
| | | await this.$elBusUtil.confirm(`确定要隐藏这个评价吗?`) |
| | | const { code } = await this.$elBusHttp.request( |
| | | 'flower/api/v2/flower-comment/show/' + item.id + '', |
| | | { |
| | | method: 'put', |
| | | data: {showFalg: 1}, |
| | | data: { showFalg: 1 }, |
| | | } |
| | | ) |
| | | if (code === 0) { |
| | |
| | | } catch (e) { |
| | | return false |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | <style lang="scss"> |
| | | .evaluation-drawer-wrapper { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | width: 35% !important; |
| | | margin-top: 0 !important; |
| | | min-height: 100vh; |
| | | } |
| | | </style> |