PaymentMethodsList.vue 9.6 KB

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