index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true" :bgColor="'#f8f9f9'">
  3. <cwg-header :title="t('Home.page_ib.item1')" />
  4. <uni-row class="demo-uni-row uni-row1">
  5. <uni-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  6. <view class="dashboard-container">
  7. <!-- 余额卡片 -->
  8. <view class="card balance-card">
  9. <view class="card-header">
  10. <view class="header-left">
  11. <cwg-icon name="qbye" :size="24" />
  12. <text class="header-title">{{ t('news_add_field.Label.Balance') }}</text>
  13. </view>
  14. <view class="header-right">
  15. <cwg-dropdown :menu-list="menuList" @menuClick="handleMenuClick">
  16. <view class="pc-header-btn">
  17. <cwg-icon name="crm-ellipsis" :size="24" />
  18. </view>
  19. </cwg-dropdown>
  20. </view>
  21. </view>
  22. <view class="balance-content">
  23. <view class="balance-main">
  24. <text class="balance-currency">$</text>
  25. <text class="balance-amount">{{ balanceInt }}</text>
  26. <text class="balance-decimal">.{{ balanceDecimal }}</text>
  27. </view>
  28. <view class="total-earnings">
  29. <text class="total-label">{{ t('Ib.Index.TotalRevenue') }}</text>
  30. <text class="total-value">{{ totalEarnings }}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 开户链接 -->
  35. <view class="card partner-card">
  36. <view class="card-header">
  37. <view class="header-left">
  38. <cwg-icon name="crm-share-nodes" :size="24" />
  39. <text class="header-title">{{ t('Ib.Index.Link') }}</text>
  40. </view>
  41. </view>
  42. <view class="partner-content">
  43. <view class="link-area">
  44. <button class="link-btn" @click="LinkActivity1">
  45. {{ t('Ib.Index.CreateLink') }}
  46. </button>
  47. <button class="link-btn" @click="LinkActivity">
  48. {{ t('Ib.Index.CreateLinkActivity') }}
  49. </button>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 名下客户 -->
  54. <view class="card custom-card">
  55. <view class="card-header">
  56. <view class="header-left">
  57. <cwg-icon name="crm-custom" :size="24" />
  58. <text class="header-title">{{ t('Ib.Index.NameCustom') }}</text>
  59. </view>
  60. </view>
  61. <view class="custom-content">
  62. <view class="con" @click="toCustomManagement">
  63. <view class="num">
  64. {{ ibData.customAmount }}
  65. </view>
  66. <view class="des">
  67. {{ t('Ib.Index.Custom') }}
  68. </view>
  69. </view>
  70. <view class="con" @click="toIbManagement">
  71. <view class="num">
  72. {{ ibData.ibAmount }}
  73. </view>
  74. <view class="des">
  75. {{ t('Ib.Index.Agent') }}
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 归属推荐码 -->
  81. <view class="card code-card">
  82. <view class="card-header">
  83. <view class="header-left">
  84. <text class="header-title">{{ t('Tips.AttributionCode') }}</text>
  85. <uni-tooltip placement="top">
  86. <text class="icon-tip">?</text>
  87. <template v-slot:content>
  88. <view style="width: 100px;">
  89. {{ t('Tips.tips') }}
  90. </view>
  91. </template>
  92. </uni-tooltip>
  93. </view>
  94. </view>
  95. <view class="code-content">
  96. <uni-easyinput class="code-input" :disabled="true" v-model="getInfoId" :clearable="false"></uni-easyinput>
  97. <button class="link-btn">{{ t('Ib.Index.Copy') }}</button>
  98. </view>
  99. </view>
  100. </view>
  101. </uni-col>
  102. </uni-row>
  103. <!-- 二维码弹窗 -->
  104. <uni-popup ref="linkPopup" type="center" :title="t('Ib.Index.CreateLink')" :mask-click="false" background-color="#fff">
  105. <view class="dia-content">
  106. <view class="content" style="font-size: 14px; text-align: left">
  107. <view class="label">{{ t("Ib.Index.Spread5") }} :</view>
  108. <cwg-combox
  109. v-model="excludeShowLoginTypes"
  110. :multiple="true"
  111. :options="excludeList"
  112. :placeholder="t('placeholder.choose')"
  113. />
  114. <view class="label">{{ t("Ib.Index.Spread4") }} :</view>
  115. <uni-data-select
  116. v-model="selectedSpreadId"
  117. :localdata="spreadList.map(item => ({
  118. value: item.id,
  119. text: t('Ib.Index.Commission') + ':' + item.comPoint +
  120. (levelNum === 1 ? '-' + t('Ib.Index.Hide') + ':' + item.hide :
  121. (fixedHide === 1 ? '' : '-' + t('Ib.Index.Hide') + ':' + item.hide))
  122. }))"
  123. :placeholder="t('placeholder.choose')"
  124. style="width: 100%"
  125. />
  126. <view class="label">{{ t('Ib.Index.IbInvalid') }}</view>
  127. <uni-data-select
  128. v-model="ibInvalid"
  129. :localdata="[
  130. { value: 'B0', text: t('Ib.Custom.Allow') },
  131. { value: 'B1', text: t('Ib.Custom.NotAllow') }
  132. ]"
  133. :placeholder="t('placeholder.choose')"
  134. style="width: 100%"
  135. />
  136. <view>
  137. <text style="line-height: 1.5">{{ t('ApplicationDialog.item1') }}</text>
  138. </view>
  139. <view>
  140. <text style="line-height: 1.5">{{ t('ApplicationDialog.item2') }}</text>
  141. <navigator
  142. :url="country == 'NG' || country == 'TH' || country == 'LA' || isAfterJuly7()
  143. ? `pdf/pdf6/all/Account Type Allocation Table - ${lang}.pdf`
  144. : `pdf/pdf6/no/Account Type Allocation Table-${lang}.pdf`"
  145. target="_blank"
  146. >
  147. {{ t('ApplicationDialog.item3') }}
  148. </navigator>
  149. </view>
  150. <view class="btn">
  151. <text
  152. class="crm-cursor"
  153. @click="CreateLink"
  154. >{{ t('Ib.Index.CreateLink') }}</text>
  155. </view>
  156. <view class="link qrCode" v-if="link">
  157. <QrCode
  158. ref="qrCode"
  159. :text="link"
  160. :width="200"
  161. :height="200"
  162. />
  163. <view class="btn">
  164. <text
  165. class="crm-cursor"
  166. style="height: 16px"
  167. @click="downloadQrCode"
  168. >{{ t('Btn.item9') }}</text>
  169. </view>
  170. </view>
  171. <view class="link">
  172. <uni-easyinput
  173. readonly
  174. v-model="link"
  175. placeholder=""
  176. id="custom_link"
  177. />
  178. <view class="btn">
  179. <text
  180. class="crm-cursor"
  181. @click="CopyShareLink('custom_link')"
  182. >{{ t('Ib.Index.Copy') }}</text>
  183. </view>
  184. </view>
  185. </view>
  186. </view>
  187. </uni-popup>
  188. </cwg-page-wrapper>
  189. </template>
  190. <script setup>
  191. import { ref, computed, watch, onMounted } from 'vue'
  192. import { useI18n } from 'vue-i18n'
  193. import useRouter from '@/hooks/useRouter'
  194. import {ibApi} from '@/service/ib'
  195. import config from '@/config/index'
  196. import useUserStore from '@/stores/use-user-store'
  197. const { t } = useI18n()
  198. const router = useRouter()
  199. const {Code } = config
  200. const { userInfo } = useUserStore()
  201. // 数据
  202. const balanceInt = ref(0)
  203. const balanceDecimal = ref('00')
  204. const totalEarnings = ref(0.00)
  205. const partnerLink = ref('https://one.exnessonelink.com/a/plokue4yj3')
  206. const partnerCode = ref('PLOKUE4YJ3')
  207. const activeTab = ref('link') // 'link' 或 'code'
  208. const getInfoId = ref('123123')
  209. const ibData = ref({
  210. customAmount: "",
  211. ibAmount: "",
  212. }
  213. )
  214. const selectedSpreadId = ref('')
  215. const spreadList = ref([])
  216. const excludeShowLoginTypes = ref([])
  217. const pammManagerValid = ref()
  218. const menuList = ref([
  219. {label: t('Custom.Index.Withdrawals'),type: 1},
  220. {label: t('Custom.Index.Transfer'),type: 2},
  221. ])
  222. const excludeList = ref([])
  223. const excludeLists = ref([
  224. {text: t('AccountType.SeniorAccount'),value: '2'},
  225. // {text: t('AccountType.SeniorAccount'),value: '3'},
  226. {text: t('AccountType.StandardAccount'),value: '7'},
  227. {text: t('AccountType.CentAccount'),value: '8'},
  228. ])
  229. // 开户链接
  230. const linkPopup = ref(null)
  231. const qrSize = ref(200)
  232. // 显示内容
  233. const displayContent = computed(() => {
  234. return activeTab.value === 'link' ? partnerLink.value : partnerCode.value
  235. })
  236. // 复制内容
  237. const handleCopy = () => {
  238. uni.setClipboardData({
  239. data: displayContent.value,
  240. success: () => {
  241. uni.showToast({
  242. title: '复制成功',
  243. icon: 'success',
  244. })
  245. },
  246. fail: () => {
  247. uni.showToast({
  248. title: '复制失败',
  249. icon: 'none',
  250. })
  251. },
  252. })
  253. }
  254. // 查看所有合作伙伴链接
  255. const handleViewAllLinks = () => {
  256. // 根据实际路由配置跳转,此处示例为复制提示或跳转内部页面
  257. uni.navigateTo({
  258. url: '/pages/promo/registration_tools/links',
  259. fail: () => {
  260. uni.showToast({
  261. title: '页面开发中,敬请期待',
  262. icon: 'none',
  263. })
  264. },
  265. })
  266. }
  267. const loginTypeList = async () => {
  268. const res = await ibApi.loginTypeList(
  269. {
  270. page:{
  271. current: 1,
  272. row: 100
  273. }
  274. }
  275. )
  276. if (res.code === Code.StatusOK) {
  277. spreadList.value = res.data
  278. }else {
  279. uni.showToast(res.msg)
  280. }
  281. }
  282. const getAgentAccountSetting = async () => {
  283. console.log(userInfo)
  284. const {agentAccountSetting = ''} = userInfo.ibInfo ?? {}
  285. if (agentAccountSetting === 0) {
  286. const excludeValues = userInfo.customInfo.excludeShowLoginTypes;
  287. try{
  288. excludeList.value = excludeLists.value.filter(
  289. (item) => !excludeValues.includes(item.value)
  290. )
  291. excludeShowLoginTypes.value = []
  292. }catch(e){
  293. excludeShowLoginTypes.value = []
  294. excludeList.value = excludeLists.value
  295. }
  296. }else {
  297. excludeShowLoginTypes.value = []
  298. excludeList.value = excludeLists.value
  299. }
  300. }
  301. // 生成开户链接
  302. const LinkActivity1 = async () => {
  303. // await loginTypeList()
  304. await getAgentAccountSetting()
  305. selectedSpreadId.value = ''
  306. linkPopup.value.open()
  307. }
  308. // 生成活动分享链接
  309. const LinkActivity = () => {
  310. // 根据实际路由配置跳转,此处示例为复制提示或跳转内部页面
  311. uni.navigateTo({
  312. url: '/pages/promo/registration_tools/links',
  313. fail: () => {
  314. uni.showToast({
  315. title: '页面开发中,敬请期待',
  316. icon: 'none',
  317. })
  318. },
  319. })
  320. }
  321. const handleMenuClick = ({value})=>{
  322. console.log(value.type)
  323. if (value.type === 1) {
  324. toWithdraw()
  325. }else {
  326. toTransfer()
  327. }
  328. }
  329. const toWithdraw = () => {
  330. router.push({
  331. path: '/pages/ib/withdraw',
  332. }
  333. )
  334. }
  335. const toTransfer = () => {
  336. router.push({
  337. path: '/pages/ib/transfer',
  338. }
  339. )
  340. }
  341. const toCustomManagement = () => {
  342. router.push({
  343. path: '/pages/ib/customer',
  344. query: { type: 3 }
  345. }
  346. )
  347. }
  348. const toIbManagement = () => {
  349. router.push({
  350. path: '/pages/ib/customer',
  351. query: { type: 2 }
  352. }
  353. )
  354. }
  355. const getIbData = async () => {
  356. const res = await ibApi.IbData()
  357. if (res.code === Code.StatusOK) {
  358. if (res.data != null)
  359. ibData.value = res.data
  360. }else {
  361. uni.showToast(res.msg)
  362. }
  363. }
  364. const getPammManagerValid = async () => {
  365. const res = await ibApi.mamApplyPammManagerValid()
  366. if (res.code === Code.StatusOK) {
  367. if (res.data != null)
  368. pammManagerValid.value = res.data
  369. }else {
  370. uni.showToast(res.msg)
  371. }
  372. }
  373. onMounted(() => {
  374. // 初始化数据
  375. getIbData()
  376. getPammManagerValid()
  377. })
  378. </script>
  379. <style lang="scss" scoped>
  380. @import "@/uni.scss";
  381. .dashboard-container {
  382. min-height: 100vh;
  383. box-sizing: border-box;
  384. }
  385. /* 卡片通用样式 */
  386. .card {
  387. background: var(--color-white);
  388. color: #333;
  389. padding: px2rpx(12) px2rpx(16);
  390. border-radius: 4px;
  391. margin-bottom: px2rpx(20);
  392. box-shadow: 0 px2rpx(4) px2rpx(12) rgba(0, 0, 0, 0.2);
  393. }
  394. .card-header {
  395. display: flex;
  396. justify-content: space-between;
  397. align-items: center;
  398. margin-bottom: px2rpx(12);
  399. }
  400. .header-left {
  401. display: flex;
  402. align-items: center;
  403. gap: 12rpx;
  404. }
  405. .header-title {
  406. font-size: px2rpx(14);
  407. font-weight: 600;
  408. }
  409. .header-right {
  410. display: flex;
  411. align-items: center;
  412. }
  413. .action-btn {
  414. background: #ffde02;
  415. border: none;
  416. border-radius: 50%;
  417. width: px2rpx(32);
  418. height: px2rpx(32);
  419. display: flex;
  420. align-items: center;
  421. justify-content: center;
  422. padding: 0;
  423. margin: 0;
  424. &:after {
  425. border: none;
  426. }
  427. }
  428. /* 余额区域 */
  429. .balance-content {
  430. display: flex;
  431. flex-direction: column;
  432. align-items: center;
  433. gap: 16rpx;
  434. }
  435. .balance-main {
  436. display: flex;
  437. align-items: baseline;
  438. flex-wrap: wrap;
  439. }
  440. .balance-amount {
  441. font-size: px2rpx(20);
  442. font-weight: 700;
  443. line-height: 1;
  444. }
  445. .balance-decimal {
  446. font-size: px2rpx(16);
  447. font-weight: 500;
  448. line-height: 1;
  449. }
  450. .balance-currency {
  451. font-size: px2rpx(16);
  452. font-weight: 500;
  453. }
  454. .total-earnings {
  455. display: flex;
  456. gap: 12px;
  457. color: rgba(20, 29, 34, 0.6);
  458. font-size: px2rpx(12);
  459. }
  460. .total-value {
  461. }
  462. /* 合作伙伴卡片 */
  463. .partner-content {
  464. display: flex;
  465. flex-direction: column;
  466. gap: 12px;
  467. }
  468. .link-area {
  469. display: flex;
  470. flex-wrap: wrap;
  471. justify-content: space-around;
  472. align-items: center;
  473. gap: 12px;
  474. }
  475. .link-btn {
  476. height: px2rpx(32);
  477. background-color: rgb(108, 133, 149);
  478. line-height: px2rpx(32);
  479. color: var(--color-white);
  480. border-radius: px2rpx(16);
  481. font-size: px2rpx(14);
  482. margin: 0;
  483. }
  484. .code-content {
  485. display: flex;
  486. justify-content: center;
  487. }
  488. .code-input {
  489. width: 50%;
  490. max-width: px2rpx(178);
  491. margin-right: px2rpx(20);
  492. }
  493. .custom-content {
  494. display: flex;
  495. justify-content: center;
  496. justify-content: space-around;
  497. flex-wrap: wrap;
  498. .con {
  499. cursor: pointer;
  500. text-align: center;
  501. font-size: px2rpx(16);
  502. margin: 5px;
  503. }
  504. .num {
  505. font-weight: bold;
  506. }
  507. .des {
  508. margin-top: px2rpx(5);
  509. }
  510. }
  511. /* 知识库卡片 */
  512. .knowledge-content {
  513. padding: 8rpx 0;
  514. }
  515. .knowledge-text {
  516. font-size: 28rpx;
  517. line-height: 1.5;
  518. text-decoration: underline;
  519. text-decoration-color: rgba(255, 255, 255, 0.4);
  520. }
  521. /* 二维码弹窗样式 */
  522. .qr-modal {
  523. width: 560rpx;
  524. background: #1e1e2a;
  525. border-radius: 32rpx;
  526. overflow: hidden;
  527. }
  528. .qr-header {
  529. display: flex;
  530. justify-content: space-between;
  531. align-items: center;
  532. padding: 24rpx 32rpx;
  533. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  534. }
  535. .qr-title {
  536. font-size: 32rpx;
  537. font-weight: 600;
  538. }
  539. .qr-close {
  540. font-size: 48rpx;
  541. color: rgba(255, 255, 255, 0.6);
  542. line-height: 1;
  543. cursor: pointer;
  544. }
  545. .qr-body {
  546. display: flex;
  547. justify-content: center;
  548. align-items: center;
  549. padding: 32rpx;
  550. }
  551. .qr-canvas {
  552. width: 400rpx;
  553. height: 400rpx;
  554. background: #fff;
  555. border-radius: 16rpx;
  556. }
  557. .qr-footer {
  558. padding: 24rpx 32rpx;
  559. border-top: 1px solid rgba(255, 255, 255, 0.1);
  560. text-align: center;
  561. }
  562. .qr-tip {
  563. font-size: 24rpx;
  564. color: rgba(255, 255, 255, 0.6);
  565. word-break: break-all;
  566. }
  567. .dia-content {
  568. padding: 20rpx;
  569. }
  570. .content {
  571. display: flex;
  572. flex-direction: column;
  573. gap: 20rpx;
  574. }
  575. .label {
  576. font-weight: 500;
  577. margin-bottom: 8rpx;
  578. }
  579. .btn {
  580. margin-top: 16rpx;
  581. text-align: center;
  582. }
  583. .crm-cursor {
  584. cursor: pointer;
  585. color: #ea002a;
  586. text-decoration: underline;
  587. }
  588. .link {
  589. margin-top: 20rpx;
  590. }
  591. .qrCode {
  592. display: flex;
  593. flex-direction: column;
  594. align-items: center;
  595. gap: 16rpx;
  596. }
  597. </style>