<!-- 
  TODO 客户业务 / 客户总账-界面
 -->
<template>
  <el-main class="usermoneysum-list">
    <el-form
      class="el-search-form"
      :model="listParm"
      label-width="80px"
      :inline="true"
    >
      <el-form-item class="item-search">
        <BaseSelect
          v-model:modelValue="listParm.customerId"
          :options="stateUserMoneySumList.customertList"
          placeholder="客户"
          clearable
        />
      </el-form-item>
      <el-form-item class="item-search">
        <BaseSelect
          v-model:modelValue="listParm.currencyCode"
          :options="stateUserMoneySumList.currencyList"
          placeholder="币种"
          clearable
        />
      </el-form-item>
      <el-form-item class="item-search">
        <BaseSelect
          v-model:modelValue="listParm.isInterceptCustomers"
          :options="stateUserMoneySumList.isInterceptCustomersList"
          placeholder="是否拦截"
          :filterable="false"
          clearable
        />
      </el-form-item>
      <el-form-item class="item-search">
        <BaseSelect
          v-model:modelValue="listParm.status"
          :options="stateUserMoneySumList.statusList"
          :clearable="true"
          :filterable="false"
          placeholder="状态"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          :loading="stateUserMoneySumList.loading"
          :icon="Search"
          @click="searchBtn"
        >
          搜索
        </el-button>
        <el-button
          :loading="stateUserMoneySumList.loading"
          class="reset-btn"
          :icon="RefreshRight"
          @click="resetBtn"
        >
          重置
        </el-button>
        <el-button
          v-permission="['sys:userMoneyDetail:recharge']"
          type="success"
          :icon="Money"
          plain
          @click="hanleRecharge"
        >
          充值
        </el-button>
        <el-button
          v-permission="['sys:customerSumMoney:download']"
          plain
          type="primary"
          :icon="Download"
          :loading="downloadUserMoneyLoading"
          @click="onDownloadUserMoney"
        >
          导出
        </el-button>
      </el-form-item>
    </el-form>
    <!-- 列表 -->
    <VxeBasicTable
      v-bind="moneySumListOptions"
      ref="moneySumListTableRef"
    >
      <template #isInterceptCustomers="{ row }">
        <el-tag :type="row.isInterceptCustomers ? 'danger' : ''">
          {{ row.isInterceptCustomers ? '是' : '否' }}
        </el-tag>
      </template>
      <!-- <template #customerId="{ row }">
        {{ dealListIitemToName(row.customerId, customertList) }}
      </template> -->
      <!-- 操作 -->
      <template #actions="{ row }">
        <!-- <el-button
          size="small"
          type="primary"
          @click="handleGoDetail(row)"
        >
          明细
        </el-button> -->
        <DropDownButtons
          :model-value="row"
          :action-options="actionOptions"
          @click-change="handleClickChange"
        />
      </template>
    </VxeBasicTable>
    <el-pagination
      v-model:current-page="listParm.pageNum"
      :page-sizes="[10, 20, 40, 80, 100]"
      :page-size="listParm.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="listParm.total"
      background
      @size-change="sizeChange"
      @current-change="currentChange"
    />
  </el-main>
  <!-- <UserMoneySumDetail
    ref="userMoneySumDetailRef"
    :customert-list="customertList"
    :currency-list="currencyList"
    :customer-type-list="customerTypeList"
    :operating-type-list="operatingTypeList"
    :fee-data-type-list="feeDataTypeList"
    :branch-company-customers="branchCompanyCustomers"
    :country-list="countryList"
    :product-list="productList"
    :package-type-list="packageTypeList"
    :report-model-type-list="reportModelTypeList"
    :report-query-date-type-list="reportQueryDateTypeList"
  /> -->
  <AddRechargeAdd
    ref="rechargeAddRef"
    :customert-list="customertList"
    :currency-list="currencyList"
    :branch-company-customers="branchCompanyCustomers"
    :all-payment-platform-list="allPaymentPlatformList"
    @on-update-recharge="hanleUpdateRecharge"
  />
  <Rdfund
    ref="refundRef"
    @on-refund="onRefund"
  />
</template>
<script lang="ts" setup name="userMoneySum">
import {
  Search,
  RefreshRight,
  Money,
  Download
} from "@element-plus/icons-vue";
import BaseSelect from '@/components/QuerySelect/BaseSelect.vue';
import DropDownButtons from '@/components/DropDownButtons/index.vue';
import { userMoneySumList, userMoneySumListModel } from '@/composables/userMoneySumList/userMoneySumList';
// import UserMoneySumDetail from './UserMoneySumDetail.vue';
// import { dealListIitemToName } from "@/utils/dealData";
import AddRechargeAdd from '@/views/recharge/AddRechargeAdd.vue';
import Rdfund from '@/views/recharge/Rdfund.vue';
import { VxeBasicTable } from "@/components/VxeTable";
import { useInitTableHeight } from "@/hooks/useInitTableHeight";

const { moneySumListOptions, actionOptions } = userMoneySumListModel()
//   初始化表格高度
useInitTableHeight(moneySumListOptions);
const { 
  listParm, 
  stateUserMoneySumList,
  refundRef,
  rechargeAddRef,
  hanleUpdateRecharge,
  sizeChange, 
  currentChange, 
  searchBtn, 
  resetBtn, 
  handleGoDetail,
  downloadUserMoneyLoading,
  hanleRecharge,
  onDownloadUserMoney,
  handleClickChange,
  customertList, 
  currencyList,
  branchCompanyCustomers,
  allPaymentPlatformList,
  onRefund
} = userMoneySumList(moneySumListOptions)
</script>
<style lang="scss" scoped>
.usermoneysum-list {
}
</style>