account-select.vue 15 KB

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