index.vue 36 KB

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