PaymentMethodsList.vue 11 KB

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