index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true" :bgColor="'#f8f9f9'">
  3. <cwg-header :title="t('Home.page_ib.item1')" :showBack="false" />
  4. <uni-row class="demo-uni-row uni-row1">
  5. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  6. <view class="dashboard-container">
  7. <!-- 余额卡片 -->
  8. <view class="card balance-card">
  9. <view class="card-header">
  10. <view class="header-left">
  11. <cwg-icon name="qbye" :size="24" />
  12. <text class="header-title">{{ t('news_add_field.Label.Balance') }}</text>
  13. </view>
  14. <view class="header-right">
  15. <cwg-dropdown :menu-list="menuList" @menuClick="handleMenuClick">
  16. <view class="pc-header-btn">
  17. <cwg-icon name="crm-ellipsis" :size="24" />
  18. </view>
  19. </cwg-dropdown>
  20. </view>
  21. </view>
  22. <view class="balance-content">
  23. <view class="balance-main">
  24. <text class="balance-currency">$</text>
  25. <text class="balance-amount">{{ balanceInt }}</text>
  26. <text class="balance-decimal">.{{ balanceDecimal }}</text>
  27. </view>
  28. <view class="total-earnings">
  29. <text class="total-label">{{ t('Ib.Index.TotalRevenue') }}</text>
  30. <text class="total-value">{{ ibData.all }}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 开户链接 -->
  35. <view class="card partner-card">
  36. <view class="card-header">
  37. <view class="header-left">
  38. <cwg-icon name="crm-share-nodes" :size="24" />
  39. <text class="header-title">{{ t('Ib.Index.Link') }}</text>
  40. </view>
  41. </view>
  42. <view class="partner-content">
  43. <view class="link-area">
  44. <button class="link-btn" @click="LinkActivity1">
  45. {{ t('Ib.Index.CreateLink') }}
  46. </button>
  47. <!-- <button class="link-btn" @click="LinkActivity">-->
  48. <!-- {{ t('Ib.Index.CreateLinkActivity') }}-->
  49. <!-- </button>-->
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 名下客户 -->
  54. <view class="card custom-card">
  55. <view class="card-header">
  56. <view class="header-left">
  57. <cwg-icon name="crm-custom" :size="24" />
  58. <text class="header-title">{{ t('Ib.Index.NameCustom') }}</text>
  59. </view>
  60. </view>
  61. <view class="custom-content">
  62. <view class="con" @click="toCustomManagement">
  63. <view class="num">
  64. {{ ibData.customAmount }}
  65. </view>
  66. <view class="des">
  67. {{ t('Ib.Index.Custom') }}
  68. </view>
  69. </view>
  70. <view class="con" @click="toIbManagement">
  71. <view class="num">
  72. {{ ibData.ibAmount }}
  73. </view>
  74. <view class="des">
  75. {{ t('Ib.Index.Agent') }}
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 归属推荐码 -->
  81. <!-- <view class="card code-card">
  82. <view class="card-header">
  83. <view class="header-left">
  84. <text class="header-title">{{ t('Tips.AttributionCode') }}</text>
  85. <uni-tooltip placement="top">
  86. <text class="icon-tip">?</text>
  87. <template v-slot:content>
  88. <view style="width: 100px;">
  89. {{ t('Tips.tips') }}
  90. </view>
  91. </template>
  92. </uni-tooltip>
  93. </view>
  94. </view>
  95. <view class="code-content">
  96. <uni-easyinput class="code-input" :disabled="true" v-model="getInfoId" :clearable="false"></uni-easyinput>
  97. <button class="link-btn">{{ t('Ib.Index.Copy') }}</button>
  98. </view>
  99. </view>-->
  100. </view>
  101. </uni-col>
  102. <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  103. <view class="dashboard-container">
  104. <view class="card mam-card">
  105. <view class="card-header">
  106. <view class="header-left">
  107. <text class="header-title">{{ t('Ib.Index.MAMList') }}</text>
  108. </view>
  109. <view class="header-right" v-if="showAddMamAccount">
  110. <cwg-dropdown :menu-list="addMamAccountMenus" @menuClick="handleAddMamAccountMenuClick">
  111. <button type="primary" class="add-mam-btn">
  112. <cwg-icon name="icon_add" :size="18" color="#fff" />
  113. <text class="btn-text">{{ t('Custom.Index.AddAccount') }}</text>
  114. </button>
  115. </cwg-dropdown>
  116. </view>
  117. </view>
  118. <cwg-tabel
  119. ref="mamTableRef"
  120. :columns="mamColumns"
  121. :mobilePrimaryFields="mamMobilePrimaryFields"
  122. :queryParams="mamSearch"
  123. :api="mamListApi"
  124. :show-operation="false"
  125. :showPagination="true"
  126. >
  127. <template #mamAccount="{ row }">
  128. <view v-if="row.type == 1 || row.type == 2">
  129. <text>{{ row.login || '-' }}</text>
  130. </view>
  131. <view v-else-if="row.type == 3">
  132. <view class="mam-line">
  133. <text>{{ t('Ib.PammManager.ownerId') }}:</text>
  134. <text>{{ row.ownerId || '--' }}</text>
  135. </view>
  136. <view class="mam-line">
  137. <text>{{ t('Ib.PammManager.accountId') }}:</text>
  138. <text>{{ row.accountId || '--' }}</text>
  139. </view>
  140. <view class="mam-line">
  141. <text>{{ t('Ib.PammManager.percent') }}:</text>
  142. <text>{{ (row.percent ?? '--') + '%' }}</text>
  143. </view>
  144. </view>
  145. </template>
  146. <template #mamType="{ row }">
  147. <text>{{ formatMamType(row.type) }}</text>
  148. </template>
  149. <template #loginType="{ row }">
  150. <text>{{ formatAccountType(row.accountType) }}</text>
  151. </template>
  152. <template #leverage="{ row }">
  153. <text>{{ row.leverage ? '1:' + row.leverage : '-' }}</text>
  154. </template>
  155. <template #balance="{ row }">
  156. <text>{{ numberFormat(row.balance || 0) }}</text>
  157. </template>
  158. <template #equity="{ row }">
  159. <text>{{ numberFormat(row.equity || 0) }}</text>
  160. </template>
  161. <template #operation="{ row }">
  162. <view class="mam-ops">
  163. <view v-if="row.type == 1 || row.type == 2" class="mam-op" @click.stop="toSettings(row)">
  164. <text>{{ t('Ib.Index.Settings') }}</text>
  165. </view>
  166. <view v-if="row.type == 3" class="mam-op" @click.stop="toSettings(row)">
  167. <text>{{ t('Ib.PammManager.btn1') }}</text>
  168. </view>
  169. <view v-if="row.type == 3" class="mam-op" @click.stop="toDialogPercent(row)">
  170. <text>{{ t('Ib.PammManager.percent') }}</text>
  171. </view>
  172. <view class="mam-op" @click.stop="toDialogSubs(row)">
  173. <text>{{ t('blockchain.item1') }}</text>
  174. </view>
  175. </view>
  176. </template>
  177. </cwg-tabel>
  178. </view>
  179. </view>
  180. </uni-col>
  181. </uni-row>
  182. <!-- 二维码弹窗 -->
  183. <cwg-popup ref="linkPopup" type="center" :title="t('Ib.Index.CreateLink')" :showFooters="false" showFooterLine>
  184. <view class="dia-content">
  185. <view class="content" style="font-size: 14px; text-align: left">
  186. <view class="label">{{ t('Ib.Index.Spread5') }} :</view>
  187. <cwg-combox
  188. v-model="excludeShowLoginTypes"
  189. :multiple="true"
  190. :options="excludeList"
  191. :placeholder="t('placeholder.choose')"
  192. @change="handleChange"
  193. />
  194. <view class="label">{{ t('Ib.Index.Spread4') }} :</view>
  195. <cwg-combox
  196. v-model:value="selectedSpreadId"
  197. :options="spreadList.map(item => ({
  198. value: item.id,
  199. text: t('Ib.Index.Commission') + ':' + item.comPoint +
  200. (levelNum === 1 ? '-' + t('Ib.Index.Hide') + ':' + item.hide :
  201. (fixedHide === 1 ? '' : '-' + t('Ib.Index.Hide') + ':' + item.hide))
  202. }))"
  203. :placeholder="t('placeholder.choose')"
  204. />
  205. <view class="label">{{ t('Ib.Index.IbInvalid') }}</view>
  206. <cwg-combox
  207. v-model:value="ibInvalid"
  208. :options="[
  209. { value: 'B0', text: t('Ib.Custom.Allow') },
  210. { value: 'B1', text: t('Ib.Custom.NotAllow') }
  211. ]"
  212. :placeholder="t('placeholder.choose')"
  213. />
  214. <view>
  215. <text style="line-height: 1.5">{{ t('ApplicationDialog.item1') }}</text>
  216. </view>
  217. <view>
  218. <text style="line-height: 1.5">{{ t('ApplicationDialog.item2') }}</text>
  219. <a
  220. :href="country == 'NG' || country == 'TH' || country == 'LA'
  221. ? `pdf/pdf6/all/Account Type Allocation Table - ${lang}.pdf`
  222. : `pdf/pdf6/no/Account Type Allocation Table-${lang}.pdf`"
  223. target="_blank"
  224. >
  225. {{ t('ApplicationDialog.item3') }}
  226. </a>
  227. </view>
  228. <view class="btn">
  229. <button
  230. class="crm-cursor"
  231. @click="CreateLink"
  232. >{{ t('Ib.Index.CreateLink') }}
  233. </button>
  234. </view>
  235. <view class="link qrCode" v-if="link">
  236. <QrCode
  237. ref="qrCode"
  238. :text="link"
  239. :width="200"
  240. :height="200"
  241. />
  242. <view class="btn">
  243. <button
  244. class="crm-cursor"
  245. style="height: 16px"
  246. @click="downloadQrCode()"
  247. >{{ t('Btn.item9') }}
  248. </button>
  249. </view>
  250. </view>
  251. <view class="link">
  252. <uni-easyinput
  253. disabled
  254. v-model="link"
  255. />
  256. <button class="btn" @click="CopyShareLink(link)">
  257. {{ t('Ib.Index.Copy') }}
  258. </button>
  259. </view>
  260. </view>
  261. </view>
  262. </cwg-popup>
  263. <!-- 活动链接弹窗 -->
  264. <cwg-popup ref="linkActivityPopup" type="center" :title="t('Ib.Index.CreateLinkActiv')" :showFooters="false"
  265. showFooterLine>
  266. <view class="dia-content">
  267. <view class="content" style="font-size: 14px; text-align: left">
  268. <view class="label">{{ t('Ib.Index.ChooseActiv') }}</view>
  269. <cwg-combox
  270. v-model:value="activityLing"
  271. :options="agentLinkList.map(item => ({ value: item.link, text: item.name }))"
  272. :placeholder="t('Ib.Index.ChooseActiv')"
  273. />
  274. <view class="label">{{ t('Ib.Index.Spread5') }} :</view>
  275. <cwg-combox
  276. v-model:value="excludeShowLoginTypes"
  277. :multiple="true"
  278. :options="excludeList"
  279. :placeholder="t('placeholder.choose')"
  280. @change="handleChange"
  281. />
  282. <view class="label">{{ t('Ib.Index.Spread4') }} :</view>
  283. <cwg-combox
  284. v-model:value="selectedSpreadId"
  285. :options="spreadList.map(item => ({
  286. value: item.id,
  287. text: t('Ib.Index.Commission') + ':' + item.comPoint +
  288. (levelNum === 1 ? '-' + t('Ib.Index.Hide') + ':' + item.hide :
  289. (fixedHide === 1 ? '' : '-' + t('Ib.Index.Hide') + ':' + item.hide))
  290. }))"
  291. :placeholder="t('placeholder.choose')"
  292. />
  293. <view class="label">{{ t('Ib.Index.IbInvalid') }}</view>
  294. <cwg-combox
  295. v-model:value="ibInvalid"
  296. :options="[
  297. { value: 'B0', text: t('Ib.Custom.Allow') },
  298. { value: 'B1', text: t('Ib.Custom.NotAllow') }
  299. ]"
  300. :placeholder="t('placeholder.choose')"
  301. />
  302. <view>
  303. <text style="line-height: 1.5">{{ t('ApplicationDialog.item1') }}</text>
  304. </view>
  305. <view>
  306. <text style="line-height: 1.5">{{ t('ApplicationDialog.item2') }}</text>
  307. <a
  308. :href="country == 'NG' || country == 'TH' || country == 'LA' || isAfterJuly7()
  309. ? `pdf/pdf6/all/Account Type Allocation Table - ${lang}.pdf`
  310. : `pdf/pdf6/no/Account Type Allocation Table-${lang}.pdf`"
  311. target="_blank"
  312. >
  313. {{ t('ApplicationDialog.item3') }}
  314. </a>
  315. </view>
  316. <view class="btn">
  317. <button
  318. class="crm-cursor"
  319. @click="CreateActivityLink"
  320. >{{ t('Ib.Index.CreateLinkActivity') }}
  321. </button>
  322. </view>
  323. <view class="link qrCode" v-if="linkActivity">
  324. <QrCode
  325. ref="qrCode1"
  326. :text="linkActivity"
  327. :width="200"
  328. :height="200"
  329. />
  330. <view class="btn">
  331. <button
  332. class="crm-cursor"
  333. @click="downloadQrCode(1)"
  334. >{{ t('Btn.item9') }}
  335. </button>
  336. </view>
  337. </view>
  338. </view>
  339. </view>
  340. </cwg-popup>
  341. <!-- 调整收益分成弹窗 -->
  342. <cwg-popup
  343. :visible="dialogPercent"
  344. :title="t('Ib.PammManager.percent')"
  345. @close="closeDialogPercent"
  346. @confirm="applyPercent"
  347. >
  348. <view class="dia-content custom-dialog-content">
  349. <uni-forms :model="dialogPercentData" label-width="150" label-position="left">
  350. <uni-forms-item :label="t('Ib.PammManager.ownerId') + ':'">
  351. <text class="info-text">{{ dialogPercentData.oldOwnerId || "--" }}</text>
  352. </uni-forms-item>
  353. <uni-forms-item :label="t('Ib.PammManager.accountId') + ':'">
  354. <text class="info-text">{{ dialogPercentData.oldAccountId || "--" }}</text>
  355. </uni-forms-item>
  356. <uni-forms-item :label="t('Ib.PammManager.percent') + ':'">
  357. <text class="info-text">{{ dialogPercentData.oldPercent }}%</text>
  358. </uni-forms-item>
  359. <uni-forms-item :label="t('Ib.PammManager.percentNew') + ':'" name="percent" required>
  360. <uni-easyinput
  361. v-model="dialogPercentData.percent"
  362. :placeholder="t('placeholder.input')"
  363. />
  364. </uni-forms-item>
  365. </uni-forms>
  366. </view>
  367. </cwg-popup>
  368. </cwg-page-wrapper>
  369. </template>
  370. <script setup>
  371. import { ref, computed, watch, onMounted } from 'vue'
  372. import { useI18n } from 'vue-i18n'
  373. import useRouter from '@/hooks/useRouter'
  374. import { ibApi } from '@/service/ib'
  375. import config from '@/config/index'
  376. import useUserStore from '@/stores/use-user-store'
  377. import { useStorage } from '@/hooks/useStorage'
  378. import QrCode from '@/components/QrCode.vue'
  379. import { useFilters } from '@/composables/useFilters'
  380. import { isAfterJuly28 } from '@/utils/dateUtils'
  381. const { t } = useI18n()
  382. const router = useRouter()
  383. const { Code } = config
  384. const { userInfo } = useUserStore()
  385. const { numberFormat } = useFilters()
  386. // 数据
  387. const totalEarnings = ref(0.00)
  388. const partnerLink = ref('https://one.exnessonelink.com/a/plokue4yj3')
  389. const partnerCode = ref('PLOKUE4YJ3')
  390. const activeTab = ref('link') // 'link' 或 'code'
  391. const ibData = ref({
  392. customAmount: 0,
  393. ibAmount: 0,
  394. },
  395. )
  396. const selectedSpreadId = ref('')
  397. const spreadList = ref([])
  398. const excludeShowLoginTypes = ref([])
  399. const pammManagerValid = ref()
  400. const dialogPercent = ref(false)
  401. const dialogPercentData = ref({
  402. oldPercent: '',
  403. mamListId: '',
  404. oldOwnerId: '',
  405. oldAccountId: '',
  406. percent: ''
  407. })
  408. const isActionLoading = ref(false)
  409. const menuList = ref([
  410. { label: t('Custom.Index.Withdrawals'), type: 1 },
  411. { label: t('Custom.Index.Transfer'), type: 2 },
  412. ])
  413. const excludeList = ref([])
  414. const excludeLists = ref([
  415. { text: t('AccountType.SeniorAccount'), value: '2' },
  416. // {text: t('AccountType.SeniorAccount'),value: '3'},
  417. { text: t('AccountType.StandardAccount'), value: '7' },
  418. { text: t('AccountType.CentAccount'), value: '8' },
  419. ])
  420. const link = ref('')
  421. const loginTypes = ref('')
  422. const ibInvalid = ref('B0')
  423. const qrCode = ref(null)
  424. const qrCode1 = ref(null)
  425. // 语言
  426. const lang = useStorage('lang')
  427. const flag = ref(false)
  428. const agentLinkList = ref([])
  429. const activityLing = ref('')
  430. const linkActivity = ref('')
  431. const commission = ref('')
  432. const linkActivityPopup = ref(null)
  433. // 开户链接
  434. const linkPopup = ref(null)
  435. const qrSize = ref(200)
  436. const levelNum = computed(() => {
  437. return userInfo.ibInfo.levelNum
  438. })
  439. const fixedHide = computed(() => {
  440. return userInfo.ibInfo.fixedHide
  441. })
  442. const getInfoId = computed(() => {
  443. return userInfo.ibInfo.id
  444. })
  445. const balanceInt = computed(() => {
  446. return numberFormat(ibData.value?.balance || 0, true)[0]
  447. })
  448. const balanceDecimal = computed(() => {
  449. return numberFormat(ibData.value?.balance || 0, true)[1]
  450. })
  451. // 国家
  452. const country = computed(() => {
  453. console.log(userInfo.customInfo.country, '2')
  454. return userInfo.customInfo.country
  455. })
  456. // 修改多选
  457. const handleChange = (val) => {
  458. excludeShowLoginTypes.value = val
  459. }
  460. const isAfterJuly7 = () => {
  461. const currentDate = new Date()
  462. const july7 = new Date(currentDate.getFullYear(), 6, 7) // 月份从0开始,6表示7月
  463. return currentDate >= july7
  464. }
  465. const getValidAccountTypes = (selectedExcludeValues, selectedSpreadId) => {
  466. const spread = spreadList.value.find(
  467. (item) => item.id === selectedSpreadId,
  468. )
  469. let data = {
  470. hide: '',
  471. commission: '',
  472. excludeShowLoginTypes: [],
  473. }
  474. if (!spread) return data
  475. const validValues = selectedExcludeValues.filter((value) =>
  476. spread.loginTypes.includes(value),
  477. )
  478. const invalidValues = selectedExcludeValues.filter(
  479. (value) => !spread.loginTypes.includes(value),
  480. )
  481. const invalidLabels = excludeList.value
  482. .filter((item) => invalidValues.includes(item.value))
  483. .map((item) => item.label)
  484. const excludeTypes = excludeLists.value
  485. .filter((item) => !validValues.includes(item.value))
  486. .map((item) => item.value)
  487. loginTypes.value = invalidLabels.join('、')
  488. return {
  489. hide: spread.hide,
  490. commission: spread.comPoint,
  491. excludeShowLoginTypes: excludeTypes,
  492. invalidLabels,
  493. invalidValues,
  494. }
  495. }
  496. const downloadQrCode = (type = 0) => {
  497. if (type === 1) {
  498. qrCode1.value.download()
  499. } else {
  500. qrCode.value.download()
  501. }
  502. }
  503. // 复制
  504. const CopyShareLink = (value) => {
  505. uni.setClipboardData({ data: value })
  506. }
  507. const getLink1 = async () => {
  508. console.log(excludeShowLoginTypes.value, 2)
  509. if (excludeShowLoginTypes.value.length == 0) {
  510. uni.showToast({
  511. title: t('Ib.Index.Spread5'), icon: 'none',
  512. })
  513. link.value = ''
  514. return
  515. }
  516. if (!selectedSpreadId.value.length) {
  517. uni.showToast({
  518. title: t('Ib.Index.Spread4'), icon: 'none',
  519. })
  520. link.value = ''
  521. return
  522. }
  523. const validList = getValidAccountTypes(
  524. excludeShowLoginTypes.value,
  525. selectedSpreadId.value,
  526. )
  527. if (validList.invalidLabels.length > 0) {
  528. return new Promise((resolve) => {
  529. uni.showModal({
  530. title: t('Msg.SystemPrompt'),
  531. content: `${t('Ib.Index.Spread1')}${
  532. loginTypes.value
  533. }${t('')}`,
  534. confirmText: t('Btn.Confirm'),
  535. cancelText: t('Btn.Cancel'),
  536. success: async (res) => {
  537. if (res.confirm) {
  538. const res = await ibApi.customLink(validList)
  539. if (res.code === Code.StatusOK) {
  540. uni.showToast({
  541. title: res.msg,
  542. icon: 'none',
  543. })
  544. resolve(res.data)
  545. } else {
  546. uni.showToast({
  547. title: res.msg,
  548. icon: 'none',
  549. })
  550. resolve('')
  551. }
  552. }
  553. },
  554. fail: () => resolve(''),
  555. })
  556. })
  557. } else {
  558. const res = await ibApi.customLink(validList)
  559. if (res.code === Code.StatusOK) {
  560. uni.showToast({
  561. title: res.msg,
  562. icon: 'none',
  563. })
  564. return res.data
  565. } else {
  566. uni.showToast({
  567. title: res.msg,
  568. icon: 'none',
  569. })
  570. return ''
  571. }
  572. }
  573. }
  574. const CreateLink = async () => {
  575. const linkValue = await getLink1()
  576. if (!linkValue) return
  577. link.value = `${Host80}/#/signup/${getInfoId.value}/${linkValue}/${ibInvalid.value}`
  578. }
  579. const loginTypeList = async () => {
  580. const res = await ibApi.loginTypeList(
  581. {
  582. page: {
  583. current: 1,
  584. row: 100,
  585. },
  586. },
  587. )
  588. if (res.code === Code.StatusOK) {
  589. spreadList.value = res.data
  590. } else {
  591. uni.showToast({ title: res.msg, icon: 'none' })
  592. }
  593. }
  594. const getAgentAccountSetting = async () => {
  595. const { agentAccountSetting = '' } = userInfo.ibInfo ?? {}
  596. if (agentAccountSetting === 0) {
  597. const excludeValues = userInfo.customInfo.excludeShowLoginTypes
  598. try {
  599. excludeList.value = excludeLists.value.filter(
  600. (item) => !excludeValues.includes(item.value),
  601. )
  602. excludeShowLoginTypes.value = []
  603. } catch (e) {
  604. excludeShowLoginTypes.value = []
  605. excludeList.value = excludeLists.value
  606. }
  607. } else {
  608. excludeShowLoginTypes.value = []
  609. excludeList.value = excludeLists.value
  610. }
  611. }
  612. // 生成开户链接
  613. const LinkActivity1 = async () => {
  614. // 跳转到开户链接页面
  615. uni.navigateTo({
  616. url: '/pages/ib/linkList',
  617. })
  618. }
  619. // 生成活动分享链接
  620. const LinkActivity = async () => {
  621. if (flag.value) {
  622. } else {
  623. flag.value = true
  624. }
  625. let res = await ibApi.marketAgentLinkList({})
  626. if (res.code === Code.StatusOK) {
  627. agentLinkList.value = res.data ?? []
  628. loginTypeList()
  629. getAgentAccountSetting()
  630. activityLing.value = ''
  631. linkActivity.value = ''
  632. commission.value = 0
  633. ibInvalid.value = 'B0'
  634. linkActivityPopup.value.open()
  635. flag.value = false
  636. }
  637. }
  638. const CreateActivityLink = async () => {
  639. if (!activityLing.value) {
  640. uni.showToast({ title: t('Ib.Index.ChooseActiv'), icon: 'error' })
  641. return
  642. }
  643. const linkValue = await getLink1()
  644. if (!linkValue) return
  645. if (activityLing.value.indexOf('http') > -1) {
  646. if (activityLing.value.indexOf('?') > -1) {
  647. linkActivity.value =
  648. activityLing.value +
  649. '&mmdi=' +
  650. getInfoId.value +
  651. '&mmF=' +
  652. linkValue +
  653. '&mmB=' +
  654. ibInvalid.value
  655. } else {
  656. linkActivity.value =
  657. activityLing.value +
  658. '?mmdi=' +
  659. getInfoId.value +
  660. '&mmF=' +
  661. linkValue +
  662. '&mmB=' +
  663. ibInvalid.value
  664. }
  665. } else {
  666. if (activityLing.value.indexOf('?') > -1) {
  667. linkActivity.value =
  668. Host80 +
  669. '/' +
  670. activityLing.value +
  671. '&mmdi=' +
  672. getInfoId.value +
  673. '&mmF=' +
  674. linkValue +
  675. '&mmB=' +
  676. ibInvalid.value
  677. } else {
  678. linkActivity.value =
  679. Host80 +
  680. '/' +
  681. activityLing.value +
  682. '?mmdi=' +
  683. getInfoId.value +
  684. '&mmF=' +
  685. linkValue +
  686. '&mmB=' +
  687. ibInvalid.value
  688. }
  689. }
  690. }
  691. const handleMenuClick = ({ value }) => {
  692. console.log(value.type)
  693. if (value.type === 1) {
  694. toWithdraw()
  695. } else {
  696. toTransfer()
  697. }
  698. }
  699. const toWithdraw = () => {
  700. router.push({
  701. path: '/pages/ib/withdraw',
  702. },
  703. )
  704. }
  705. const toTransfer = () => {
  706. router.push({
  707. path: '/pages/ib/transfer',
  708. },
  709. )
  710. }
  711. const toCustomManagement = () => {
  712. router.push({
  713. path: '/pages/ib/customer',
  714. query: { type: 3 },
  715. },
  716. )
  717. }
  718. const toIbManagement = () => {
  719. router.push({
  720. path: '/pages/ib/subsList',
  721. query: { type: 2 },
  722. },
  723. )
  724. }
  725. const getIbData = async () => {
  726. const res = await ibApi.IbData()
  727. if (res.code === Code.StatusOK) {
  728. if (res.data != null)
  729. ibData.value = res.data
  730. } else {
  731. uni.showToast({ title: res.msg, icon: 'none' })
  732. }
  733. }
  734. const getPammManagerValid = async () => {
  735. const res = await ibApi.mamApplyPammManagerValid()
  736. if (res.code === Code.StatusOK) {
  737. if (res.data != null)
  738. pammManagerValid.value = res.data
  739. } else {
  740. uni.showToast({ title: res.msg, icon: 'none' })
  741. }
  742. }
  743. const mamTableRef = ref(null)
  744. const mamSearch = ref({})
  745. const mamListApi = (params) => ibApi.MamList(params)
  746. const showAddMamAccount = computed(() => {
  747. return !!(
  748. pammManagerValid.value?.mamValid ||
  749. pammManagerValid.value?.pammValid ||
  750. pammManagerValid.value?.pammManagerValid
  751. )
  752. })
  753. const addMamAccountMenus = computed(() => {
  754. const list = []
  755. if (pammManagerValid.value?.mamValid) list.push({ label: 'MAM', type: 1 })
  756. if (pammManagerValid.value?.pammValid) list.push({ label: 'Money Manager', type: 2 })
  757. if (pammManagerValid.value?.pammManagerValid) list.push({ label: t('Ib.PammManager.title'), type: 3 })
  758. return list
  759. })
  760. const handleAddMamAccountMenuClick = ({ value }) => {
  761. toNewAccount(value.type)
  762. }
  763. const formatMamType = (type) => {
  764. if (type == 1) return 'MAM'
  765. if (type == 2) return 'Money Manager'
  766. if (type == 3) return t('Ib.PammManager.title1')
  767. return '--'
  768. }
  769. const formatAccountType = (accountType) => {
  770. if (accountType == 1) return t('AccountType.ClassicAccount')
  771. if (accountType == 2) return t('AccountType.SeniorAccount')
  772. if (accountType == 3 && !isAfterJuly28()) return t('AccountType.AgencyAccount')
  773. if (accountType == 5) return t('AccountType.SpeedAccount')
  774. if (accountType == 6) return t('AccountType.SpeedAccount')
  775. if (accountType == 7) return t('AccountType.StandardAccount')
  776. if (accountType == 8) return t('AccountType.CentAccount')
  777. return '--'
  778. }
  779. const mamColumns = computed(() => [
  780. { prop: 'mamAccount', label: t('Ib.Index.MAMAccount'), align: 'center', slot: 'mamAccount' },
  781. { prop: 'type', label: t('Label.Type'), align: 'center', slot: 'mamType' },
  782. { prop: 'accountType', label: t('Ib.Index.LoginType'), align: 'center', slot: 'loginType' },
  783. { prop: 'platform', label: t('Ib.Index.Platform'), align: 'center' },
  784. { prop: 'currency', label: t('Ib.Index.Currency'), align: 'center' },
  785. { prop: 'leverage', label: t('Ib.Index.Leverage'), align: 'center', slot: 'leverage' },
  786. { prop: 'balance', label: t('Ib.Index.Balance'), align: 'center', slot: 'balance' },
  787. { prop: 'equity', label: t('Ib.Index.Equity'), align: 'center', slot: 'equity' },
  788. { prop: 'commission', label: t('Ib.Index.Commission'), align: 'center' },
  789. { prop: 'operation', label: t('Ib.Index.Operation'), align: 'center', slot: 'operation' },
  790. ])
  791. const mamMobilePrimaryFields = computed(() => [
  792. { prop: 'mamAccount', label: t('Ib.Index.MAMAccount'), align: 'center', slot: 'mamAccount' },
  793. { prop: 'type', label: t('Label.Type'), align: 'center', slot: 'mamType' },
  794. { prop: 'platform', label: t('Ib.Index.Platform'), align: 'center' },
  795. { prop: 'more', type: 'more', width: 20, align: 'right' },
  796. ])
  797. const toNewAccount = (type) => {
  798. if (type == 3) {
  799. router.push({
  800. path: '/pages/ib/openPammManager',
  801. query: {
  802. type: type,
  803. },
  804. })
  805. } else {
  806. router.push({
  807. path: '/pages/ib/openAccount',
  808. query: {
  809. type: type,
  810. },
  811. })
  812. }
  813. }
  814. const toSettings = (row) => {
  815. router.push({
  816. path: '/pages/ib/settingPammManager',
  817. query: { login: row.accountId, id: row.id },
  818. })
  819. }
  820. const toDialogPercent = (row) => {
  821. dialogPercentData.value.oldPercent = row.percent
  822. dialogPercentData.value.mamListId = row.id
  823. dialogPercentData.value.oldOwnerId = row.ownerId
  824. dialogPercentData.value.oldAccountId = row.accountId
  825. dialogPercentData.value.percent = ''
  826. dialogPercent.value = true
  827. }
  828. const closeDialogPercent = () => {
  829. dialogPercent.value = false
  830. }
  831. const applyPercent = async () => {
  832. if (isActionLoading.value) return
  833. if (!dialogPercentData.value.percent) {
  834. uni.showToast({ title: t('placeholder.input'), icon: 'none' })
  835. return
  836. }
  837. isActionLoading.value = true
  838. try {
  839. const res = await ibApi.applyPercent({
  840. mamListId: dialogPercentData.value.mamListId,
  841. percent: dialogPercentData.value.percent,
  842. })
  843. if (res.code === Code.StatusOK) {
  844. uni.showToast({ title: res.msg, icon: 'success' })
  845. dialogPercent.value = false
  846. // Refresh MAM list
  847. mamTableRef.value?.refreshTable()
  848. } else {
  849. uni.showToast({ title: res.msg, icon: 'none' })
  850. }
  851. } catch (error) {
  852. uni.showToast({ title: t('Msg.Fail'), icon: 'none' })
  853. } finally {
  854. isActionLoading.value = false
  855. }
  856. }
  857. const toDialogSubs = (row) => {
  858. if (row?.type == 3) {
  859. router.push({
  860. path: '/pages/ib/transfer',
  861. query: { tab: 'pammSubs', id: row.id },
  862. })
  863. return
  864. }
  865. router.push({
  866. path: '/pages/ib/transfer',
  867. query: { tab: 'mamSubs', id: row.id },
  868. })
  869. }
  870. onMounted(() => {
  871. // 初始化数据
  872. getIbData()
  873. getPammManagerValid()
  874. })
  875. </script>
  876. <style lang="scss" scoped>
  877. @import "@/uni.scss";
  878. .dashboard-container {
  879. min-height: 10vh;
  880. box-sizing: border-box;
  881. }
  882. /* 卡片通用样式 */
  883. .card {
  884. background: var(--color-white);
  885. color: #333;
  886. padding: px2rpx(12) px2rpx(16);
  887. border-radius: 4px;
  888. margin-bottom: px2rpx(20);
  889. box-shadow: 0 px2rpx(4) px2rpx(12) rgba(0, 0, 0, 0.2);
  890. }
  891. .custom-dialog-content {
  892. padding: px2rpx(20);
  893. .info-text {
  894. color: #333;
  895. font-size: px2rpx(14);
  896. line-height: px2rpx(36);
  897. }
  898. }
  899. .card-header {
  900. display: flex;
  901. justify-content: space-between;
  902. align-items: center;
  903. margin-bottom: px2rpx(12);
  904. }
  905. .header-left {
  906. display: flex;
  907. align-items: center;
  908. gap: 12rpx;
  909. }
  910. .header-title {
  911. font-size: px2rpx(14);
  912. font-weight: 600;
  913. }
  914. .header-right {
  915. display: flex;
  916. align-items: center;
  917. }
  918. .action-btn {
  919. background: #ffde02;
  920. border: none;
  921. border-radius: 50%;
  922. width: px2rpx(32);
  923. height: px2rpx(32);
  924. display: flex;
  925. align-items: center;
  926. justify-content: center;
  927. padding: 0;
  928. margin: 0;
  929. &:after {
  930. border: none;
  931. }
  932. }
  933. /* 余额区域 */
  934. .balance-content {
  935. display: flex;
  936. flex-direction: column;
  937. align-items: center;
  938. gap: 16rpx;
  939. }
  940. .balance-main {
  941. display: flex;
  942. align-items: baseline;
  943. flex-wrap: wrap;
  944. }
  945. .balance-amount {
  946. font-size: px2rpx(20);
  947. font-weight: 700;
  948. line-height: 1;
  949. }
  950. .balance-decimal {
  951. font-size: px2rpx(16);
  952. font-weight: 500;
  953. line-height: 1;
  954. }
  955. .balance-currency {
  956. font-size: px2rpx(16);
  957. font-weight: 500;
  958. }
  959. .total-earnings {
  960. display: flex;
  961. gap: 12px;
  962. color: rgba(20, 29, 34, 0.6);
  963. font-size: px2rpx(12);
  964. }
  965. .total-value {
  966. }
  967. /* 合作伙伴卡片 */
  968. .partner-content {
  969. display: flex;
  970. flex-direction: column;
  971. gap: 12px;
  972. }
  973. .link-area {
  974. display: flex;
  975. flex-wrap: wrap;
  976. justify-content: space-around;
  977. align-items: center;
  978. gap: 12px;
  979. }
  980. .link-btn {
  981. height: px2rpx(32);
  982. background-color: rgb(108, 133, 149);
  983. line-height: px2rpx(32);
  984. color: var(--color-white);
  985. border-radius: px2rpx(16);
  986. font-size: px2rpx(14);
  987. margin: 0;
  988. }
  989. .code-content {
  990. display: flex;
  991. justify-content: center;
  992. }
  993. .code-input {
  994. width: 50%;
  995. max-width: px2rpx(178);
  996. margin-right: px2rpx(20);
  997. }
  998. .custom-content {
  999. display: flex;
  1000. justify-content: space-around;
  1001. flex-wrap: wrap;
  1002. .con {
  1003. cursor: pointer;
  1004. text-align: center;
  1005. font-size: px2rpx(16);
  1006. margin: 5px;
  1007. }
  1008. .num {
  1009. font-weight: bold;
  1010. }
  1011. .des {
  1012. margin-top: px2rpx(5);
  1013. }
  1014. }
  1015. .dia-content {
  1016. padding: 20rpx;
  1017. }
  1018. .content {
  1019. display: flex;
  1020. flex-direction: column;
  1021. gap: 20rpx;
  1022. }
  1023. .label {
  1024. font-weight: 500;
  1025. margin-bottom: 8rpx;
  1026. }
  1027. .btn {
  1028. margin-top: 16rpx;
  1029. text-align: center;
  1030. }
  1031. .crm-cursor {
  1032. cursor: pointer;
  1033. }
  1034. .link {
  1035. display: flex;
  1036. margin-top: 20rpx;
  1037. .btn {
  1038. display: flex;
  1039. align-items: center;
  1040. justify-content: center;
  1041. height: px2rpx(35);
  1042. margin: 0 px2rpx(10);
  1043. }
  1044. }
  1045. .qrCode {
  1046. display: flex;
  1047. flex-direction: column;
  1048. align-items: center;
  1049. gap: 16rpx;
  1050. }
  1051. .mam-card {
  1052. .add-mam-btn {
  1053. display: flex;
  1054. align-items: center;
  1055. gap: 8rpx;
  1056. height: px2rpx(32);
  1057. line-height: px2rpx(32);
  1058. padding: 0 px2rpx(12);
  1059. margin: 0;
  1060. }
  1061. }
  1062. .mam-line {
  1063. display: flex;
  1064. justify-content: center;
  1065. gap: 6rpx;
  1066. line-height: 1.5;
  1067. }
  1068. .mam-ops {
  1069. display: flex;
  1070. flex-wrap: wrap;
  1071. justify-content: center;
  1072. gap: 10rpx;
  1073. }
  1074. .mam-op {
  1075. color: #2b5aed;
  1076. font-size: px2rpx(12);
  1077. line-height: 1.4;
  1078. }
  1079. </style>