<template>
|
<view class="box">
|
<view class="list">
|
<view :class="item.id == selectBank.id?'list-item active':'list-item'" v-for="(item,index) in bankList" :key="index" >
|
<view class="list-item-a" v-if="item.id == selectBank.id" @click="selectBankDo(item)">
|
<u-icon name="checkmark" color="#004096" size="18"></u-icon>
|
</view>
|
<view class="list-item-b" @click="selectBankDo(item)">
|
{{item.bankInfo || ''}}
|
</view>
|
<view class="list-item-c" @click="jumpEditBank(item)">修改</view>
|
</view>
|
<view v-if="!bankList ||!bankList.length" class="nomore" style="margin-top: 100rpx;">尚未添加银行账户</view>
|
</view>
|
<view style="width: 100%; height: calc(env(safe-area-inset-bottom) + 108rpx);"></view>
|
<view class="button" @click="jumpEditBank()">添加提现银行</view>
|
</view>
|
</template>
|
|
<script>
|
import { mapState } from 'vuex'
|
export default {
|
computed: {
|
...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
|
},
|
data() {
|
return {
|
bankList:[],
|
selectBank:{},
|
id:null,
|
shop:{},
|
info:{}
|
};
|
},
|
onLoad(options) {
|
this.info={}
|
this.shop ={}
|
this.bankList = []
|
this.selectBank=[]
|
this.checkShopLogin()
|
this.shop = this.shopInfo || {}
|
if(options.item){
|
try{
|
this.selectBank = JSON.parse(options.item)
|
}catch(e){
|
|
}
|
}
|
this.getBankList()
|
var that =this
|
uni.$on('editBank',function(data){
|
console.log('监听到事件来自 editBank:' ,data);
|
that.getBankList(true)
|
})
|
|
},
|
methods:{
|
selectBankDo(item){
|
this.selectBank=item
|
uni.$emit('selectBank',{info:this.selectBank})
|
uni.navigateBack({delta:1})
|
},
|
jumpEditBank(item ){
|
if(item && item.id){
|
uni.navigateTo({
|
url: '/pagesA/pages/add-bank-card/add-bank-card?item='+JSON.stringify(item)
|
})
|
}else{
|
uni.navigateTo({
|
url: '/pagesA/pages/add-bank-card/add-bank-card'
|
})
|
}
|
},
|
async getBankList(isRefresh){
|
var that =this
|
let res = await that.$u.api.getBankList({tokenType:1 })
|
var tmpId = (that.selectBank && that.selectBank.id)?that.selectBank.id:null
|
that.selectBank =null
|
if (res.code === 200) {
|
that.bankList = res.data || []
|
if(that.bankList.length>0 ){
|
if( !tmpId ){
|
that.selectBank = that.bankList[0]
|
}else{
|
var tt = false
|
that.bankList.forEach(item =>{
|
if(tmpId == item.id){
|
tt=true
|
that.selectBank = item
|
}
|
})
|
}
|
}
|
if(isRefresh){
|
console.log('selectBank=====',that.selectBank)
|
uni.$emit('selectBank',{info:that.selectBank})
|
}
|
}
|
|
},
|
async checkShopLogin(){
|
var that =this
|
if( this.shopInfo ==null || this.shopInfo.id==null || this.shopToken==null || this.shopToken==''){
|
uni.navigateTo({
|
url: '/pages/login/login'
|
})
|
}
|
}
|
}
|
}
|
</script>
|
|
<style>
|
page {
|
background-color: #F9F9FB;
|
}
|
</style>
|
<style lang="scss" scoped>
|
.box {
|
width: 100%;
|
.button {
|
width: calc(100vw - 60rpx);
|
height: 88rpx;
|
line-height: 88rpx;
|
text-align: center;
|
background: #004096;
|
border-radius: 44rpx;
|
font-weight: 600;
|
font-size: 32rpx;
|
color: #FFFFFF;
|
position: fixed;
|
left: 30rpx;
|
bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
}
|
.list {
|
width: 100%;
|
padding: 0 30rpx;
|
box-sizing: border-box;
|
background-color: #ffffff;
|
.active {
|
.list-item-b {
|
font-weight: 600 !important;
|
font-size: 30rpx !important;
|
color: #222222 !important;
|
}
|
}
|
.list-item {
|
width: 100%;
|
height: 102rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
border-bottom: 1rpx solid #E5E5E5;
|
&:last-child {
|
border: none !important;
|
}
|
.list-item-a {
|
flex-shrink: 0;
|
width: 60rpx;
|
}
|
.list-item-b {
|
flex: 1;
|
font-weight: 400;
|
font-size: 30rpx;
|
color: #222222;
|
}
|
.list-item-c {
|
font-weight: 400;
|
font-size: 28rpx;
|
color: #004096;
|
}
|
}
|
}
|
}
|
</style>
|