| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
- <cwg-header :title="t('Home.page_ib.item7')" />
- <view class="account-content">
- <view class="search-content">
- <view class="search-bar">
- <cwg-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch"
- @reset="handleReset" />
- </view>
- <view />
- </view>
- <cwg-tabel
- ref="tableRef"
- :columns="columns"
- :mobilePrimaryFields="mobilePrimaryFields"
- :queryParams="search"
- :api="listApi"
- :show-operation="true"
- :showPagination="true"
- >
- <template #remitChannelName="{row}">
- <text>
- {{
- isZh ? row.remitChannelName || '--' : row.remitChannelEnName || '--'
- }}
- </text>
- </template>
- <template #status="{row}">
- <text v-if="row.status == 1">
- {{ t('State.ToBeProcessed') }}
- </text>
- <text v-if="row.status == 2&&row.submitStatus == 2">
- {{ t('State.Completed') }}
- </text>
- <text v-if="row.status == 2&&row.submitStatus != 2">
- {{ t('State.InTheProcessing') }}
- </text>
- <text v-if="row.status == 3 || row.callbackStatus == 2">
- {{ t('State.Refused') }}
- </text>
- <text v-if="row.status == 5">
- {{ t('State.Cancelled') }}
- </text>
- <button class="cancel-btn" v-if="row.status == 1" @click.stop="cancel(row.id)">
- {{ t('Btn.Cancel') }}
- </button>
- </template>
- </cwg-tabel>
- </view>
- <cwg-confirm-popup />
- </cwg-page-wrapper>
- </template>
- <script setup lang="ts">
- // 申请历史
- import { ref, reactive, computed, onMounted, onUnmounted } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- import { useI18n } from 'vue-i18n' // uni-app 中已集成,但需配置
- import { customApi } from '@/service/custom'
- import { financialApi } from '@/service/financial'
- import Config from '@/config/index'
- import { ibApi } from '@/service/ib'
- import { useRecordingConst } from '@/pages/ib/const/recording'
- import { useFilters } from '@/composables/useFilters'
- import { useConfirm } from '@/hooks/useConfirm'
- import { nextTick } from 'vue'
- const confirm = useConfirm()
- const { numberFormat, numberDecimal } = useFilters()
- const { t, locale } = useI18n()
- const { columnList, mobileList, apiList } = useRecordingConst()
- let { Code } = Config
- const typeList = computed(() => [
- { text: t('Ib.Recording.NewAccount'), value: 1 },
- { text: t('Ib.Recording.LeverageApply'), value: 2 },
- { text: t('Ib.Recording.InternalTransfer'), value: 3 },
- { text: t('Ib.Recording.ActivitiesApply'), value: 4 },
- { text: t('Ib.Recording.MaidAdjust'), value: 5 },
- { text: t('Ib.Recording.BelongingAdjust'), value: 6 },
- { text: t('Ib.Recording.CommissionAllocation'), value: 7 },
- { text: t('Custom.Withdraw.Title'), value: 8 },
- { text: t('Ib.Recording.MamHangUndo'), value: 9 },
- { text: t('Home.page_ib.item9'), value: 10 },
- { text: t('Ib.PammManager.title2'), value: 11 },
- { text: t('Ib.PammManager.title3'), value: 12 },
- { text: t('Ib.Transfer.IbAccountTransfer'), value: 13 },
- ])
- const getCurrentMonthRange = () => {
- const now = new Date()
- const year = now.getFullYear()
- const month = now.getMonth()
- // 第一天
- const firstDay = new Date(year, month, 1)
- // 最后一天
- const lastDay = new Date(year, month + 1, 0)
- const format = (date) => {
- const y = date.getFullYear()
- const m = String(date.getMonth() + 1).padStart(2, '0')
- const d = String(date.getDate()).padStart(2, '0')
- return `${y}-${m}-${d}`
- }
- return [format(firstDay), format(lastDay)]
- }
- const defaultDateRange = getCurrentMonthRange()
- const searchParams = ref({
- types: 1,
- date: defaultDateRange,
- })
- const search = ref({
- types: 1,
- startDate: defaultDateRange[0],
- endDate: defaultDateRange[1],
- })
- const filterFields = computed(() => [
- {
- key: 'types',
- type: 'select',
- label: t('placeholder.choose'),
- placeholder: t('placeholder.choose'),
- options: typeList.value,
- defaultValue: 1,
- isSelect: true,
- clearable: false,
- },
- {
- key: 'date',
- label: t('placeholder.Start') + ' - ' + t('placeholder.End'),
- type: 'daterange',
- defaultValue: defaultDateRange,
- },
- ])
- const tableRef = ref<any>(null)
- const handleSearch = (params: any) => {
- const payload = { ...params }
- search.value = payload
- nextTick(() => {
- tableRef.value?.refreshTable?.()
- })
- }
- const handleReset = (params) => {
- searchParams.value = {
- ...params,
- types: 1,
- }
- search.value = {
- ...params,
- types: 1,
- }
- nextTick(() => {
- tableRef.value?.refreshTable?.()
- })
- }
- const isZh = computed(() => {
- return ['cn', 'zhHant'].indexOf(locale.value) != -1
- })
- // 表格列配置 根据types 切换
- const columns = computed(() => {
- return columnList.value[search.value.types]
- })
- const mobilePrimaryFields = computed(() => {
- return [
- ...mobileList.value[search.value.types],
- {
- prop: 'more',
- type: 'more',
- width: 20,
- align: 'right',
- },
- ]
- })
- // 接口 根据types 切换
- const listApi = computed(() => {
- let other = {}
- switch (search.value.types) {
- case 1:
- other = {
- mamType: 0,
- }
- break
- case 4:
- other = {
- type: 4,
- }
- break
- case 11:
- case 12:
- other = {
- mamType: 3,
- }
- break
- }
- return (params) => ibApi[apiList.value[search.value.types]]({ ...params, ...other })
- })
- const cancel = async (id) => {
- tableRef.value.setDetailVisible(false)
- try {
- await confirm({
- title: t('Msg.SystemPrompt'),
- content: t('Msg.Cancle'),
- confirmText: t('Btn.item6'),
- cancelText: t('Btn.item7'),
- })
- let res = await ibApi.withdrawCancel({ id })
- if (res.code == Code.StatusOK) {
- uni.showToast({
- title: t('Msg.Success'),
- icon: 'success',
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- }
- } catch (err) {
- }
- }
- onMounted(() => {
- })
- </script>
- <style lang="scss" scoped>
- @import "@/uni.scss";
- .search-content {
- display: flex;
- justify-content: space-between;
- .uni-date {
- width: px2rpx(250) !important;
- flex: none;
- }
- }
- .cancel-btn{
- display: block;
- width: px2rpx(50);
- line-height: px2rpx(10) !important;
- }
- </style>
|