PaymentMethodsList.vue 4.2 KB

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