FirstApply.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="page">
  3. <view class="status-box">
  4. <view v-t="'card.Info.s11'"></view>
  5. <image src="/static/images/card/img2.png" mode="aspectFit" />
  6. <view class="status-box-btn">
  7. <view v-t="'card.Btn.b7'" class="btn-apply" :class="{ disabled: !isAuthVerified || isLoading }"
  8. @click="handleApply"></view>
  9. </view>
  10. <view v-if="!isAuthVerified && !isLoading" class="auth-tip">
  11. {{ t('pages.card.authTip') || '请先完成身份认证' }}
  12. </view>
  13. <view v-t="'card.Info.s12'" class="a-title"></view>
  14. <view class="step-box">
  15. <view class="step-item">
  16. <view class="ids">1</view>
  17. <view v-t="'card.Info.s13'" class="k"></view>
  18. <view v-t="'card.Info.s14'" class="v"></view>
  19. </view>
  20. <view class="step-item">
  21. <view class="ids">2</view>
  22. <view v-t="'card.Info.s15'" class="k"></view>
  23. <view v-t="'card.Info.s16'" class="v"></view>
  24. </view>
  25. <view class="step-item">
  26. <view class="ids">3</view>
  27. <view v-t="'card.Info.s17'" class="k"></view>
  28. <view v-t="'card.Info.s18'" class="v"></view>
  29. </view>
  30. <view class="step-item">
  31. <view class="ids">4</view>
  32. <view v-t="'card.Info.s19'" class="k"></view>
  33. <view v-t="'card.Info.s20'" class="v"></view>
  34. </view>
  35. </view>
  36. <view v-t="'card.Info.s21'" class="f"></view>
  37. </view>
  38. <!-- <view class="cwg-button">
  39. <van-button type="primary" block @click="handleApply">{{ t('cards.p4') }}</van-button>
  40. </view> -->
  41. </view>
  42. </template>
  43. <script setup lang="ts">
  44. import { ref, onMounted, computed } from "vue";
  45. import { useI18n } from "vue-i18n";
  46. import useRouter from "@/hooks/useRouter";
  47. import { userApi } from "@/api/user";
  48. import useUserStore from "@/stores/use-user-store";
  49. import { userToken } from "@/composables/config";
  50. const router = useRouter();
  51. const { t } = useI18n();
  52. const userStore = useUserStore();
  53. const userInfo = computed(() => userStore.userInfo);
  54. // 认证状态
  55. const isAuthVerified = ref(false);
  56. const isLoading = ref(true);
  57. // 检查认证状态
  58. function checkAuthStatus(userData: any) {
  59. // approveStatus == 2 或 kycStatus == 2 表示认证通过
  60. if (userData?.approveStatus == 2) {
  61. isAuthVerified.value = true;
  62. } else {
  63. isAuthVerified.value = false;
  64. }
  65. }
  66. // 获取用户详情
  67. async function getUserSingle() {
  68. if (!userToken.value) {
  69. isLoading.value = false;
  70. isAuthVerified.value = false;
  71. return;
  72. }
  73. try {
  74. isLoading.value = true;
  75. const res = await userApi.getUserSingle();
  76. if (res.code === 200 && res.data) {
  77. // 更新用户信息到 store
  78. userStore.saveUserInfo(res.data);
  79. // 检查认证状态
  80. checkAuthStatus(res.data);
  81. } else {
  82. isAuthVerified.value = false;
  83. }
  84. } catch (error: any) {
  85. console.error('获取用户详情失败:', error);
  86. isAuthVerified.value = false;
  87. } finally {
  88. isLoading.value = false;
  89. }
  90. }
  91. function handleApply() {
  92. if (!isAuthVerified.value || isLoading.value) {
  93. uni.showToast({
  94. title: t('pages.card.authTip') || '请先完成身份认证',
  95. icon: 'none'
  96. });
  97. return;
  98. }
  99. router.push("/pages/card/select");
  100. }
  101. onMounted(async () => {
  102. // 如果 store 中已有用户信息,先检查认证状态
  103. if (userInfo.value) {
  104. checkAuthStatus(userInfo.value);
  105. isLoading.value = false;
  106. }
  107. // 调用接口获取最新用户信息
  108. await getUserSingle();
  109. });
  110. </script>
  111. <style scoped lang="scss">
  112. @import "@/uni.scss";
  113. .page {
  114. // margin: 0 px2rpx(24) px2rpx(100) px2rpx(24);
  115. }
  116. .imgs {
  117. margin-left: px2rpx(74);
  118. margin-bottom: px2rpx(40);
  119. }
  120. .apply-card-steps {
  121. width: 100%;
  122. margin-bottom: px2rpx(52);
  123. display: flex;
  124. flex-direction: column;
  125. align-items: center;
  126. }
  127. .steps-top {
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. width: 100%;
  132. position: relative;
  133. max-width: px2rpx(600);
  134. margin: 0 auto;
  135. }
  136. .step {
  137. display: flex;
  138. flex-direction: column;
  139. align-items: center;
  140. position: relative;
  141. z-index: 2;
  142. flex: 0 0 auto;
  143. }
  144. .step-circle {
  145. width: px2rpx(28);
  146. height: px2rpx(28);
  147. color: var(--main-yellow);
  148. border-radius: 50%;
  149. font-size: px2rpx(14);
  150. font-weight: bold;
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. border: 2px solid var(--main-yellow);
  155. margin-bottom: px2rpx(8);
  156. transition: all 0.3s ease;
  157. }
  158. .step-circle:hover {
  159. transform: scale(1.1);
  160. box-shadow: 0 0 10px rgba(73, 247, 166, 0.3);
  161. }
  162. .step-dash {
  163. flex: 1;
  164. height: px2rpx(2);
  165. background: repeating-linear-gradient(to right,
  166. var(--main-yellow),
  167. var(--main-yellow) px2rpx(6),
  168. transparent px2rpx(6),
  169. transparent px2rpx(12));
  170. min-width: px2rpx(18);
  171. position: relative;
  172. top: -px2rpx(16);
  173. }
  174. .step-label {
  175. color: var(--white);
  176. font-size: px2rpx(14);
  177. font-weight: 500;
  178. text-align: center;
  179. line-height: 2;
  180. }
  181. .status-box {
  182. width: 100%;
  183. display: flex;
  184. justify-content: flex-start;
  185. flex-wrap: wrap;
  186. margin-bottom: px2rpx(20);
  187. gap: px2rpx(16);
  188. .status {
  189. width: 100%;
  190. color: #333333;
  191. font-size: px2rpx(26);
  192. font-family: PingFang SC;
  193. font-weight: 500;
  194. word-wrap: break-word;
  195. text-align: start;
  196. }
  197. view {
  198. width: 100%;
  199. text-align: start;
  200. color: #6f6f6f;
  201. font-size: px2rpx(18);
  202. font-family: PingFang SC;
  203. font-weight: 400;
  204. word-wrap: break-word;
  205. line-height: px2rpx(32);
  206. padding: px2rpx(20) px2rpx(30) px2rpx(20) 0;
  207. margin: 0;
  208. }
  209. .a-title {
  210. color: #333333;
  211. font-size: px2rpx(18);
  212. font-family: PingFang SC;
  213. font-weight: 500;
  214. word-wrap: break-word;
  215. margin-top: px2rpx(44);
  216. }
  217. .step-box {
  218. width: 100%;
  219. display: flex;
  220. flex-wrap: wrap;
  221. justify-content: space-between;
  222. margin-top: px2rpx(20);
  223. padding: 0 0;
  224. .step-item {
  225. width: 100%;
  226. padding: 0 0 px2rpx(10) px2rpx(60);
  227. text-align: center;
  228. position: relative;
  229. &::after {
  230. content: "";
  231. position: absolute;
  232. top: 0;
  233. left: px2rpx(15);
  234. width: 0;
  235. height: 100%;
  236. border-left: 1px dashed #ccc;
  237. z-index: 1;
  238. }
  239. &:last-child {
  240. &::after {
  241. display: none;
  242. }
  243. }
  244. .ids {
  245. position: absolute;
  246. left: 0;
  247. top: 0;
  248. width: px2rpx(30);
  249. height: px2rpx(30);
  250. padding: 0;
  251. position: absolute;
  252. color: #000;
  253. line-height: px2rpx(30);
  254. background-color: #fff;
  255. text-align: center;
  256. border-radius: px2rpx(9999);
  257. border: 1px #ccc dashed;
  258. z-index: 12;
  259. }
  260. .k {
  261. font-size: px2rpx(14);
  262. color: #333333;
  263. font-weight: bold;
  264. padding: 0;
  265. }
  266. .v {
  267. font-size: px2rpx(14);
  268. color: #6f6f6f;
  269. padding: 0;
  270. }
  271. }
  272. }
  273. .f {
  274. margin: px2rpx(20) 0 0 px2rpx(60);
  275. color: #333333;
  276. font-size: px2rpx(14);
  277. font-family: PingFang SC;
  278. font-weight: 500;
  279. word-wrap: break-word;
  280. }
  281. }
  282. .status-box-btn {
  283. margin-top: px2rpx(20);
  284. width: 100%;
  285. display: flex;
  286. justify-content: flex-start;
  287. .btn-apply {
  288. width: px2rpx(193);
  289. height: px2rpx(40);
  290. background: #eb3f57;
  291. border-radius: px2rpx(4);
  292. text-align: center;
  293. color: white;
  294. font-size: px2rpx(16);
  295. font-family: Roboto;
  296. font-weight: 600;
  297. line-height: px2rpx(40);
  298. cursor: pointer;
  299. user-select: none;
  300. padding: 0;
  301. transition: all 0.3s ease;
  302. &.disabled {
  303. background: #ccc;
  304. cursor: not-allowed;
  305. opacity: 0.6;
  306. }
  307. }
  308. }
  309. .status-box-btn1 {
  310. justify-content: center;
  311. }
  312. .auth-tip {
  313. margin-top: px2rpx(12);
  314. width: 100%;
  315. color: #ff6b6b;
  316. font-size: px2rpx(14);
  317. text-align: left;
  318. padding: 0 px2rpx(30) 0 0;
  319. }
  320. </style>