From 0d8603edc1c19164883e005f7502c627feccbb16 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期四, 31 十月 2024 18:31:34 +0800
Subject: [PATCH] fix: 评价时间
---
pages/order/evaluation/index.vue | 129 +++++++++++++++++++++++++++---------------
1 files changed, 83 insertions(+), 46 deletions(-)
diff --git a/pages/order/evaluation/index.vue b/pages/order/evaluation/index.vue
index e03d133..a67c40b 100644
--- a/pages/order/evaluation/index.vue
+++ b/pages/order/evaluation/index.vue
@@ -2,7 +2,14 @@
<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>
@@ -32,7 +39,7 @@
{
type: 'row',
items: [
- { label: '订单编号', id: 'orderId', type: 'input' },
+ { label: '订单编号', id: 'orderNo', type: 'input' },
{ label: '商品名称', id: 'flowerName', type: 'input' },
{
label: '评价星级',
@@ -45,11 +52,11 @@
},
},
{
- label: '申请日期',
+ label: '评价时间',
component: 'el-bus-date-range',
- id: 'createDateBeginStr',
+ id: 'commentStartDate',
commonFormat: true,
- commonFormatProps: ['createDateBeginStr', 'createDateEndStr'],
+ commonFormatProps: ['commentStartDate', 'commentEndDate'],
customClass: 'in-bus-form',
},
],
@@ -62,13 +69,16 @@
{
title: '评价详情',
readonly: true,
+ showButton: false,
dialogAttrs: {
width: '70%',
+ closeOnClickModal: true,
+ customClass: 'evaluation-drawer-wrapper',
},
form: [
{
label: '订单编号:',
- id: 'orderId',
+ id: 'orderNo',
type: 'input',
readonly: true,
},
@@ -86,7 +96,9 @@
el: {
listType: 'picture-card',
limitSize: 2,
+ valueType: 'string',
},
+ forceDisabled: true,
},
{
label: '商品等级:',
@@ -115,14 +127,23 @@
{
label: '评价星级:',
id: 'commentGrade',
- type: 'input',
+ component: 'simple-text',
readonly: true,
+ el: {
+ type: 'primary',
+ },
+ forceDisabled: true,
},
{
label: '评论显示状态:',
id: 'showFlag',
- type: 'input',
+ component: 'simple-text',
readonly: true,
+ el: (row) => ({
+ type: 'primary',
+ text: row.showFlag === 0 ? '显示' : '隐藏',
+ }),
+ forceDisabled: true,
},
{
label: '评价内容:',
@@ -145,10 +166,24 @@
{
label: '评价图片:',
id: 'commentImages',
- type: 'image',
+ type: 'bus-upload',
readonly: true,
+ el: {
+ listType: 'picture-card',
+ limit: 1,
+ limitSize: 2,
+ },
+ inputFormat: (row) => {
+ if ('commentImages' in row) {
+ return row.commentImages
+ ? JSON.parse(row.commentImages).map((i) => ({ url: i }))
+ : []
+ }
+ },
+ commonFormat: true,
+ forceDisabled: true,
},
- ]
+ ],
},
{
title: '回复评价',
@@ -196,31 +231,30 @@
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) {
- console.log(data);
- console.log(data[0].orderId);
- this.$refs.crud.$refs.extraDialog[0].show(data[0])
-
- }
- },
+ 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]
+ row.supplierName = row.supplierName+'[ID:'+ row.supplierId +'], 电话:'+row.supplierContactTel
+ row.customerName = row.customerName+'[UID:'+ row.customerId +']'
+ row.commentGrade = row.commentGrade+'星'
+ this.$refs.crud.$refs.extraDialog[0].show(row)
+ }
+ },
async onDelete(item) {
try {
- await this.$elBusUtil.confirm(
- `确定要删除这个商品吗?`
- )
- const {code, data} = await this.$elBusHttp.request(
+ await this.$elBusUtil.confirm(`确定要删除这个商品吗?`)
+ const { code } = await this.$elBusHttp.request(
'flower/api/v2/flower-comment/' + item.id + '',
{
method: 'delete',
@@ -238,14 +272,12 @@
},
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) {
@@ -259,14 +291,12 @@
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) {
@@ -276,11 +306,18 @@
} 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>
--
Gitblit v1.9.3