111
This commit is contained in:
@@ -0,0 +1,322 @@
|
||||
// case/pages/improveInfo/improveInfo.js
|
||||
// case/pages/register/register.js
|
||||
import {throttle} from "../../../utils/util"
|
||||
import {hostConfig} from "../../../utils/config"
|
||||
import {getArea,addBank} from "../../../api/api"
|
||||
const host=hostConfig().host;
|
||||
const app=getApp();
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
showSuccess:false,
|
||||
img_host:app.hostConfig().imghost,
|
||||
showArea:false,
|
||||
cityName:'',
|
||||
areaColumns:[
|
||||
{
|
||||
values: [1,2],
|
||||
className: 'column1',
|
||||
},
|
||||
{
|
||||
values: [3,4],
|
||||
className: 'column2',
|
||||
defaultIndex: 0
|
||||
},
|
||||
{
|
||||
values: [3,4],
|
||||
className: 'column3',
|
||||
defaultIndex: 0
|
||||
},
|
||||
],
|
||||
showArea:false,
|
||||
bankCardNo:'',
|
||||
bankName:'',
|
||||
cityId:'',
|
||||
countyId:'',
|
||||
provId:'',
|
||||
name:'',
|
||||
idCardNo:'',
|
||||
signImg:'',
|
||||
},
|
||||
opeArea(){
|
||||
this.setData({
|
||||
showArea:true
|
||||
})
|
||||
},
|
||||
openOffice(){
|
||||
this.setData({
|
||||
showOffice:true,
|
||||
})
|
||||
},
|
||||
openPosition(){
|
||||
this.setData({
|
||||
showPosition:true,
|
||||
})
|
||||
},
|
||||
onChange(e){
|
||||
const {value} = e.detail;
|
||||
|
||||
const {id}=e.currentTarget.dataset;
|
||||
// console.log(value,id)
|
||||
this.setData({
|
||||
[id]: value
|
||||
});
|
||||
},
|
||||
onChangeArea(event){
|
||||
const { picker, value, index } = event.detail;
|
||||
const provinceId=value[0].id;
|
||||
const cityId=value[1].id;
|
||||
if(index==0){
|
||||
this.handleGetArea(provinceId,2);
|
||||
}else if(index==1){
|
||||
this.handleGetArea(cityId,3)
|
||||
}
|
||||
},
|
||||
confirmArea(event){
|
||||
const {value} = event.detail;
|
||||
console.log(value);
|
||||
let provId=value[0].id;
|
||||
let cityId=value[1].id;
|
||||
let countyId=value[2]?value[2].id:value[1].id;
|
||||
let cityName='';
|
||||
for (let i = 0; i <value.length; i++) {
|
||||
if(value[i]){
|
||||
cityName+=value[i].name
|
||||
};
|
||||
|
||||
};
|
||||
this.setData({
|
||||
provId:provId,
|
||||
cityId:cityId,
|
||||
countyId:countyId,
|
||||
cityName:cityName,
|
||||
showArea:false
|
||||
});
|
||||
|
||||
},
|
||||
cancelArea(){
|
||||
this.setData({
|
||||
showArea:false
|
||||
})
|
||||
},
|
||||
confirmHospital(event){
|
||||
let {value}=event.detail;
|
||||
this.setData({
|
||||
showHospital:false,
|
||||
hospital_uuid:value.uuid,
|
||||
hospital_name:value.name
|
||||
})
|
||||
},
|
||||
cancelHospital(){
|
||||
this.setData({
|
||||
showHospital:false
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
handleAddBank:throttle(function(){
|
||||
let {signImg,bankCardNo,bankName,cityId,countyId,idCardNo,name,provId}=this.data;
|
||||
if (!/^([\u4e00-\u9fa5\·]{2,10})$/.test(name)) {
|
||||
wx.showToast({
|
||||
title: `姓名要求在2-10个汉字`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
};
|
||||
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(idCardNo)){
|
||||
wx.showToast({
|
||||
title: `请输入有效的身份证号`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
};
|
||||
if(!provId){
|
||||
wx.showToast({
|
||||
title: `请选择开户行所在城市`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if(!bankName){
|
||||
wx.showToast({
|
||||
title: `请输入开户行`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if(!this.luhnCheck(bankCardNo)){
|
||||
wx.showToast({
|
||||
title: `请输入有效银行卡号`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
};
|
||||
if(!signImg){
|
||||
wx.showToast({
|
||||
title: `请添加签名`,
|
||||
icon: 'none',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
addBank({
|
||||
signImg,
|
||||
bankCardNo,
|
||||
bankName,
|
||||
cityId,
|
||||
countyId,
|
||||
idCardNo,
|
||||
name,
|
||||
provId
|
||||
}).then(res=>{
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
icon:'none',
|
||||
duration:2000,
|
||||
success:function(){
|
||||
let timer=setTimeout(()=>{
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
clearTimeout(timer)
|
||||
},1000)
|
||||
}
|
||||
})
|
||||
})
|
||||
}),
|
||||
luhnCheck(cardNumber) {
|
||||
var sum = 0;
|
||||
var shouldDouble = false;
|
||||
var digit;
|
||||
|
||||
// 去除任何非数字字符
|
||||
cardNumber = cardNumber.replace(/\D/g, '');
|
||||
|
||||
// 从右向左遍历数字
|
||||
for (var i = cardNumber.length - 1; i >= 0; i--) {
|
||||
digit = parseInt(cardNumber.charAt(i), 10);
|
||||
|
||||
if (shouldDouble) {
|
||||
if ((digit *= 2) > 9) digit -= 9;
|
||||
}
|
||||
|
||||
sum += digit;
|
||||
shouldDouble = !shouldDouble;
|
||||
}
|
||||
|
||||
// 如果校验和能被10整除,则卡号有效
|
||||
return (sum % 10) === 0;
|
||||
},
|
||||
goSign:throttle(function(){
|
||||
app.method.navigateTo({
|
||||
url:'/case/pages/signcanvas/signcanvas'
|
||||
})
|
||||
}),
|
||||
handleGetArea(id,type){
|
||||
getArea({
|
||||
parent:id
|
||||
}).then(res=>{
|
||||
if(type==1){
|
||||
let obj='areaColumns[0].values';
|
||||
this.setData({
|
||||
[obj]:res
|
||||
})
|
||||
this.handleGetArea(res[0].id,2)
|
||||
}else if(type==2){
|
||||
let obj='areaColumns[1].values';
|
||||
this.setData({
|
||||
[obj]:res
|
||||
})
|
||||
this.handleGetArea(res[0].id,3)
|
||||
}else{
|
||||
let obj='areaColumns[2].values';
|
||||
this.setData({
|
||||
[obj]:res
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}).catch(error=>{
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
handleGetOffice(){
|
||||
getOfficeList({}).then(res=>{
|
||||
this.setData({
|
||||
officeColumns:res
|
||||
})
|
||||
}).catch(error=>{
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
handleGetPosition(){
|
||||
getPosition().then(res=>{
|
||||
this.setData({
|
||||
positionColumns:res
|
||||
})
|
||||
this.handleNeedInfo();
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.handleGetArea('',1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
// onShareAppMessage() {
|
||||
|
||||
// }
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navBar":"../../../components/navBar/navBar",
|
||||
"dialog":"../../../components/dialog/dialog",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-picker": "@vant/weapp/picker/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"van-uploader": "@vant/weapp/uploader/index",
|
||||
"van-cell-group": "@vant/weapp/cell-group/index"
|
||||
},
|
||||
"navigationStyle":"custom"
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<!--case/pages/bankCard/bankCard.wxml-->
|
||||
<navBar navName="绑定银行卡"></navBar>
|
||||
<view class="page">
|
||||
<view class="content">
|
||||
<view class="tip">请确定开户人姓名与真实姓名一致</view>
|
||||
<view >
|
||||
<van-cell-group class="group" >
|
||||
<van-field value="{{ name }}" label="姓名" placeholder="请输入您的真实姓名" input-align="right" placeholder-style="color:#999;font-size:15px" bind:change="onChange" data-id="name" extra-event-params/>
|
||||
<van-field value="{{ idCardNo }}" label="身份证号" placeholder="请输入您的身份证号" input-align="right" placeholder-style="color:#999;font-size:15px" bind:change="onChange" data-id="idCardNo" extra-event-params/>
|
||||
|
||||
|
||||
|
||||
|
||||
</van-cell-group>
|
||||
<view style="margin-top: 40rpx;">
|
||||
<van-cell-group class="group" >
|
||||
<van-field value="{{cityName}}" label="所在城市" placeholder="请选择开户行所在城市" right-icon="arrow" placeholder-style="color:#999;font-size:15px"
|
||||
input-align="right" bind:tap="opeArea" readonly/>
|
||||
<van-field value="{{ bankName }}"
|
||||
placeholder-style="color:#999;font-size:15px" bind:change="onChange" data-id="bankName" extra-event-params label="开户行" placeholder="请输入开户行" input-align="right" />
|
||||
<van-field value="{{ bankCardNo }}"
|
||||
placeholder-style="color:#999;font-size:15px" bind:change="onChange" data-id="bankCardNo" extra-event-params label="银行卡号" placeholder="请输入银行卡号" input-align="right" />
|
||||
|
||||
</van-cell-group>
|
||||
</view>
|
||||
<view style="margin-top: 40rpx;">
|
||||
<view class="signbox">
|
||||
<view class="signname"><text class="name">签名</text></view>
|
||||
<view class="uploadbox" bind:tap="goSign" wx:if="{{!signImg}}">
|
||||
<van-icon name="plus" size="40px" color="#999"/>
|
||||
<view class="name">添加签名</view>
|
||||
</view>
|
||||
<image class="uploadbox" src="{{signImg}}" mode="widthFix" wx:else />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="next">
|
||||
<van-button type="primary" block bind:tap="handleAddBank">提交</van-button>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup
|
||||
show="{{ showArea }}"
|
||||
round
|
||||
position="bottom"
|
||||
custom-style="height: 50%"
|
||||
>
|
||||
<van-picker columns="{{ areaColumns }}" value-key="name" bind:change="onChangeArea" title="请选择地区" show-toolbar bind:confirm="confirmArea" bind:cancel="cancelArea"/>
|
||||
</van-popup>
|
||||
@@ -0,0 +1,143 @@
|
||||
/* case/pages/bankCard/bankCard.wxss *//* case/pages/improveInfo/improveInfo.wxss */
|
||||
/* case/pages/register/register.wxss */
|
||||
page{
|
||||
overflow: hidden;
|
||||
}
|
||||
.page{
|
||||
height:calc(100vh - 172rpx);
|
||||
margin-top: 172rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #F4F4F4;
|
||||
}
|
||||
.content{
|
||||
flex:1;
|
||||
overflow: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.tip{
|
||||
height:80rpx;
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
align-items: center;
|
||||
color:#fff;
|
||||
padding:0 32rpx;
|
||||
background: #3881F7;
|
||||
border-bottom:1px solid #ccc;
|
||||
}
|
||||
.next{
|
||||
margin: 40rpx 20rpx!important;
|
||||
}
|
||||
.prev{
|
||||
margin:-20rpx 20rpx 0!important ;
|
||||
}
|
||||
.van-field__label{
|
||||
white-space: nowrap;
|
||||
}
|
||||
.custom-class .van-cell:last-child{
|
||||
background-color: red;
|
||||
}
|
||||
.van-cell__title{
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
color: #646566;
|
||||
align-items: center;
|
||||
}
|
||||
.van-image{
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.van-cell{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.van-field__label,.van-cell__title{
|
||||
position: relative;
|
||||
}
|
||||
.signname .name{
|
||||
width: auto;
|
||||
position: relative;
|
||||
}
|
||||
.van-field__label::after,.cert .van-cell__title::after{
|
||||
content: "*";
|
||||
color:red;
|
||||
position: absolute;
|
||||
top:12rpx;
|
||||
right:-14rpx;
|
||||
}
|
||||
.signname .name::after{
|
||||
content: "*";
|
||||
color:red;
|
||||
position: absolute;
|
||||
top:4rpx;
|
||||
right:-14rpx;
|
||||
}
|
||||
.cert .van-cell__title::after{
|
||||
top:4rpx;
|
||||
}
|
||||
.myclass .van-field__label::after{
|
||||
content: "";
|
||||
}
|
||||
.upload{
|
||||
opacity:0;
|
||||
position: absolute;
|
||||
z-index:99;
|
||||
}
|
||||
.cert .van-cell{
|
||||
overflow: hidden;
|
||||
}
|
||||
.van-button{
|
||||
border-radius: 10rpx!important;
|
||||
}
|
||||
.imgCode{
|
||||
width:200rpx;
|
||||
height:75.6rpx;
|
||||
}
|
||||
.custom-class{
|
||||
min-height:43.5px !important;
|
||||
}
|
||||
.van-field__label{
|
||||
color:#333!important;
|
||||
padding:12rpx 0;
|
||||
font-size: 15px!important;
|
||||
}
|
||||
.van-cell__title{
|
||||
color:#333!important;
|
||||
font-size: 15px!important;
|
||||
}
|
||||
.buttonbox{
|
||||
position: absolute;
|
||||
z-index:99;
|
||||
display: flex;
|
||||
width:600rpx;
|
||||
left:50%;
|
||||
transform: translateX(-50%);
|
||||
justify-content: space-between;
|
||||
bottom:50rpx;
|
||||
}
|
||||
.van-button--primary{
|
||||
background: linear-gradient(90deg, #377FF7 0%, #51AAFF 100%)!important;
|
||||
border-color:#377FF7!important
|
||||
}
|
||||
.signbox{
|
||||
border: 0.5px solid #ebedf0;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
padding:10px 16px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.uploadbox{
|
||||
margin-top: 20rpx;
|
||||
width:300rpx;
|
||||
height:300rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
font-size: 28rpx;
|
||||
color:#666;
|
||||
border-radius: 10rpx;
|
||||
background-color: #f7f8fa;
|
||||
}
|
||||
.uploadbox .name{
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user