PaymentMethodsList.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <view class="row">
  3. <view class="col-lg-3 col-sm-12" v-for="item in list" :key="item.id" :class="{ disabled: item.disabled }">
  4. <view class="card">
  5. <view class="card-header d-flex justify-content-between align-items-center">
  6. <h4 class="card-title mb-0">{{ item.name }}</h4>
  7. </view>
  8. <view class="card-body">
  9. <image class="img-fluid mb-3" :src="imgUrl + item.icon" mode="widthFix" />
  10. <!-- <image src="/static/images/vu/pay-3.jpg" class="img-fluid mb-3" mode="widthFix" /> -->
  11. <view v-if="item.payTypeTags && item.payTypeTags.length > 0" class="pay-box">
  12. <view class="carousel-box">
  13. <!-- 超过3个:轮播 -->
  14. <view v-if="item.payTypeTags.length > 3" class="carousel-track carousel-animate">
  15. <view v-for="(icon, index) in item.payTypeTags" :key="index" class="pay-icon-container">
  16. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  17. </view>
  18. <view v-for="(icon, index) in item.payTypeTags" :key="`copy-${index}`" class="pay-icon-container">
  19. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  20. </view>
  21. </view>
  22. <!-- 小于等于3个:不轮播 -->
  23. <view v-else class="carousel-track">
  24. <view v-for="(icon, index) in item.payTypeTags" :key="index" class="pay-icon-container">
  25. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="mb-3"> <span class="mb-1" v-t="'Label.ProcessingTime'" />
  31. <p class="text-dark fw-semibold mb-0">{{ item.fundingTime || '--' }}</p>
  32. </view>
  33. <view class="mb-3"> <span class="mb-1" v-t="'Label.Fee'" />
  34. <p class="text-dark fw-semibold mb-0">
  35. <text v-if="item.feeType == 1">{{ item.free != null ? item.free + '%' : '-' }}</text>
  36. <text v-else-if="item.feeType == 2">${{ item.feeAmount != null ? item.feeAmount : '0'
  37. }}</text>
  38. <text v-else>{{ item.free != null ? item.free + '%' : '-' }}</text>
  39. </p>
  40. </view>
  41. <view class="mb-3"> <span class="mb-1" v-t="'vu.item8'" />
  42. <p class="text-dark fw-semibold mb-0">{{ item.minAmount }}-{{ item.maxAmount }} {{ item.currency }}</p>
  43. </view>
  44. <button @click="handleClick(item)" class="btn btn-dark w-100 waves-effect waves-light"><i
  45. class="fi fi-rs-check"></i> <text v-t="'Btn.item13'" /></button>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- <view class="payment-list">
  51. <view v-for="item in list" :key="item.id" class="payment-card" :class="{ disabled: item.disabled }"
  52. @click="handleClick(item)">
  53. <view class="icon-wrapper">
  54. <image class="icon" :src="imgUrl + item.icon" mode="widthFix" />
  55. </view>
  56. <view class="content">
  57. <view class="header">
  58. <text class="title">{{ item.name }}</text>
  59. <view v-if="item.payTypeTags && item.payTypeTags.length > 0" class="pay-box">
  60. <view class="carousel-box">
  61. 超过3个:轮播
  62. <view v-if="item.payTypeTags.length > 3" class="carousel-track carousel-animate">
  63. <view v-for="(icon, index) in item.payTypeTags" :key="index" class="pay-icon-container">
  64. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  65. </view>
  66. <view v-for="(icon, index) in item.payTypeTags" :key="`copy-${index}`" class="pay-icon-container">
  67. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  68. </view>
  69. </view>
  70. 小于等于3个:不轮播
  71. <view v-else class="carousel-track">
  72. <view v-for="(icon, index) in item.payTypeTags" :key="index" class="pay-icon-container">
  73. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="info-list">
  80. <view class="info-item">
  81. <text class="info-label" v-t="'Label.ProcessingTime'" />
  82. <text class="info-value">{{ item.fundingTime || '--' }}</text>
  83. </view>
  84. <view class="info-item">
  85. <text class="info-label" v-t="'Label.Fee'" />
  86. <text class="info-value" v-if="item.feeType == 1">{{ item.free != null ? item.free + '%' : '-' }}</text>
  87. <text class="info-value" v-else-if="item.feeType == 2">${{ item.feeAmount != null ? item.feeAmount : '0'
  88. }}</text>
  89. <text class="info-value" v-else>{{ item.free != null ? item.free + '%' : '-' }}</text>
  90. </view>
  91. <view class="info-item">
  92. <text class="info-label">限制</text>
  93. <text class="info-value">{{ item.minAmount }}-{{ item.maxAmount }} {{ item.currency }}</text>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view> -->
  99. </template>
  100. <script setup>
  101. import { defineProps, defineEmits } from 'vue'
  102. import Config from '@/config/index'
  103. const { Code, Host05, Host80 } = Config
  104. const imgUrl = Host05
  105. // 定义 props,接收支付方式列表
  106. const props = defineProps({
  107. list: {
  108. type: Array,
  109. default: () => []
  110. }
  111. })
  112. // 定义事件,点击卡片时触发
  113. const emit = defineEmits(['select'])
  114. const handleClick = (item) => {
  115. if (!item.disabled) {
  116. emit('select', item)
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. @import "@/uni.scss";
  122. .payment-list {
  123. display: grid;
  124. grid-row-gap: px2rpx(16);
  125. grid-column-gap: px2rpx(24);
  126. grid-template-columns: repeat(auto-fill, minmax(px2rpx(480), 1fr));
  127. }
  128. .payment-card {
  129. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  130. border-radius: px2rpx(12);
  131. padding: px2rpx(16);
  132. display: flex;
  133. align-items: flex-start;
  134. border: 1px solid rgba(14, 15, 12, 0.08);
  135. transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  136. cursor: pointer;
  137. box-sizing: border-box;
  138. gap: px2rpx(16);
  139. &:hover {
  140. transform: translateY(px2rpx(-2));
  141. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  142. box-shadow: 0 px2rpx(8) px2rpx(20) rgba(0, 0, 0, 0.06);
  143. border-color: var(--color-primary, #007aff);
  144. }
  145. &.disabled {
  146. opacity: 0.5;
  147. cursor: not-allowed;
  148. filter: grayscale(100%);
  149. }
  150. .icon-wrapper {
  151. width: px2rpx(120);
  152. height: px2rpx(120);
  153. flex-shrink: 0;
  154. border-radius: px2rpx(8);
  155. background-color: var(--color-zinc-50, #f9f9f9);
  156. display: flex;
  157. align-items: center;
  158. justify-content: center;
  159. overflow: hidden;
  160. .icon {
  161. width: 80%;
  162. }
  163. }
  164. .content {
  165. flex: 1;
  166. min-width: 0; // 防止文本溢出
  167. .header {
  168. margin-bottom: px2rpx(12);
  169. display: flex;
  170. align-items: center;
  171. justify-content: space-between;
  172. .title {
  173. font-size: px2rpx(16);
  174. font-weight: 700;
  175. color: var(--color-navy-900, #1e2a3a);
  176. word-break: break-all;
  177. flex: 1;
  178. margin-right: px2rpx(12);
  179. }
  180. }
  181. .info-list {
  182. .info-item {
  183. display: flex;
  184. justify-content: space-between;
  185. align-items: center;
  186. margin-bottom: px2rpx(8);
  187. font-size: px2rpx(13);
  188. line-height: 1.4;
  189. .info-label {
  190. color: var(--color-zinc-500, #7f8c8d);
  191. margin-right: px2rpx(8);
  192. white-space: nowrap;
  193. }
  194. .info-value {
  195. color: var(--color-navy-900, #1e2a3a);
  196. font-weight: 600;
  197. text-align: right;
  198. word-break: break-all;
  199. }
  200. &:last-child {
  201. margin-bottom: 0;
  202. }
  203. }
  204. }
  205. }
  206. }
  207. .pay-box {
  208. width: px2rpx(60 * 3 + 8 * 2);
  209. flex-shrink: 0;
  210. overflow: hidden;
  211. margin: px2rpx(12) 0;
  212. .carousel-box {
  213. width: 100%;
  214. overflow: hidden;
  215. }
  216. .carousel-track {
  217. display: flex;
  218. gap: px2rpx(8);
  219. width: max-content;
  220. }
  221. // 只有超过3个才加动画
  222. .carousel-animate {
  223. animation: carousel 8s linear infinite;
  224. }
  225. @keyframes carousel {
  226. 0% {
  227. transform: translateX(0);
  228. }
  229. 100% {
  230. transform: translateX(-50%);
  231. }
  232. }
  233. .pay-icon-container {
  234. width: px2rpx(60);
  235. height: px2rpx(60);
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. // background-color: var(--color-zinc-50, #f9f9f9);
  240. // border-radius: px2rpx(6);
  241. // border: 1px solid var(--color-zinc-100, #f3f4f6);
  242. flex-shrink: 0;
  243. overflow: hidden;
  244. }
  245. .pay-icon {
  246. width: px2rpx(60);
  247. height: px2rpx(60);
  248. object-fit: contain;
  249. }
  250. }
  251. /* 移动端适配 */
  252. @media screen and (max-width: 768px) {
  253. .payment-list {
  254. grid-template-columns: 1fr;
  255. grid-row-gap: px2rpx(12);
  256. }
  257. .payment-card {
  258. padding: px2rpx(12);
  259. gap: px2rpx(12);
  260. .icon-wrapper {
  261. width: px2rpx(90);
  262. height: px2rpx(90);
  263. }
  264. .content {
  265. .header {
  266. margin-bottom: px2rpx(8);
  267. .title {
  268. font-size: px2rpx(15);
  269. }
  270. }
  271. .info-list {
  272. .info-item {
  273. margin-bottom: px2rpx(4);
  274. font-size: px2rpx(12);
  275. }
  276. }
  277. }
  278. }
  279. }
  280. </style>