PaymentMethodsList.vue 10 KB

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