index.vue 33 KB

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