Files
integral-shop/single_uniapp22miao/pages/sub-pages/my-payee/index.vue

167 lines
3.4 KiB
Vue
Raw Normal View History

<template>
<view class="payee-page">
<!-- 支付宝 -->
<view class="payee-item" @click="goToAlipay">
<view class="item-left">
<view class="icon-wrapper alipay">
<image src="/static/images/alipay-icon.png" class="icon"></image>
</view>
<view class="info">
<view class="title">支付宝</view>
<view class="subtitle" v-if="alipayInfo.account">
{{ alipayInfo.account }}
</view>
<view class="subtitle" v-else>未绑定</view>
</view>
</view>
<view class="item-right">
<text class="arrow"></text>
</view>
</view>
<!-- 银行卡 -->
<view class="payee-item" @click="goToBank">
<view class="item-left">
<view class="icon-wrapper bank">
<image src="/static/images/bank-icon.png" class="icon"></image>
</view>
<view class="info">
<view class="title">银行卡</view>
<view class="subtitle" v-if="bankInfo.card_no">
{{ bankInfo.bank_name }} ({{ bankInfo.card_no.slice(-4) }})
</view>
<view class="subtitle" v-else>未绑定</view>
</view>
</view>
<view class="item-right">
<text class="arrow"></text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
alipayInfo: {},
bankInfo: {}
}
},
onLoad() {
this.loadPayeeInfo();
},
onShow() {
this.loadPayeeInfo();
},
methods: {
// 加载收款信息
async loadPayeeInfo() {
try {
// 加载支付宝信息
const alipayRes = await this.$http.get('/api/alipay/index');
if (alipayRes.code === 0) {
this.alipayInfo = alipayRes.data;
}
// 加载银行卡信息
const bankRes = await this.$http.get('/api/bank/index');
if (bankRes.code === 0) {
this.bankInfo = bankRes.data;
}
} catch (error) {
console.error('加载收款信息失败:', error);
}
},
// 去支付宝页面
goToAlipay() {
uni.navigateTo({
url: '/pages/sub-pages/my-payee/zfb-detail'
});
},
// 去银行卡页面
goToBank() {
uni.navigateTo({
url: '/pages/sub-pages/my-payee/yl-detail'
});
}
}
}
</script>
<style lang="scss" scoped>
.payee-page {
min-height: 100vh;
background-color: #f5f5f5;
padding: 20rpx 30rpx;
}
.payee-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx;
background-color: #fff;
border-radius: 20rpx;
margin-bottom: 20rpx;
.item-left {
display: flex;
align-items: center;
flex: 1;
.icon-wrapper {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
&.alipay {
background-color: #1678FF;
}
&.bank {
background-color: #FF6B6B;
}
.icon {
width: 60rpx;
height: 60rpx;
}
}
.info {
flex: 1;
.title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.subtitle {
font-size: 26rpx;
color: #999;
}
}
}
.item-right {
.arrow {
font-size: 50rpx;
color: #ccc;
}
}
}
</style>