settings.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <uni-row class="form-row uni-row1">
  4. <uni-col :xs="24" :sm="24" :md="24" :lg="18" :xl="18">
  5. <AccountList />
  6. <TransactionCharts />
  7. </uni-col>
  8. <uni-col :xs="24" :sm="24" :md="24" :lg="6" :xl="6">
  9. <ActivitiesSwiper />
  10. <Timeline />
  11. </uni-col>
  12. </uni-row>
  13. <!-- </view> -->
  14. </cwg-page-wrapper>
  15. </template>
  16. <script setup lang="ts">
  17. import { computed, ref, onMounted } from 'vue';
  18. import { useI18n } from 'vue-i18n';
  19. const { t, locale } = useI18n();
  20. import { customApi } from '@/service/custom';
  21. import useUserStore from "@/stores/use-user-store";
  22. import useRouter from "@/hooks/useRouter";
  23. const router = useRouter();
  24. import AccountList from './components/AccountList.vue';
  25. import TransactionCharts from './components/TransactionCharts.vue';
  26. import ActivitiesSwiper from './components/ActivitiesSwiper.vue';
  27. import Timeline from './components/Timeline.vue';
  28. const userStore = useUserStore();
  29. const userInfo = computed(() => userStore.userInfo);
  30. const getInfoAgentTransfer = computed(() => userInfo.value.agentTransfer)
  31. const typeMap = computed(() => ([
  32. { value: 1, text: t('Custom.Recording.NewAccount') },
  33. { value: 2, text: t('Custom.Recording.LeverageApply') },
  34. { value: 3, text: t('Custom.Recording.InternalTransfer') },
  35. { value: 4, text: t('Custom.Recording.ActivitiesApply') },
  36. ...(getInfoAgentTransfer.value == 1 ? [{ value: 5, text: t('Custom.Recording.Transfer') }] : [])
  37. ]));
  38. const isZh = computed(() => ['cn', 'zh', 'zhHant'].includes(locale.value));
  39. // 账户类型映射
  40. const accountTypeMap = {
  41. 1: 'AccountType.ClassicAccount',
  42. 2: 'AccountType.SeniorAccount',
  43. 5: 'AccountType.SpeedAccount',
  44. 6: 'AccountType.SpeedAccount',
  45. 7: 'AccountType.StandardAccount',
  46. 8: 'AccountType.CentAccount'
  47. }
  48. // 拒绝原因映射(示例)
  49. const reasons = ref({})
  50. // 根据类型获取列配置
  51. const getColumnsByType = (type: number) => {
  52. switch (type) {
  53. case 1: // 开户记录
  54. return [
  55. {
  56. prop: 'platform',
  57. label: t('Custom.Recording.Platform'),
  58. align: 'left'
  59. },
  60. {
  61. prop: 'type',
  62. label: t('Custom.PaymentHistory.payType'),
  63. align: 'left',
  64. slot: 'type'
  65. },
  66. {
  67. prop: 'channelName',
  68. label: t('Custom.PaymentHistory.PaymentMethod'),
  69. formatter: ({ row }) => isZh.value ? row.channelName : row.channelEnName,
  70. align: 'left'
  71. },
  72. {
  73. prop: 'amount',
  74. label: t('Custom.PaymentHistory.Amount'),
  75. formatter: ({ row }) => row.amount + ' ' + row.currency,
  76. align: 'left'
  77. },
  78. {
  79. prop: 'addTime',
  80. label: t('Custom.PaymentHistory.ApplicationDate'),
  81. type: 'date',
  82. dateFormat: 'YYYY-MM-DD HH:mm',
  83. align: 'left'
  84. },
  85. {
  86. prop: 'status',
  87. label: t('Custom.PaymentHistory.Status'),
  88. slot: 'status',
  89. align: 'left'
  90. },
  91. {
  92. prop: 'note',
  93. label: t('Custom.Recording.Note'),
  94. formatter: ({ row }) => row.note || '--',
  95. align: 'left'
  96. }
  97. ]
  98. case 2: // 杠杆修改记录
  99. return [
  100. {
  101. prop: 'login',
  102. label: t('Custom.Recording.TradingAccount'),
  103. align: 'center',
  104. formatter: ({ row }) => row.login || '--'
  105. },
  106. {
  107. prop: 'oldLeverage',
  108. label: t('Custom.Recording.OldLever'),
  109. align: 'center',
  110. formatter: ({ row }) => row.oldLeverage ? `1:${row.oldLeverage}` : '--'
  111. },
  112. {
  113. prop: 'newLeverage',
  114. label: t('Custom.Recording.NewLever'),
  115. align: 'center',
  116. formatter: ({ row }) => row.newLeverage ? `1:${row.newLeverage}` : '--'
  117. },
  118. {
  119. prop: 'addTime',
  120. label: t('Custom.PaymentHistory.ApplicationDate'),
  121. type: 'date',
  122. dateFormat: 'YYYY-MM-DD HH:mm',
  123. align: 'left'
  124. },
  125. {
  126. prop: 'status',
  127. label: t('Custom.PaymentHistory.Status'),
  128. slot: 'status',
  129. align: 'left'
  130. },
  131. {
  132. prop: 'note',
  133. label: t('Custom.Recording.Note'),
  134. formatter: ({ row }) => row.note || '--',
  135. align: 'left'
  136. }
  137. ]
  138. case 3: // 转账记录
  139. case 5: // 内部转账记录
  140. return [
  141. {
  142. prop: 'withdrawLogin',
  143. label: t('Custom.Recording.TransferAccounts'),
  144. align: 'center',
  145. formatter: ({ row }) => row.withdrawLogin || '--'
  146. },
  147. {
  148. prop: 'depositLogin',
  149. label: t('Custom.Recording.IntoAccount'),
  150. align: 'center',
  151. formatter: ({ row }) => row.depositLogin || '--',
  152. },
  153. {
  154. prop: 'withdrawCurrency',
  155. label: t('Custom.Recording.CurrencyType'),
  156. align: 'center',
  157. formatter: ({ row }) => row.withdrawCurrency || '--',
  158. },
  159. {
  160. prop: 'withdrawAmount',
  161. label: t('Custom.Recording.Amount'),
  162. align: 'center',
  163. slot: 'amount'
  164. },
  165. {
  166. prop: 'addTime',
  167. label: t('Custom.PaymentHistory.ApplicationDate'),
  168. type: 'date',
  169. dateFormat: 'YYYY-MM-DD HH:mm',
  170. align: 'left'
  171. },
  172. {
  173. prop: 'status',
  174. label: t('Custom.PaymentHistory.Status'),
  175. slot: 'status',
  176. align: 'left'
  177. },
  178. {
  179. prop: 'note',
  180. label: t('Custom.Recording.Note'),
  181. formatter: ({ row }) => row.note || '--',
  182. align: 'left'
  183. }
  184. ]
  185. case 4: // 活动申请记录
  186. return [
  187. {
  188. prop: 'login',
  189. label: t('Custom.Recording.TradingAccount'),
  190. align: 'center',
  191. formatter: ({ row }) => row.login || '--'
  192. },
  193. {
  194. prop: 'loginType',
  195. label: t('Custom.Recording.AccountType'),
  196. align: 'center',
  197. slot: 'accountType'
  198. },
  199. {
  200. prop: 'title',
  201. label: t('Custom.Recording.ActivityName'),
  202. align: 'center',
  203. formatter: ({ row }) => row.title || '--'
  204. },
  205. {
  206. prop: 'addTime',
  207. label: t('Custom.PaymentHistory.ApplicationDate'),
  208. type: 'date',
  209. dateFormat: 'YYYY-MM-DD HH:mm',
  210. align: 'left'
  211. },
  212. {
  213. prop: 'status',
  214. label: t('Custom.PaymentHistory.Status'),
  215. slot: 'status',
  216. align: 'left'
  217. },
  218. {
  219. prop: 'note',
  220. label: t('Custom.Recording.Note'),
  221. formatter: ({ row }) => row.note || '--',
  222. align: 'left'
  223. }
  224. ]
  225. }
  226. }
  227. // 当前列配置
  228. const currentColumns = computed(() => getColumnsByType(search.value.type))
  229. // 获取状态文本
  230. const getStatusText = (row: any) => {
  231. const status = row.status
  232. // 根据不同记录类型处理状态
  233. if (search.value.type === 1) {
  234. if (status === 1) return t('State.ToBeProcessed')
  235. if (status === 2 && row.accountStatus === 2) return t('State.Completed')
  236. if (status === 2 && (row.accountStatus === 1 || !row.accountStatus)) return t('State.InTheProcessing')
  237. if (status === 3) return t('State.Refused')
  238. } else if (search.value.type === 2) {
  239. if (status === 1) return t('State.ToBeProcessed')
  240. if (status === 2 && row.leverageStatus === 2) return t('State.Completed')
  241. if (status === 2 && row.leverageStatus === 1) return t('State.InTheProcessing')
  242. if (status === 3) return t('State.Refused')
  243. } else if (search.value.type === 3 || search.value.type === 5) {
  244. if (status === 1) return t('State.ToBeProcessed')
  245. if (status === 2 && row.withdrawStatus === 2 && row.depositStatus === 2) return t('State.Completed')
  246. if (status === 2 && (row.withdrawStatus === 1 || row.depositStatus === 1)) return t('State.InTheProcessing')
  247. if (status === 3 || row.withdrawStatus === 3 || row.depositStatus === 3) return t('State.Refused')
  248. } else {
  249. // 活动申请等
  250. if (status === 1) return t('State.ToBeProcessed')
  251. if (status === 2) return t('State.Completed')
  252. if (status === 3) return t('State.Refused')
  253. }
  254. return '--'
  255. }
  256. // 获取状态样式类
  257. const getStatusClass = (status: number) => {
  258. const classMap: Record<number, string> = {
  259. 1: 'status-warning',
  260. 2: 'status-success',
  261. 3: 'status-processing',
  262. 4: 'status-danger'
  263. }
  264. return classMap[status] || ''
  265. }
  266. // 获取账户类型文本
  267. const getAccountTypeText = (type: number) => {
  268. const key = accountTypeMap[type as keyof typeof accountTypeMap]
  269. return key ? t(key) : '--'
  270. }
  271. // 格式化数字
  272. const formatNumber = (value: string | number) => {
  273. if (!value) return '--'
  274. const num = Number(value)
  275. return isNaN(num) ? '--' : num.toFixed(2)
  276. }
  277. // 格式化备注
  278. const formatNote = (approveDesc: string) => {
  279. if (!approveDesc) return '--'
  280. const reason = reasons.value[approveDesc as keyof typeof reasons.value]
  281. if (reason) {
  282. return isZh.value ? reason.content : reason.enContent
  283. }
  284. return approveDesc
  285. }
  286. const listApi = ref(null)
  287. listApi.value = customApi.CustomRecordAccount
  288. </script>
  289. <style scoped lang="scss">
  290. @import "@/uni.scss";
  291. .avatar {
  292. width: px2rpx(60);
  293. height: px2rpx(60);
  294. border-radius: 4px;
  295. }
  296. .content-title {
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: center;
  300. font-size: px2rpx(20);
  301. font-weight: 500;
  302. .content-title-btns {
  303. margin: px2rpx(8) 0;
  304. display: flex;
  305. align-items: center;
  306. justify-content: center;
  307. gap: px2rpx(12);
  308. .btn-primary {
  309. min-width: px2rpx(120);
  310. background-color: var(--color-error);
  311. color: white;
  312. padding: 0 px2rpx(12);
  313. border: none;
  314. font-size: px2rpx(14);
  315. text-align: center;
  316. cursor: pointer;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. gap: px2rpx(8);
  321. }
  322. .btn-primary:active {
  323. background-color: var(--color-navy-700);
  324. }
  325. }
  326. }
  327. .operation-btn {
  328. :deep(span) {
  329. display: flex;
  330. align-items: center;
  331. justify-content: center;
  332. gap: px2rpx(4);
  333. cursor: pointer;
  334. background-color: var(--color-slate-150);
  335. padding: px2rpx(8) 0;
  336. }
  337. }
  338. .operation-btn.disabled {
  339. cursor: not-allowed;
  340. opacity: 0.5;
  341. }
  342. .search-bar {
  343. display: flex;
  344. align-items: center;
  345. justify-content: flex-start;
  346. flex-wrap: wrap;
  347. gap: px2rpx(16);
  348. margin: px2rpx(16) 0;
  349. .cwg-combox,
  350. .uni-easyinput,
  351. .uni-date {
  352. width: px2rpx(240) !important;
  353. flex: none;
  354. }
  355. }
  356. </style>