<template>
  <page-header-wrapper>
    <a-card>
      <JeepaySearchForm :searchFunc="searchFunc" :resetFunc="onReset">
        <a-form-item label="" class="table-search-item">
          <JeepayDateRangePicker ref="dateRangePicker" v-model:value="vdata.searchData['queryDateRange']" customDateRangeType="dateTime" />
        </a-form-item>
        <jeepay-text-up v-model:value="vdata.searchData.unionOrderId" :placeholder="'订单号'" />

        <jeepay-text-up v-model:value="vdata.searchData.mchInfo" :placeholder="'商户名称/商户号'" />
        <jeepay-text-up v-model:value="vdata.searchData.storeInfo" :placeholder="'门店名称/门店编号'" />
        <jeepay-text-up v-model:value="vdata.searchData.ifCode" :placeholder="'支付通道'" />
        <jeepay-text-up v-model:value="vdata.searchData.isvNo" :placeholder="'渠道名称/渠道号'" />
        <jeepay-text-up v-model:value="vdata.searchData.appId" :placeholder="'应用名称/应用ID'" />
        <a-form-item label="" class="table-search-item">
          <a-select v-model:value="vdata.searchData.state" placeholder="退款状态">
            <a-select-option value="">全部</a-select-option>
            <a-select-option value="0">订单生成</a-select-option>
            <a-select-option value="1">退款中</a-select-option>
            <a-select-option value="2">退款成功</a-select-option>
            <a-select-option value="3">退款失败</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item label="" class="table-search-item">
          <a-select v-model:value="vdata.searchData.refundType" placeholder="退款类型">
            <a-select-option value="">全部</a-select-option>
            <a-select-option value="1">全额退款</a-select-option>
            <a-select-option value="2">部分退款</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item label="" class="table-search-item">
          <a-select v-model:value="vdata.searchData.extParam" placeholder="退款模式">
            <a-select-option value="">全部</a-select-option>
            <a-select-option value="1">收款商户号</a-select-option>
            <a-select-option value="2">退款专用账户</a-select-option>
          </a-select>
        </a-form-item>
<!--        <a-form-item label="" class="table-search-item">-->
<!--          <a-select v-model:value="vdata.searchData.ifCode" placeholder="支付通道">-->

<!--            <a-select-option  v-for="item in vdata.payDefines" :key="item.ifCode" :value="item.ifCode">{{ item.ifName }}</a-select-option>-->
<!--          </a-select>-->
<!--        </a-form-item>-->
      </JeepaySearchForm>

      <!-- 列表渲染 -->
      <JeepayTable
        ref="infoTable"
        :initData="true"
        :closable="true"
        :searchData="vdata.searchData"
        :reqTableDataFunc="reqTableDataFunc"
        :tableColumns="tableColumns"
        rowKey="refundOrderId"
        :tableRowCrossColor="true"
        :statisticsIsShow="true"
        :tableExportFunc="tableExportFunc"
        @btnLoadClose="vdata.btnLoading=false"
      >
        <template #statistics>
          <div class="statistics-list">
            <div v-for="(item, index) in orderCountList" :key="index" class="item">
              <div v-if="item.type == 'line'" class="line" />
              <div class="title">{{ item.title }}</div>
              <div v-if="item.title" class="amount" :style="{color: item.textColor}">
                <!-- <span v-if="item.symbol" class="symbol">{{ item.symbol == 'add' ? '+' : '-' }}</span> -->
                <span class="amount-num">{{ item.content }}</span>{{ item.unit?item.unit:'元' }}
              </div>
              <div v-if="item.title" class="amount" >
                <!-- <span v-if="item.symbol" class="symbol">{{ item.symbol == 'add' ? '+' : '-' }}</span> -->
                <span class="amount-num">{{ item.num }}</span>笔
              </div>
            </div>
          </div>
        </template>
        <template #bodyCell="{column,record}">
<!--          <template v-if="column.key == 'payAmount'"><b>￥{{ record.payAmount/100 }}</b></template>-->
          <template v-if="column.key == 'refundAmount'">
            <a-tooltip>
              <template #title>
                <p>退款金额：￥{{ record.payAmount/100 }}</p>
                <p>手续费退还金额：￥{{ record.refundFeeAmount/100 }}</p>
              </template>
              <b style="color: #1890ff">￥{{ record.refundAmount/100 }}</b>
            </a-tooltip>
          </template>
