<template>
  <el-dialog title="查看" :close-on-click-modal="false" :visible.sync="visible" width="600px">
    <el-form :model="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="150px">
      <el-form-item label="评价内容:">

        <!-- <img :src="item" v-for="(item,index) in dataForm.commentImages" :key="index" style="height: 120px;width: 120px"> -->
        <el-image style="height: 120px;width: 120px" v-for="(item,index) in dataForm.commentImages" :src="item" :key="index" :preview-src-list="[item]">
        </el-image>
        <div>{{dataForm.comment}}</div>
      </el-form-item>
      <el-form-item label="评价回复:" v-if="dataForm.reply&&dataForm.reply.content">
        <div>
          {{dataForm.reply.content}}
        </div>
      </el-form-item>
    </el-form>

    <span slot="footer" class="dialog-footer">
      <el-button @click="close()">取消</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { shopOrderCommentInfo } from "@/api/order"
export default {
  data () {
    return {
      visible: false,
      dataForm: {
        commentImages: [],
        content: ''
      }
    }
  },

  methods: {
    init (row) {
      this.visible = true
      // this.dataForm = JSON.parse(JSON.stringify(row))
      // if (row.img) {
      //   this.dataForm.imgUrls = row.img.split(',')
      // }
      this.getCommentInfo(row.commentId)
    },
    // 获取详情
    getCommentInfo (commentId) {
      shopOrderCommentInfo(commentId).then(res => {
        this.dataForm = res.data
        // if (res.data.commentImages) {
        //   this.dataForm.imgUrls = res.data.commentImages.split(',')
        // }
      })
    },
    close () {
      this.visible = false
    }
  }
}
</script>

<style lang="scss">
img {
  margin-right: 10px;
}
</style>
