PaymentMethodsList.vue 4.3 KB

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