<!--          <template v-if="column.key == 'refundFeeAmount'"><b>￥{{ record.refundFeeAmount/100 }}</b></template>-->
          <template v-if="column.key == 'state'">
            <div>
              <a-tag
                :key="record.state"
                :color="record.state === 0?'blue':record.state === 1?'orange':record.state === 2?'green':'volcano'"
              >
                {{ record.state === 0?'订单生成':record.state === 1?'退款中':record.state === 2?'退款成功':record.state === 3?'退款失败':record.state === 4?'任务关闭':'未知' }}
              </a-tag>
              <a-tooltip  :title="record.errMsg" v-if="record.state == 3">
                <question-circle-outlined style="color: #FF0000;"/>
              </a-tooltip>
              <a-tooltip  title="快钱通道部分退款类型的退款金额将于第二个工作日凌晨4-5点到账" v-if="record.ifCode == 'kqpay' && record.state==2 && record.refundType ==2">
                <question-circle-outlined style="color: #FF0000;"/>
              </a-tooltip>
            </div>


          </template>
          <template v-if="column.key == 'refundType'">
            <div>
              <a-tag
                  :key="record.state"
                  :color="record.refundType === 0?'blue':record.refundType === 1?'red':record.refundType === 2?'orange':'volcano'"
              >
                {{ record.refundType === 1?'全额退款':record.refundType === 2?'部分退款':'' }}
              </a-tag>
            </div>
          </template>

          <template v-if="column.key == 'extParam'">
            <div>
              <a-tag
                  :key="record.extParam"
                  :color="record.extParam === '1'?'blue':record.extParam === '2'?'orange':''"
              >
                {{ record.extParam === "1"?'收款商户号':record.extParam === "2"?'退款专用账户':'' }}
              </a-tag>
            </div>
          </template>


          <template v-if="column.key === 'appId'">
            <a-tooltip  class="my-tooltip" overlayClassName="tooltip-box-name">
              <template #title>
                <span>应用名称：{{record.appName}}</span><br>
                <span>应用ID：{{record.appId}}</span>
              </template>
              <div class="my-tooltip-title-box"> {{record.appName}}</div>
            </a-tooltip>
          </template>
          <template v-if="column.key === 'mchName'">
            <a-tooltip  class="my-tooltip" overlayClassName="tooltip-box-name">
              <template #title>
                <span>商户名称：{{record.mchName}}</span><br>
                <span>商户号：{{record.mchExtNo}}</span>
              </template>
              <div class="my-tooltip-title-box"> {{record.mchName}}</div>
            </a-tooltip>
          </template>
          <template v-if="column.key === 'storeName'">
            <a-tooltip  class="my-tooltip" overlayClassName="tooltip-box-name">
              <template #title>
                <span>门店名称：{{record.storeName}}</span><br>
                <span>门店编号：{{record.storeId}}</span>
              </template>
              <div class="my-tooltip-title-box"> {{record.storeName}}</div>
            </a-tooltip>
          </template>
          <template v-if="column.key === 'isvName'">
            <a-tooltip  class="my-tooltip" overlayClassName="tooltip-box-name">
              <template #title>
                <span>渠道名称：{{record.isvName}}</span><br>
                <span>渠道号：{{record.isvNo}}</span>
              </template>
              <div class="my-tooltip-title-box"> {{record.isvName}}</div>
            </a-tooltip>
          </template>


          <template v-if="column.key == 'refund'">
<!--            <div class="order-list">-->
<!--              <p><span style="color:#729ED5;background:#e7f5f7">支付</span>{{ record.payOrderId }}</p>-->
<!--              <p v-if="record.channelPayOrderNo" style="margin-bottom: 0;">-->
<!--                <span style="color:#fff;background:#E09C4D">渠道</span>-->
<!--                <a-tooltip v-if="record.channelPayOrderNo.length > record.payOrderId.length" placement="bottom" style="font-weight: normal;">-->
<!--                  <template #title>-->
<!--                    <span>{{ record.channelPayOrderNo }}</span>-->
<!--                  </template>-->
<!--                  {{ changeStr2ellipsis(record.channelPayOrderNo, record.payOrderId.length) }}-->
<!--                </a-tooltip>-->
<!--                <span v-else style="font-weight: normal;">{{ record.channelPayOrderNo }}</span>-->
<!--              </p>-->
<!--            </div>-->
            <a-tooltip>
              <template #title>
                <p>渠道：{{ record.channelPayOrderNo }}</p>
              </template>
              <b style="color: #1890ff">{{ record.payOrderId }}</b>
            </a-tooltip>
          </template>
          <template v-if="column.key == 'pay'">
