锶源昆仑会员+体验官
This commit is contained in:
115
pages/account/bankList/index.js
Normal file
115
pages/account/bankList/index.js
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
createArr : [] , //列表
|
||||
page : {}, //分页信息
|
||||
type : '', //类型
|
||||
lodingStats : false, //加载状态
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
type: options.type
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取我的账户
|
||||
this.createInfo();
|
||||
},
|
||||
|
||||
// 我的银行卡
|
||||
createInfo(page){
|
||||
wx.$api.user.createList({page : page || 1}).then(res => {
|
||||
let listArr = this.data.createArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.data)
|
||||
this.setData({
|
||||
createArr : newData,
|
||||
page : res.data.page,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
// 删除地址
|
||||
bankRemove(e){
|
||||
let newid = e.currentTarget.dataset.id
|
||||
let list = this.data.createArr
|
||||
wx.showModal({
|
||||
title : '提示',
|
||||
content : '是否删除银行卡',
|
||||
success : res=> {
|
||||
if (res.confirm) {
|
||||
wx.showLoading({
|
||||
title: '删除中',
|
||||
})
|
||||
wx.$api.user.bankDel(newid).then(res=>{
|
||||
this.setData({
|
||||
createArr: list
|
||||
})
|
||||
wx.showToast({
|
||||
title: res.data,
|
||||
icon : "none"
|
||||
})
|
||||
wx.hideLoading()
|
||||
// 获取我的账户
|
||||
this.createInfo();
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择地址
|
||||
*/
|
||||
BankClick(e){
|
||||
let atAdds = this.data.createArr[e.currentTarget.dataset.index]
|
||||
let pages = getCurrentPages(),
|
||||
prepage = pages[pages.length-2]
|
||||
prepage.setData({
|
||||
accounts: atAdds
|
||||
})
|
||||
wx.navigateBack()
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取我的账户
|
||||
this.createInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取我的账户
|
||||
this.createInfo(pageNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
3
pages/account/bankList/index.json
Normal file
3
pages/account/bankList/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
55
pages/account/bankList/index.wxml
Normal file
55
pages/account/bankList/index.wxml
Normal file
@@ -0,0 +1,55 @@
|
||||
<view class="title">
|
||||
<view class="title-name">
|
||||
我的卡<text>(共{{createArr.length}}张)</text>
|
||||
</view>
|
||||
<navigator hover-class="none" url="../bankAdd/index" class="title-add">
|
||||
<image src="/static/icons/bank_add.png"></image>添加银行卡
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="list" wx:if="{{createArr.length > 0}}">
|
||||
<view class="item" wx:for="{{createArr}}" wx:key="createArr">
|
||||
<view class="item-logo">
|
||||
<image src="{{item.bank.cover}}"></image>
|
||||
</view>
|
||||
<view class="item-text">
|
||||
<view class="item-top">
|
||||
<view class="item-title">
|
||||
{{item.bank.name}}
|
||||
</view>
|
||||
<view class="item-name">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-number">
|
||||
{{item.no}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-tool">
|
||||
<view class="item-left" wx:if="{{type == 'selectBank'}}">
|
||||
<view class="item-tool-btn" bindtap="BankClick" data-index="{{index}}">
|
||||
选择此账户
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-btn">
|
||||
<navigator hover-class="none" url="../bankAdd/index?edistatet=compile&bankid={{item.bank_account_id}}" class="item-tool-btn">
|
||||
<image src="/static/icons/bank_edit.png"></image>编辑
|
||||
</navigator>
|
||||
<view class="item-tool-btn" bindtap="bankRemove" data-index="{{index}}" data-id="{{item.bank_account_id}}">
|
||||
<image src="/static/icons/bank_del.png"></image>删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pagesLoding" wx:if="{{lodingStats}}">
|
||||
<block wx:if="{{page.has_more}}">
|
||||
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...
|
||||
</block>
|
||||
<block wx:else>
|
||||
没有更多了~
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pack-center pages-hint" wx:else>
|
||||
<image src="/static/imgs/coupon_null.png"></image>
|
||||
<view>暂无数据</view>
|
||||
</view>
|
||||
130
pages/account/bankList/index.wxss
Normal file
130
pages/account/bankList/index.wxss
Normal file
@@ -0,0 +1,130 @@
|
||||
page {
|
||||
background: #f4f5f9;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
margin-bottom: 30rpx;
|
||||
line-height: 54rpx;
|
||||
}
|
||||
|
||||
.title-name {
|
||||
flex: 1;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.title-name text {
|
||||
color: #9d9d9d;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.title-add {
|
||||
background-color: #e2ecff;
|
||||
display: inline-block;
|
||||
font-size: 28rpx;
|
||||
line-height: 54rpx;
|
||||
padding: 0 15rpx;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
|
||||
.title-add image {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
vertical-align: middle;
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
background-image: linear-gradient(to top left, #3b61ce, #3f8ad4);
|
||||
border-radius: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
position: relative;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.item:nth-child(even) {
|
||||
background-image: linear-gradient(to top left, #e7796e, #e35d65);
|
||||
}
|
||||
|
||||
.item-logo {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
background-color: #ffffff;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.item-logo image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.item-text {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 30rpx 30rpx 30rpx 160rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.item-top {
|
||||
display: flex;
|
||||
color: #ffffff;
|
||||
font-size: 34rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
flex: 1;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.item-number {
|
||||
color: #e9f3ff;
|
||||
}
|
||||
|
||||
|
||||
.item-tool {
|
||||
display: flex;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.item-left {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.item-btn {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.item-tool-btn {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.item-tool-btn {
|
||||
background-color: rgba(255, 255, 255, .4);
|
||||
color: #ffffff;
|
||||
border-radius: 6rpx;
|
||||
height: 48rpx;
|
||||
display: inline-block;
|
||||
line-height: 48rpx;
|
||||
font-size: 26rpx;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.item-tool-btn image {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
vertical-align: -2rpx;
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user