PaymentMethodsList.vue 5.3 KB

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