<!--            <a-tooltip>-->
<!--              <template #title>-->
<!--                <p>商户退款单号：{{ record.mchRefundNo }}</p>-->
<!--                <p>渠道退款单号：{{ record.channelPayOrderNo }}</p>-->
<!--                <p>订单号：{{ record.payOrderId }}</p>-->
<!--              </template>-->
<!--              <b style="color: #1890ff">{{ record.refundOrderId }}</b>-->
<!--            </a-tooltip>-->

            <a-popover placement="top">
              <template #content>
                <p>商户退款单号：{{ record.mchRefundNo }}</p>
                <p>渠道退款单号：{{ record.channelPayOrderNo }}</p>
                <p>平台订单号：{{ record.payOrderId }}</p>
              </template>
              <b style="color: #1890ff"> {{ record.refundOrderId??"--" }} </b>
            </a-popover>


<!--            <div class="order-list">-->
<!--              <p><span style="color:#729ED5;background:#e7f5f7">退款</span>{{ record.refundOrderId }}</p>-->
<!--              <p style="margin-bottom: 0;">-->
<!--                <span style="color:#56cf56;background:#d8eadf">商户</span>-->
<!--                <a-tooltip v-if="record.mchRefundNo.length > record.refundOrderId.length" placement="bottom" style="font-weight: normal;">-->
<!--                  <template #title>-->
<!--                    <span>{{ record.mchRefundNo }}</span>-->
<!--                  </template>-->
<!--                  {{ changeStr2ellipsis(record.mchRefundNo, record.refundOrderId.length) }}-->
<!--                </a-tooltip>-->
<!--                <span v-else style="font-weight: normal;">{{ record.mchRefundNo }}</span>-->
<!--              </p>-->
<!--            </div>-->
          </template>
          <template v-if="column.key == 'op'">
            <!-- 操作列插槽 -->
            <a-button v-if="$access('ENT_REFUND_ORDER_VIEW')" type="link" @click="detailFunc(record)">详情</a-button>
          </template>
        </template>
      </JeepayTable>
    </a-card>
    <!-- 日志详情抽屉 -->
