<template>
  <div id="">
    <BaseDialog
      width="1000px"
      :isShow.sync="isShow"
      title="业务员分销订单"
      @close="close"
      @submit="submit"
      :isShowFooter="false"
    >
      <template>
        <table-list
          rowKey="orderGoodsId"
          ref="tableList"
          :tableSets="tableSet"
          :tableData="tableData"
          :navText="navText"
          :loading="loading"
        >
          <template slot="btn" slot-scope="props">
            <el-button type="text" @click="editClick(props.scope.row)"
              >详情</el-button
            >
          </template>
        </table-list>
        <pagination
          :total="total"
          :pageSize="formData.pageSize"
          :currentPage="formData.pageNum"
          @handleSizeChange="handleSizeChange"
          @handleCurrentChange="handleCurrentChange"
        />
      </template>
    </BaseDialog>
  </div>
</template>

<script>
import tableList from "@/components/tableList";
import pagination from "@/components/pagination";
export default {
  components: { tableList, pagination },
  data() {
    return {
      isShow: false,
      loading: false, //当前表单加载是否加载动画
      navText: {
        tableHide: true,
        title: "业务员分销订单",
        index: 0,
        ch: "条",
        num: true,
        choice: false,
        addHide: true,
        openCheckMore: true,
        changeWidth: "100px",
        backFatherBtn: {
          status: false,
          title: "配置下单填选模板",
        },
      },
      tableSet: [
        {
          label: "订单号",
          prop: "orderSn",
          width: "180",
          hidden: true,
        },
        {
          label: "订单金额",
          prop: "orderPrice",
          hidden: true,
        },
        {
          label: "订单时间",
          prop: "orderTime",
          scope: "aTimeList",
          width: "160",
          hidden: true,
        },
        {
          label: "所属活动",
          prop: "distributionName",
          width: "180",
          hidden: true,
        },
        {
          label: "下单人",
          prop: "orderUserName",
          hidden: true,
        },
        {
          label: "佣金类型",
          prop: "cashType",
          hidden: true,
          scope: "isOptions",
          options: [
            {
              label: "百分比",
              value: 1,
            },
            {
              label: "固定金额",
              value: 2,
            },
          ],
        },
        {
          label: "佣金比例",
          prop: "cashRatio",
          hidden: true,
          scope:"cashRatio"
        },
        {
          label: "佣金金额（元）",
          prop: "cash",
          hidden: true,
        },
        {
          label: "佣金结算时间",
          prop: "cashTime",
          hidden: true,
          scope: "aTimeList",
          width: "160",
        },
        {
          label: "佣金状态",
          prop: "cashStatus",
          hidden: true,
          scope: "isOptions",
          options: [
            {
              label: "冻结",
              value: 1,
            },
            {
              label: "正常",
              value: 2,
            },
            {
              label: "退款",
              value: 3,
            },
          ],
        },
      ],
      tableData: [],
      formData: {
        sellerId: "",
        pageSize: 10,
        pageNum: 1,
      },
      total: 0,
    };
  },
  methods: {
    showBox(id) {
      this.formData.sellerId = id;
      this.search(2);
      this.isShow = true;
    },
    search(e) {
      this.loading = true;
      if (e === 2) {
        this.formData.pageSiz = 10;
        this.formData.pageNum = 1;
      }
      this.$api
        .distributionactivitysellerorder(this.formData)
        .then((res) => {
          this.tableData = res.rows;
          this.total = res.total;
          this.navText.index = res.total;
        })
        .finally(() => {
          this.loading = false;
        });
    },
    close() {},
    submit() {},
    handleSizeChange(v) {
      this.formData.pageSize = v;
      this.formData.pageNum = 1;
      this.search();
    },
    handleCurrentChange(v) {
      this.formData.pageNum = v;
      this.search();
    },
  },
};
</script>

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