follow-list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Documentary.TundManagement.item17')" />
  4. <view class="content-container">
  5. <view class="info-card">
  6. <cwg-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch"
  7. @reset="handleReset" />
  8. <cwg-tabel ref="tableRef" :columns="currentColumns" :immediate="false" :queryParams="search"
  9. :api="listApi" :show-operation="false">
  10. <template #balanceEquity="{ row }">
  11. <view class="sp-view-tab">
  12. {{ numberDecimal(row.followBalance || 0) }}
  13. </view>
  14. <view class="sp-view-tab-b">
  15. {{ numberDecimal(row.followEquity || 0) }}
  16. </view>
  17. </template>
  18. <template #followType="{ row }">
  19. <text v-t="followTypeMap[row.followType || row.loginType]" />
  20. </template>
  21. <template #timeRange="{ row }">
  22. <view class="sp-view-tab">
  23. {{ row.startTime || '--' }}
  24. </view>
  25. <view class="sp-view-tab-b">
  26. {{ row.endTime || '--' }}
  27. </view>
  28. </template>
  29. </cwg-tabel>
  30. </view>
  31. </view>
  32. </cwg-page-wrapper>
  33. </template>
  34. <script setup lang="ts">
  35. import { computed, ref, nextTick, onMounted, reactive, watch } from 'vue';
  36. import { useI18n } from 'vue-i18n';
  37. const { t, locale } = useI18n();
  38. import { documentaryApi } from '@/service/documentary';
  39. import { useFilters } from '@/composables/useFilters'
  40. const { numberDecimal, percentFormat } = useFilters()
  41. const search = ref({
  42. type: 1
  43. })
  44. const typeMap = [
  45. { value: 'MT4', text: 'MT4' },
  46. { value: 'MT5', text: 'MT5' }]
  47. // 动态传入筛选字段配置
  48. const filterFields = computed(() => [
  49. { key: 'followPlatform', type: 'select', label: t('Label.Platform'), placeholder: t('placeholder.choose'), options: typeMap, defaultValue: 1 },
  50. !isSubscribeLoading.value && { key: 'followLogin', type: 'select', label: t('Documentary.console.item28'), placeholder: t('placeholder.choose'), options: accountDownData.value },
  51. { key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' }
  52. ])
  53. const followTypeMap = {
  54. 1: 'Documentary.tradingCenter.item116',
  55. 2: 'Documentary.tradingCenter.item117',
  56. 3: 'Documentary.tradingCenter.item118'
  57. }
  58. //获取客户跟单账户的下拉列表
  59. const isSubscribeLoading = ref(false)
  60. const accountDownData = ref([])
  61. const getSubscribeLoginDown = async () => {
  62. isSubscribeLoading.value = true
  63. let res = await documentaryApi.followDealLoginList({
  64. platform: "",
  65. page: null,
  66. });
  67. if (res.code == 200) {
  68. accountDownData.value = res.data?.map(item => ({
  69. text: t('Documentary.console.item28') + '-' + item.dealLogin || '--',
  70. value: item.dealLogin
  71. })) || []
  72. } else {
  73. uni.showToast({
  74. title: res.msg,
  75. icon: 'none'
  76. })
  77. }
  78. isSubscribeLoading.value = false
  79. }
  80. const searchParams = ref({})
  81. const tableRef = ref(null)
  82. const handleSearch = (params) => {
  83. search.value = params
  84. nextTick(() => {
  85. tableRef.value.refreshTable()
  86. })
  87. }
  88. const handleReset = (params) => {
  89. search.value = params
  90. nextTick(() => {
  91. tableRef.value.refreshTable()
  92. })
  93. }
  94. // 当前列配置
  95. const currentColumns = computed(() => [
  96. {
  97. prop: 'dealPlatform',
  98. label: t('Label.Platform'),
  99. align: 'center',
  100. formatter: ({ row }) => row.dealPlatform || '--'
  101. },
  102. {
  103. prop: 'followLogin',
  104. label: t('Documentary.TundManagement.item25'),
  105. align: 'center',
  106. formatter: ({ row }) => row.followLogin || '--'
  107. },
  108. {
  109. prop: 'followType',
  110. label: t('Documentary.TundManagement.item19'),
  111. align: 'center',
  112. slot: 'followType' // 使用插槽显示跟单类型(正向/反向/混合)
  113. },
  114. {
  115. prop: 'followValue',
  116. label: t('Documentary.TundManagement.item20'),
  117. align: 'center',
  118. slot: 'followValue' // 使用插槽显示跟单数值(手数/比例/--)
  119. },
  120. {
  121. prop: 'followLeverage',
  122. label: t('Label.Leverage'),
  123. align: 'center',
  124. formatter: ({ row }) => row.followLeverage ? `1:${row.followLeverage}` : '--'
  125. },
  126. {
  127. prop: 'balanceEquity',
  128. label: t('Label.Balance') + '/' + t('Label.Equity'),
  129. align: 'center',
  130. slot: 'balanceEquity',
  131. },
  132. {
  133. prop: 'timeRange',
  134. label: t('Documentary.TundManagement.item26'),
  135. align: 'center',
  136. slot: 'timeRange' // 使用插槽显示开始时间和结束时间(上下两行)
  137. },
  138. {
  139. prop: 'followProfit',
  140. label: t('Documentary.TundManagement.item21'),
  141. align: 'center',
  142. formatter: ({ row }) => percentFormat(row.followProfit || 0)
  143. }
  144. ])
  145. const selectLoginDeal = () => {
  146. loginOptionsLogin.value.forEach((item) => {
  147. if (item.login == dialogFllowDataApply.dealLogin) {
  148. dialogFllowDataApply.leverage = "1:" + item.leverage;
  149. dialogFllowDataApply.loginType = item.type;
  150. dialogFllowDataApply.platform = item.platform;
  151. }
  152. });
  153. }
  154. const applyRef = ref(null)
  155. const dialogFllowDataApply = reactive({
  156. dealLogin: '',
  157. leverage: '',
  158. loginType: '',
  159. platform: '',
  160. currency: '',
  161. leverageStatus: '',
  162. withdrawStatus: '',
  163. depositStatus: '',
  164. accountStatus: '',
  165. status: '',
  166. note: '',
  167. followType: '',
  168. volume: '',
  169. ratio: '',
  170. traderStrategy: '',
  171. personalSignature: '',
  172. nickname: '',
  173. protectAmount: '',
  174. protectRatio: '',
  175. introduceShow: '',
  176. historyShow: '',
  177. historyTime: '',
  178. settlementCycle: '',
  179. distributionType: '',
  180. distributionRatio: '',
  181. withdrawCurrency: '',
  182. withdrawAmount: '',
  183. depositCurrency: '',
  184. depositAmount: '',
  185. withdrawLogin: '',
  186. depositLogin: '',
  187. addTime: '',
  188. title: '',
  189. })
  190. const loginOptionsLogin = ref([])
  191. const dialogFllowApply = ref(false)
  192. //获取申请信号源交易账户下拉
  193. const getCustomLoginDownLogin = async () => {
  194. if (flag.value) {
  195. return;
  196. } else {
  197. flag.value = true;
  198. }
  199. let res = await documentaryApi.CustomDropdownData({
  200. platform: "",
  201. });
  202. if (res.code == 200) {
  203. loginOptionsLogin.value = res.data;
  204. dialogFllowApply.value = true;
  205. } else {
  206. uni.showToast({
  207. title: res.msg,
  208. icon: 'none'
  209. });
  210. }
  211. flag.value = false;
  212. }
  213. watch(() => dialogFllowDataApply.dealLogin, (newVal, oldVal) => {
  214. if (newVal !== oldVal) {
  215. selectLoginDeal();
  216. }
  217. })
  218. //申请信号源
  219. const ApplyFllow = async () => {
  220. try {
  221. await applyRef.value.validate()
  222. if (flag.value) {
  223. return;
  224. } else {
  225. flag.value = true;
  226. }
  227. let res = await documentaryApi.followDealApply({
  228. ...dialogFllowDataApply,
  229. });
  230. if (res.code == 200) {
  231. uni.showToast({
  232. title: t("Msg.Success"),
  233. icon: 'none'
  234. });
  235. ApplyFllowCancel();
  236. tableRef.value.refreshTable();
  237. getDealLogin();
  238. flag.value = false;
  239. } else {
  240. uni.showToast({
  241. title: res.msg,
  242. icon: 'none'
  243. });
  244. flag.value = false;
  245. }
  246. } catch (error) {
  247. return false;
  248. } finally {
  249. flag.value = false;
  250. }
  251. }
  252. const ApplyFllowCancel = () => {
  253. applyRef.value &&
  254. applyRef.value.clearValidate();
  255. dialogFllowApply.value = false;
  256. }
  257. //获取客户信号源账户
  258. const accountDataLoading = ref(false)
  259. const accountData = ref([])
  260. const accountPager = ref({
  261. current: 1,
  262. row: 10,
  263. rowTotal: 0,
  264. pageTotal: 0
  265. })
  266. const getDealLogin = async () => {
  267. accountDataLoading.value = true;
  268. let res = await documentaryApi.followDealList({
  269. platform: null,
  270. status: 2,
  271. page: {
  272. current: accountPager.value.current,
  273. row: accountPager.value.row,
  274. },
  275. });
  276. if (res.code == 200) {
  277. accountData.value = res.data || []
  278. accountPager.value.rowTotal = res.page.rowTotal;
  279. accountPager.value.pageTotal = res.page.pageTotal;
  280. } else {
  281. uni.showToast({
  282. title: res.msg,
  283. icon: 'none'
  284. });
  285. }
  286. accountDataLoading.value = false;
  287. }
  288. //修改信号源
  289. const dialogFllowData = ref({})
  290. const dialogFllow = ref(false)
  291. const dialogFllowDataDelete = ref({})
  292. const dialogFllowDelete = ref(false)
  293. const flag = ref(false)
  294. const listApi = ref(null)
  295. onMounted(() => {
  296. getDealLogin()
  297. getSubscribeLoginDown()
  298. listApi.value = documentaryApi.followDealSubscribeDealList
  299. })
  300. </script>
  301. <style scoped lang="scss">
  302. @import "@/uni.scss";
  303. .sp-view-tab {
  304. border-bottom: 1px dashed #98989880;
  305. line-height: 2;
  306. }
  307. .sp-view-tab-b {
  308. line-height: 2;
  309. }
  310. .avatar {
  311. width: px2rpx(60);
  312. height: px2rpx(60);
  313. border-radius: 4px;
  314. }
  315. .content-title {
  316. display: flex;
  317. justify-content: space-between;
  318. align-items: center;
  319. font-size: px2rpx(22);
  320. font-weight: 500;
  321. color: var(--bs-emphasis-color);
  322. background-color: rgba(255, 255, 255, 0);
  323. .content-title-btns {
  324. display: flex;
  325. align-items: center;
  326. justify-content: center;
  327. gap: px2rpx(12);
  328. .btn-primary {
  329. min-width: px2rpx(120);
  330. background-color: var(--color-error);
  331. color: #fff;
  332. padding: 0 px2rpx(12);
  333. border: none;
  334. font-size: px2rpx(14);
  335. text-align: center;
  336. cursor: pointer;
  337. display: flex;
  338. align-items: center;
  339. justify-content: center;
  340. gap: px2rpx(8);
  341. }
  342. .btn-primary1 {
  343. background-color: #cf1322;
  344. ;
  345. }
  346. .btn-primary2 {
  347. background-color: var(--color-secondary-focus);
  348. }
  349. }
  350. }
  351. .operation-btn {
  352. :deep(text) {
  353. display: flex;
  354. align-items: center;
  355. justify-content: center;
  356. gap: px2rpx(4);
  357. cursor: pointer;
  358. background-color: var(--color-slate-150);
  359. padding: px2rpx(8) 0;
  360. }
  361. }
  362. .operation-btn.disabled {
  363. cursor: not-allowed;
  364. opacity: 0.5;
  365. }
  366. .search-bar {
  367. display: flex;
  368. align-items: center;
  369. justify-content: flex-start;
  370. flex-wrap: wrap;
  371. gap: px2rpx(16);
  372. margin: px2rpx(16) 0;
  373. .cwg-combox,
  374. .uni-easyinput,
  375. .uni-date {
  376. width: px2rpx(240) !important;
  377. flex: none;
  378. }
  379. }
  380. .dia-content {
  381. padding: px2rpx(20);
  382. .uni-forms-item {
  383. width: 100%;
  384. }
  385. .grid-layout {
  386. display: grid;
  387. grid-template-columns: 1fr 1fr;
  388. gap: px2rpx(20);
  389. margin: px2rpx(24) 0;
  390. padding: px2rpx(20);
  391. background-color: transparent;
  392. border-radius: px2rpx(8);
  393. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  394. }
  395. .fllow-title {
  396. display: flex;
  397. align-items: center;
  398. justify-content: space-between;
  399. border-bottom: 1px solid #eee;
  400. padding-bottom: 10px;
  401. margin-bottom: 10px;
  402. .title {
  403. font-weight: bold;
  404. color: var(--bs-heading-color);
  405. padding-left: 8px;
  406. border-left: 4px solid #eb3f57;
  407. font-size: 16px;
  408. }
  409. }
  410. .delete-grid {
  411. margin: px2rpx(16) 0;
  412. }
  413. .delete-row {
  414. display: grid;
  415. grid-template-columns: 1fr 1fr;
  416. gap: px2rpx(12);
  417. @media screen and (max-width: 768px) {
  418. grid-template-columns: 1fr;
  419. }
  420. }
  421. .delete-item {
  422. flex: 1;
  423. display: flex;
  424. justify-content: space-between;
  425. align-items: center;
  426. padding: px2rpx(12) 0;
  427. border-bottom: 1px dashed #e9ecef;
  428. &:first-child {
  429. padding-right: px2rpx(16);
  430. }
  431. &:last-child {
  432. padding-left: px2rpx(16);
  433. }
  434. }
  435. .delete-label {
  436. font-size: px2rpx(14);
  437. color: var(--bs-body-color);
  438. }
  439. .delete-value {
  440. font-size: px2rpx(14);
  441. color: var(--bs-emphasis-color);
  442. font-weight: 400;
  443. }
  444. .delete-tip {
  445. margin-top: px2rpx(16);
  446. font-size: px2rpx(14);
  447. color: var(--bs-body-color);
  448. line-height: 1.5;
  449. padding-top: px2rpx(16);
  450. }
  451. .tip-star {
  452. color: #dc3545;
  453. margin-right: px2rpx(4);
  454. }
  455. .agree {
  456. margin-top: px2rpx(20);
  457. }
  458. .checkbox-agree {
  459. display: flex;
  460. align-items: flex-start;
  461. gap: px2rpx(8);
  462. .agree-text {
  463. font-size: px2rpx(14);
  464. color: var(--bs-body-color);
  465. line-height: 1.5;
  466. width: 100%;
  467. white-space: wrap;
  468. .a {
  469. color: #007bff;
  470. text-decoration: underline;
  471. margin: 0 px2rpx(4);
  472. &:hover {
  473. color: #0056b3;
  474. }
  475. }
  476. }
  477. }
  478. .fllow-content {
  479. margin-bottom: px2rpx(16);
  480. .tit {
  481. font-size: px2rpx(14);
  482. font-weight: 500;
  483. color: var(--bs-body-color);
  484. margin-bottom: px2rpx(6);
  485. text-transform: uppercase;
  486. letter-spacing: px2rpx(0.5);
  487. }
  488. .con {
  489. font-size: px2rpx(16);
  490. font-weight: 400;
  491. color: var(--bs-emphasis-color);
  492. line-height: 1.4;
  493. }
  494. }
  495. .form-row {
  496. display: grid;
  497. grid-template-columns: 1fr 1fr;
  498. gap: px2rpx(20);
  499. margin-top: px2rpx(16);
  500. }
  501. .form-item {
  502. display: flex;
  503. flex-direction: column;
  504. align-items: flex-start;
  505. text {
  506. font-size: px2rpx(14);
  507. font-weight: 500;
  508. color: var(--bs-body-color);
  509. margin-bottom: px2rpx(8);
  510. white-space: nowrap;
  511. }
  512. input,
  513. select,
  514. textarea {
  515. width: 100%;
  516. padding: px2rpx(10);
  517. border: 1px solid #ced4da;
  518. border-radius: px2rpx(4);
  519. font-size: px2rpx(14);
  520. transition: all 0.2s ease;
  521. &:focus {
  522. outline: none;
  523. border-color: #4dabf7;
  524. box-shadow: 0 0 0 2px rgba(77, 171, 247, 0.2);
  525. }
  526. }
  527. textarea {
  528. resize: vertical;
  529. min-height: px2rpx(100);
  530. }
  531. }
  532. .tip-red {
  533. color: #dc3545;
  534. font-size: px2rpx(14);
  535. margin: px2rpx(12) 0 px2rpx(24) 0;
  536. }
  537. .tip-text {
  538. margin-top: px2rpx(24);
  539. font-size: px2rpx(14);
  540. color: var(--bs-body-color);
  541. line-height: 1.5;
  542. padding: px2rpx(16);
  543. background-color: #e7f3ff;
  544. border-radius: px2rpx(4);
  545. border-left: 4px solid #4dabf7;
  546. }
  547. }
  548. /* 弹窗按钮样式 */
  549. :deep(.cwg-popup__footer) {
  550. display: flex;
  551. gap: px2rpx(20);
  552. padding: px2rpx(20);
  553. border-top: 1px solid #e9ecef;
  554. button {
  555. flex: 1;
  556. padding: px2rpx(12) 0;
  557. border-radius: px2rpx(4);
  558. font-size: px2rpx(14);
  559. font-weight: 500;
  560. transition: all 0.2s ease;
  561. &:first-child {
  562. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  563. color: #495057;
  564. border: 1px solid #ced4da;
  565. &:hover {
  566. background-color: transparent;
  567. border-color: #adb5bd;
  568. }
  569. &:active {
  570. transform: scale(0.98);
  571. }
  572. }
  573. &:last-child {
  574. background-color: #dc3545;
  575. color: white;
  576. border: 1px solid #dc3545;
  577. &:hover {
  578. background-color: #c82333;
  579. border-color: #bd2130;
  580. }
  581. &:active {
  582. transform: scale(0.98);
  583. }
  584. }
  585. }
  586. }
  587. </style>