绚火健康
This commit is contained in:
115
pages/bankCard/bankAdd/bankAdd.js
Normal file
115
pages/bankCard/bankAdd/bankAdd.js
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
bankId : '', // 银行id
|
||||
type : '', // 类型
|
||||
bankData : '', // 银行卡编辑
|
||||
bankArr : [], // 银行列表
|
||||
bankIndex : 0, // 银行列表 index
|
||||
disabled : false// 提交按钮
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
type : options.type,
|
||||
bankId: options.id
|
||||
})
|
||||
|
||||
if(options.type == 'Compile') {
|
||||
// 获取银行编辑信息
|
||||
this.bankEdit();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取银行列表
|
||||
this.bankInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 银行编辑信息
|
||||
*/
|
||||
bankEdit() {
|
||||
wx.$api.bank.cardEdit(this.data.bankId).then(res => {
|
||||
let bankValue = res.data.banks.findIndex(val=> val.id == res.data.info.bank.id)
|
||||
this.setData({
|
||||
bankData : res.data.info,
|
||||
bankIndex: bankValue
|
||||
})
|
||||
}).catch(err => { })
|
||||
},
|
||||
|
||||
/**
|
||||
* 银行机构列表
|
||||
*/
|
||||
bankInfo() {
|
||||
wx.$api.bank.Creates().then(res => {
|
||||
this.setData({
|
||||
bankArr: res.data.banks
|
||||
})
|
||||
}).catch(err => { })
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择银行index
|
||||
*/
|
||||
bankChange(e) {
|
||||
this.setData({
|
||||
bankIndex: e.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
siteform(val) {
|
||||
let value = val.detail.value
|
||||
console.log(value)
|
||||
let data = {
|
||||
name : value.name,
|
||||
mobile : value.mobile,
|
||||
no : value.no,
|
||||
branch_name : value.branch_name,
|
||||
bank_id : this.data.bankArr[this.data.bankIndex].id
|
||||
}
|
||||
this.setData({
|
||||
disabled: true
|
||||
})
|
||||
|
||||
// 入口为编辑
|
||||
if(this.data.type == 'Compile') {
|
||||
wx.$api.bank.Confirm(this.data.bankId, data).then(res => {
|
||||
wx.navigateBack()
|
||||
}).catch(() =>{
|
||||
this.setData({
|
||||
disabled: false
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 新增
|
||||
wx.$api.bank.cardBind(data).then(res => {
|
||||
wx.navigateBack()
|
||||
}).catch(() =>{
|
||||
this.setData({
|
||||
disabled: false
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
4
pages/bankCard/bankAdd/bankAdd.json
Normal file
4
pages/bankCard/bankAdd/bankAdd.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "绑定银行卡"
|
||||
}
|
||||
34
pages/bankCard/bankAdd/bankAdd.wxml
Normal file
34
pages/bankCard/bankAdd/bankAdd.wxml
Normal file
@@ -0,0 +1,34 @@
|
||||
<!-- 添加地址 -->
|
||||
<form bindsubmit="siteform" class="ce-radius site-form">
|
||||
<view class="ce-white">
|
||||
<view class="site-input">
|
||||
<label>开户银行</label>
|
||||
<picker bindchange="bankChange" value="{{bankIndex}}" range="{{bankArr}}" range-key="name" class="conneColor">
|
||||
<view class="picker">
|
||||
{{bankArr[bankIndex].name}}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>支行名称</label>
|
||||
<input placeholder="请输入支行名称" name="branch_name" value="{{bankData.branch_name}}"></input>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>银行卡号</label>
|
||||
<input placeholder="请输入银行卡号" name="no" value="{{bankData.no}}"></input>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>收款人姓名</label>
|
||||
<input placeholder="请输入收款人姓名" name="name" value="{{bankData.name}}"></input>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>收款人手机号</label>
|
||||
<input placeholder="请输入开户账号手机号" name="mobile" type="number" maxlength="11" value="{{bankData.mobile}}"></input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="site-btn">
|
||||
<button form-type="submit" size="mini" disabled="{{disabled}}">确认添加</button>
|
||||
</view>
|
||||
</form>
|
||||
137
pages/bankCard/bankAdd/bankAdd.wxss
Normal file
137
pages/bankCard/bankAdd/bankAdd.wxss
Normal file
@@ -0,0 +1,137 @@
|
||||
.site-form {
|
||||
margin: 20rpx;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.site-btn {
|
||||
margin: 40rpx 0;
|
||||
}
|
||||
|
||||
.site-input {
|
||||
padding: 0 30rpx 0 280rpx;
|
||||
position: relative;
|
||||
line-height: 100rpx;
|
||||
min-height: 100rpx;
|
||||
}
|
||||
|
||||
.site-input label {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.site-input input {
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.site-input::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 30rpx;
|
||||
right: 0;
|
||||
height: 1rpx;
|
||||
content: "";
|
||||
background: #e4e6f2;
|
||||
}
|
||||
|
||||
.site-input:last-child::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tui-picker-detail {
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.site-btn button[size="mini"] {
|
||||
width: 100%;
|
||||
background: #da2b54;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
font-size: 30rpx;
|
||||
color: white;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.site-btn button[disabled] {
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
/* pickerView */
|
||||
|
||||
.pickerView-back {
|
||||
background: rgba(0, 0, 0, .3);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pickerView-back.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pickerView-layer {
|
||||
position: fixed;
|
||||
bottom: -571rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background: white;
|
||||
transition: all .3s;
|
||||
}
|
||||
|
||||
.pickerView-layer.active {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.pickerView-btn {
|
||||
line-height: 90rpx;
|
||||
font-size: 30rpx;
|
||||
padding: 0 30rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.pickerView {
|
||||
height: 480rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.pickerView-name {
|
||||
line-height: 80rpx;
|
||||
padding: 0 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pickerView-mask {
|
||||
border-top: solid 1rpx #e4e6f2;
|
||||
}
|
||||
|
||||
.pickerView-indicator {
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.pickerView-determine {
|
||||
color: #3ec28e;
|
||||
}
|
||||
|
||||
.pickerView-cancel {
|
||||
color: #747788;
|
||||
}
|
||||
|
||||
|
||||
.site-input image {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: calc(50% - 19rpx);
|
||||
}
|
||||
|
||||
.site-switch {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
100
pages/bankCard/index.js
Normal file
100
pages/bankCard/index.js
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
bankArr : [], //列表数据
|
||||
page : {}, //分页信息
|
||||
lodingStats : false, //加载状态
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取银行卡列表
|
||||
this.bankInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 银行卡列表
|
||||
*/
|
||||
bankInfo (page) {
|
||||
wx.$api.bank.Cards({
|
||||
page: page
|
||||
}).then(res=>{
|
||||
let listArr = this.data.bankArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.data)
|
||||
this.setData({
|
||||
bankArr : newData,
|
||||
page : res.data.page,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取银行卡列表
|
||||
this.bankInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取银行卡列表
|
||||
this.bankInfo(pageNumber);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除地址
|
||||
*/
|
||||
bankRemove(e){
|
||||
let id = e.target.dataset.id,
|
||||
index = e.target.dataset.index,
|
||||
list = this.data.bankArr
|
||||
|
||||
list.splice(index,1)
|
||||
|
||||
wx.showModal({
|
||||
title : '提示',
|
||||
content : '是否删除银行卡',
|
||||
success : res=> {
|
||||
if (res.confirm) {
|
||||
wx.showLoading({
|
||||
title: '删除中',
|
||||
})
|
||||
wx.$api.bank.cardsDel(id).then(res=>{
|
||||
this.setData({
|
||||
bankArr: list
|
||||
})
|
||||
wx.hideLoading()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
4
pages/bankCard/index.json
Normal file
4
pages/bankCard/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "银行账户"
|
||||
}
|
||||
41
pages/bankCard/index.wxml
Normal file
41
pages/bankCard/index.wxml
Normal file
@@ -0,0 +1,41 @@
|
||||
<view class="address" wx:if="{{bankArr.length > 0}}">
|
||||
<view class="address-li" wx:for="{{bankArr}}" wx:key="bankArr" wx:for-index="index">
|
||||
<view class="top">
|
||||
<image class="top-logo" src="{{item.bank.cover}}" mode="aspectFill"></image>
|
||||
<view class="top-name">{{item.bank.name}}</view>
|
||||
</view>
|
||||
<view class="cont">
|
||||
<view class="address-title">
|
||||
<text>支行名称</text>{{item.branch_name}}
|
||||
</view>
|
||||
<view class="address-title">
|
||||
<text>银行卡号</text>{{item.no}}
|
||||
</view>
|
||||
<view class="address-title">
|
||||
<text>收款人姓名</text>{{item.name}}
|
||||
</view>
|
||||
<view class="address-title">
|
||||
<text>收款人手机号</text>{{item.mobile}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-tool">
|
||||
<view class="address-tool {{type == 'selectAddress' ? 'active' : ''}}" wx:if="{{type == 'selectAddress'}}">
|
||||
<view class="address-tool-btn {{type == 'selectAddress' ? 'active' : ''}}" bindtap="selectAddress" data-index="{{index}}">选择地址</view>
|
||||
</view>
|
||||
<view class="address-icon" wx:else>
|
||||
<navigator hover-class="none" class="address-edit address-edit-border" url="/pages/bankCard/bankAdd/bankAdd?type=Compile&id={{item.bank_account_id}}">编辑账户</navigator>
|
||||
<view class="address-edit" bindtap="bankRemove" data-index="{{index}}" data-id="{{item.bank_account_id}}">删除账户</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="pack-center pages-hint" wx:else>
|
||||
<image src="/static/imgs/cont_null.png" mode="widthFix"></image>
|
||||
<view>还未添加银行卡</view>
|
||||
</view>
|
||||
|
||||
<!-- 添加按钮 -->
|
||||
<view class="address-footer">
|
||||
<navigator url="/pages/bankCard/bankAdd/bankAdd?type=Add">添加银行卡</navigator>
|
||||
</view>
|
||||
166
pages/bankCard/index.wxss
Normal file
166
pages/bankCard/index.wxss
Normal file
@@ -0,0 +1,166 @@
|
||||
page {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.address {
|
||||
border-bottom: 120rpx solid transparent;
|
||||
margin: 20rpx;
|
||||
}
|
||||
|
||||
.address-li {
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.top {
|
||||
position: relative;
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
padding: 20rpx 20rpx 15rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.top-logo {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.top-name {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 20rpx 20rpx 20rpx 120rpx;
|
||||
box-sizing: border-box;
|
||||
line-height: 80rpx;
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.cont {
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.address-title {
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
line-height: 80rpx;
|
||||
background-color: #f9fbfc;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.address-title text {
|
||||
display: inline-block;
|
||||
width: 200rpx;
|
||||
color: #aaaaaa;
|
||||
}
|
||||
|
||||
.address-title:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.address-nmae,
|
||||
.address-tips {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.address-text {
|
||||
font-size: 28rpx;
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
.address-tool {
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 28rpx;
|
||||
overflow: hidden;
|
||||
border-top: 2rpx solid #ececec;
|
||||
}
|
||||
|
||||
.address-edit {
|
||||
margin-left: 30rpx;
|
||||
display: inline-block;
|
||||
background-color: #ff9b26;
|
||||
border: 2rpx solid #ff9b26;
|
||||
color: #ffffff;
|
||||
line-height: 58rpx;
|
||||
padding: 0 30rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.address-edit-border {
|
||||
color: #ff9b26;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.address-edit image {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin: 2rpx 10rpx 0 0;
|
||||
}
|
||||
|
||||
|
||||
.address-tool-btn {
|
||||
height: 46rpx;
|
||||
line-height: 44rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.address-tool-btn.active{
|
||||
color: #f57e32;
|
||||
}
|
||||
|
||||
.address-tool.active::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.address-tool-btn.yellow {
|
||||
color: #f57e32;
|
||||
}
|
||||
|
||||
.address-tool-btn image {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
margin-right: 10rpx;
|
||||
vertical-align: -6rpx;
|
||||
}
|
||||
|
||||
.address-tool.active {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.address-icon {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* footer */
|
||||
|
||||
.address-footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
background: white;
|
||||
z-index: 9;
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
.address-footer navigator {
|
||||
width: 100%;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
margin: 15rpx 0;
|
||||
text-align: center;
|
||||
background: #e92152;
|
||||
font-size: 30rpx;
|
||||
color: white;
|
||||
border-radius: 10rpx
|
||||
}
|
||||
Reference in New Issue
Block a user