123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <template>
- <view class="container card clearfix">
- <view class="card-title">
- <view class="card-tabs" @click="handleCurrent(0)">
- <view class="card-tabs-text" :class="{ current : current === 0 }">借记卡</view>
- </view>
- <view class="card-tabs" @click="handleCurrent(1)">
- <view class="card-tabs-text" :class="{ current : current === 1 }">贷记卡</view>
- </view>
- </view>
- <view class="card-content">
- <view class="list" v-for="(item, index) in list" :key="index">
- <view class="list-pin">{{ item.pin }}</view>
- <view class="list-card">
- <view class="list-card-item" v-for="(card, index) in item.data" :key="index">
- <view class="logo"><image :src="handleLogo(card.B2B)"></image></view>
- <view class="name">
- <text>{{ card.name }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- StaticUrl: this.$Static,
- isIphoneX:this.$store.state.isIphoneX,
- current:0,
- listQuery: {
- userId: '', // 用户ID
- pageNum: 1, // 页数
- pageSize: 10, // 加载条数
- type: 0 // 查询余额类型
- },
- isEmpty: false,
- loadding: false,
- pullUpOn: true,
- hasNextPage: false,
- pullFlag: true,
- nomoreText: '上拉显示更多',
- list: [
- {
- pin:'G',
- data:[
- {
- type: 1,
- flag: 0,
- B2B: 'ICBC',
- name: '工商银行',
- }
- ]
- },
- {
- pin:'J',
- data:[
- {
- type: 1,
- flag: 0,
- B2B: 'CCB',
- name: '建设银行',
- },
- {
- type: 1,
- flag: 0,
- B2B: 'CCB',
- name: '交通银行',
- },
- ]
- },
- {
- pin:'N',
- data:[
- {
- type: 1,
- flag: 0,
- B2B: 'ABC',
- name: '农业银行',
- }
- ]
- }
- ]
- }
- },
- onLoad() {
- // this.GetAccountInitData()
- },
- filters: {},
- methods: {
- async GetAccountInitData(index) {
- //获取余额明细数据列表
- const user = await this.$api.getStorage()
- this.listQuery.userId = user.userId ? user.userId : 0
- this.UserService.GetUserClubBeansList(this.listQuery)
- .then(response => {
- let data = response.data
- let list = data.pageInfo.list
- this.userBeans = data.userBeans
- this.hasNextPage = data.pageInfo.hasNextPage
- if (list && list.length > 0) {
- this.isEmpty = false
- this.beansList = [...list]
- } else {
- this.isEmpty = true
- }
- if (this.hasNextPage) {
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- } else {
- if (this.beansList.length < 10) {
- this.pullUpOn = true
- } else {
- this.pullUpOn = false
- this.nomoreText = '已至底部'
- }
- }
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- GetOnReachBottomData(index) {
- //上拉加载
- this.listQuery.pageNum += 1
- this.UserService.GetUserClubBeansList(this.listQuery)
- .then(response => {
- let data = response.data
- let list = data.pageInfo.list
- this.userBeans = data.userBeans
- this.hasNextPage = data.pageInfo.hasNextPage
- this.beansList = this.beansList.concat(list)
- this.pullFlag = false // 防上拉暴滑
- setTimeout(() => {
- this.pullFlag = true
- }, 500)
- if (this.hasNextPage) {
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- } else {
- this.loadding = false
- this.pullUpOn = false
- this.nomoreText = '已至底部'
- }
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- handleCurrent(index){
- // tabs 切换
- this.current = index
- },
- handleLogo(type) {
- const LogoMap = {
- 'CCB':'https://img2.baidu.com/it/u=4262210206,1883697020&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501',
- 'ICBC':'https://www.weixinyunduan.com/ups/2016/01/309212/edf5a48e69afa569eb31a52fc36de450.jpg',
- 'ABC':'https://userfile.yksup.com/userdata/18039/img/brand-20170315232223_e0p18k.jpg'
- }
- return LogoMap[type]
- },
- handleStyle(type) {
- const styleMap = {
- 'CCB':'linear-gradient(90deg, #4D8CD8 0%, #3C66C9 100%);',
- 'ICBC':'linear-gradient(90deg, #ED796B 0%, #EF585E 100%);',
- 'ABC':'linear-gradient(90deg, #19B8B2 0%, #009C96 100%);'
- }
- return styleMap[type]
- },
- },
- onReachBottom() {
- if (this.hasNextPage) {
- this.loadding = true
- this.pullUpOn = true
- this.GetOnReachBottomData()
- }
- },
- onPullDownRefresh() {
- //下拉刷新
- this.listQuery.pageNum = 1
- this.GetAccountInitData()
- uni.stopPullDownRefresh()
- },
- onShow() {
- // this.beansList = []
- }
- }
- </script>
- <style lang="scss">
- page,
- .container {
- background: #ffffff;
- height: 100%;
- }
- .card-title {
- width: 100%;
- height: 100rpx;
- .card-tabs{
- width: 50%;
- height: 100%;
- float: left;
- .card-tabs-text{
- width: 100rpx;
- line-height: 96rpx;
- margin: 0 auto;
- font-size: $font-size-32;
- color: #333;
- font-weight: bold;
- box-sizing: border-box;
- border-bottom: 2px solid #ffffff;
- &.current{
- color: #FF5B00;
- border-color: #FF5B00;
- }
- }
- }
- }
- .card-content {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- .list {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- position: relative;
- .list-pin{
- width: 100%;
- line-height: 48rpx;
- box-sizing: border-box;
- padding-left: 47rpx;
- background-color: #F7F7F7;
- font-size: 28rpx;
- color: #333;
- float: left;
- }
- .list-card{
- width: 100%;
- height: auto;
- box-sizing: border-box;
- position: relative;
- padding: 0 32rpx;
- float: left;
- .list-card-item{
- width: 100%;
- height: 100rpx;
- box-sizing: border-box;
- padding: 26rpx 0;
- border-bottom: 1px solid #E1E1E1;
- &:last-child{
- border-bottom: none;
- }
- .logo{
- width: 48rpx;
- height: 48rpx;
- margin-right: 34rpx;
- float: left;
- border-radius: 50%;
- image{
- width: 48rpx;
- height: 48rpx;
- border-radius: 50%;
- display: block;
- }
- }
- .name{
- line-height: 48rpx;
- font-size: 28rpx;
- color: #333;
- }
- }
- }
- }
- }
- .tui-popup-box {
- position: relative;
- box-sizing: border-box;
- min-height: 100rpx;
- padding: 6rpx 24rpx;
- .tui-popup-content {
- padding-top: 30rpx;
- }
- }
- .tui-popup-btn {
- width: 100%;
- height: auto;
- float: left;
- box-sizing: border-box;
- margin-top: 30rpx;
- .tui-button {
- width: 600rpx;
- height: 88rpx;
- background: $btn-confirm;
- line-height: 88rpx;
- text-align: center;
- color: #ffffff;
- font-size: $font-size-28;
- border-radius: 44rpx;
- margin: 0 auto;
- }
- }
- </style>
|