<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-form-item>
      <el-form-item>
        <el-button type="primary" plain icon="el-icon-download" size="mini" @click="handleGenTable">导出订单</el-button>
        <el-button type="primary" plain 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="address" label="图片展示" :show-overflow-tooltip="true" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="imageCaption(scope)">查看详情</el-button>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="150">
        <template slot-scope="scope">
          <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 {
      dialogVisible: false,
      dialogVi: false,
      control: 0,
      total: 5,
      title: '修改订单',
      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) {
      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>
