<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="94px">
      <el-form-item label="联系人姓名" prop="dataName">
        <el-input v-model="queryParams.dataName" placeholder="请输入联系人姓名" clearable />
      </el-form-item>
      <el-form-item label="联系电话" prop="tableName">
        <el-input v-model="queryParams.tableName" placeholder="请输入联系电话" clearable />
      </el-form-item>
      <el-form-item label="维修时间" prop="tableComment">
        <el-date-picker v-model="value1" type="date" value-format="yyyy-MM-dd" placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="订单状态" prop="tableComment">
        <el-select v-model="value" placeholder="请选择">
          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </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-button type="primary" plain icon="el-icon-download" size="mini" @click="handleGenTable">导出订单</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="tableData" border style="width: 100%">
      <el-table-column type="index" width="50" label="序号" align="center">
      </el-table-column>
      <el-table-column prop="date" label="联系人" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="name" label="联系电话" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="province" label="维修时间" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="city" label="维修地址" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="address" label="预算金额(元)" :show-overflow-tooltip="true" align="center">
        <template>
          <el-input v-model="queryParams.dataName" placeholder="请输入联系人姓名" clearable />
        </template>
      </el-table-column>
      <el-table-column prop="address" label="沟通后金额(元)" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="address" label="订单标题" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="address" label="图片说明" :show-overflow-tooltip="true" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="imageCaption(scope, '1')">查看详情</el-button>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="视频说明" :show-overflow-tooltip="true" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="imageCaption(scope, '2')">查看详情</el-button>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="语音描述" :show-overflow-tooltip="true" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="imageCaption(scope, '3')">查看详情</el-button>
        </template>
      </el-table-column>
      <el-table-column prop="zip" label="订单状态" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="zip" label="驳回理由" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column prop="zip" label="备注说明" :show-overflow-tooltip="true" align="center">
      </el-table-column>
      <el-table-column label="操作" width="150">
        <template slot-scope="scope">
          <el-button @click="imageCaption(scope.row, '4')" type="text" size="small">生成支付订单</el-button>
          <el-button type="text" size="small" @click="imageCaption(scope.row, '5')">驳回</el-button>
          <el-button type="text" size="small" @click="modify(scope.row, '1')">修改</el-button>
          <el-button type="text" size="small" @click="modify(scope.row, '2')">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 其他 -->
    <comindex :dialogVisibl="dialogVisible" @visivie='visivie' :control="control"></comindex>
    <!-- 修改 详情 -->
    <commodify :title="title" :dialogVisibl="dialogVi" @diaisibl="diaisibl" @onSubmit="onSubmit"></commodify>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
  </div>
</template>

<script>
import comindex from './components/index'
import commodify from './components/modify'

export default {
  name: "orderform",
  data() {
    return {
      value1:'',
      dialogVisible: false,
      dialogVi: false,
      control: '0',
      total: 5,
      title: '修改订单',
      queryParams: {
        pageNum: 0,
        pageSize: 10
      },
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value: '',
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1518 弄',
        zip: 200333
      }, {
        date: '2016-05-04',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1517 弄',
        zip: 200333
      }, {
        date: '2016-05-01',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1519 弄',
        zip: 200333
      }, {
        date: '2016-05-03',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1516 弄',
        zip: 200333
      }],
      // 日期范围
      dateRange: "",
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        tableName: undefined,
        tableComment: undefined,
        dataName: ""
      },
      // 预览参数
      preview: {
        open: false,
        title: "代码预览",
        data: {},
        activeName: "domain.java"
      }
    };
  },
  components: {
    comindex,
    commodify
  },
  created() { },
  methods: {
    // 搜索
    handleQuery() {

    },
    // 重置
    resetQuery() {

    },
    // 导出订单
    handleGenTable() {

    },
    // 页码切换
    getList() {

    },
    // 打开查看详情
    imageCaption(sta, val) {
      switch (val) {
        case '1':
          this.control = val
          break;
        case '2':
          this.control = val
          break;
        case '3':
          this.control = val
          break;
        case '4':
          this.control = val
          break;
        case '5':
          this.control = val
          break;
      }
      this.dialogVisible = true
    },
    // 修改详情
    modify(sta, val) {
      if (val == '1') {
        this.title = '修改订单'
      } else {
        this.title = '订单详情'
      }
      this.dialogVi = true

    },
    // 其他 弹窗关闭
    visivie() {
      this.dialogVisible = false
    },
    // 详情 修改 弹窗关闭
    diaisibl() {
      this.dialogVi = false
    },
    // 详情 修改 确认修改
    onSubmit() {
      this.dialogVi = false
    }
  }
};
</script>