<!--    <template>-->
<!--      <a-drawer-->
<!--        v-model:visible="vdata.visible"-->
<!--        width="50%"-->
<!--        placement="right"-->
<!--        :closable="true"-->
<!--        :title="vdata.visible === true? '退款订单详情':''"-->
<!--        @close="onClose"-->
<!--      >-->
<!--        <a-row justify="space-between" type="flex">-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="所属系统">-->
<!--                {{ vdata.detailData.mchType === 1?'普通商户':vdata.detailData.mchType === 2?'特约商户':'未知' }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="服务商号">-->
<!--                {{ vdata.detailData.isvNo }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="退款订单号">-->
<!--                <a-tag color="purple">-->
<!--                  {{ vdata.detailData.refundOrderId }}-->
<!--                </a-tag>-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="用户号">-->
<!--                {{ vdata.detailData.mchNo }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="支付订单号">-->
<!--                {{ vdata.detailData.payOrderId }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="商户退款单号">-->
<!--                {{ vdata.detailData.mchRefundNo }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="渠道支付订单号">-->
<!--                {{ vdata.detailData.channelPayOrderNo }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="应用APPID">-->
<!--                {{ vdata.detailData.appId }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="门店ID">-->
<!--                {{ vdata.detailData.storeId }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="名店名称">-->
<!--                {{ vdata.detailData.storeName }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="支付金额">-->
<!--                <a-tag color="green">-->
<!--                  {{ vdata.detailData.payAmount/100 }}-->
<!--                </a-tag>-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="退款金额">-->
<!--                <a-tag color="green">-->
<!--                  {{ vdata.detailData.refundAmount/100 }}-->
<!--                </a-tag>-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="手续费退还金额">-->
<!--                <a-tag color="green">-->
<!--                  {{ vdata.detailData.refundFeeAmount/100 }}-->
<!--                </a-tag>-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="订单状态">-->
<!--                <a-tag :color="vdata.detailData.state === 0?'blue':vdata.detailData.state === 1?'orange':vdata.detailData.state === 2?'green':'volcano'">-->
<!--                  {{ vdata.detailData.state === 0?'订单生成':vdata.detailData.state === 1?'退款中':vdata.detailData.state === 2?'退款成功':vdata.detailData.state === 3?'退款失败':vdata.detailData.state === 4?'任务关闭':'未知' }}-->
<!--                </a-tag>-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="24">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="退款成功时间">-->
<!--                {{ vdata.detailData.successTime }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="创建时间">-->
<!--                {{ vdata.detailData.createdAt }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="更新时间">-->
<!--                {{ vdata.detailData.updatedAt }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-divider />-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="接口代码">-->
<!--                {{ vdata.detailData.ifCode }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="货币代码">-->
<!--                {{ vdata.detailData.currency }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="方式代码">-->
<!--                {{ vdata.detailData.wayCode }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="12">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="客户端IP">-->
<!--                {{ vdata.detailData.clientIp }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--          <a-col :sm="24">-->
<!--            <a-descriptions>-->
<!--              <a-descriptions-item label="异步通知地址">-->
<!--                {{ vdata.detailData.notifyUrl }}-->
<!--              </a-descriptions-item>-->
<!--            </a-descriptions>-->
<!--          </a-col>-->
<!--        </a-row>-->
<!--        <a-divider />-->
<!--        <a-col :sm="12">-->
<!--          <a-descriptions>-->
<!--            <a-descriptions-item label="渠道订单号">-->
<!--              {{ vdata.detailData.channelOrderNo }}-->
<!--            </a-descriptions-item>-->
<!--          </a-descriptions>-->
<!--        </a-col>-->
<!--        <a-col :sm="12">-->
<!--          <a-descriptions>-->
<!--            <a-descriptions-item label="渠道错误码">-->
<!--              {{ vdata.detailData.errCode }}-->
<!--            </a-descriptions-item>-->
<!--          </a-descriptions>-->
<!--        </a-col>-->
<!--        <a-col :sm="12">-->
<!--          <a-descriptions>-->
<!--            <a-descriptions-item label="渠道错误描述">-->
<!--              {{ vdata.detailData.errMsg }}-->
<!--            </a-descriptions-item>-->
<!--          </a-descriptions>-->
<!--        </a-col>-->
<!--        <a-col :sm="24">-->
<!--          <span style="color: black;">渠道额外参数:</span>-->
<!--          <a-form-item>-->
<!--            <a-input-->
<!--              v-model:value="vdata.detailData.channelExtra"-->
<!--              type="textarea"-->
<!--              disabled="disabled"-->
<!--              style="height: 100px;color: black;margin-top: 10px;"-->
<!--            />-->
<!--          </a-form-item>-->
<!--        </a-col>-->
<!--        <a-divider />-->
<!--        <a-col :sm="24">-->
<!--          <span style="color: black;">扩展参数:</span>-->
<!--          <a-form-item>-->
<!--            <a-input-->
<!--              v-model:value="vdata.detailData.extParam"-->
<!--              type="textarea"-->
<!--              disabled="disabled"-->
<!--              style="height: 100px;color: black;margin-top: 10px;"-->
<!--            />-->
<!--          </a-form-item>-->
<!--        </a-col>-->
<!--        <a-col :sm="24">-->
<!--          <span style="color: black;">备注:</span>-->
<!--          <a-form-item>-->
<!--            <a-input-->
<!--              v-model:value="vdata.detailData.remark"-->
<!--              type="textarea"-->
<!--              disabled="disabled"-->
<!--              style="height: 100px;color: black;margin-top: 10px;"-->
<!--            />-->
<!--          </a-form-item>-->
<!--        </a-col>-->
<!--      </a-drawer>-->
<!--    </template>-->
  </page-header-wrapper>

  <RefundDetail ref="refundDetail"  />
</template>
<script lang="ts" setup>
import {
  API_URL_REFUND_ORDER_LIST,
  req,
  $exportExcel,
  exportExcelUrl,
  $refundOrderCount,
  API_MCH_PAY_DEFINES
} from '@/api/manage'
  import moment from 'moment'
  import fileDownload from 'js-file-download'
  import {ref, onMounted, reactive, getCurrentInstance} from 'vue'
import {useRoute} from "vue-router";
import RefundDetail from "@/views/order/refund/RefundDetail.vue";
const refundDetail = ref() // 对话框
  // 获取全局函数
  const { $infoBox,$access } = getCurrentInstance()!.appContext.config.globalProperties

  // eslint-disable-next-line no-unused-vars
  const tableColumns = reactive([
    // { key: 'pay', title: '退款订单号', scopedSlots: { customRender: 'refundOrderSlot' } },
    { key: 'pay', title: '退款订单号' },
    { key: 'mchName', title: '商户名称', dataIndex: 'mchName' },
    { key: 'storeName', title: '门店名称', dataIndex: 'storeName' },
    // { key: 'refund', title: '支付订单号', scopedSlots: { customRender: 'payOrderSlot' }, width: '260px' },
    { key: 'ifName', title: '支付通道', dataIndex: 'ifName',},
    { key: 'isvName', title: '所属渠道', dataIndex: 'isvName' },
    // { key: 'payAmount', title: '支付金额' },
    { key: 'refundAmount', title: '退款金额(元)' },
    // { key: 'refundFeeAmount', title: '手续费退还金额' },
    // { key: 'refundOrderId', title: '退款订单号', dataIndex: 'refundOrderId' },
    // { key: 'mchRefundNo', title: '商户退款单号', dataIndex: 'mchRefundNo' },
    // { key: 'payOrderId', title: '支付订单号', dataIndex: 'payOrderId' },
    // { key: 'channelPayOrderNo', title: '渠道订单号', dataIndex: 'channelPayOrderNo' },
    { key: 'state', title: '退款状态', scopedSlots: { customRender: 'stateSlot' } },
    { key: 'appId', title: '所属应用', dataIndex: 'appId' },
    { key: 'refundType', title: '退款类型', scopedSlots: { customRender: 'stateSlot' } },
    { key: 'extParam', title: '退款模式' },
    { key: 'createdAt', dataIndex: 'createdAt', title: '创建日期' },
    { key: 'op', title: '操作', width: '100px', fixed: 'right', align: 'center', scopedSlots: { customRender: 'opSlot' } }
  ])


  const infoTable = ref()
  const dateRangePicker = ref()

  const vdata =  reactive({
    payDefines: [] as any,
    btnLoading: false,
    tableColumns: tableColumns,
    searchData: {queryDateRange: 'today'} as any,
    createdStart: '', // 选择开始时间
    createdEnd: '', // 选择结束时间
    visible: false,
    detailData: {} as any
  })

  onMounted( () => {
    getOrderCount()
    payFefines();
    if(useRoute().query.payOrderId !== undefined){
      vdata.searchData.unionOrderId = useRoute().query.payOrderId
      vdata.searchData.queryDateRange = ''

      setTimeout(function (){
        searchFunc()
      },500)
    }
  })
//通道
function  payFefines() {
  req.list(API_MCH_PAY_DEFINES,{ 'pageSize': -1 }).then(res => {
    vdata.payDefines = res
  })
}

  let orderCountList:any = ref([]) // 数据统计数组
  // 数据统计
  const getOrderCount = () => {

    // if(!$access('ENT_REFUND_ORDER_COUNT')){
    //   return false
    // }

    $refundOrderCount(vdata.searchData).then( res => {
      orderCountList.value = [
        {title: '退款金额', symbol: 'add', textColor: '#1A66FF', content: (res.allCountAmount / 100).toFixed(2), num:res.allCount },
        {type: 'line'},
        {title: '退款成功金额',symbol: 'add', textColor: '#389e0d',content: (res.succesAmount / 100).toFixed(2),  num:res.succesCount },
        {type: 'line'},
        {title: '手续费退款金额',symbol: 'add',textColor: '#FF0000', content: (res.feeAmount / 100).toFixed(2),  num:res.feeCount},
      ]
    })
  }

  function queryFunc () {
    vdata.btnLoading = true
    infoTable.value.refTable(true)
  }
  // 请求table接口数据
  function reqTableDataFunc(params){
    return req.list(API_URL_REFUND_ORDER_LIST, params)
  }
  function searchFunc() { // 点击【查询】按钮点击事件
    infoTable.value.refTable(true)
    getOrderCount()
  }
  function detailFunc(record) {
    refundDetail.value.show(record)
    // req.getById(API_URL_REFUND_ORDER_LIST, record.refundOrderId).then(res => {
    //   vdata.detailData = res
    //   console.log(res,'res')
    // })
    vdata.visible = true
  }

  function onClose () {
    vdata.visible = false
  }
  function changeStr2ellipsis (orderNo, baseLength) {
    const halfLengh = baseLength / 2
    return orderNo.substring(0, halfLengh - 1) + '...' + orderNo.substring(orderNo.length - halfLengh, orderNo.length)
  }

  function tableExportFunc(){
    return $exportExcel(exportExcelUrl.refundOrder, Object.assign({}, vdata.searchData, {'pageSize': -1})).then(res => {
        fileDownload(res.data, '退款订单.xlsx')
    }).catch ((error) =>{console.log(error)} )
  }

  function onReset(){
    //重置搜索内容
    dateRangePicker.value.returnSelectModel()
    vdata.searchData = { queryDateRange: 'today' }
  }
</script>
<style lang="less" scoped>
.order-list {
  -webkit-text-size-adjust:none;
  font-size: 12px;
  display: flex;
  flex-direction: column;

  p {
    white-space:nowrap;
    span {
      display: inline-block;
      font-weight: 800;
      height: 16px;
      line-height: 16px;
      width: 35px;
      border-radius: 5px;
      text-align: center;
      margin-right: 2px;
    }
  }
}
</style>
