follow-list.vue 17 KB

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