list.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <cwg-page-wrapper>
  3. <view class="page page-shadow">
  4. <view class="apply-card-footer">
  5. <view v-if="cardList.length > 0">
  6. <view class="kyc-list">
  7. <view v-for="item in cardList" :key="item.id" class="kyc-item">
  8. <view class="g">
  9. <view class="g-l">
  10. <view class="g-item">
  11. <view class="label a1 ellipsis">{{ item.cardName }}</view>
  12. <view class="status" :class="statusClass1(item.status)">{{
  13. status[item.status]
  14. }}</view>
  15. </view>
  16. <view class="g-item">
  17. <view class="label a2">{{
  18. item?.cardNumber?.replace(
  19. /(\d{4})\d+(\d{4})/,
  20. "$1 **** **** $2"
  21. )
  22. }}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="g">
  27. <view class="g-l g-l1">
  28. <view class="g-item">
  29. <view class="label a3">{{ t("cards.p12") }}</view>
  30. <view class="status-views" @click="handleApply(item)">{{
  31. t("cards.p11")
  32. }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <cwg-empty-state v-if="cardList.length === 0" :title="t('empty-state.t3')" :text="t('empty-state.c3')" />
  40. </view>
  41. </view>
  42. </cwg-page-wrapper>
  43. </template>
  44. <script setup lang="ts">
  45. import { ref, onMounted, watch, computed } from "vue";
  46. import type { CardInfo } from "@/api/ucard";
  47. import { useI18n } from "vue-i18n";
  48. import useRouter from "@/hooks/useRouter";
  49. import { ucardApi } from "@/api/ucard";
  50. import useCardStore from "@/stores/use-card-store";
  51. const cardStore = useCardStore();
  52. const router = useRouter();
  53. const { t } = useI18n();
  54. const status: Record<string, string> = {
  55. success: t("card.Status.t6"),
  56. fail: t("card.Status.t7"),
  57. processing: t("card.Status.t3"),
  58. wait_process: t("card.Status.t3"),
  59. cancel: t("card.New2.p3"),
  60. null: t("card.Status.t3"),
  61. };
  62. function statusClass1(status: string) {
  63. switch (status) {
  64. case "success":
  65. return "status-default status-success";
  66. case "fail":
  67. return "status-default status-error";
  68. case "cancel":
  69. return "status-default status-error";
  70. default:
  71. return "status-default";
  72. }
  73. }
  74. const cardList = ref<CardInfo[]>([]);
  75. const search = ref({});
  76. async function getCardList() {
  77. try {
  78. const res = await ucardApi.applyList({
  79. ...search.value,
  80. page: { current: 1, row: 10 },
  81. });
  82. if (res.code == 200) {
  83. const a = res.data.map((i) => {
  84. if (i.cardNumber) {
  85. i.isOk = true;
  86. } else {
  87. i.isOk = false;
  88. i.cardNumber = "**** **** **** ****";
  89. }
  90. return i;
  91. });
  92. cardList.value = a;
  93. } else {
  94. cardList.value = [];
  95. }
  96. cardStore.saveApplyCard(cardList.value);
  97. } catch (error) {
  98. cardList.value = [];
  99. }
  100. }
  101. function handleApply(item: any) {
  102. router.push({
  103. path: "/pages/apply-record/detail",
  104. query: {
  105. id: item.id,
  106. },
  107. });
  108. }
  109. onMounted(async () => {
  110. getCardList();
  111. });
  112. </script>
  113. <style scoped lang="scss">
  114. @import "@/uni.scss";
  115. .apply-card-footer {
  116. width: 100%;
  117. }
  118. .kyc-item {
  119. display: flex;
  120. align-items: center;
  121. flex-direction: column;
  122. padding: px2rpx(12);
  123. border-bottom: 1px solid var(--border, #333);
  124. font-size: px2rpx(16);
  125. background: var(--action-bg);
  126. border-radius: px2rpx(16);
  127. margin-bottom: px2rpx(16);
  128. border: 1px solid rgba(214, 255, 0, 0.2);
  129. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  130. gap: px2rpx(16);
  131. }
  132. .kyc-item:last-child {
  133. border-bottom: none;
  134. }
  135. .g {
  136. width: 100%;
  137. img {
  138. width: px2rpx(56);
  139. height: px2rpx(35);
  140. }
  141. .g-l {
  142. margin-left: 0;
  143. .g-item {
  144. margin-bottom: 0;
  145. }
  146. .label {
  147. font-family: 'Roboto';
  148. font-style: normal;
  149. font-weight: 600;
  150. font-size: px2rpx(14);
  151. line-height: px2rpx(16);
  152. text-align: left;
  153. color: #1a1a1a;
  154. width: px2rpx(180);
  155. }
  156. .a2 {
  157. color: #6b7280;
  158. font-size: px2rpx(12);
  159. line-height: px2rpx(16);
  160. }
  161. .a1 {
  162. line-height: px2rpx(16);
  163. }
  164. .a3 {
  165. color: #8e8a8a;
  166. font-family: Roboto;
  167. font-size: px2rpx(14);
  168. font-style: normal;
  169. font-weight: 400;
  170. line-height: px2rpx(16);
  171. letter-spacing: px2rpx(0.07);
  172. }
  173. }
  174. .g-l1 {
  175. margin-left: 0;
  176. }
  177. }
  178. </style>
  179. //
  180. <style scoped lang="scss">
  181. @import "@/uni.scss";
  182. // .apply-card-footer {
  183. // width: 100%;
  184. // }
  185. // .kyc-item {
  186. // display: flex;
  187. // align-items: center;
  188. // flex-direction: column;
  189. // padding: px2rpx(12);
  190. // border-bottom: 1px solid var(--border, #333);
  191. // font-size: px2rpx(31);
  192. // background: var(--action-bg);
  193. // border-radius: px2rpx(31);
  194. // margin-bottom: px2rpx(31);
  195. // border: 1px solid rgba(214, 255, 0, 0.2);
  196. // box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  197. // gap: px2rpx(31);
  198. // }
  199. // .kyc-item:last-child {
  200. // border-bottom: none;
  201. // }
  202. // .g {
  203. // width: 100%;
  204. // img {
  205. // width: px2rpx(111);
  206. // height: px2rpx(35);
  207. // }
  208. // .g-l {
  209. // margin-left: 0;
  210. // .g-item {
  211. // margin-bottom: 0;
  212. // }
  213. // .label {
  214. // font-family: "Roboto";
  215. // font-style: normal;
  216. // font-weight: 600;
  217. // font-size: px2rpx(14);
  218. // line-height: px2rpx(31);
  219. // text-align: left;
  220. // color: #1a1a1a;
  221. // width: px2rpx(330);
  222. // }
  223. // .a2 {
  224. // color: #6b7280;
  225. // font-size: px2rpx(12);
  226. // line-height: px2rpx(31);
  227. // }
  228. // .a1 {
  229. // line-height: px2rpx(31);
  230. // }
  231. // .a3 {
  232. // color: #8e8a8a;
  233. // font-family: Roboto;
  234. // font-size: px2rpx(14);
  235. // font-style: normal;
  236. // font-weight: 400;
  237. // line-height: px2rpx(31);
  238. // letter-spacing: px2rpx(0.07);
  239. // }
  240. // }
  241. // .g-l1 {
  242. // margin-left: 0;
  243. // }
  244. // }
  245. // </style>