account-select.vue 13 KB

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