<template>
  <el-card>
    <el-row :gutter="20">
      <el-form
        :model="queryForm"
        ref="queryForm"
        label-width="100px"
        :inline="false"
        size="samll"
      >
        <el-col :span="6">
          <el-form-item label="超级查询">
            <el-input
              v-model="queryForm.queryParam"
              placeholder="请输入"
              @keyup.enter.native="getList"
              clearable
            ></el-input>
          </el-form-item>
        </el-col>
        <el-form-item>
          <el-button size="mini" type="primary" @click="getList"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQueryForm"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </el-row>
    <div class="btnRow mb10">
      <div class="btnList">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="addHandler"
          >新增
        </el-button>
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="myDeleteHandler"
          >删除
        </el-button>
        <el-button
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="upload.open = true"
          >导入
        </el-button>
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          >导出
        </el-button>
      </div>
    </div>
    <!-- 列表 -->
    <el-table
      :data="tableList"
      border
      stripe
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" />
      <el-table-column prop="saleDate" label="日期" />
      <el-table-column prop="customName" label="客户名称" />
      <el-table-column prop="deliveryDate" label="交货日期" />
      <el-table-column prop="saleLeadTime" label="交货天数" />
      <el-table-column prop="saleAmountInWords" label="合计金额" />
      <el-table-column prop="salesman" label="销售员" />
      <el-table-column prop="remark" label="备注" />
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-dropdown>
            <el-button type="warning" plain size="small">
              操作<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdate(scope.row)"
                  v-hasPermi="['system:productCodeList:edit']"
                  >修改
                </el-button>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  @click="handleDelete(scope.row)"
                  v-hasPermi="['system:productCodeList:remove']"
                  >删除
                </el-button>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryForm.pageNum"
      :limit.sync="queryForm.pageSize"
      @pagination="getList"
    />
  </el-card>
  <!-- 添加或修改订单信息对话框 -->
</template>

<script>
import { saleOrderList } from "@/api/system/retailMange.js";
export default {
  name: "retailMange",
  props: [],
  components: {},
  data() {
    return {
      // 查询参数
      queryForm: {
        pageNum: 1, // 第几页
        pageSize: 10, // 每页大小
        queryParam: "",
      },
      // 表格数据
      tableList: [],

      // 新增或修改弹窗参数
      // start

      // end
    };
  },
  computed: {},
  mounted() {
    this.getList();
  },
  methods: {
    // 表格数据查询
    async getList() {
      try {
        let res = await saleOrderList(this.queryForm);
        console.log(res);
        if (res.code == 200) {
          this.tableList = res.rows;
          this.total = res.total;
        } else {
          this.$message.error(res.msg);
        }
      } catch (error) {
        console.log(error);
      }
    },
    resetQueryForm() {
      this.queryForm.queryParam = "";
      this.getList();
    },
  },
};
</script>

<style scoped></style>
