|
|
@@ -9,7 +9,7 @@
|
|
|
<view class="flex align-center" style="padding: 30upx 60upx 20upx 60upx;">
|
|
|
<view style="width: 160upx;font-family: PingFang SC;font-weight: bold;color: #000000;"><text class="text-red">*</text>选择银行</view>
|
|
|
<view class="flex justify-between align-center" style="width: 260upx;height: 60upx;border: #b0b0b0 1upx solid;border-radius: 16upx;" @click="bankShow = true">
|
|
|
- <view class="padding-left-sm" :class="bank.startsWith('请') ? 'text-gray': ''">{{bank}}</view>
|
|
|
+ <view class="padding-left-sm" :class="cardInfo.bankType.startsWith('请') ? 'text-gray': ''">{{cardInfo.bankType}}</view>
|
|
|
<view class="padding-right-xs cuIcon-unfold"></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -19,7 +19,7 @@
|
|
|
<view class="flex align-center" style="padding: 20upx 60upx;">
|
|
|
<view style="width: 160upx;font-family: PingFang SC;font-weight: bold;color: #000000;"><text class="text-red">*</text>账号类型</view>
|
|
|
<view class="flex justify-between align-center" style="width: 260upx;height: 60upx;border: #b0b0b0 1upx solid;border-radius: 16upx;" @click="accountShow = true">
|
|
|
- <view class="padding-left-sm" :class="account.startsWith('请') ? 'text-gray': ''">{{account}}</view>
|
|
|
+ <view class="padding-left-sm" :class="cardInfo.bankAccountType.startsWith('请') ? 'text-gray': ''">{{cardInfo.bankAccountType}}</view>
|
|
|
<view class="padding-right-xs cuIcon-unfold"></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -28,21 +28,21 @@
|
|
|
</view>
|
|
|
<view class="flex align-center" style="padding: 20upx 60upx;">
|
|
|
<view style="width: 160upx;font-family: PingFang SC;font-weight: bold;color: #000000;"><text class="text-red">*</text>银行卡号</view>
|
|
|
- <u-input v-model="cardNum" placeholder="请输入银行卡号" :clearable="false" />
|
|
|
+ <u-input v-model="cardInfo.cardNo" placeholder="请输入银行卡号" :clearable="false" />
|
|
|
</view>
|
|
|
<view style="padding: 0 60upx;">
|
|
|
<u-line color="#d4d4d4"></u-line>
|
|
|
</view>
|
|
|
<view class="flex align-center" style="padding: 20upx 60upx;">
|
|
|
<view style="width: 160upx;font-family: PingFang SC;font-weight: bold;color: #000000;"><text class="text-red">*</text>真实姓名</view>
|
|
|
- <u-input v-model="name" placeholder="请输入真实姓名" :clearable="false" />
|
|
|
+ <u-input v-model="cardInfo.realName" placeholder="请输入真实姓名" :clearable="false" />
|
|
|
</view>
|
|
|
<view style="padding: 0 60upx;">
|
|
|
<u-line color="#d4d4d4"></u-line>
|
|
|
</view>
|
|
|
<view class="flex align-center" style="padding: 20upx 60upx;">
|
|
|
<view style="width: 160upx;font-family: PingFang SC;font-weight: bold;color: #000000;"><text class="text-red">*</text>手机号码</view>
|
|
|
- <u-input v-model="phone" placeholder="请输入手机号码" :clearable="false" />
|
|
|
+ <u-input v-model="cardInfo.phone" placeholder="请输入手机号码" :clearable="false" />
|
|
|
</view>
|
|
|
<view style="padding: 0 60upx;">
|
|
|
<u-line color="#d4d4d4"></u-line>
|
|
|
@@ -65,13 +65,16 @@
|
|
|
data() {
|
|
|
return {
|
|
|
bankShow: false,
|
|
|
- bank: '请选择银行',
|
|
|
- cardNum: '',
|
|
|
- account: '请选择类型',
|
|
|
+ cardInfo: {
|
|
|
+ userId: '',
|
|
|
+ bankType: '请选择银行',
|
|
|
+ cardNo: '',
|
|
|
+ bankAccountType: '请选择类型',
|
|
|
+ realName: '',
|
|
|
+ phone: '',
|
|
|
+ },
|
|
|
accountType: [],
|
|
|
accountShow: false,
|
|
|
- name: '',
|
|
|
- phone: '',
|
|
|
code: '',
|
|
|
state: false, //是否开启倒计时
|
|
|
totalTime: 120, //总时间,单位秒
|
|
|
@@ -80,7 +83,10 @@
|
|
|
selector: [],
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
+ onLoad(options) {
|
|
|
+ if (!this.$u.test.isEmpty(options.cardId)) {
|
|
|
+ this.getCardInfo();
|
|
|
+ }
|
|
|
this.getBankType('bank_type');
|
|
|
this.getAccountType('bank_account_type');
|
|
|
},
|
|
|
@@ -95,21 +101,28 @@
|
|
|
this.accountType = res;
|
|
|
})
|
|
|
},
|
|
|
+ getCardInfo() {
|
|
|
+ let userId = uni.getStorageSync("userId");
|
|
|
+ this.$u.api.bankCard.cardDetail({userId: userId}).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.cardInfo = res.records[0];
|
|
|
+ })
|
|
|
+ },
|
|
|
bankConfirm(index) {
|
|
|
- this.bank = this.selector[index].dictValue;
|
|
|
+ this.cardInfo.bankType = this.selector[index].dictValue;
|
|
|
},
|
|
|
accountConfirm(index) {
|
|
|
- this.account = this.accountType[index].dictValue;
|
|
|
+ this.cardInfo.bankAccountType = this.accountType[index].dictValue;
|
|
|
},
|
|
|
checking() {
|
|
|
- if(!this.$u.test.mobile(this.phone)) {
|
|
|
+ if(!this.$u.test.mobile(this.cardInfo.phone)) {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
title: "请输入正确的手机号码"
|
|
|
})
|
|
|
return;
|
|
|
} else {
|
|
|
- let url = 'huawei/sms/sendSms?phone=' + this.phone
|
|
|
+ let url = 'huawei/sms/sendSms?phone=' + this.cardInfo.phone
|
|
|
this.$u.post(url).then(res => {
|
|
|
if (res == 'success') {
|
|
|
//把显示时间设为总时间
|
|
|
@@ -156,35 +169,35 @@
|
|
|
}
|
|
|
},
|
|
|
bind() {
|
|
|
- if (this.$u.test.isEmpty(this.bank)) {
|
|
|
+ if (this.$u.test.isEmpty(this.cardInfo.bankType)) {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
title: '请选择银行',
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- if (this.$u.test.isEmpty(this.account)) {
|
|
|
+ if (this.$u.test.isEmpty(this.cardInfo.bankAccountType)) {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
title: '请选择账号类型',
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- if (this.$u.test.isEmpty(this.cardNum)) {
|
|
|
+ if (this.$u.test.isEmpty(this.cardInfo.cardNo)) {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
title: '请输入银行卡号',
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- if (this.$u.test.isEmpty(this.name)) {
|
|
|
+ if (this.$u.test.isEmpty(this.cardInfo.realName)) {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
title: '请输入真实姓名',
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- if (this.$u.test.isEmpty(this.phone) || !this.$u.test.mobile(this.phone)) {
|
|
|
+ if (this.$u.test.isEmpty(this.cardInfo.phone) || !this.$u.test.mobile(this.cardInfo.phone)) {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
title: '请填写正确的手机号',
|
|
|
@@ -198,34 +211,16 @@
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- let url = 'huawei/sms/validCode?phone=' + this.phone + '&code=' + this.code;
|
|
|
+ let url = 'huawei/sms/validCode?phone=' + this.cardInfo.phone + '&code=' + this.code;
|
|
|
this.$u.post(url).then(res => {
|
|
|
if (res == 'success') {
|
|
|
uni.showLoading({
|
|
|
title: '绑定银行卡号...',
|
|
|
mask: true
|
|
|
})
|
|
|
- this.$u.api.bankCard.bindCard({
|
|
|
- userId: uni.getStorageSync("userId"),
|
|
|
- cardNo: this.cardNum,
|
|
|
- realName: this.name,
|
|
|
- phone: this.phone,
|
|
|
- bankType: this.bank,
|
|
|
- bankAccountType: this.account,
|
|
|
- }).then(res => {
|
|
|
- console.log("绑定成功", res)
|
|
|
- uni.hideLoading();
|
|
|
- uni.showToast({
|
|
|
- icon: "none",
|
|
|
- title: res,
|
|
|
- duration: 3000,
|
|
|
- success() {
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1,
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ setTimeout(() => {
|
|
|
+ this.saveCardInfo();
|
|
|
+ },700)
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
@@ -233,6 +228,23 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ saveCardInfo() {
|
|
|
+ this.cardInfo.userId = uni.getStorageSync("userId");
|
|
|
+ this.$u.api.bankCard.bindCard(this.cardInfo).then(res => {
|
|
|
+ console.log("插入成功",res);
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: res,
|
|
|
+ duration: 3000,
|
|
|
+ success: () => {
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|