<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="店铺" prop="storeId">
         <el-select v-model="queryParams.storeId" placeholder="店铺" clearable size="small" filterable>
        <el-option
            v-for="dict in storeOPtions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="会员ID" prop="userId">
        <el-input
          v-model="queryParams.userId"
          placeholder="请输入会员ID"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="订单号" prop="orderCode">
        <el-input
          v-model="queryParams.orderCode"
          placeholder="请输入订单号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="员工姓名" prop="companyUserNickName">
        <el-input
        style="width:220px"
          v-model="queryParams.companyUserNickName"
          placeholder="请输入员工姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物流状态" prop="deliveryStatus">
        <el-select  style="width:220px" v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
        <el-option
                v-for="item in deliveryStatusOptions"
                :key="item.dictValue"
                :label="item.dictLabel"
                :value="item.dictValue"
              />
        </el-select>
      </el-form-item>
      <el-form-item label="结算状态" prop="deliveryPayStatus">
        <el-select style="width:220px" v-model="queryParams.deliveryPayStatus" placeholder="请选择物流结算状态" clearable size="small" >
        <el-option
                v-for="item in deliveryPayStatusOptions"
                :key="item.dictValue"
                :label="item.dictLabel"
                :value="item.dictValue"
              />
        </el-select>
      </el-form-item>
      <el-form-item label="收货人" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="请输入收货人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="电话" prop="userPhone">
        <el-input
          v-model="queryParams.userPhone"
          placeholder="请输入收货人电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="加密号码" prop="userPhoneMk">
        <el-input
          v-model="queryParams.userPhoneMk"
          placeholder="请输入收货人电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="套餐名称" prop="packageSecondName">
        <el-input
          v-model="queryParams.packageSecondName"
          placeholder="请输入套餐别名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否首次进线" prop="isFirst">
        <el-select filterable v-model="queryParams.isFirst" placeholder="状态" clearable size="small">
                <el-option
                  v-for="dict in orOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                />
              </el-select>
      </el-form-item>
      <el-form-item label="医生姓名" prop="doctorName">
        <el-input
          v-model="queryParams.doctorName"
          placeholder="请输入医生姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
	  <el-form-item label="订单来源" prop="source">
	  	  <el-select v-model="queryParams.source" placeholder="请选择订单来源" clearable size="small">
	  	    <el-option
	  	      v-for="dict in sourceOptions"
	  	      :key="dict.dictValue"
	  	      :label="dict.dictLabel"
	  	      :value="dict.dictValue"
	  	    />
	  	  </el-select>
	  	</el-form-item>
      <el-form-item label="患者姓名" prop="patientName">
        <el-input
          v-model="queryParams.patientName"
          placeholder="请输入患者姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="订单类型" prop="orderType">
        <el-select v-model="queryParams.orderType" placeholder="状态" clearable size="small">
                <el-option
                  v-for="dict in orderTypeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                />
              </el-select>
      </el-form-item>
      <el-form-item label="支付方式" prop="payType">
         <el-select  multiple  v-model="payTypeArr" placeholder="请选择支付方式" clearable size="small" >
         <el-option
                v-for="item in PayOptions"
                :key="'type'+item.dictValue"
                :label="item.dictLabel"
                :value="item.dictValue"
              />
        </el-select>
      </el-form-item>

      <el-form-item label="快递单号" prop="deliverySn">
        <el-input
          v-model="queryParams.deliverySn"
          placeholder="请输入快递单号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="档期归属" prop="scheduleId"  >
            <el-select multiple filterable style="width: 200px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
              <el-option
                      v-for="item in scheduleOptions"
                      :key="'scheduleId'+item.id"
                      :label="item.name"
                      :value="item.id"
                    />
            </el-select>
        </el-form-item>
        <el-form-item label="订单购买类型" prop="orderBuyType">
         <el-select multiple filterable style="width: 200px" v-model="buyTypeArr" placeholder="请选择购买类型" clearable size="small" >
         <el-option
                v-for="item in orderBuyTypeOptions"
                :key="'bugType'+item.dictValue"
                :label="item.dictLabel"
                :value="item.dictValue"
              />
        </el-select>
      </el-form-item>
      <el-form-item label="渠道" prop="channel">
         <el-select multiple filterable style="width: 200px" v-model="channelArr" placeholder="请选择渠道" clearable size="small" >
          <el-option
            v-for="item in channelOptions"
            :key="'channel'+item.dictValue"
            :label="item.dictLabel"
            :value="item.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="企微主体" prop="qwSubject">
         <el-select multiple filterable style="width: 200px" v-model="qwSubjectArr" placeholder="请选择企微主体" clearable size="small" >
          <el-option
            v-for="item in qwSubjectOptions"
            :key="'qwSubject'+item.dictValue"
            :label="item.dictLabel"
            :value="item.dictValue"
          />
        </el-select>
      </el-form-item>
    <el-form-item label="下单时间" prop="createTime">
           <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
    </el-form-item>
    <el-form-item label="支付时间" prop="payTime">
           <el-date-picker v-model="payTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changePayTime"></el-date-picker>
    </el-form-item>
	
	<el-form-item label="发货时间" prop="deliverySendTime">
	      <el-date-picker v-model="deliverySendTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
	</el-form-item>
	
	<el-form-item label="入账时间" prop="tuiMoneyTime">
	      <el-date-picker v-model="tuiMoneyTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
	</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>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">

        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['his:storeOrder:myExport']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
      <el-tab-pane label="全部订单" name="10"></el-tab-pane>
      <el-tab-pane v-for="(item,index) in orderOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
    </el-tabs>
    <el-table height="450" v-loading="loading" border :data="orderList" @selection-change="handleSelectionChange" >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="药品订单号" align="center" prop="orderCode" width="180px"/>
      <el-table-column label="所属公司" align="center" prop="companyName" />
      <el-table-column label="员工" align="center" prop="companyUserName" />
      <el-table-column label="就诊人" align="center" prop="patientName" />
      <el-table-column label="收货人" align="center" prop="userName" />
      <el-table-column label="套餐名称" align="center" prop="packageName" />
      <el-table-column label="套餐别名" align="center" prop="packageSecondName" />
      <el-table-column label="应收金额" align="center" prop="payPrice" />
      <el-table-column label="实收金额" align="center" prop="payMoney" />
      <el-table-column label="支付方式" align="center" prop="payType" >
        <template slot-scope="scope">
              <dict-tag :options="PayOptions" :value="scope.row.payType"/>
         </template>
      </el-table-column>
		<el-table-column label="订单来源" align="center" prop="source" >
				  <template slot-scope="scope">
				     <dict-tag :options="sourceOptions" :value="scope.row.source"/>
				  </template>
				</el-table-column>
        <el-table-column label="下单时间" align="center" prop="createTime" width="180" />
        <el-table-column label="支付时间" align="center" prop="payTime" width="180" />
        <el-table-column label="订单状态" align="center" prop="status" >
          <template slot-scope="scope">
                <dict-tag :options="orderOptions" :value="scope.row.status"/>
           </template>
        </el-table-column>
     <el-table-column label="物流状态" align="center" prop="deliveryStatus" >
       <template slot-scope="scope">
             <dict-tag :options="deliveryStatusOptions" :value="scope.row.deliveryStatus"/>
        </template>
     </el-table-column>
    <el-table-column label="结算状态" align="center" prop="deliveryPayStatus" >
      <template slot-scope="scope">
            <dict-tag :options="deliveryPayStatusOptions" :value="scope.row.deliveryPayStatus"/>
       </template>
    </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="100px">
      <template slot-scope="scope">
          <el-button
              size="mini"
              type="text"
              v-hasPermi="['store:storeOrder:query']"
              @click="handledetails(scope.row)"
            >查看
            </el-button>
      </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
   <el-drawer
        :with-header="false"
        size="75%"
         :title="show.title" :visible.sync="show.open">
     <storeOrderDetails  ref="Details" />
   </el-drawer>
  </div>
