<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="会员昵称" prop="keyword">
        <el-input
          v-model="queryParams.keyword"
          placeholder="请输入会员昵称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
     
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>


    <el-table v-loading="loading" border :data="pingList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <!-- <el-table-column label="订单编号" align="center" prop="orderSn" /> -->
      <el-table-column label="会员昵称" align="center" prop="nickName" width="130" />
      <el-table-column label="用户头像" align="center" prop="avatar" width="150" >
         <template slot-scope="scope">
                 <el-image v-if="scope.row.avatar!=null"
                     style="width: 50px;"
                     :src="scope.row.avatar"
                    >
                 </el-image>
         </template>
      </el-table-column>
      <el-table-column label="评价内容" align="center" prop="pingContent" />
      <el-table-column label="评分" align="center" prop="pingStar" width="200px">
        <template slot-scope="scope">
          <el-rate
            v-model="scope.row.pingStar"
            disabled
            show-score
            text-color="#ff9900"
            score-template="{value}">
          </el-rate>
        </template>
      </el-table-column>
      <el-table-column label="评价时间" align="center" prop="pingTime" width="200" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />



  </div>
</template>

<script>
import { inquiryOrderPingList } from "@/api/inquiryOrder";
import Editor from '@/components/Editor/wang';
// import inquiryOrderDetails from '../../components/his/inquiryOrderDetails.vue';
export default {
  name: "Ping",
  components: { Editor },

  data() {
    return {
      userList:[],
      // 遮罩层
      loading: true,
      show:{

        open:false,
          },
      userName: {name:"1"},
      doctorName: {name:"1"},
      docuser:[],

      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      pingTime:[],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 评价管理表格数据
      pingList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        doctorName: null,
        sTime:null,
        eTime:null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {  userId: [
        { required: true, message: '请选择所属用户', trigger: 'blur' }
      ],
      doctorId: [
        { required: true, message: '请选择医生', trigger: 'blur' }
      ],
      pingStar: [
        { required: true, message: '请评分', trigger: 'blur' }
      ],
      pingContent: [
        { required: true, message: '请输入评价内容', trigger: 'blur' }
      ],
      pingTime: [
        { required: true, message: '请选择评价时间', trigger: 'change' }
      ]
      }
    };
  },
  created() {


    this.getList();
  },
  methods: {
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.orderId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    handledetails(row){
      if(row.orderId==null){
        return this.$message('没有此订单');
      }
      this.show.open=true;
      setTimeout(() => {
          this.$refs.Details.getDetails(row.orderId);
      }, 1);
    },
    /** 查询评价管理列表 */
    getList() {
      this.loading = true;
      inquiryOrderPingList(this.queryParams).then(response => {
        this.pingList = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
     
  }
};
</script>
