分销认证新增 银行开户行 银行开户名 银行账号

master
lemon橪 2021-07-02 15:26:52 +08:00
parent efb2a7963e
commit 9f48cc7110
5 changed files with 142 additions and 91 deletions

View File

@ -4,10 +4,10 @@
*/ */
// 开发环境 // 开发环境
const dev = { const dev = {
common: "https://common-api.pickmall.cn", // common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn", // buyer: "https://buyer-api.pickmall.cn",
// common: "http://192.168.0.109:8890", common: "http://192.168.0.109:8890",
// buyer: "http://192.168.0.109:8888", buyer: "http://192.168.0.109:8888",
}; };
// 生产环境 // 生产环境
const prod = { const prod = {

View File

@ -8,10 +8,16 @@
<u-input v-model="ruleForm.name" placeholder="请输入您的真实姓名" /> <u-input v-model="ruleForm.name" placeholder="请输入您的真实姓名" />
</u-form-item> </u-form-item>
<u-form-item label="身份证" prop="idNumber"> <u-form-item label="身份证" prop="idNumber">
<u-input <u-input v-model="ruleForm.idNumber" placeholder="请输入身份证号码" />
v-model="ruleForm.idNumber" </u-form-item>
placeholder="请输入身份证号码" <u-form-item label="银行开户行" prop="settlementBankBranchName">
/> <u-input v-model="ruleForm.settlementBankBranchName" type="text" placeholder="请输入银行开户行" />
</u-form-item>
<u-form-item label="银行开户名" prop="settlementBankAccountName">
<u-input v-model="ruleForm.settlementBankAccountName" type="text" placeholder="请输入银行开户名" />
</u-form-item>
<u-form-item label="银行账号" prop="settlementBankAccountNum">
<u-input v-model="ruleForm.settlementBankAccountNum" type="text" placeholder="请输入银行账号" />
</u-form-item> </u-form-item>
<!-- <u-form-item label="身份证正面照" prop="name"> <!-- <u-form-item label="身份证正面照" prop="name">
<u-upload></u-upload> <u-upload></u-upload>
@ -35,12 +41,16 @@
</template> </template>
<script> <script>
import { applyDistribution } from "@/api/goods"; import { applyDistribution } from "@/api/goods";
import { checkBankno } from "@/utils/Foundation";
export default { export default {
data() { data() {
return { return {
ruleForm: { ruleForm: {
name: "", name: "",
idNumber: "", idNumber: "",
settlementBankBranchName: "", //
settlementBankAccountName: "", //
settlementBankAccountNum: "", //
}, },
rules: { rules: {
name: [ name: [
@ -62,6 +72,50 @@ export default {
trigger: ["change", "blur"], trigger: ["change", "blur"],
}, },
], ],
//
settlementBankBranchName: [
{
required: true,
message: "银行开户行",
//
trigger: "blur",
},
{
validator: (rule, value, callback) => {
// truefalse
// this.$u.test.mobile()truefalse
return this.$u.test.chinese(value);
},
message: "银行开户行不正确",
// blurchange
trigger: ["change", "blur"],
},
], //
settlementBankAccountName: [
{
required: true,
message: "银行开户名",
//
trigger: "blur",
},
],
//
settlementBankAccountNum: [
{
required: true,
message: "银行账号不正确",
//
trigger: "blur",
},
{
validator: (rule, value, callback) => {
// truefalse
// this.$u.test.mobile()truefalse
return checkBankno(value);
},
message: "银行账号不正确",
},
],
idNumber: [ idNumber: [
{ {
required: true, required: true,
@ -98,14 +152,12 @@ export default {
setTimeout(() => { setTimeout(() => {
uni.navigateBack(); uni.navigateBack();
},500) }, 500);
} else {
}
else{
uni.showToast({ uni.showToast({
title: res.data.message, title: res.data.message,
duration: 2000, duration: 2000,
icon:"none" icon: "none",
}); });
} }
}); });

View File

@ -57,10 +57,7 @@
applyInfo.refundWay == 'ORIGINAL' ? '原路退回' : '账号退款' applyInfo.refundWay == 'ORIGINAL' ? '原路退回' : '账号退款'
" type="text" input-align="right" :disabled="true" /> " type="text" input-align="right" :disabled="true" />
</u-form-item> </u-form-item>
<view v-if=" <view >
applyInfo.accountType === 'BANK_TRANSFER' &&
applyInfo.applyRefundPrice != 0
">
<u-form-item label="银行开户行" :label-width="150"> <u-form-item label="银行开户行" :label-width="150">
<u-input v-model="form.bankDepositName" type="text" input-align="right" placeholder="请输入银行开户行" /> <u-input v-model="form.bankDepositName" type="text" input-align="right" placeholder="请输入银行开户行" />
</u-form-item> </u-form-item>
@ -100,7 +97,7 @@ import {
import city from "@/components/m-city/m-city"; import city from "@/components/m-city/m-city";
import { upload } from "@/api/common.js"; import { upload } from "@/api/common.js";
import {checkBankno} from '@/utils/Foundation'
import storage from "@/utils/storage.js"; import storage from "@/utils/storage.js";
export default { export default {
component: { component: {
@ -278,6 +275,7 @@ export default {
if (!this.handleCheckParams()) { if (!this.handleCheckParams()) {
return; return;
} }
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
}); });
@ -297,71 +295,6 @@ export default {
} }
}); });
}, },
/**
* 验证银行卡号
*/
checkBankno(bankno) {
var lastNum = bankno.substr(bankno.length - 1, 1); //luhm
var first15Num = bankno.substr(0, bankno.length - 1); //1518
var newArr = [];
for (var i = first15Num.length - 1; i > -1; i--) {
//1518
newArr.push(first15Num.substr(i, 1));
}
var arrJiShu = []; //*2 <9
var arrJiShu2 = []; //*2 >9
var arrOuShu = []; //
for (var j = 0; j < newArr.length; j++) {
if ((j + 1) % 2 == 1) {
//
if (parseInt(newArr[j]) * 2 < 9)
arrJiShu.push(parseInt(newArr[j]) * 2);
else arrJiShu2.push(parseInt(newArr[j]) * 2);
} //
else arrOuShu.push(newArr[j]);
}
var jishu_child1 = []; //*2 >9
var jishu_child2 = []; //*2 >9
for (var h = 0; h < arrJiShu2.length; h++) {
jishu_child1.push(parseInt(arrJiShu2[h]) % 10);
jishu_child2.push(parseInt(arrJiShu2[h]) / 10);
}
var sumJiShu = 0; //*2 < 9
var sumOuShu = 0; //
var sumJiShuChild1 = 0; //*2 >9
var sumJiShuChild2 = 0; //*2 >9
var sumTotal = 0;
for (var m = 0; m < arrJiShu.length; m++) {
sumJiShu = sumJiShu + parseInt(arrJiShu[m]);
}
for (var n = 0; n < arrOuShu.length; n++) {
sumOuShu = sumOuShu + parseInt(arrOuShu[n]);
}
for (var p = 0; p < jishu_child1.length; p++) {
sumJiShuChild1 = sumJiShuChild1 + parseInt(jishu_child1[p]);
sumJiShuChild2 = sumJiShuChild2 + parseInt(jishu_child2[p]);
}
//
sumTotal =
parseInt(sumJiShu) +
parseInt(sumOuShu) +
parseInt(sumJiShuChild1) +
parseInt(sumJiShuChild2);
//Luhm
var k = parseInt(sumTotal) % 10 == 0 ? 10 : parseInt(sumTotal) % 10;
var luhm = 10 - k;
if (lastNum == luhm) {
return true;
} else {
return false;
}
},
// //
handleCheckParams() { handleCheckParams() {
@ -398,7 +331,7 @@ export default {
type: "error", type: "error",
}); });
return false; return false;
} else if (this.checkBankno(this.form.bankAccountNumber) === false) { } else if (checkBankno(this.form.bankAccountNumber) === false) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "银行卡卡号不正确", title: "银行卡卡号不正确",
type: "error", type: "error",

View File

@ -73,7 +73,10 @@ export default {
distribution().then((res) => { distribution().then((res) => {
if (res.data.result) { if (res.data.result) {
let type = res.data.result.distributionStatus; let type = res.data.result.distributionStatus;
uni.navigateTo({
url: "/pages/mine/distribution/auth",
});
return
if (type == "PASS") { if (type == "PASS") {
uni.navigateTo({ uni.navigateTo({
url: "/pages/mine/distribution/home", url: "/pages/mine/distribution/home",
@ -91,7 +94,7 @@ export default {
} }
} else if (!res.data.success && res.data.code == 22000) { } else if (!res.data.success && res.data.code == 22000) {
uni.showToast({ uni.showToast({
title: '分销功能暂未开启', title: "分销功能暂未开启",
duration: 2000, duration: 2000,
icon: "none", icon: "none",
}); });

View File

@ -9,6 +9,69 @@
* randomString 随机生成指定长度的字符串 * randomString 随机生成指定长度的字符串
*/ */
/**
* 验证银行卡号
*/
export function checkBankno(bankno) {
var lastNum = bankno.substr(bankno.length - 1, 1); //取出最后一位与luhm进行比较
var first15Num = bankno.substr(0, bankno.length - 1); //前15或18位
var newArr = [];
for (var i = first15Num.length - 1; i > -1; i--) {
//前15或18位倒序存进数组
newArr.push(first15Num.substr(i, 1));
}
var arrJiShu = []; //奇数位*2的积 <9
var arrJiShu2 = []; //奇数位*2的积 >9
var arrOuShu = []; //偶数位数组
for (var j = 0; j < newArr.length; j++) {
if ((j + 1) % 2 == 1) {
//奇数位
if (parseInt(newArr[j]) * 2 < 9) arrJiShu.push(parseInt(newArr[j]) * 2);
else arrJiShu2.push(parseInt(newArr[j]) * 2);
} //偶数位
else arrOuShu.push(newArr[j]);
}
var jishu_child1 = []; //奇数位*2 >9 的分割之后的数组个位数
var jishu_child2 = []; //奇数位*2 >9 的分割之后的数组十位数
for (var h = 0; h < arrJiShu2.length; h++) {
jishu_child1.push(parseInt(arrJiShu2[h]) % 10);
jishu_child2.push(parseInt(arrJiShu2[h]) / 10);
}
var sumJiShu = 0; //奇数位*2 < 9 的数组之和
var sumOuShu = 0; //偶数位数组之和
var sumJiShuChild1 = 0; //奇数位*2 >9 的分割之后的数组个位数之和
var sumJiShuChild2 = 0; //奇数位*2 >9 的分割之后的数组十位数之和
var sumTotal = 0;
for (var m = 0; m < arrJiShu.length; m++) {
sumJiShu = sumJiShu + parseInt(arrJiShu[m]);
}
for (var n = 0; n < arrOuShu.length; n++) {
sumOuShu = sumOuShu + parseInt(arrOuShu[n]);
}
for (var p = 0; p < jishu_child1.length; p++) {
sumJiShuChild1 = sumJiShuChild1 + parseInt(jishu_child1[p]);
sumJiShuChild2 = sumJiShuChild2 + parseInt(jishu_child2[p]);
}
//计算总和
sumTotal =
parseInt(sumJiShu) +
parseInt(sumOuShu) +
parseInt(sumJiShuChild1) +
parseInt(sumJiShuChild2);
//计算Luhm值
var k = parseInt(sumTotal) % 10 == 0 ? 10 : parseInt(sumTotal) % 10;
var luhm = 10 - k;
if (lastNum == luhm) {
return true;
} else {
return false;
}
}
/** /**
* 登录后跳转判断 * 登录后跳转判断
* 计算出当前router路径 * 计算出当前router路径
@ -154,7 +217,6 @@ export function countTimeDown(seconds) {
}; };
} }
function navigationToBack(type) { function navigationToBack(type) {
if (type == "wx") { if (type == "wx") {
// console.log(getCurrentPages().length - 3) // console.log(getCurrentPages().length - 3)
@ -194,4 +256,5 @@ module.exports = {
countTimeDown, countTimeDown,
theNextDayTime, theNextDayTime,
whetherNavigate, whetherNavigate,
checkBankno,
}; };