| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <template>
- <view class="payment-list">
- <view v-for="item in list" :key="item.id" class="payment-card" :class="{ disabled: item.disabled }"
- @click="handleClick(item)">
- <view class="icon-wrapper">
- <image class="icon" :src="imgUrl + item.icon" mode="widthFix" />
- </view>
- <view class="content">
- <view class="header">
- <text class="title">{{ item.name }}</text>
- </view>
- <view class="info-list">
- <view class="info-item">
- <text class="info-label" v-t="'Label.ProcessingTime'" />
- <text class="info-value">{{ item.fundingTime }}</text>
- </view>
- <view class="info-item">
- <text class="info-label" v-t="'Label.Fee'" />
- <text class="info-value">{{ item.free != null ? item.free + '%' : '-' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">限制</text>
- <text class="info-value">{{ item.minAmount }}-{{ item.maxAmount }} {{ item.currency }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { defineProps, defineEmits } from 'vue'
- import Config from '@/config/index'
- const { Code, Host80 } = Config
- const imgUrl = Host80
- // 定义 props,接收支付方式列表
- const props = defineProps({
- list: {
- type: Array,
- default: () => []
- }
- })
- // 定义事件,点击卡片时触发
- const emit = defineEmits(['select'])
- const handleClick = (item) => {
- if (!item.disabled) {
- emit('select', item)
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "@/uni.scss";
- .payment-list {
- display: grid;
- grid-row-gap: px2rpx(16);
- grid-column-gap: px2rpx(24);
- grid-template-columns: repeat(auto-fill, minmax(px2rpx(320), 1fr));
- }
- .payment-card {
- background-color: #fff;
- border-radius: px2rpx(12);
- padding: px2rpx(16);
- display: flex;
- align-items: flex-start;
- border: 1px solid rgba(14, 15, 12, 0.08);
- transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
- cursor: pointer;
- box-sizing: border-box;
- gap: px2rpx(16);
- &:hover {
- transform: translateY(px2rpx(-2));
- background-color: #fff;
- box-shadow: 0 px2rpx(8) px2rpx(20) rgba(0, 0, 0, 0.06);
- border-color: var(--color-primary, #007aff);
- }
- &.disabled {
- opacity: 0.5;
- cursor: not-allowed;
- filter: grayscale(100%);
- }
- .icon-wrapper {
- width: px2rpx(120);
- height: px2rpx(120);
- flex-shrink: 0;
- border-radius: px2rpx(8);
- background-color: var(--color-zinc-50, #f9f9f9);
- display: flex;
- align-items: center;
- justify-content: center;
- overflow: hidden;
- .icon {
- width: 80%;
- }
- }
- .content {
- flex: 1;
- min-width: 0; // 防止文本溢出
- .header {
- margin-bottom: px2rpx(12);
- .title {
- font-size: px2rpx(16);
- font-weight: 700;
- color: var(--color-navy-900, #1e2a3a);
- word-break: break-all;
- }
- }
- .info-list {
- .info-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: px2rpx(8);
- font-size: px2rpx(13);
- line-height: 1.4;
- .info-label {
- color: var(--color-zinc-500, #7f8c8d);
- margin-right: px2rpx(8);
- white-space: nowrap;
- }
- .info-value {
- color: var(--color-navy-900, #1e2a3a);
- font-weight: 600;
- text-align: right;
- word-break: break-all;
- }
- &:last-child {
- margin-bottom: 0;
- }
- }
- }
- }
- }
- /* 移动端适配 */
- @media screen and (max-width: 768px) {
- .payment-list {
- grid-template-columns: 1fr;
- grid-row-gap: px2rpx(12);
- }
- .payment-card {
- padding: px2rpx(12);
- gap: px2rpx(12);
- .icon-wrapper {
- width: px2rpx(90);
- height: px2rpx(90);
- }
- .content {
- .header {
- margin-bottom: px2rpx(8);
- .title {
- font-size: px2rpx(15);
- }
- }
- .info-list {
- .info-item {
- margin-bottom: px2rpx(4);
- font-size: px2rpx(12);
- }
- }
- }
- }
- }
- </style>
|