</template>

<script>
import { listOrder,myListOrder, getOrder, delOrder, addOrder, updateOrder, exportOrder,importTemplate ,myExportOrder} from "@/api/store/storeOrder";
import storeOrderDetails from '../components/storeOrderDetails.vue';
import { getTcmScheduleList } from "@/api/company/tcmScheduleReport";
import { getTask } from "@/api/common";
import {listStore} from "@/api/store/storeProduct";
export default {
  name: "Order",
  components: { storeOrderDetails },
  data() {
    return {
      actName:"10",
      show:{
              title:"订单详情",
              open:false,
            },
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
	  deliveryImportTime:null,
	  deliverySendTime:null,
	  tuiMoneyTime:null,
	  sourceOptions:[],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 订单表格数据
      orderList: [],
      scheduleIdArr:[],
      buyTypeArr:[],
      // 弹出层标题
      title: "",
      createTime:null,
      payTime:null,
      // 是否显示弹出层
      open: false,
      // 查询参数
     queryParams: {
       pageNum: 1,
       pageSize: 10,
       storeId: null,
       orderCode: null,
       userId: null,
       userName: null,
       userPhone: null,
       userPhoneMk: null,
       userAddress: null,
       cartId: null,
       totalNum: null,
       totalPrice: null,
       payPrice: null,
       payMoney: null,
       isPay: null,
       payTime: null,
       payType: null,
       status: null,
       refundStatus: null,
       refundImg: null,
       refundExplain: null,
       refundTime: null,
       refundReason: null,
       refundMoney: null,
       deliveryCode: null,
       deliveryName: null,
       deliverySn: null,
       isDel: null,
       costPrice: null,
       verifyCode: null,
       shippingType: null,
       isChannel: null,
       isPrescribe: null,
       prescribeId: null,
       finishTime: null,
       patientName: null,
       doctorName: null,
       sTime:null,
       eTime:null,
       paysTime:null,
       payeTime:null,
       deliveryTime: null,
       tuiMoney: null,
       tuiMoneyStatus: null,
       tuisTime:null,
       tuieTime:null,
       tuiUserId: null,
       orderCreateType: null,
       companyUserName:null,
       companyName:null,
       packageSecondName:null,
       isFirst:null,
     		source:null,
     },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      channelArr:[],
      qwSubjectArr:[],
       payTypeArr:[],
       PayOptions:[],
       orderOptions:[],
       payStatusOptions:[],
       refundOptions:[],
       channelOptions:[],
       qwSubjectOptions:[],
       orderTypeOptions:[],
       tuiOptions:[],
       orOptions:[],
       storeOPtions:[],
       deliveryPayStatusOptions:[],
       deliveryStatusOptions:[],
       orderBuyTypeOptions:[],
       scheduleOptions:[],
    };
  },
  created() {
    this.getstoreList();
    this.getList();
    getTcmScheduleList().then(response => {
        this.scheduleOptions = response.data;
        this.scheduleOptions.push({id: "-1",
            name: "无"})
      });
    this.getDicts("sys_store_order_buy_type").then(response => {
        this.orderBuyTypeOptions = response.data;
        this.orderBuyTypeOptions.push({dictLabel: "无",
            dictValue: "-1"})
      });
	  this.getDicts("sys_order_source").then(response => {
	  	  this.sourceOptions = response.data;
	  	});
    this.getDicts("sys_store_pay_type").then(response => {
        this.PayOptions = response.data;
      });
    this.getDicts("sys_inquiry_pay").then(response => {
        this.PayOptions = response.data;
      });
    this.getDicts("store_order_type").then(response => {
        this.orderTypeOptions = response.data;
      });
    this.getDicts("sys_order_status").then(response => {
        this.orderOptions = response.data;
      });
    this.getDicts("sys_order_pay").then(response => {
        this.payStatusOptions = response.data;
      });
    this.getDicts("sys_refund_status").then(response => {
        this.refundOptions = response.data;
      });
    this.getDicts("sys_store_channel").then(response => {
      this.channelOptions = response.data;
      this.channelOptions.push({dictLabel: "无",
            dictValue: "-1"})
    });
    this.getDicts("sys_store_qw_subject").then(response => {
      this.qwSubjectOptions = response.data;
      this.qwSubjectOptions.push({dictLabel: "无",
            dictValue: "-1"})
      });
    this.getDicts("sys_tui_money_status").then(response => {
          this.tuiOptions = response.data;
        });
    this.getDicts("sys_company_or").then(response => {
          this.orOptions = response.data;
        });
    this.getDicts("sys_store_delivery_pay_status").then(response => {
          this.deliveryPayStatusOptions = response.data;
        });
    this.getDicts("sys_store_order_delivery_status").then(response => {
          this.deliveryStatusOptions = response.data;
        });


  },
  methods: {
    /** 导入按钮操作 */
    handleImport() {
        this.upload.title = "商品导入";
        this.upload.open = true;
       },

      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        this.upload.open = false;
        this.upload.isUploading = false;
        this.$refs.upload.clearFiles();
        this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
        this.getList();
      },
      // 提交上传文件
      submitFileForm() {
        this.$refs.upload.submit();
      },
    handledetails(row){
        this.show.open=true;
        setTimeout(() => {
             this.$refs.Details.getDetails(row.orderId,row.nickName,row.storeName);
        }, 1);
        },
    getstoreList() {
      listStore().then(response => {
        this.storeOPtions = response.rows;
      });
    },
    /** 查询订单列表 */
    getList() {
      this.loading = true;
      if(this.payTypeArr.length>0){
        this.queryParams.payType=this.payTypeArr.toString();
      }
      else{
        this.queryParams.payType=null
      }
      if(this.scheduleIdArr.length>0){
        this.queryParams.scheduleId=this.scheduleIdArr.toString();
      }
      else{
        this.queryParams.scheduleId=null
      }
      if(this.buyTypeArr.length>0){
        this.queryParams.orderBuyType=this.buyTypeArr.toString();
      }
      else{
        this.queryParams.orderbuyType=null
      }
      if(this.channelArr.length>0){
        this.queryParams.orderChannel=this.channelArr.toString();
      }
      else{
        this.queryParams.orderChannel=null
      }
      if(this.qwSubjectArr.length>0){
        this.queryParams.qwSubject=this.qwSubjectArr.toString();
      }
      else{
        this.queryParams.qwSubject=null
      }
      myListOrder(this.queryParams).then(response => {
        this.orderList = response.rows;
        this.total = response.total;
        this.loading = false;
      });

    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
        storeId: null,
        orderCode: null,
        userId: null,
        userName: null,
        userPhone: null,
        userAddress: null,
        cartId: null,
        totalNum: null,
        totalPrice: null,
        payPrice: null,
        payMoney: null,
        isPay: null,
        payTime: null,
        payType: null,
        createTime: null,
        updateTime: null,
        status: null,
        refundStatus: "0",
        refundImg: null,
        refundExplain: null,
        refundTime: null,
        refundReason: null,
        refundMoney: null,
        deliveryCode: null,
        deliveryName: null,
        deliverySn: null,
        remark: null,
        isDel: null,
        costPrice: null,
        verifyCode: null,
        shippingType: null,
        isChannel: null,
        isPrescribe: null,
        prescribeId: null,
        finishTime: null,
        deliveryTime: null,
        tuiMoney: null,
        tuiMoneyStatus: 0,
        tuiUserId: null,
        orderCreateType: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
   handleClickX(tab, event) {
    if(tab.name=="10"){
      this.queryParams.status=null;
    }else{
      this.queryParams.status=tab.name;
    }
     this.handleQuery();
   },
  changeTime(){
        if(this.createTime!=null){
          this.queryParams.sTime=this.createTime[0];
          this.queryParams.eTime=this.createTime[1];
        }else{
          this.queryParams.sTime=null;
          this.queryParams.eTime=null;
        }
        if(this.deliverySendTime!=null){
          this.queryParams.deliverySendsTime=this.deliverySendTime[0];
          this.queryParams.deliverySendeTime=this.deliverySendTime[1];
        }else{
          this.queryParams.deliverySendsTime=null;
          this.queryParams.deliverySendeTime=null;
        }
        if(this.deliveryImportTime!=null){
          this.queryParams.deliveryImportsTime=this.deliveryImportTime[0];
          this.queryParams.deliveryImporteTime=this.deliveryImportTime[1];
        }else{
          this.queryParams.deliveryImportsTime=null;
          this.queryParams.deliveryImporteTime=null;
        }
        if(this.tuiMoneyTime!=null){
          this.queryParams.tuisTime=this.tuiMoneyTime[0];
          this.queryParams.tuieTime=this.tuiMoneyTime[1];
        }else{
          this.queryParams.tuisTime=null;
          this.queryParams.tuieTime=null;
        }

      },
  changePayTime(){
      if(this.payTime!=null){
        this.queryParams.sTime=this.payTime[0];
        this.queryParams.eTime=this.payTime[1];
      }else{
        this.queryParams.paysTime=null;
        this.queryParams.payeTime=null;
      }

    },


    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
       this.createTime=null;
      this.queryParams.sTime=null;
      this.queryParams.eTime=null;
       this.payTime=null;
      this.queryParams.paysTime=null;
      this.queryParams.payeTime=null;
      this.queryParams.deliveryImportTime = null;
      this.queryParams.deliveryImportsTime = null;
      this.queryParams.deliveryImporteTime = null;
      this.queryParams.deliverySendTime = null;
      this.queryParams.deliverySendsTime = null;
      this.queryParams.deliverySendeTime = null;
      this.queryParams.tuisTIme = null;
      this.queryParams.tuieTIme = null;
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.orderId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加订单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const orderId = row.orderId || this.ids
      getOrder(orderId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改订单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.orderId != null) {
            updateOrder(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addOrder(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const orderIds = row.orderId || this.ids;
      this.$confirm('是否确认删除订单编号为"' + orderIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delOrder(orderIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
		var that=this;
      if(this.payTypeArr.length>0){
        this.queryParams.payType=this.payTypeArr.toString();
      }
      else{
        this.queryParams.payType=null
      }
      if(this.scheduleIdArr.length>0){
        this.queryParams.scheduleId=this.scheduleIdArr.toString();
      }
      else{
        this.queryParams.scheduleId=null
      }
      if(this.buyTypeArr.length>0){
        this.queryParams.orderBuyType=this.buyTypeArr.toString();
      }
      else{
        this.queryParams.orderbuyType=null
      }
      if(this.channelArr.length>0){
        this.queryParams.orderChannel=this.channelArr.toString();
      }
      else{
        this.queryParams.orderChannel=null
      }
      if(this.qwSubjectArr.length>0){
        this.queryParams.qwSubject=this.qwSubjectArr.toString();
      }
      else{
        this.queryParams.qwSubject=null
      }
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有订单数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return myExportOrder(queryParams);
        }).then(response => {

          if(response.code==200){
          that.msgSuccess(response.msg);
          that.taskId=response.data;
          that.time=setInterval(function(){
            //查订单
            getTask(that.taskId).then(res => {
              if(res.data.status==1){
                that.exportLoading = false;
                clearTimeout(that.time)
                that.time=null;
                that.download(res.data.fileUrl);
              }
            });
          },10000);
        }
        }).catch(() => {});
    }
  }
};
</script>
