PaymentMethodsList.vue 11 KB

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