recording.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_ib.item7')" />
  4. <view class="account-content">
  5. <view class="search-content">
  6. <view class="search-bar">
  7. <cwg-combox v-model:value="search.types" :options="typeList"
  8. :placeholder="t('placeholder.choose')" :clearable="false" />
  9. <uni-datetime-picker type="daterange" v-model="search.date"
  10. :placeholder="t('placeholder.Start') + ' - ' + t('placeholder.End')"
  11. @change="handleDateChange" />
  12. </view>
  13. <view />
  14. </view>
  15. <cwg-tabel
  16. ref="tableRef"
  17. :columns="columns"
  18. :mobilePrimaryFields="mobilePrimaryFields"
  19. :queryParams="search"
  20. :api="listApi"
  21. :show-operation="true"
  22. :showPagination="true"
  23. >
  24. <template #remitChannelName="{row}">
  25. <text>
  26. {{
  27. isZh ? row.remitChannelName || '--' : row.remitChannelEnName || '--'
  28. }}
  29. </text>
  30. </template>
  31. <template #status="{row}">
  32. <text v-if="row.status == 1">
  33. {{ t('State.ToBeProcessed') }}
  34. </text>
  35. <text v-if="row.status == 2&&row.submitStatus == 2">
  36. {{ t('State.Completed') }}
  37. </text>
  38. <text v-if="row.status == 2&&row.submitStatus != 2">
  39. {{ t('State.InTheProcessing') }}
  40. </text>
  41. <text v-if="row.status == 3 || row.callbackStatus == 2">
  42. {{ t('State.Refused') }}
  43. </text>
  44. <text v-if="row.status == 5">
  45. {{ t('State.Cancelled') }}
  46. </text>
  47. <button v-if="row.status == 1" @click.stop="cancel(row.id)">
  48. {{ t('Btn.Cancel') }}
  49. </button>
  50. </template>
  51. </cwg-tabel>
  52. </view>
  53. </cwg-page-wrapper>
  54. </template>
  55. <script setup lang="ts">
  56. // 申请历史
  57. import { ref, reactive, computed, onMounted, onUnmounted } from 'vue'
  58. import { onLoad } from '@dcloudio/uni-app'
  59. import { useI18n } from 'vue-i18n' // uni-app 中已集成,但需配置
  60. import { customApi } from '@/service/custom'
  61. import { financialApi } from '@/service/financial'
  62. import Config from '@/config/index'
  63. import { ibApi } from '@/service/ib'
  64. import { useRecordingConst } from '@/pages/ib/const/recording'
  65. import { useFilters } from '@/composables/useFilters'
  66. import { useConfirm } from '@/hooks/useConfirm'
  67. const confirm = useConfirm()
  68. const { numberFormat, numberDecimal } = useFilters()
  69. const { t, locale } = useI18n()
  70. const { columnList, mobileList, apiList } = useRecordingConst()
  71. let { Code } = Config
  72. const typeList = computed(() => [
  73. { text: t('Ib.Recording.NewAccount'), value: 1 },
  74. { text: t('Ib.Recording.LeverageApply'), value: 2 },
  75. { text: t('Ib.Recording.InternalTransfer'), value: 3 },
  76. { text: t('Ib.Recording.ActivitiesApply'), value: 4 },
  77. { text: t('Ib.Recording.MaidAdjust'), value: 5 },
  78. { text: t('Ib.Recording.BelongingAdjust'), value: 6 },
  79. { text: t('Ib.Recording.CommissionAllocation'), value: 7 },
  80. { text: t('Custom.Withdraw.Title'), value: 8 },
  81. { text: t('Ib.Recording.MamHangUndo'), value: 9 },
  82. { text: t('Home.page_ib.item9'), value: 10 },
  83. { text: t('Ib.PammManager.title2'), value: 11 },
  84. { text: t('Ib.PammManager.title3'), value: 12 },
  85. { text: t('Ib.Transfer.IbAccountTransfer'), value: 13 },
  86. ])
  87. const getCurrentMonthRange = () => {
  88. const now = new Date()
  89. const year = now.getFullYear()
  90. const month = now.getMonth()
  91. // 第一天
  92. const firstDay = new Date(year, month, 1)
  93. // 最后一天
  94. const lastDay = new Date(year, month + 1, 0)
  95. const format = (date) => {
  96. const y = date.getFullYear()
  97. const m = String(date.getMonth() + 1).padStart(2, '0')
  98. const d = String(date.getDate()).padStart(2, '0')
  99. return `${y}-${m}-${d}`
  100. }
  101. return [format(firstDay), format(lastDay)]
  102. }
  103. const defaultDateRange = getCurrentMonthRange()
  104. const search = ref({
  105. types: 1,
  106. date: defaultDateRange,
  107. startDate: defaultDateRange[0],
  108. endDate: defaultDateRange[1],
  109. })
  110. const isZh = computed(() => {
  111. return ['cn', 'zhHant'].indexOf(locale.value) != -1
  112. })
  113. // 表格列配置 根据types 切换
  114. const columns = computed(() => {
  115. return columnList.value[search.value.types]
  116. })
  117. const mobilePrimaryFields = computed(() => {
  118. return [
  119. ...mobileList.value[search.value.types],
  120. {
  121. prop: 'more',
  122. type: 'more',
  123. width: 20,
  124. align: 'right',
  125. },
  126. ]
  127. })
  128. // 接口 根据types 切换
  129. const listApi = computed(() => {
  130. return search.value.types == 4? (params)=> ibApi[apiList.value[search.value.types]]({ ...params ,type: 4}): (params)=> ibApi[apiList.value[search.value.types]]({ ...params })
  131. })
  132. const handleDateChange = (val) => {
  133. if (val && val.length === 2) {
  134. search.value.startDate = val[0]
  135. search.value.endDate = val[1]
  136. } else {
  137. search.value.startDate = ''
  138. search.value.endDate = ''
  139. }
  140. }
  141. const cancel = async (id) => {
  142. try {
  143. await confirm({
  144. title: t('Msg.SystemPrompt'),
  145. content: t('Msg.Cancle'),
  146. confirmText: t('Btn.item6'),
  147. cancelText: t('Btn.item7'),
  148. })
  149. let res = await ibApi.withdrawCancel({ id })
  150. if (res.code == Code.StatusOK) {
  151. uni.showToast({
  152. title: t('Msg.Success'),
  153. icon: 'success',
  154. })
  155. } else {
  156. uni.showToast({
  157. title: res.msg,
  158. icon: 'none',
  159. })
  160. }
  161. } catch (err) {
  162. }
  163. }
  164. onMounted(() => {
  165. })
  166. </script>
  167. <style lang="scss" scoped>
  168. @import "@/uni.scss";
  169. .search-content {
  170. display: flex;
  171. justify-content: space-between;
  172. .uni-date {
  173. width: px2rpx(250) !important;
  174. flex: none;
  175. }
  176. }
  177. </style>