account-select.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Custom.Withdraw.Title1')" />
  4. <view class="account-selector">
  5. <template v-if="loading">
  6. </template>
  7. <template v-else-if="standardAccounts.length > 0">
  8. <!-- PC 端表格视图 -->
  9. <view class="account-table pc-view">
  10. <!-- 表头:账户类型 -->
  11. <view class="table-header">
  12. <view class="header-cell type-cell">标准型账户</view>
  13. <view class="header-cell" v-t="'vu.item9'"></view>
  14. <view class="header-cell" v-t="'vu.item10'"></view>
  15. <view class="header-cell" v-t="'vu.item11'"></view>
  16. <!-- <view class="header-cell" v-t="'vu.item12'"></view> -->
  17. </view>
  18. <!-- 标准账户行 -->
  19. <template v-for="account in standardAccounts" :key="account.id">
  20. <view class="account-row" v-if="account.showCondition()" @click="onAccountSelect(account.id)"
  21. :class="{ 'active': account.id == selectedAccountId }">
  22. <view class="row-cell type-cell">
  23. <radio-group @change="(e) => onAccountSelect(account.id)" class="radio-group">
  24. <label class="radio-label">
  25. <radio :value="account.id" :checked="selectedAccountId === account.id"
  26. color="#1e2a3a" />
  27. <image class="account-icon" :src="account.icon" mode="aspectFit" />
  28. <view class="account-info">
  29. <text class="account-name" v-t="account.name" />
  30. <text class="account-desc" v-t="account.description" />
  31. </view>
  32. </label>
  33. </radio-group>
  34. </view>
  35. <view class="row-cell">{{ account.minDeposit }}</view>
  36. <view class="row-cell">{{ account.minSpread }}</view>
  37. <view class="row-cell">{{ account.maxLeverage }}</view>
  38. <!-- <view class="row-cell">{{ account.minSpread }}</view> -->
  39. </view>
  40. </template>
  41. </view>
  42. <!-- 移动端轮播视图 -->
  43. <view class="mobile-view">
  44. <swiper class="account-swiper" :current="currentSwiperIndex" circular indicator-dots
  45. indicator-active-color="#cf1322" @change="onSwiperChange">
  46. <swiper-item v-for="account in filteredAccounts" :key="account.id">
  47. <view class="account-card" @click="onAccountSelect(account.id)"
  48. :class="{ 'active': account.id == selectedAccountId }">
  49. <image class="card-img" :src="account.icon" mode="aspectFit" />
  50. <view class="card-title" v-t="account.name"></view>
  51. <view class="card-tag">
  52. <text class="tag-label">{{ account.typeLabel }}</text>
  53. </view>
  54. <p class="card-desc" v-t="account.description"></p>
  55. <view class="card-info-stack">
  56. <cwg-label-line-value :label="t('vu.item9')" :value="account.minDeposit" />
  57. <cwg-label-line-value :label="t('vu.item10')" :value="account.minSpread" />
  58. <cwg-label-line-value :label="t('vu.item11')" :value="account.maxLeverage" />
  59. <!-- <cwg-label-line-value :label="t('vu.item12')" :value="account.minSpread" /> -->
  60. </view>
  61. </view>
  62. </swiper-item>
  63. </swiper>
  64. </view>
  65. <!-- 继续按钮 -->
  66. <view class="action-button">
  67. <view class="btn" @click="handleContinue">
  68. <text class="button-text" v-t="'forget.forget'" />
  69. </view>
  70. </view>
  71. </template>
  72. </view>
  73. <!-- 条款说明 -->
  74. <view class="terms-section">
  75. <text v-t="'news_add_field.OpenAccount.Des1'"></text>
  76. <text class="pdfLink">
  77. <cwg-link type="pdf" title="news_add_field.OpenAccount.Des2" url="pdf/PrivacyPolicy2019_01.pdf"
  78. target="_blank" />
  79. </text>
  80. </view>
  81. </cwg-page-wrapper>
  82. </template>
  83. <script setup>
  84. import { ref, computed, onMounted, } from 'vue';
  85. import { onLoad } from '@dcloudio/uni-app';
  86. import { customApi } from "@/service/custom";
  87. import useRouter from "@/hooks/useRouter";
  88. import { useI18n } from "vue-i18n";
  89. const router = useRouter();
  90. const { t } = useI18n();
  91. const server = ref('')
  92. const showLogin = ref(null)
  93. const isTimeShow = ref(true)
  94. const loading = ref(true)
  95. onLoad((e) => {
  96. server.value = e.server
  97. })
  98. const typeList = computed(() => [
  99. {
  100. id: 7,
  101. type: 'StandardAccount',
  102. name: 'AccountType.StandardAccount',
  103. showCondition: () => showLogin.value && showLogin.value.indexOf('7') == -1,
  104. description: 'Custom.NewAccount.DesLogin5',
  105. minDeposit: '200 USD',
  106. minSpread: '0.01',
  107. maxLeverage: '1:1000',
  108. icon: '/static/images/info/bank-information-1.webp',
  109. },
  110. {
  111. id: 2,
  112. type: 'SeniorAccount',
  113. name: 'AccountType.SeniorAccount',
  114. showCondition: () => showLogin.value && showLogin.value.indexOf('2') == -1,
  115. description: 'Custom.NewAccount.DesLogin3',
  116. minDeposit: '200 USD',
  117. minSpread: '0.01',
  118. maxLeverage: '1:1000',
  119. icon: '/static/images/info/bank-information-2.webp',
  120. },
  121. {
  122. id: 8,
  123. type: 'CentAccount',
  124. name: 'AccountType.CentAccount',
  125. showCondition: () => showLogin.value && showLogin.value.indexOf('8') == -1 && isTimeShow.value,
  126. description: 'Custom.NewAccount.DesLogin8',
  127. minDeposit: '200 USD',
  128. minSpread: '0.01',
  129. maxLeverage: '1:500',
  130. icon: '/static/images/info/bank-information-3.webp',
  131. }
  132. ])
  133. // 定义账户数据类型
  134. const standardAccounts = computed(() => typeList.value.filter(account => account.showCondition()))
  135. const getExcludeShowLogin = async () => {
  136. try {
  137. let res = await customApi.excludeShowLogin({});
  138. if (res.code == 200) {
  139. if (res.data == null) {
  140. showLogin.value = [];
  141. } else {
  142. showLogin.value = res.data.excludeShowLoginTypes;
  143. }
  144. } else {
  145. console.error('获取账户显示权限失败:', res.msg);
  146. showLogin.value = [];
  147. }
  148. } catch (error) {
  149. console.error('获取账户显示权限出错:', error);
  150. showLogin.value = [];
  151. } finally {
  152. loading.value = false;
  153. }
  154. }
  155. // 过滤后的账户列表
  156. const filteredAccounts = computed(() => {
  157. return standardAccounts.value.filter(account => account.showCondition())
  158. })
  159. // 当前选中的账户 ID
  160. const selectedAccountId = ref(7)
  161. // 轮播图当前索引
  162. const currentSwiperIndex = computed(() => {
  163. const index = filteredAccounts.value.findIndex(a => a.id === selectedAccountId.value)
  164. return index > -1 ? index : 0
  165. })
  166. // 账户选择事件
  167. const onAccountSelect = (id) => {
  168. selectedAccountId.value = id
  169. }
  170. // 轮播图切换事件
  171. const onSwiperChange = (e) => {
  172. const index = e.detail.current
  173. const account = filteredAccounts.value[index]
  174. if (account) {
  175. selectedAccountId.value = account.id
  176. }
  177. }
  178. // 继续按钮点击事件,向上传递选中的账户信息
  179. const handleContinue = () => {
  180. router.push({
  181. path: "/pages/customer/create-account",
  182. query: { id: selectedAccountId.value, server: server.value },
  183. });
  184. }
  185. //获取显示权限
  186. onMounted(() => {
  187. getExcludeShowLogin()
  188. })
  189. </script>
  190. <style lang="scss" scoped>
  191. @import "@/uni.scss";
  192. .account-selector {
  193. background-color: #fff;
  194. overflow: hidden;
  195. min-height: 400px;
  196. }
  197. .loading-container {
  198. display: flex;
  199. flex-direction: column;
  200. align-items: center;
  201. justify-content: center;
  202. height: 400px;
  203. .loading-spinner {
  204. width: 40px;
  205. height: 40px;
  206. border: 3px solid #f3f3f3;
  207. border-top: 3px solid #1e2a3a;
  208. border-radius: 50%;
  209. animation: spin 1s linear infinite;
  210. margin-bottom: 16px;
  211. }
  212. .loading-text {
  213. font-size: 14px;
  214. color: #606266;
  215. }
  216. }
  217. @keyframes spin {
  218. 0% {
  219. transform: rotate(0deg);
  220. }
  221. 100% {
  222. transform: rotate(360deg);
  223. }
  224. }
  225. .table-wrapper {
  226. width: 100%;
  227. overflow-x: auto;
  228. white-space: nowrap;
  229. }
  230. .account-table {
  231. min-width: px2rpx(350);
  232. margin-bottom: px2rpx(10);
  233. /* 保证在小屏上可滚动 */
  234. display: flex;
  235. flex-direction: column;
  236. font-size: px2rpx(14);
  237. color: var(--bs-heading-color);
  238. }
  239. .table-header {
  240. display: flex;
  241. padding: px2rpx(10) 0;
  242. font-weight: 500;
  243. color: var(--bs-heading-color);
  244. .header-cell {
  245. flex: 1;
  246. text-align: center;
  247. padding: 0 px2rpx(8);
  248. white-space: normal;
  249. word-break: break-word;
  250. }
  251. .type-cell {
  252. flex: 2;
  253. text-align: left;
  254. padding-left: px2rpx(12);
  255. }
  256. }
  257. .professional-header {
  258. margin-top: px2rpx(8);
  259. }
  260. .account-row {
  261. display: flex;
  262. align-items: center;
  263. padding: px2rpx(12) 0;
  264. margin: px2rpx(12) 0;
  265. border: 1px solid rgba(108, 133, 149, 0.2);
  266. border-radius: px2rpx(8);
  267. &:hover {
  268. box-shadow: 0 10px 15px -3px rgba(7, 10, 12, 0.08), 0 4px 6px -4px rgba(7, 10, 12, 0.08), 0 0 4px 0 rgba(7, 10, 12, 0.08);
  269. }
  270. &.active {
  271. background-color: rgba(108, 133, 149, 0.07843);
  272. }
  273. .row-cell {
  274. flex: 1;
  275. text-align: center;
  276. padding: 0 px2rpx(8);
  277. font-size: px2rpx(12);
  278. color: #1e2a3a;
  279. white-space: normal;
  280. word-break: break-word;
  281. }
  282. .type-cell {
  283. flex: 2;
  284. text-align: left;
  285. padding-left: px2rpx(12);
  286. }
  287. }
  288. .radio-group {
  289. display: flex;
  290. align-items: center;
  291. width: 100%;
  292. }
  293. .radio-label {
  294. display: flex;
  295. align-items: center;
  296. gap: px2rpx(6);
  297. width: 100%;
  298. }
  299. radio {
  300. transform: scale(0.8);
  301. margin-right: px2rpx(4);
  302. }
  303. .account-icon {
  304. width: px2rpx(48);
  305. height: px2rpx(48);
  306. margin-right: px2rpx(24);
  307. flex-shrink: 0;
  308. }
  309. .account-info {
  310. flex: 1;
  311. display: flex;
  312. flex-direction: column;
  313. text-align: left;
  314. .account-name {
  315. font-size: px2rpx(14);
  316. font-weight: 500;
  317. color: #1e2a3a;
  318. margin-bottom: px2rpx(4);
  319. }
  320. .account-desc {
  321. font-size: px2rpx(12);
  322. color: #7f8c8d;
  323. line-height: 1.4;
  324. }
  325. }
  326. .mobile-view {
  327. display: none;
  328. }
  329. @media screen and (max-width: 600px) {
  330. .pc-view {
  331. display: none;
  332. }
  333. .mobile-view {
  334. display: block;
  335. padding: px2rpx(20) 0;
  336. }
  337. .account-swiper {
  338. min-height: px2rpx(480);
  339. width: 100%;
  340. }
  341. :deep(uni-swiper-item) {
  342. padding: 10px;
  343. box-sizing: border-box;
  344. }
  345. .account-card {
  346. background: #fff;
  347. border-radius: px2rpx(8);
  348. margin: px2rpx(2) px2rpx(2);
  349. padding: px2rpx(16);
  350. display: flex;
  351. flex-direction: column;
  352. align-items: center;
  353. text-align: center;
  354. border: 2px solid transparent;
  355. transition: all 0.3s;
  356. height: px2rpx(400);
  357. color: rgb(20, 29, 34);
  358. box-shadow:
  359. rgba(54, 61, 66, 0.15) 0px 0px 1px 0px,
  360. rgba(54, 61, 66, 0.04) 0px 2px 2px 0px,
  361. rgba(54, 61, 66, 0.12) 0px 2px 8px 0px,
  362. rgba(54, 61, 66, 0.08) 0px -2px 4px 0px;
  363. transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1);
  364. overflow: hidden;
  365. &.active {
  366. transform: translateY(px2rpx(-5));
  367. }
  368. .card-img {
  369. width: px2rpx(120);
  370. height: px2rpx(120);
  371. margin-bottom: px2rpx(20);
  372. }
  373. .card-title {
  374. font-size: px2rpx(24);
  375. font-weight: 700;
  376. color: #1e2a3a;
  377. margin-bottom: px2rpx(8);
  378. }
  379. .card-tag {
  380. background: #f0f2f5;
  381. padding: px2rpx(4) px2rpx(12);
  382. border-radius: px2rpx(20);
  383. margin-bottom: px2rpx(16);
  384. .tag-label {
  385. font-size: px2rpx(12);
  386. color: var(--bs-heading-color);
  387. }
  388. }
  389. .card-desc {
  390. font-size: px2rpx(14);
  391. color: #7f8c8d;
  392. line-height: 1.6;
  393. margin-bottom: px2rpx(24);
  394. height: px2rpx(44);
  395. overflow: hidden;
  396. }
  397. .card-info-stack {
  398. width: 100%;
  399. display: flex;
  400. flex-direction: column;
  401. gap: px2rpx(12);
  402. .info-row {
  403. display: flex;
  404. justify-content: space-between;
  405. align-items: baseline;
  406. position: relative;
  407. font-size: px2rpx(14);
  408. &::after {
  409. content: "";
  410. flex: 1;
  411. margin: 0 px2rpx(10);
  412. border-bottom: 1px dotted #ddd;
  413. height: 1px;
  414. }
  415. .label {
  416. color: var(--bs-heading-color);
  417. order: 1;
  418. }
  419. .value {
  420. color: #1e2a3a;
  421. font-weight: 500;
  422. order: 3;
  423. }
  424. }
  425. }
  426. }
  427. .action-button {
  428. justify-content: center !important;
  429. // padding: 0 px2rpx(20);
  430. .btn {
  431. width: 100%;
  432. min-width: unset !important;
  433. }
  434. }
  435. .terms-section {
  436. text-align: center;
  437. padding: 0 px2rpx(20);
  438. }
  439. }
  440. .action-button {
  441. width: 100%;
  442. display: flex;
  443. justify-content: flex-end;
  444. margin-top: px2rpx(40);
  445. .btn {
  446. width: px2rpx(320);
  447. background-color: #cf1322;
  448. padding: px2rpx(12) px2rpx(20);
  449. border-radius: px2rpx(8);
  450. text-align: center;
  451. cursor: pointer;
  452. box-sizing: border-box;
  453. transition: all 0.2s;
  454. &:active {
  455. opacity: 0.9;
  456. transform: scale(0.98);
  457. }
  458. .button-text {
  459. color: #fff;
  460. font-size: px2rpx(16);
  461. font-weight: 600;
  462. }
  463. }
  464. }
  465. .terms-section {
  466. margin: px2rpx(30) 0;
  467. font-size: px2rpx(14);
  468. line-height: 1.7;
  469. color: var(--bs-heading-color);
  470. text-align: center;
  471. .pdfLink {
  472. margin-left: px2rpx(4);
  473. a {
  474. color: var(--color-primary);
  475. text-decoration: none;
  476. &:hover {
  477. text-decoration: underline;
  478. }
  479. }
  480. }
  481. }
  482. </style>