index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209
  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">
  6. <uni-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  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">
  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. </cwg-page-wrapper>
  370. </template>
  371. <script setup>
  372. import { ref, computed, watch, onMounted } from 'vue'
  373. import { useI18n } from 'vue-i18n'
  374. import useRouter from '@/hooks/useRouter'
  375. import { ibApi } from '@/service/ib'
  376. import config from '@/config/index'
  377. import useUserStore from '@/stores/use-user-store'
  378. import { useStorage } from '@/hooks/useStorage'
  379. import QrCode from '@/components/QrCode.vue'
  380. import { useFilters } from '@/composables/useFilters'
  381. import { isAfterJuly28 } from '@/utils/dateUtils'
  382. const { t } = useI18n()
  383. const loading = ref(false)
  384. const router = useRouter()
  385. const { Code } = config
  386. const { userInfo } = useUserStore()
  387. const { numberFormat } = useFilters()
  388. // 数据
  389. const totalEarnings = ref(0.00)
  390. const partnerLink = ref('https://one.exnessonelink.com/a/plokue4yj3')
  391. const partnerCode = ref('PLOKUE4YJ3')
  392. const activeTab = ref('link') // 'link' 或 'code'
  393. const ibData = ref({
  394. customAmount: 0,
  395. ibAmount: 0,
  396. },
  397. )
  398. const selectedSpreadId = ref('')
  399. const spreadList = ref([])
  400. const excludeShowLoginTypes = ref([])
  401. const pammManagerValid = ref()
  402. const dialogPercent = ref(false)
  403. const dialogPercentData = ref({
  404. oldPercent: '',
  405. mamListId: '',
  406. oldOwnerId: '',
  407. oldAccountId: '',
  408. percent: '',
  409. })
  410. const isActionLoading = ref(false)
  411. const menuList = computed(() => [
  412. { label: t('Custom.Index.Withdrawals'), type: 1 },
  413. { label: t('Home.page_ib.item4'), type: 2 },
  414. { label: t('Ib.Transfer.CommissionIssue'), type: 3 },
  415. ])
  416. const excludeList = ref([])
  417. const excludeLists = ref([
  418. { text: t('AccountType.SeniorAccount'), value: '2' },
  419. // {text: t('AccountType.SeniorAccount'),value: '3'},
  420. { text: t('AccountType.StandardAccount'), value: '7' },
  421. { text: t('AccountType.CentAccount'), value: '8' },
  422. ])
  423. const link = ref('')
  424. const loginTypes = ref('')
  425. const ibInvalid = ref('B0')
  426. const qrCode = ref(null)
  427. const qrCode1 = ref(null)
  428. // 语言
  429. const lang = useStorage('lang')
  430. const flag = ref(false)
  431. const agentLinkList = ref([])
  432. const activityLing = ref('')
  433. const linkActivity = ref('')
  434. const commission = ref('')
  435. const linkActivityPopup = ref(null)
  436. // 开户链接
  437. const linkPopup = ref(null)
  438. const qrSize = ref(200)
  439. const levelNum = computed(() => {
  440. return userInfo.ibInfo.levelNum
  441. })
  442. const fixedHide = computed(() => {
  443. return userInfo.ibInfo.fixedHide
  444. })
  445. const getInfoId = computed(() => {
  446. return userInfo.ibInfo.id
  447. })
  448. const balanceInt = computed(() => {
  449. return numberFormat(ibData.value?.balance || 0, true)[0]
  450. })
  451. const balanceDecimal = computed(() => {
  452. return numberFormat(ibData.value?.balance || 0, true)[1] || '00'
  453. })
  454. // 国家
  455. const country = computed(() => {
  456. console.log(userInfo.customInfo.country, '2')
  457. return userInfo.customInfo.country
  458. })
  459. // 修改多选
  460. const handleChange = (val) => {
  461. excludeShowLoginTypes.value = val
  462. }
  463. const isAfterJuly7 = () => {
  464. const currentDate = new Date()
  465. const july7 = new Date(currentDate.getFullYear(), 6, 7) // 月份从0开始,6表示7月
  466. return currentDate >= july7
  467. }
  468. const getValidAccountTypes = (selectedExcludeValues, selectedSpreadId) => {
  469. const spread = spreadList.value.find(
  470. (item) => item.id === selectedSpreadId,
  471. )
  472. let data = {
  473. hide: '',
  474. commission: '',
  475. excludeShowLoginTypes: [],
  476. }
  477. if (!spread) return data
  478. const validValues = selectedExcludeValues.filter((value) =>
  479. spread.loginTypes.includes(value),
  480. )
  481. const invalidValues = selectedExcludeValues.filter(
  482. (value) => !spread.loginTypes.includes(value),
  483. )
  484. const invalidLabels = excludeList.value
  485. .filter((item) => invalidValues.includes(item.value))
  486. .map((item) => item.label)
  487. const excludeTypes = excludeLists.value
  488. .filter((item) => !validValues.includes(item.value))
  489. .map((item) => item.value)
  490. loginTypes.value = invalidLabels.join('、')
  491. return {
  492. hide: spread.hide,
  493. commission: spread.comPoint,
  494. excludeShowLoginTypes: excludeTypes,
  495. invalidLabels,
  496. invalidValues,
  497. }
  498. }
  499. const downloadQrCode = (type = 0) => {
  500. if (type === 1) {
  501. qrCode1.value.download()
  502. } else {
  503. qrCode.value.download()
  504. }
  505. }
  506. // 复制
  507. const CopyShareLink = (value) => {
  508. uni.setClipboardData({ data: value })
  509. }
  510. const getLink1 = async () => {
  511. console.log(excludeShowLoginTypes.value, 2)
  512. if (excludeShowLoginTypes.value.length == 0) {
  513. uni.showToast({
  514. title: t('Ib.Index.Spread5'), icon: 'none',
  515. })
  516. link.value = ''
  517. return
  518. }
  519. if (!selectedSpreadId.value.length) {
  520. uni.showToast({
  521. title: t('Ib.Index.Spread4'), icon: 'none',
  522. })
  523. link.value = ''
  524. return
  525. }
  526. const validList = getValidAccountTypes(
  527. excludeShowLoginTypes.value,
  528. selectedSpreadId.value,
  529. )
  530. if (validList.invalidLabels.length > 0) {
  531. return new Promise((resolve) => {
  532. uni.showModal({
  533. title: t('Msg.SystemPrompt'),
  534. content: `${t('Ib.Index.Spread1')}${
  535. loginTypes.value
  536. }${t('')}`,
  537. confirmText: t('Btn.Confirm'),
  538. cancelText: t('Btn.Cancel'),
  539. success: async (res) => {
  540. if (res.confirm) {
  541. const res = await ibApi.customLink(validList)
  542. if (res.code === Code.StatusOK) {
  543. uni.showToast({
  544. title: res.msg,
  545. icon: 'none',
  546. })
  547. resolve(res.data)
  548. } else {
  549. uni.showToast({
  550. title: res.msg,
  551. icon: 'none',
  552. })
  553. resolve('')
  554. }
  555. }
  556. },
  557. fail: () => resolve(''),
  558. })
  559. })
  560. } else {
  561. const res = await ibApi.customLink(validList)
  562. if (res.code === Code.StatusOK) {
  563. uni.showToast({
  564. title: res.msg,
  565. icon: 'none',
  566. })
  567. return res.data
  568. } else {
  569. uni.showToast({
  570. title: res.msg,
  571. icon: 'none',
  572. })
  573. return ''
  574. }
  575. }
  576. }
  577. const CreateLink = async () => {
  578. const linkValue = await getLink1()
  579. if (!linkValue) return
  580. link.value = `${Host80}/#/signup/${getInfoId.value}/${linkValue}/${ibInvalid.value}`
  581. }
  582. const loginTypeList = async () => {
  583. const res = await ibApi.loginTypeList(
  584. {
  585. page: {
  586. current: 1,
  587. row: 100,
  588. },
  589. },
  590. )
  591. if (res.code === Code.StatusOK) {
  592. spreadList.value = res.data
  593. } else {
  594. uni.showToast({ title: res.msg, icon: 'none' })
  595. }
  596. }
  597. const getAgentAccountSetting = async () => {
  598. const { agentAccountSetting = '' } = userInfo.ibInfo ?? {}
  599. if (agentAccountSetting === 0) {
  600. const excludeValues = userInfo.customInfo.excludeShowLoginTypes
  601. try {
  602. excludeList.value = excludeLists.value.filter(
  603. (item) => !excludeValues.includes(item.value),
  604. )
  605. excludeShowLoginTypes.value = []
  606. } catch (e) {
  607. excludeShowLoginTypes.value = []
  608. excludeList.value = excludeLists.value
  609. }
  610. } else {
  611. excludeShowLoginTypes.value = []
  612. excludeList.value = excludeLists.value
  613. }
  614. }
  615. // 生成开户链接
  616. const LinkActivity1 = async () => {
  617. // 跳转到开户链接页面
  618. uni.navigateTo({
  619. url: '/pages/ib/linkList',
  620. })
  621. }
  622. // 生成活动分享链接
  623. const LinkActivity = async () => {
  624. if (flag.value) {
  625. } else {
  626. flag.value = true
  627. }
  628. let res = await ibApi.marketAgentLinkList({})
  629. if (res.code === Code.StatusOK) {
  630. agentLinkList.value = res.data ?? []
  631. loginTypeList()
  632. getAgentAccountSetting()
  633. activityLing.value = ''
  634. linkActivity.value = ''
  635. commission.value = 0
  636. ibInvalid.value = 'B0'
  637. linkActivityPopup.value.open()
  638. flag.value = false
  639. }
  640. }
  641. const CreateActivityLink = async () => {
  642. if (!activityLing.value) {
  643. uni.showToast({ title: t('Ib.Index.ChooseActiv'), icon: 'error' })
  644. return
  645. }
  646. const linkValue = await getLink1()
  647. if (!linkValue) return
  648. if (activityLing.value.indexOf('http') > -1) {
  649. if (activityLing.value.indexOf('?') > -1) {
  650. linkActivity.value =
  651. activityLing.value +
  652. '&mmdi=' +
  653. getInfoId.value +
  654. '&mmF=' +
  655. linkValue +
  656. '&mmB=' +
  657. ibInvalid.value
  658. } else {
  659. linkActivity.value =
  660. activityLing.value +
  661. '?mmdi=' +
  662. getInfoId.value +
  663. '&mmF=' +
  664. linkValue +
  665. '&mmB=' +
  666. ibInvalid.value
  667. }
  668. } else {
  669. if (activityLing.value.indexOf('?') > -1) {
  670. linkActivity.value =
  671. Host80 +
  672. '/' +
  673. activityLing.value +
  674. '&mmdi=' +
  675. getInfoId.value +
  676. '&mmF=' +
  677. linkValue +
  678. '&mmB=' +
  679. ibInvalid.value
  680. } else {
  681. linkActivity.value =
  682. Host80 +
  683. '/' +
  684. activityLing.value +
  685. '?mmdi=' +
  686. getInfoId.value +
  687. '&mmF=' +
  688. linkValue +
  689. '&mmB=' +
  690. ibInvalid.value
  691. }
  692. }
  693. }
  694. const handleMenuClick = ({ value }) => {
  695. console.log(value.type)
  696. if (value.type === 1) {
  697. toWithdraw()
  698. } else if (value.type === 2) {
  699. toTransfer()
  700. } else {
  701. toTransfer(2)
  702. }
  703. }
  704. const toWithdraw = () => {
  705. router.push({
  706. path: '/pages/ib/withdraw-select',
  707. },
  708. )
  709. }
  710. const toTransfer = (tab = 1) => {
  711. router.push({
  712. path: '/pages/ib/transfer',
  713. query: { tab },
  714. },
  715. )
  716. }
  717. const toCustomManagement = () => {
  718. router.push({
  719. path: '/pages/ib/customer',
  720. query: { type: 3 },
  721. },
  722. )
  723. }
  724. const toIbManagement = () => {
  725. router.push({
  726. path: '/pages/ib/subsList',
  727. query: { type: 2 },
  728. },
  729. )
  730. }
  731. const getIbData = async () => {
  732. const res = await ibApi.IbData()
  733. if (res.code === Code.StatusOK) {
  734. if (res.data != null)
  735. ibData.value = res.data
  736. } else {
  737. uni.showToast({ title: res.msg, icon: 'none' })
  738. }
  739. }
  740. const getPammManagerValid = async () => {
  741. // 没有ib状态不调用
  742. if (!userInfo.ibInfo) {
  743. return
  744. }
  745. const res = await ibApi.mamApplyPammManagerValid()
  746. if (res.code === Code.StatusOK) {
  747. if (res.data != null)
  748. pammManagerValid.value = res.data
  749. } else {
  750. uni.showToast({ title: res.msg, icon: 'none' })
  751. }
  752. }
  753. const mamTableRef = ref(null)
  754. const mamSearch = ref({})
  755. const mamListApi = computed(() => {
  756. // 模拟,没有ib不调用接口
  757. if (!userInfo.ibInfo) {
  758. return (params) => new Promise(resolve => {
  759. resolve({
  760. code: 200,
  761. data: [],
  762. })
  763. })
  764. }
  765. return (params) => ibApi.MamList(params)
  766. })
  767. const showAddMamAccount = computed(() => {
  768. return !!(
  769. pammManagerValid.value?.mamValid ||
  770. pammManagerValid.value?.pammValid ||
  771. pammManagerValid.value?.pammManagerValid
  772. )
  773. })
  774. const addMamAccountMenus = computed(() => {
  775. const list = []
  776. if (pammManagerValid.value?.mamValid) list.push({ label: 'MAM', type: 1 })
  777. if (pammManagerValid.value?.pammValid) list.push({ label: 'Money Manager', type: 2 })
  778. if (pammManagerValid.value?.pammManagerValid) list.push({ label: t('Ib.PammManager.title'), type: 3 })
  779. return list
  780. })
  781. const handleAddMamAccountMenuClick = ({ value }) => {
  782. toNewAccount(value.type)
  783. }
  784. const formatMamType = (type) => {
  785. if (type == 1) return 'MAM'
  786. if (type == 2) return 'Money Manager'
  787. if (type == 3) return t('Ib.PammManager.title1')
  788. return '--'
  789. }
  790. const formatAccountType = (accountType) => {
  791. if (accountType == 1) return t('AccountType.ClassicAccount')
  792. if (accountType == 2) return t('AccountType.SeniorAccount')
  793. if (accountType == 3 && !isAfterJuly28()) return t('AccountType.AgencyAccount')
  794. if (accountType == 5) return t('AccountType.SpeedAccount')
  795. if (accountType == 6) return t('AccountType.SpeedAccount')
  796. if (accountType == 7) return t('AccountType.StandardAccount')
  797. if (accountType == 8) return t('AccountType.CentAccount')
  798. return '--'
  799. }
  800. const mamColumns = computed(() => [
  801. { prop: 'mamAccount', label: t('Ib.Index.MAMAccount'), align: 'center', slot: 'mamAccount' },
  802. { prop: 'type', label: t('Label.Type'), align: 'center', slot: 'mamType' },
  803. { prop: 'accountType', label: t('Ib.Index.LoginType'), align: 'center', slot: 'loginType' },
  804. { prop: 'platform', label: t('Ib.Index.Platform'), align: 'center' },
  805. { prop: 'currency', label: t('Ib.Index.Currency'), align: 'center' },
  806. { prop: 'leverage', label: t('Ib.Index.Leverage'), align: 'center', slot: 'leverage' },
  807. { prop: 'balance', label: t('Ib.Index.Balance'), align: 'center', slot: 'balance' },
  808. { prop: 'equity', label: t('Ib.Index.Equity'), align: 'center', slot: 'equity' },
  809. { prop: 'commission', label: t('Ib.Index.Commission'), align: 'center' },
  810. { prop: 'operation', label: t('Ib.Index.Operation'), align: 'center', slot: 'operation' },
  811. ])
  812. const mamMobilePrimaryFields = computed(() => [
  813. { prop: 'mamAccount', label: t('Ib.Index.MAMAccount'), align: 'center', slot: 'mamAccount' },
  814. { prop: 'type', label: t('Label.Type'), align: 'center', slot: 'mamType' },
  815. { prop: 'platform', label: t('Ib.Index.Platform'), align: 'center' },
  816. { prop: 'more', type: 'more', width: 20, align: 'right' },
  817. ])
  818. const toNewAccount = (type) => {
  819. if (type == 3) {
  820. router.push({
  821. path: '/pages/ib/openPammManager',
  822. query: {
  823. type: type,
  824. },
  825. })
  826. } else {
  827. router.push({
  828. path: '/pages/ib/openAccount',
  829. query: {
  830. type: type,
  831. },
  832. })
  833. }
  834. }
  835. const toSettings = (row) => {
  836. router.push({
  837. path: '/pages/ib/settingPammManager',
  838. query: { login: row.accountId, id: row.id },
  839. })
  840. }
  841. const toDialogPercent = (row) => {
  842. dialogPercentData.value.oldPercent = row.percent
  843. dialogPercentData.value.mamListId = row.id
  844. dialogPercentData.value.oldOwnerId = row.ownerId
  845. dialogPercentData.value.oldAccountId = row.accountId
  846. dialogPercentData.value.percent = ''
  847. dialogPercent.value = true
  848. }
  849. const closeDialogPercent = () => {
  850. dialogPercent.value = false
  851. }
  852. const applyPercent = async () => {
  853. if (isActionLoading.value) return
  854. if (!dialogPercentData.value.percent) {
  855. uni.showToast({ title: t('placeholder.input'), icon: 'none' })
  856. return
  857. }
  858. isActionLoading.value = true
  859. try {
  860. const res = await ibApi.applyPercent({
  861. mamListId: dialogPercentData.value.mamListId,
  862. percent: dialogPercentData.value.percent,
  863. })
  864. if (res.code === Code.StatusOK) {
  865. uni.showToast({ title: res.msg, icon: 'success' })
  866. dialogPercent.value = false
  867. // Refresh MAM list
  868. mamTableRef.value?.refreshTable()
  869. } else {
  870. uni.showToast({ title: res.msg, icon: 'none' })
  871. }
  872. } catch (error) {
  873. uni.showToast({ title: t('Msg.Fail'), icon: 'none' })
  874. } finally {
  875. isActionLoading.value = false
  876. }
  877. }
  878. const toDialogSubs = (row) => {
  879. if (row?.type == 3) {
  880. router.push({
  881. path: '/pages/ib/transfer',
  882. query: { tab: 'pammSubs', id: row.id },
  883. })
  884. return
  885. }
  886. router.push({
  887. path: '/pages/ib/transfer',
  888. query: { tab: 'mamSubs', id: row.id },
  889. })
  890. }
  891. onMounted(async () => {
  892. loading.value = true
  893. // 初始化数据
  894. await getIbData()
  895. await getPammManagerValid()
  896. loading.value = false
  897. })
  898. </script>
  899. <style lang="scss" scoped>
  900. @import "@/uni.scss";
  901. .dashboard-container {
  902. min-height: 10vh;
  903. box-sizing: border-box;
  904. }
  905. /* 卡片通用样式 */
  906. .card {
  907. background: var(--color-white);
  908. color: #333;
  909. padding: px2rpx(12) px2rpx(16);
  910. border-radius: 4px;
  911. margin-bottom: px2rpx(20);
  912. box-shadow: 0 px2rpx(4) px2rpx(12) rgba(0, 0, 0, 0.2);
  913. }
  914. .custom-dialog-content {
  915. padding: px2rpx(20);
  916. .info-text {
  917. color: #333;
  918. font-size: px2rpx(14);
  919. line-height: px2rpx(36);
  920. }
  921. }
  922. .card-header {
  923. display: flex;
  924. justify-content: space-between;
  925. align-items: center;
  926. margin-bottom: px2rpx(12);
  927. }
  928. .header-left {
  929. display: flex;
  930. align-items: center;
  931. gap: 12rpx;
  932. }
  933. .header-title {
  934. font-size: px2rpx(14);
  935. font-weight: 600;
  936. }
  937. .header-right {
  938. display: flex;
  939. align-items: center;
  940. }
  941. .action-btn {
  942. background: #ffde02;
  943. border: none;
  944. border-radius: 50%;
  945. width: px2rpx(32);
  946. height: px2rpx(32);
  947. display: flex;
  948. align-items: center;
  949. justify-content: center;
  950. padding: 0;
  951. margin: 0;
  952. &:after {
  953. border: none;
  954. }
  955. }
  956. /* 余额区域 */
  957. .balance-content {
  958. display: flex;
  959. flex-direction: column;
  960. align-items: center;
  961. gap: 16rpx;
  962. }
  963. .balance-main {
  964. display: flex;
  965. align-items: baseline;
  966. flex-wrap: wrap;
  967. }
  968. .balance-amount {
  969. font-size: px2rpx(20);
  970. font-weight: 700;
  971. line-height: 1;
  972. }
  973. .balance-decimal {
  974. font-size: px2rpx(16);
  975. font-weight: 500;
  976. line-height: 1;
  977. }
  978. .balance-currency {
  979. font-size: px2rpx(16);
  980. font-weight: 500;
  981. }
  982. .total-earnings {
  983. display: flex;
  984. align-items: center;
  985. gap: 5px;
  986. color: rgba(20, 29, 34, 0.6);
  987. font-size: px2rpx(12);
  988. }
  989. .total-value {
  990. align-self: flex-end;
  991. }
  992. /* 合作伙伴卡片 */
  993. .partner-content {
  994. display: flex;
  995. flex-direction: column;
  996. gap: 12px;
  997. }
  998. .link-area {
  999. display: flex;
  1000. flex-wrap: wrap;
  1001. justify-content: space-around;
  1002. align-items: center;
  1003. gap: 12px;
  1004. }
  1005. .link-btn {
  1006. height: px2rpx(32);
  1007. background-color: rgb(108, 133, 149);
  1008. line-height: px2rpx(32);
  1009. color: var(--color-white);
  1010. border-radius: px2rpx(16);
  1011. font-size: px2rpx(14);
  1012. margin: 0;
  1013. }
  1014. .code-content {
  1015. display: flex;
  1016. justify-content: center;
  1017. }
  1018. .code-input {
  1019. width: 50%;
  1020. max-width: px2rpx(178);
  1021. margin-right: px2rpx(20);
  1022. }
  1023. .custom-content {
  1024. display: flex;
  1025. justify-content: space-around;
  1026. flex-wrap: wrap;
  1027. .con {
  1028. cursor: pointer;
  1029. text-align: center;
  1030. font-size: px2rpx(16);
  1031. margin: 5px;
  1032. }
  1033. .num {
  1034. font-weight: bold;
  1035. }
  1036. .des {
  1037. margin-top: px2rpx(5);
  1038. }
  1039. }
  1040. .dia-content {
  1041. padding: 20rpx;
  1042. }
  1043. .content {
  1044. display: flex;
  1045. flex-direction: column;
  1046. gap: 20rpx;
  1047. }
  1048. .label {
  1049. font-weight: 500;
  1050. margin-bottom: 8rpx;
  1051. }
  1052. .btn {
  1053. margin-top: 16rpx;
  1054. text-align: center;
  1055. }
  1056. .crm-cursor {
  1057. cursor: pointer;
  1058. }
  1059. .link {
  1060. display: flex;
  1061. margin-top: 20rpx;
  1062. .btn {
  1063. display: flex;
  1064. align-items: center;
  1065. justify-content: center;
  1066. height: px2rpx(35);
  1067. margin: 0 px2rpx(10);
  1068. }
  1069. }
  1070. .qrCode {
  1071. display: flex;
  1072. flex-direction: column;
  1073. align-items: center;
  1074. gap: 16rpx;
  1075. }
  1076. .mam-card {
  1077. .add-mam-btn {
  1078. display: flex;
  1079. background-color: var(--color-error);
  1080. align-items: center;
  1081. gap: 8rpx;
  1082. height: px2rpx(32);
  1083. line-height: px2rpx(32);
  1084. padding: 0 px2rpx(12);
  1085. margin: 0;
  1086. }
  1087. }
  1088. .mam-line {
  1089. display: flex;
  1090. justify-content: center;
  1091. gap: 6rpx;
  1092. line-height: 1.5;
  1093. }
  1094. .mam-ops {
  1095. display: flex;
  1096. flex-wrap: wrap;
  1097. justify-content: center;
  1098. gap: 10rpx;
  1099. }
  1100. .mam-op {
  1101. color: #2b5aed;
  1102. font-size: px2rpx(12);
  1103. line-height: 1.4;
  1104. }
  1105. </style>