PaymentMethodsList.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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 v-if="item.icon" class="img-fluid mb-3 square-box" :src="imgUrl + item.icon" mode="aspectFit" />
  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 mt-1 mb-0">{{ item.fundingTime || '--' }}</p>
  32. </view>
  33. <view class="mb-3"> <span class="mb-2" v-t="'Label.Fee'" />
  34. <p class="text-dark fw-semibold mt-1 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 mt-1 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. .row {
  123. display: flex;
  124. flex-wrap: wrap;
  125. align-items: stretch;
  126. }
  127. .card {
  128. height: 100%;
  129. display: flex;
  130. flex-direction: column;
  131. }
  132. .card-body {
  133. flex: 1;
  134. display: flex;
  135. flex-direction: column;
  136. }
  137. .square-box {
  138. height: px2rpx(64) !important;
  139. }
  140. .square-img {
  141. position: absolute;
  142. top: 0;
  143. left: 0;
  144. width: 100%;
  145. height: 100%;
  146. }
  147. /* 确保按钮始终在底部 */
  148. .card-body .btn {
  149. margin-top: auto;
  150. }
  151. /* 可选:让卡片内的所有内容区域高度一致 */
  152. .card-body>*:not(.btn) {
  153. flex-shrink: 0;
  154. }
  155. .payment-list {
  156. display: grid;
  157. grid-row-gap: px2rpx(16);
  158. grid-column-gap: px2rpx(24);
  159. grid-template-columns: repeat(auto-fill, minmax(px2rpx(480), 1fr));
  160. }
  161. .payment-card {
  162. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  163. border-radius: px2rpx(12);
  164. padding: px2rpx(16);
  165. display: flex;
  166. align-items: flex-start;
  167. border: 1px solid rgba(14, 15, 12, 0.08);
  168. transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  169. cursor: pointer;
  170. box-sizing: border-box;
  171. gap: px2rpx(16);
  172. &:hover {
  173. transform: translateY(px2rpx(-2));
  174. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  175. box-shadow: 0 px2rpx(8) px2rpx(20) rgba(0, 0, 0, 0.06);
  176. border-color: var(--color-primary, #007aff);
  177. }
  178. &.disabled {
  179. opacity: 0.5;
  180. cursor: not-allowed;
  181. filter: grayscale(100%);
  182. }
  183. .icon-wrapper {
  184. width: px2rpx(120);
  185. height: px2rpx(120);
  186. flex-shrink: 0;
  187. border-radius: px2rpx(8);
  188. background-color: var(--color-zinc-50, #f9f9f9);
  189. display: flex;
  190. align-items: center;
  191. justify-content: center;
  192. overflow: hidden;
  193. .icon {
  194. width: 80%;
  195. }
  196. }
  197. .content {
  198. flex: 1;
  199. min-width: 0; // 防止文本溢出
  200. .header {
  201. margin-bottom: px2rpx(12);
  202. display: flex;
  203. align-items: center;
  204. justify-content: space-between;
  205. .title {
  206. font-size: px2rpx(16);
  207. font-weight: 700;
  208. color: var(--color-navy-900, #1e2a3a);
  209. word-break: break-all;
  210. flex: 1;
  211. margin-right: px2rpx(12);
  212. }
  213. }
  214. .info-list {
  215. .info-item {
  216. display: flex;
  217. justify-content: space-between;
  218. align-items: center;
  219. margin-bottom: px2rpx(8);
  220. font-size: px2rpx(13);
  221. line-height: 1.4;
  222. .info-label {
  223. color: var(--color-zinc-500, #7f8c8d);
  224. margin-right: px2rpx(8);
  225. white-space: nowrap;
  226. }
  227. .info-value {
  228. color: var(--color-navy-900, #1e2a3a);
  229. font-weight: 600;
  230. text-align: right;
  231. word-break: break-all;
  232. }
  233. &:last-child {
  234. margin-bottom: 0;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. .pay-box {
  241. width: px2rpx(60 * 3 + 8 * 2);
  242. flex-shrink: 0;
  243. overflow: hidden;
  244. margin: px2rpx(12) 0;
  245. .carousel-box {
  246. width: 100%;
  247. overflow: hidden;
  248. }
  249. .carousel-track {
  250. display: flex;
  251. gap: px2rpx(8);
  252. width: max-content;
  253. }
  254. // 只有超过3个才加动画
  255. .carousel-animate {
  256. animation: carousel 8s linear infinite;
  257. }
  258. @keyframes carousel {
  259. 0% {
  260. transform: translateX(0);
  261. }
  262. 100% {
  263. transform: translateX(-50%);
  264. }
  265. }
  266. .pay-icon-container {
  267. width: px2rpx(60);
  268. height: px2rpx(60);
  269. display: flex;
  270. align-items: center;
  271. justify-content: center;
  272. // background-color: var(--color-zinc-50, #f9f9f9);
  273. // border-radius: px2rpx(6);
  274. // border: 1px solid var(--color-zinc-100, #f3f4f6);
  275. flex-shrink: 0;
  276. overflow: hidden;
  277. }
  278. .pay-icon {
  279. width: px2rpx(60);
  280. height: px2rpx(60);
  281. object-fit: contain;
  282. }
  283. }
  284. /* 移动端适配 */
  285. @media screen and (max-width: 768px) {
  286. .payment-list {
  287. grid-template-columns: 1fr;
  288. grid-row-gap: px2rpx(12);
  289. }
  290. .payment-card {
  291. padding: px2rpx(12);
  292. gap: px2rpx(12);
  293. .icon-wrapper {
  294. width: px2rpx(90);
  295. height: px2rpx(90);
  296. }
  297. .content {
  298. .header {
  299. margin-bottom: px2rpx(8);
  300. .title {
  301. font-size: px2rpx(15);
  302. }
  303. }
  304. .info-list {
  305. .info-item {
  306. margin-bottom: px2rpx(4);
  307. font-size: px2rpx(12);
  308. }
  309. }
  310. }
  311. }
  312. }
  313. </style>