<template>
  <div id="">
    <search-box-new
      ref="searchBox"
      :formData="formData"
      :formList="formList"
      @search="search"
      @init="init"
    />
    <table-list
      rowKey="id"
      ref="tableList"
      :tableSets="tableSet"
      :tableData="tableData"
      :navText="navText"
      :loading="loading"
    >
      <template slot="customize">
        <el-button> 导出excel </el-button>
      </template>
      <template slot="integral" slot-scope="props">
        {{ props.scope.row["g"] }}积分
      </template>
    </table-list>
    <pagination
      :total="total"
      :pageSize.sync="formData.pageSize"
      :currentPage.sync="formData.pageNum"
      @search="search"
    />
    <dislog
      :dialogVisible.sync="dialogVisible"
      @search="search"
      :activeData="activeData"
    ></dislog>
  </div>
</template>

<script>
import dislog from "./dislog.vue";
import searchBoxNew from "@/components/searchBoxNew";
import tableList from "@/components/tableList";
import pagination from "@/components/pagination";
export default {
  name: "",
  components: { searchBoxNew, tableList, pagination, dislog },
  data() {
    return {
      loading: false,
      navText: {
        title: "核销管理",
        index: 0,
        ch: "条",
        num: true,
        choice: false,
        addHide: true,
        custom: false,
        tableHide: true,
      },
      formList: [
        {
          prop: "tenantid",
          placeholder: "请选择机构名称",
        },
      ],
      formData: {},
      tableSet: [
        {
          label: "合作商户",
          prop: "a",
          hidden: true,
        },
        {
          label: "会员手机号",
          prop: "b",
          hidden: true,
        },
        {
          label: "会员名称",
          prop: "c",
          hidden: true,
        },
        {
          label: "核销人",
          prop: "d",
          hidden: true,
        },
        {
          label: "核销时间",
          prop: "e",
          hidden: true,
          scope: "aTimeList",
        },
        {
          label: "付款方式",
          prop: "f",
          hidden: true,
          scope: "isOptions",
          options: [
            {
              label: "扫码付款",
              value: 1,
            },
            {
              label: "现金支付",
              value: 2,
            },
          ],
        },
        {
          label: "消费积分",
          prop: "g",
          hidden: true,
          scope: "solt",
          soltName: "integral",
        },
      ],
      tableData: [],
      total: 0,
      dialogVisible: false,
      activeData: {},
    };
  },
  created() {
    this.search(2);
  },
  methods: {
    addClick(data) {
      this.activeData = data || {};
      this.dialogVisible = true;
    },
    search(v) {
      this.tableData = [
        {
          a: "深圳桥恩心理咨询有限公司",
          b: 13800138000,
          c: "张三",
          d: "李四",
          e: 1234567891,
          f: 1,
          g: 2000,
        },
      ];
      //   this.loading = true;
      //   if (v === 2) {
      //     this.formData = {
      //       pageSize: 10,
      //       pageNum: 1,
      //     };
      //   }
      //   this.$api
      //     .xxx(this.formData)
      //     .then((res) => {
      //       this.tableData = res.rows;
      //       this.total = res.total;
      //       this.navText.index = res.total;
      //     })
      //     .finally(() => {
      //       this.loading = false;
      //     });
    },
    init() {
      this.search(2);
    },
    del(v) {
      this.$alert(
        "确定删除此内容？<br />内容删除后将无法恢复，请慎重考虑",
        "提示",
        {
          dangerouslyUseHTMLString: true,
        }
      )
        .then(() => {})
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
  },
};
</script>

<style lang="scss" scoped></style>
