PaymentMethodsList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="payment-list">
  3. <view v-for="item in list" :key="item.id" class="payment-card" :class="{ disabled: item.disabled }"
  4. @click="handleClick(item)">
  5. <view class="icon-wrapper">
  6. <image class="icon" :src="imgUrl + item.icon" mode="widthFix" />
  7. </view>
  8. <view class="content">
  9. <view class="header">
  10. <text class="title">{{ item.name }}</text>
  11. </view>
  12. <view class="info-list">
  13. <view class="info-item">
  14. <text class="info-label" v-t="'Label.ProcessingTime'" />
  15. <text class="info-value">{{ item.fundingTime }}</text>
  16. </view>
  17. <view class="info-item">
  18. <text class="info-label" v-t="'Label.Fee'" />
  19. <text class="info-value">{{ item.free != null ? item.free + '%' : '-' }}</text>
  20. </view>
  21. <view class="info-item">
  22. <text class="info-label">限制</text>
  23. <text class="info-value">{{ item.minAmount }}-{{ item.maxAmount }} {{ item.currency }}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. import { defineProps, defineEmits } from 'vue'
  32. import Config from '@/config/index'
  33. const { Code, Host80 } = Config
  34. const imgUrl = Host80
  35. // 定义 props,接收支付方式列表
  36. const props = defineProps({
  37. list: {
  38. type: Array,
  39. default: () => []
  40. }
  41. })
  42. // 定义事件,点击卡片时触发
  43. const emit = defineEmits(['select'])
  44. const handleClick = (item) => {
  45. if (!item.disabled) {
  46. emit('select', item)
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. @import "@/uni.scss";
  52. .payment-list {
  53. display: grid;
  54. grid-row-gap: px2rpx(16);
  55. grid-column-gap: px2rpx(24);
  56. grid-template-columns: repeat(auto-fill, minmax(px2rpx(320), 1fr));
  57. }
  58. .payment-card {
  59. background-color: #fff;
  60. border-radius: px2rpx(12);
  61. padding: px2rpx(16);
  62. display: flex;
  63. align-items: flex-start;
  64. border: 1px solid rgba(14, 15, 12, 0.08);
  65. transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  66. cursor: pointer;
  67. box-sizing: border-box;
  68. gap: px2rpx(16);
  69. &:hover {
  70. transform: translateY(px2rpx(-2));
  71. background-color: #fff;
  72. box-shadow: 0 px2rpx(8) px2rpx(20) rgba(0, 0, 0, 0.06);
  73. border-color: var(--color-primary, #007aff);
  74. }
  75. &.disabled {
  76. opacity: 0.5;
  77. cursor: not-allowed;
  78. filter: grayscale(100%);
  79. }
  80. .icon-wrapper {
  81. width: px2rpx(120);
  82. height: px2rpx(120);
  83. flex-shrink: 0;
  84. border-radius: px2rpx(8);
  85. background-color: var(--color-zinc-50, #f9f9f9);
  86. display: flex;
  87. align-items: center;
  88. justify-content: center;
  89. overflow: hidden;
  90. .icon {
  91. width: 80%;
  92. }
  93. }
  94. .content {
  95. flex: 1;
  96. min-width: 0; // 防止文本溢出
  97. .header {
  98. margin-bottom: px2rpx(12);
  99. .title {
  100. font-size: px2rpx(16);
  101. font-weight: 700;
  102. color: var(--color-navy-900, #1e2a3a);
  103. word-break: break-all;
  104. }
  105. }
  106. .info-list {
  107. .info-item {
  108. display: flex;
  109. justify-content: space-between;
  110. align-items: center;
  111. margin-bottom: px2rpx(8);
  112. font-size: px2rpx(13);
  113. line-height: 1.4;
  114. .info-label {
  115. color: var(--color-zinc-500, #7f8c8d);
  116. margin-right: px2rpx(8);
  117. white-space: nowrap;
  118. }
  119. .info-value {
  120. color: var(--color-navy-900, #1e2a3a);
  121. font-weight: 600;
  122. text-align: right;
  123. word-break: break-all;
  124. }
  125. &:last-child {
  126. margin-bottom: 0;
  127. }
  128. }
  129. }
  130. }
  131. }
  132. /* 移动端适配 */
  133. @media screen and (max-width: 768px) {
  134. .payment-list {
  135. grid-template-columns: 1fr;
  136. grid-row-gap: px2rpx(12);
  137. }
  138. .payment-card {
  139. padding: px2rpx(12);
  140. gap: px2rpx(12);
  141. .icon-wrapper {
  142. width: px2rpx(90);
  143. height: px2rpx(90);
  144. }
  145. .content {
  146. .header {
  147. margin-bottom: px2rpx(8);
  148. .title {
  149. font-size: px2rpx(15);
  150. }
  151. }
  152. .info-list {
  153. .info-item {
  154. margin-bottom: px2rpx(4);
  155. font-size: px2rpx(12);
  156. }
  157. }
  158. }
  159. }
  160. }
  161. </style>