PaymentMethodsList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <view class="row">
  3. <view class="col-lg-3 col-sm-12 cursor-pointer mb-2 " :data-tooltip="props.title" v-for="item in list"
  4. :key="item.id" :class="{ disabled: item.disabled }" @click="handleClick(item)">
  5. <view class="card hover">
  6. <view class="card-header d-flex justify-content-between align-items-center">
  7. <h4 class="card-title mb-0">{{ item.name }}</h4>
  8. </view>
  9. <view class="card-body">
  10. <image v-if="item.icon" class="img-fluid mb-3 square-box" :src="imgUrl + item.icon" mode="aspectFit" />
  11. <!-- <image src="/static/images/vu/pay-3.jpg" class="img-fluid mb-3" mode="widthFix" /> -->
  12. <view v-if="item.payTypeTags && item.payTypeTags.length > 0" class="pay-box img-bg">
  13. <view class="carousel-box ">
  14. <!-- 超过3个:轮播 -->
  15. <view v-if="item.payTypeTags.length > 3" class="carousel-track carousel-animate">
  16. <view v-for="(icon, index) in item.payTypeTags" :key="index" class="pay-icon-container">
  17. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  18. </view>
  19. <view v-for="(icon, index) in item.payTypeTags" :key="`copy-${index}`" class="pay-icon-container">
  20. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  21. </view>
  22. </view>
  23. <!-- 小于等于3个:不轮播 -->
  24. <view v-else class="carousel-track">
  25. <view v-for="(icon, index) in item.payTypeTags" :key="index" class="pay-icon-container">
  26. <image class="pay-icon" :src="imgUrl + icon" mode="widthFix" />
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="mb-3"> <span class="mb-1" v-t="'Label.ProcessingTime'" />
  32. <p class="text-dark fw-semibold mt-1 mb-0">{{ item.fundingTime || '--' }}</p>
  33. </view>
  34. <view class="mb-3"> <span class="mb-2" v-t="'Label.Fee'" />
  35. <p class="text-dark fw-semibold mt-1 mb-0">
  36. <text v-if="item.feeType == 1">{{ item.free != null ? item.free + '%' : '-' }}</text>
  37. <text v-else-if="item.feeType == 2">${{ item.feeAmount != null ? item.feeAmount : '0'
  38. }}</text>
  39. <text v-else>{{ item.free != null ? item.free + '%' : '-' }}</text>
  40. </p>
  41. </view>
  42. <view class="mb-3"> <span class="mb-1" v-t="'vu.item8'" />
  43. <p class="text-dark fw-semibold mt-1 mb-0">{{ item.minAmount }}-{{ item.maxAmount }} {{ item.currency }}</p>
  44. </view>
  45. <!-- <button hover-class="" @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>-->
  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. title: {
  112. type: String,
  113. default: ''
  114. }
  115. })
  116. // 定义事件,点击卡片时触发
  117. const emit = defineEmits(['select'])
  118. const handleClick = (item) => {
  119. if (!item.disabled) {
  120. emit('select', item)
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. @import "@/uni.scss";
  126. .hover:hover {
  127. border-color: var(--bs-secondary);
  128. }
  129. .img-bg {
  130. padding: 0 px2rpx(10);
  131. border-radius: px2rpx(10);
  132. box-sizing: border-box;
  133. background-color: rgba(243, 244, 246, 0.6);
  134. }
  135. .row {
  136. display: flex;
  137. flex-wrap: wrap;
  138. align-items: stretch;
  139. }
  140. .card {
  141. height: 100%;
  142. display: flex;
  143. flex-direction: column;
  144. }
  145. .card-body {
  146. flex: 1;
  147. display: flex;
  148. flex-direction: column;
  149. }
  150. .square-box {
  151. height: px2rpx(64) !important;
  152. }
  153. .square-img {
  154. position: absolute;
  155. top: 0;
  156. left: 0;
  157. width: 100%;
  158. height: 100%;
  159. }
  160. /* 确保按钮始终在底部 */
  161. .card-body .btn {
  162. margin-top: auto;
  163. }
  164. /* 可选:让卡片内的所有内容区域高度一致 */
  165. .card-body>*:not(.btn) {
  166. flex-shrink: 0;
  167. }
  168. .payment-list {
  169. display: grid;
  170. grid-row-gap: px2rpx(16);
  171. grid-column-gap: px2rpx(24);
  172. grid-template-columns: repeat(auto-fill, minmax(px2rpx(480), 1fr));
  173. }
  174. .payment-card {
  175. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  176. border-radius: px2rpx(12);
  177. padding: px2rpx(16);
  178. display: flex;
  179. align-items: flex-start;
  180. border: 1px solid rgba(14, 15, 12, 0.08);
  181. transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  182. cursor: pointer;
  183. box-sizing: border-box;
  184. gap: px2rpx(16);
  185. &:hover {
  186. transform: translateY(px2rpx(-2));
  187. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  188. box-shadow: 0 px2rpx(8) px2rpx(20) rgba(0, 0, 0, 0.06);
  189. border-color: var(--color-primary, #007aff);
  190. }
  191. &.disabled {
  192. opacity: 0.5;
  193. cursor: not-allowed;
  194. filter: grayscale(100%);
  195. }
  196. .icon-wrapper {
  197. width: px2rpx(120);
  198. height: px2rpx(120);
  199. flex-shrink: 0;
  200. border-radius: px2rpx(8);
  201. background-color: var(--color-zinc-50, #f9f9f9);
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. overflow: hidden;
  206. .icon {
  207. width: 80%;
  208. }
  209. }
  210. .content {
  211. flex: 1;
  212. min-width: 0; // 防止文本溢出
  213. .header {
  214. margin-bottom: px2rpx(12);
  215. display: flex;
  216. align-items: center;
  217. justify-content: space-between;
  218. .title {
  219. font-size: px2rpx(16);
  220. font-weight: 700;
  221. color: var(--color-navy-900, #1e2a3a);
  222. word-break: break-all;
  223. flex: 1;
  224. margin-right: px2rpx(12);
  225. }
  226. }
  227. .info-list {
  228. .info-item {
  229. display: flex;
  230. justify-content: space-between;
  231. align-items: center;
  232. margin-bottom: px2rpx(8);
  233. font-size: px2rpx(13);
  234. line-height: 1.4;
  235. .info-label {
  236. color: var(--color-zinc-500, #7f8c8d);
  237. margin-right: px2rpx(8);
  238. white-space: nowrap;
  239. }
  240. .info-value {
  241. color: var(--color-navy-900, #1e2a3a);
  242. font-weight: 600;
  243. text-align: right;
  244. word-break: break-all;
  245. }
  246. &:last-child {
  247. margin-bottom: 0;
  248. }
  249. }
  250. }
  251. }
  252. }
  253. .pay-box {
  254. width: px2rpx(60 * 3 + 8 * 2);
  255. flex-shrink: 0;
  256. overflow: hidden;
  257. margin: px2rpx(12) 0;
  258. .carousel-box {
  259. width: 100%;
  260. overflow: hidden;
  261. }
  262. .carousel-track {
  263. display: flex;
  264. gap: px2rpx(8);
  265. width: max-content;
  266. }
  267. // 只有超过3个才加动画
  268. .carousel-animate {
  269. animation: carousel 8s linear infinite;
  270. }
  271. @keyframes carousel {
  272. 0% {
  273. transform: translateX(0);
  274. }
  275. 100% {
  276. transform: translateX(-50%);
  277. }
  278. }
  279. .pay-icon-container {
  280. width: px2rpx(60);
  281. height: px2rpx(60);
  282. display: flex;
  283. align-items: center;
  284. justify-content: center;
  285. // background-color: var(--color-zinc-50, #f9f9f9);
  286. // border-radius: px2rpx(6);
  287. // border: 1px solid var(--color-zinc-100, #f3f4f6);
  288. flex-shrink: 0;
  289. overflow: hidden;
  290. }
  291. .pay-icon {
  292. width: px2rpx(60);
  293. height: px2rpx(60);
  294. object-fit: contain;
  295. }
  296. }
  297. /* 移动端适配 */
  298. @media screen and (max-width: 768px) {
  299. .payment-list {
  300. grid-template-columns: 1fr;
  301. grid-row-gap: px2rpx(12);
  302. }
  303. .payment-card {
  304. padding: px2rpx(12);
  305. gap: px2rpx(12);
  306. .icon-wrapper {
  307. width: px2rpx(90);
  308. height: px2rpx(90);
  309. }
  310. .content {
  311. .header {
  312. margin-bottom: px2rpx(8);
  313. .title {
  314. font-size: px2rpx(15);
  315. }
  316. }
  317. .info-list {
  318. .info-item {
  319. margin-bottom: px2rpx(4);
  320. font-size: px2rpx(12);
  321. }
  322. }
  323. }
  324. }
  325. }
  326. </style>