mayf
2024-10-10 8716d3ceed3fed30a99fb4903cfc524e731a5201
评价修改
已修改1个文件
105 ■■■■■ 文件已修改
pages/order/evaluation/index.vue 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
@@ -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: '商品等级:',
@@ -121,8 +133,13 @@
              {
                label: '评论显示状态:',
                id: 'showFlag',
                type: 'input',
                component: 'simple-text',
                readonly: true,
                el: (row) => ({
                  type: 'primary',
                  text: row.showFlag === 0 ? '显示' : '隐藏',
                }),
                forceDisabled: true,
              },
              {
                label: '评价内容:',
@@ -151,10 +168,18 @@
                  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: '回复评价',
@@ -202,30 +227,27 @@
      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',
@@ -243,14 +265,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) {
@@ -264,14 +284,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) {
@@ -281,11 +299,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>