<template>
  <div class="divBox">
    <div class="selCard mb14">
      <el-form
        size="small"
        inline
        :model="tableFrom"
        ref="searchForm"
        label-width="85px"
      >
        <el-form-item label="订单状态：" class="width100" prop="status">
          <el-radio-group
            v-model="tableFrom.status"
            type="button"
            @change="getList(1), getCardList()"
          >
            <el-radio-button label=""
              >全部
              {{
                "(" + orderChartType.all ? orderChartType.all : 0 + ")"
              }}</el-radio-button
            >
            <el-radio-button label="1"
              >待付款
              {{
                "(" + orderChartType.unpaid ? orderChartType.unpaid : 0 + ")"
              }}</el-radio-button
            >
            <el-radio-button label="2"
              >待发货
              {{
                "(" + orderChartType.unshipped
                  ? orderChartType.unshipped
                  : 0 + ")"
              }}</el-radio-button
            >
            <el-radio-button label="3"
              >待收货
              {{
                "(" + orderChartType.untake ? orderChartType.untake : 0 + ")"
              }}</el-radio-button
            >
            <el-radio-button label="4"
              >待评价
              {{
                "(" + orderChartType.unevaluate
                  ? orderChartType.unevaluate
                  : 0 + ")"
              }}</el-radio-button
            >
            <el-radio-button label="5"
              >交易完成
              {{
                "(" + orderChartType.complete
                  ? orderChartType.complete
                  : 0 + ")"
              }}</el-radio-button
            >
            <el-radio-button label="6"
              >已退款
              {{
                "(" + orderChartType.refund ? orderChartType.refund : 0 + ")"
              }}</el-radio-button
            >
            <el-radio-button label="7"
              >已删除
              {{
                "(" + orderChartType.del ? orderChartType.del : 0 + ")"
              }}</el-radio-button
            >
          </el-radio-group>
        </el-form-item>
        <el-form-item label="时间选择：">
          <el-date-picker
            v-model="timeVal"
            value-format="yyyy/MM/dd HH:mm:ss"
            format="yyyy/MM/dd HH:mm:ss"
            size="small"
            type="datetimerange"
            placement="bottom-end"
            placeholder="自定义时间"
            style="width: 280px"
            :picker-options="pickerOptions"
            @change="onchangeTime"
          />
        </el-form-item>
        <el-form-item label="完成时间：">
          <el-date-picker
            v-model="finishTime"
            value-format="yyyy/MM/dd HH:mm:ss"
            format="yyyy/MM/dd HH:mm:ss"
            size="small"
            type="datetimerange"
            placement="bottom-end"
            placeholder="自定义时间"
            style="width: 280px"
            :picker-options="pickerOptions"
            @change="onchangeFinishTime"
          />
        </el-form-item>
        <el-form-item label="活动类型：" prop="activity_type">
          <el-select
            v-model="tableFrom.activity_type"
            clearable
            filterable
            placeholder="请选择"
            class="selWidth"
            @change="getList(1), getCardList()"
          >
            <el-option
              v-for="item in activity"
              :key="item.type"
              :label="item.name"
              :value="item.type"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="商户名称：" prop="mer_id">
          <el-select
            v-model="tableFrom.mer_id"
            clearable
            filterable
            placeholder="请选择"
            class="selWidth"
            @change="getList(1), getCardList()"
          >
            <el-option
              v-for="item in merSelect"
              :key="item.mer_id"
              :label="item.mer_name"
              :value="item.mer_id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="商户类别：" prop="is_trader">
          <el-select
            v-model="tableFrom.is_trader"
            clearable
            placeholder="请选择"
            class="selWidth"
            @change="getList(1), getCardList()"
          >
            <el-option label="自营" value="1" />
            <el-option label="非自营" value="0" />
          </el-select>
        </el-form-item>
        <el-form-item label="商品名称：" prop="store_name">
          <el-input
            v-model="tableFrom.store_name"
            @keyup.enter.native="getList(1), getCardList()"
            placeholder="请输入商品名称"
            class="selWidth"
            clearable
          />
        </el-form-item>
        <el-form-item label="支付方式：" prop="pay_type">
          <el-select
            v-model="tableFrom.pay_type"
            clearable
            placeholder="请选择"
            class="selWidth"
            @change="getList(1), getCardList()"
          >
            <el-option label="银联扫码" value="13" />
            <!-- <el-option label="微信" value="1" /> -->
            <el-option label="支付宝" value="12" />
            <el-option label="扫码支付" value="9" />
            <el-option label="绑卡快捷支付" value="11" />
            <!-- <el-option label="铸源星" value="7" /> -->
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="发货方式：" prop="filter_delivery">
            <el-select
              v-model="tableFrom.filter_delivery"
              placeholder="请选择"
              class="selWidth"
              clearable
              @change="getList(1),getCardList()"
            >
              <el-option
                v-for="item in dliveryWayList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="商品类型：" prop="filter_product">
            <el-select
              v-model="tableFrom.filter_product"
              placeholder="请选择"
              class="selWidth"
              clearable
              @change="getList(1),getCardList()"
            >
              <el-option
                v-for="item in productTypeList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item> -->
        <el-form-item label="关键字：" prop="keywords">
          <el-input
            v-model="tableFrom.keywords"
            @keyup.enter.native="getList(1), getCardList()"
            placeholder="请输入订单号/收货人/联系方式/ID/商品编号"
            class="selWidth"
            clearable
          />
        </el-form-item>
        <el-form-item label="总单单号：" prop="group_order_sn">
          <el-input
            v-model="tableFrom.group_order_sn"
            @keyup.enter.native="getList(1), getCardList()"
            placeholder="请输入总单单号"
            class="selWidth"
            clearable
          />
        </el-form-item>
        <el-form-item label="用户信息：" prop="username">
          <el-input
            v-model="tableFrom.username"
            @keyup.enter.native="getList(1), getCardList()"
            placeholder="请输入用户昵称/手机号"
            class="selWidth"
            clearable
          />
        </el-form-item>
        <el-form-item label="商品ID：" prop="product_id">
          <el-input
            v-model="tableFrom.product_id"
            @keyup.enter.native="getList(1), getCardList()"
            placeholder="请输入商品ID"
            class="selWidth"
            clearable
          />
        </el-form-item>
        <!-- <el-form-item label="商品编号：" prop="bar_code">
          <el-input
            v-model="tableFrom.bar_code"
            @keyup.enter.native="getList(1),getCardList()"
            placeholder="请输入商品编号"
            class="selWidth"
            clearable
          /> 
        </el-form-item> -->
        <el-form-item label="是否支付：" prop="paid">
          <el-select
            v-model="tableFrom.paid"
            clearable
            placeholder="请选择"
            class="selWidth"
            @change="getList(1)"
          >
            <el-option label="是" value="1" />
            <el-option label="否" value="0" />
          </el-select>
        </el-form-item>
        <el-form-item label="定制产品：" prop="is_customize">
          <el-select
            v-model="tableFrom.is_customize"
            clearable
            placeholder="请选择"
            class="selWidth"
            @change="getList(1)"
          >
            <el-option label="是" value="1" />
            <el-option label="否" value="0" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="small" @click="getList(1)"
            >搜索</el-button
          >
          <el-button size="small" @click="searchReset()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <cards-data v-if="cardLists.length > 0" :card-lists="cardLists" />
    <el-card>
      <el-button size="small" type="primary" class="mb20" @click="exports"
        >导出列表</el-button
      >
      <el-table
        v-loading="listLoading"
        :data="tableData.data"
        size="small"
        class="table"
        align="center"
        highlight-current-row
        :cell-class-name="addTdClass"
      >
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-form-item label="商品总价：">
                <span>{{ props.row.total_price | filterEmpty }}</span>
              </el-form-item>
              <el-form-item label="下单时间：">
                <span>{{ props.row.create_time | filterEmpty }}</span>
              </el-form-item>
              <el-form-item label="用户备注：">
                <span>{{ props.row.mark | filterEmpty }}</span>
              </el-form-item>
              <el-form-item label="商家备注：">
                <span>{{ props.row.remark | filterEmpty }}</span>
              </el-form-item>
              <el-form-item label="总单号：">
                <span>{{
                  props.row.groupOrder
                    ? props.row.groupOrder.group_order_sn
                    : ""
                }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="订单编号" min-width="150">
          <template slot-scope="scope">
            <span style="display: block" v-text="scope.row.order_sn" />
            <span
              v-show="scope.row.is_del > 0"
              style="color: #ed4014; display: block"
              >用户已删除</span
            >
          </template>
        </el-table-column>
        <el-table-column label="用户信息" min-width="130">
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              @click.native="onUserDetails(scope.row.uid)"
              >{{
                scope.row.user && scope.row.user.nickname + "/" + scope.row.uid
              }}</el-button
            >
          </template>
        </el-table-column>
        <!-- <el-table-column label="订单类型" min-width="80">
          <template slot-scope="scope">
            <span>{{ scope.row.is_virtual == 1 ? "虚拟订单" : scope.row.order_type == 0 ? "普通订单" : "核销订单" }}</span>
          </template>
        </el-table-column> -->
        <el-table-column
          prop="real_name"
          label="收货人/订购人"
          min-width="120"
        />
        <el-table-column label="商户名称" min-width="100">
          <template slot-scope="scope">
            <span>{{
              scope.row.merchant ? scope.row.merchant.mer_name : ""
            }}</span>
          </template>
        </el-table-column>
        <el-table-column label="商品信息" min-width="330">
          <template slot-scope="scope">
            <div
              v-for="(val, i) in scope.row.orderProduct"
              :key="i"
              class="tabBox acea-row row-middle"
            >
              <div class="demo-image__preview">
                <el-image
                  :src="val.cart_info.product.image"
                  :preview-src-list="[val.cart_info.product.image]"
                />
              </div>
              <span class="tabBox_tit"
                >{{ val.cart_info.product.store_name + " | "
                }}{{ val.cart_info.productAttr.sku }}</span
              >
              <span class="tabBox_pice">
                {{
                  "￥" +
                  val.cart_info.productAttr.price +
                  " x " +
                  val.product_num
                }}
                <em
                  v-if="val.refund_num < val.product_num && val.refund_num > 0"
                  style="color: red; font-style: normal"
                  >(-{{ val.product_num - val.refund_num }})</em
                >
              </span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          class-name="customize"
          prop="is_customize"
          label="定制产品"
          min-width="100"
        >
          <template slot-scope="scope">
            <div
              v-for="(val, i) in scope.row.orderProduct"
              :key="i"
              class="tabBox acea-row row-middle"
            >
              {{ val.product.is_customize ? "是" : "否" }}
            </div>
          </template>
        </el-table-column>
        <el-table-column label="实际支付" min-width="90">
          <template slot-scope="scope">
            <span>{{ scope.row.pay_price }}</span>
            <p v-if="scope.row.finalOrder">
              尾款：{{ scope.row.finalOrder.pay_price }}
            </p>
          </template>
        </el-table-column>
        <el-table-column label="支付方式" min-width="80">
          <template slot-scope="scope">
            <span v-if="scope.row.paid === 1">{{
              scope.row.pay_type | orderPayType
            }}</span>
            <span v-else>--</span>
          </template>
        </el-table-column>
        <el-table-column label="支付状态" min-width="80">
          <template slot-scope="scope">
            <span>{{ scope.row.paid == 0 ? "未支付" : "已支付" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="订单状态" min-width="80">
          <template slot-scope="scope">
            <span v-if="scope.row.is_del === 0">
              <span v-if="scope.row.paid === 0">待付款</span>
              <span v-else>
                <span
                  v-if="
                    scope.row.order_type === 0 || scope.row.order_type === 2
                  "
                  >{{ scope.row.status | orderStatusFilter }}</span
                >
                <span v-else>{{
                  scope.row.status | cancelOrderStatusFilter
                }}</span>
              </span>
            </span>
            <span v-else>已删除</span>
          </template>
        </el-table-column>
        <el-table-column prop="serviceScore" label="下单时间" min-width="150">
          <template slot-scope="scope">
            <span>{{ scope.row.create_time }}</span>
          </template>
        </el-table-column>
        <el-table-column
          width="100px"
          label="操作"
          min-width="80"
          fixed="right"
          align="center"
        >
          <template slot-scope="scope">
            <span v-for="(val, i) in scope.row.orderProduct" :key="i">
              <el-button
                v-if="orderFilter(scope.row)"
                type="text"
                size="small"
                @click="onRefundDetail(scope.row.order_sn)"
                >查看退款单</el-button
              >
            </span>
            <el-button
              type="text"
              size="small"
              @click="onOrderDetails(scope.row.order_id)"
              >详情</el-button
            >
            <!-- <el-button type="text" size="small" @click="onOrderOpenRefund(scope.row.order_id)">开启退款</el-button> -->
            <el-button
              type="text"
              size="small"
              @click="onOrderOpen(scope.row.order_id)"
              >开启强制退款</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <div class="block">
        <el-pagination
          background
          :page-size="tableFrom.limit"
          :current-page="tableFrom.page"
          layout="total, prev, pager, next, jumper"
          :total="tableData.total"
          @size-change="handleSizeChange"
          @current-change="pageChange"
        />
      </div>
    </el-card>
    <!--用户信息-->
    <user-details
      ref="userDetails"
      :drawer="userDawer"
      @closeDrawer="closeDrawer"
      @changeDrawer="changeDrawer"
      :uid="uid"
      :isUser="false"
    />
    <!--详情-->
    <order-detail
      ref="orderDetail"
      :orderId="orderId"
      @closeDrawer="closeDrawer"
      @changeDrawer="changeDrawer"
      :drawer="drawer"
    ></order-detail>
  </div>
</template>

<script>
import {
  refundorderOpenApi,
  orderListApi,
  chartApi,
  cardListApi,
  exportOrderApi,
  openRefundApi,
} from "@/api/order";
import { merSelectApi } from "@/api/product";
import userDetails from "../../user/list/userDetails";
import orderDetail from "./orderDetails.vue";
import createWorkBook from "@/utils/newToExcel.js";
import cardsData from "@/components/cards/index";
import { fromList } from "@/libs/constants.js";
import timeOptions from "@/utils/timeOptions";
import * as FileSaver from "file-saver";
import Worker from "worker-loader!@/worker/calcWorker.js";
export default {
  components: { orderDetail, cardsData, userDetails },
  data() {
    return {
      pickerOptions: timeOptions,
      orderId: 0,
      tableData: {
        data: [],
        total: 0,
      },
      activity: [
        { name: "普通订单", type: 0 },
        // {name: "秒杀订单",type: 1},
        { name: "预售订单", type: 2 },
        // {name: "助力订单",type: 3},
        // {name: "拼团订单",type: 4}
      ],
      listLoading: true,
      tableFrom: {
        order_sn: this.$route.query.order_sn ? this.$route.query.order_sn : "",
        group_order_sn: "",
        keywords: "",
        paid: "1",
        username: "",
        store_name: "",
        status: this.$route.query.status || "",
        date: "",
        mer_id: "",
        page: 1,
        limit: 20,
        is_trader: "",
        is_customize: "",
        pay_type: "",
        filter_delivery: "",
        filter_product: "",
        activity_type: "",
        product_id: "",
        bar_code: "",
        finish_time: "",
      },
      dliveryWayList: [
        { value: 1, label: "快递订单" },
        { value: 2, label: "配送订单" },
        { value: 4, label: "核销订单" },
        { value: 3, label: "虚拟发货" },
        { value: 6, label: "自动发货" },
      ], //发货方式
      productTypeList: [
        { value: 1, label: "实物商品" },
        { value: 2, label: "虚拟商品" },
        { value: 3, label: "卡密商品" },
      ], //商品类型
      orderChartType: {},
      timeVal: [],
      finishTime: [],
      fromList: fromList,
      selectionList: [],
      ids: "",
      uid: "",
      visibleDetail: false,
      tableFromLog: {
        page: 1,
        limit: 10,
      },
      tableDataLog: {
        data: [],
        total: 0,
      },
      LogLoading: false,
      dialogVisible: false,
      cardLists: [],
      orderDatalist: null,
      merSelect: [],
      drawer: false,
      userDawer: false,
    };
  },
  mounted() {
    if (this.$route.query.hasOwnProperty("order_sn")) {
      this.tableFrom.order_sn = this.$route.query.order_sn;
    } else {
      this.tableFrom.order_sn = "";
    }
    this.headerList();
    this.getMerSelect();
    this.getCardList();
    this.getList("");
  },
  // 被缓存接收参数
  activated() {
    if (this.$route.query.hasOwnProperty("order_sn")) {
      this.tableFrom.order_sn = this.$route.query.order_sn;
    } else {
      this.tableFrom.order_sn = "";
    }
    this.headerList();
    this.getMerSelect();
    this.getCardList();
    this.getList("");
  },
  methods: {
    /**重置 */
    searchReset() {
      this.timeVal = [];
      this.finishTime = [];
      this.tableFrom.date = "";
      this.tableFrom.finish_time = "";
      this.$refs.searchForm.resetFields();
      this.getList(1);
    },
    // 退款详情页
    onRefundDetail(sn) {
      console.log(sn, "sn");
      this.$router.push({
        path: "refund",
        query: {
          sn: sn,
        },
      });
    },
    // 订单筛选
    orderFilter(item) {
      let status = false;
      item.orderProduct.forEach((el) => {
        if (el.refund_num > 0 && el.refund_num < el.product_num) {
          status = true;
        }
      });
      return status;
    },
    // 表格某一行添加特定的样式
    addTdClass(val) {
      if (val.row.status > 0 && val.row.paid == 1) {
        for (let i = 0; i < val.row.orderProduct.length; i++) {
          if (
            val.row.orderProduct[i].refund_num > 0 &&
            val.row.orderProduct[i].refund_num <
              val.row.orderProduct[i].product_num
          ) {
            return "row-bg";
          }
        }
      } else {
        return " ";
      }
    },
    // 商户列表；
    getMerSelect() {
      merSelectApi()
        .then((res) => {
          this.merSelect = res.data;
        })
        .catch((res) => {
          this.$message.error(res.message);
        });
    },
    // 用户信息
    onUserDetails(uid) {
      this.uid = uid;
      this.userDawer = true;
      this.$refs.userDetails.getData(uid, false, true);
    },
    closeDrawer() {
      this.drawer = false;
      this.userDawer = false;
    },
    changeDrawer(v) {
      this.drawer = v;
      this.userDawer = v;
    },
    // 导出csv
    //   exportCsv(columns, dataList, fileName) {
    //   let title = columns.map(item => item);
    //   let keyArray = columns.map(item => item.key);
    //   let str = [];
    //   str.push(title.join(',') + '\n');
    //   for (let i = 0; i < dataList.length; i++) {
    //     const temp = [];
    //     for (let j = 0; j < keyArray.length; j++) {
    //       console.log(dataList[i][j]);
    //       temp.push(dataList[i][j]);
    //     }
    //     str.push(temp.join(',') + '\n');
    //   }
    //   let uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str.join(''));
    //   let downloadLink = document.createElement('a');
    //   downloadLink.href = uri;
    //   downloadLink.download = fileName;
    //   document.body.appendChild(downloadLink);
    //   downloadLink.click();
    //   document.body.removeChild(downloadLink);
    // },
    async exports() {
      const loading = this.$loading({
        lock: true,
        text: "导出中...",
        spinner: "el-icon-loading",
        background: "hsla(0, 0%, 100%, .9)",
      });
      let excelData = JSON.parse(JSON.stringify(this.tableFrom)),
        data = [];
      excelData.page = 1;
      excelData.limit = 200;
      let pageCount = 1;
      let lebData = {};
      // let work;
      for (let i = 0; i < pageCount; i++) {
        lebData = await this.downData(excelData);
        // if(work){
        //   work.setContent(lebData.export)
        // }else{
        //   work = createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename);
        // }
        //循环次数
        pageCount = Math.ceil(lebData.count / excelData.limit);
        // 数据同步
        if (lebData.export.length) {
          data = data.concat(lebData.export);
          excelData.page++;
        }
      }
      console.log("开始处理");
      // 获取计算开始的时间
      let start = performance.now();
      // 新建一个线程
      let worker = new Worker();
      // 线程之间通过postMessage进行通信
      worker.postMessage({
        header: lebData.header,
        title: lebData.title,
        data,
        foot: lebData.foot,
        filename: lebData.filename,
      });
      // 监听message事件
      worker.addEventListener("message", (e) => {
        // 关闭线程
        worker.terminate();
        // 获取计算结束的时间
        let end = performance.now();
        // 得到总的计算时间
        let durationTime = end - start;

        console.log("计算结果:", e.data);
        let { blob, filename } = e.data;
        FileSaver.saveAs(blob, filename + ".xlsx");
        loading.close();
        console.log(`代码执行了 ${durationTime} 毫秒`);
      });
      // this.exportCsv(lebData.header,data,lebData.filename)
      // createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename)
      // work.saveAndDowloade(lebData.filename)
      return;
    },
    /**订单列表 */
    downData(excelData) {
      return new Promise((resolve, reject) => {
        exportOrderApi(excelData).then((res) => {
          return resolve(res.data);
        });
      });
    },
    // 导出
    exportRecord() {
      exportOrderApi(this.tableFrom)
        .then((res) => {
          const h = this.$createElement;
          this.$msgbox({
            title: "提示",
            message: h("p", null, [
              h("span", null, '文件正在生成中，请稍后点击"'),
              h("span", { style: "color: teal" }, "导出记录"),
              h("span", null, '"查看~ '),
            ]),
            confirmButtonText: "我知道了",
          }).then((action) => {});
        })
        .catch((res) => {
          this.$message.error(res.message);
        });
    },
    // 详情
    onOrderDetails(id) {
      this.orderId = id;
      this.$refs.orderDetail.getInfo(id);
      this.drawer = true;
      // this.$refs.orderDetail.onOrderDetails(id);
      // this.$refs.orderDetail.onOrderLog(id);
    },
    // 开启强制退款
    onOrderOpen(id) {
      this.$modalForm(refundorderOpenApi(id)).then(() => this.getList(""));
    },
    // 开启退款
    // onOrderOpenRefund(id) {
    //   this.$confirm('此操作将开启退款, 是否继续?', '提示', {
    //       confirmButtonText: '确定',
    //       cancelButtonText: '取消',
    //       type: 'warning'
    //     }).then(() => {
    //       openRefundApi(id).then((res)=>{
    //         if(res.status == '200'){
    //           this.$message({
    //             type: 'success',
    //             message: '开启退款!'
    //           });
    //         }
    //         console.log(res, "res");
    //       })
    //       // this.$message({
    //       //   type: 'success',
    //       //   message: '开启退款!'
    //       // });
    //     }).catch(() => {

    //     });
    // },
    pageChangeLog(page) {
      this.tableFromLog.page = page;
      this.getList("");
    },
    handleSizeChangeLog(val) {
      this.tableFromLog.limit = val;
      this.getList("");
    },
    // 具体日期
    onchangeTime(e) {
      this.timeVal = e;
      console.log(e);
      this.tableFrom.date = e ? this.timeVal.join("-") : "";
      this.tableFrom.page = 1;
      this.getCardList();
      this.getList(1);
    },
    // 具体日期
    onchangeFinishTime(e) {
      this.finishTime = e;
      this.tableFrom.finish_time = e ? this.finishTime.join("-") : "";
      this.tableFrom.page = 1;
      this.getCardList();
      this.getList(1);
    },
    // 列表
    getList(num) {
      this.listLoading = true;
      this.tableFrom.page = num ? num : this.tableFrom.page;
      orderListApi(this.tableFrom)
        .then((res) => {
          this.tableData.data = res.data.list;
          this.tableData.total = res.data.count;
          //   this.cardLists = res.data.stat;
          this.listLoading = false;
          //   this.getCardList();
        })
        .catch((res) => {
          this.$message.error(res.message);
          this.listLoading = false;
        });
    },
    getCardList() {
      cardListApi(this.tableFrom)
        .then((res) => {
          this.cardLists = res.data;
        })
        .catch((res) => {
          this.$message.error(res.message);
        });
    },
    pageChange(page) {
      this.tableFrom.page = page;
      this.getList("");
    },
    handleSizeChange(val) {
      this.tableFrom.limit = val;
      this.getList("");
    },
    headerList() {
      chartApi()
        .then((res) => {
          this.orderChartType = res.data;
        })
        .catch((res) => {
          this.$message.error(res.message);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.demo-table-expand ::v-deep label {
  width: 83px !important;
}
.el-dropdown-link {
  cursor: pointer;
  color: var(--prev-color-primary);
  font-size: 12px;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.tabBox_tit {
  max-width: 60%;
  font-size: 12px !important;
  margin: 0 2px 0 10px;
  letter-spacing: 1px;
  padding: 5px 0;
  box-sizing: border-box;
}
::v-deep .row-bg .cell {
  color: red !important;
}
</style>
