银行卡签约需求-前端判断逻辑调整

This commit is contained in:
bai.jinyan
2021-07-27 13:45:06 +08:00
parent e8ffabc6cc
commit 60b13bcffb

View File

@@ -409,11 +409,19 @@ export default {
}, },
async checkBankCardSign(){ async checkBankCardSign(){
// 是否需要签约标识
let isNeedSignFlag = true;
// 1.短期险不需要签约 // 1.短期险不需要签约
console.log("是否是长险", this.$CacheUtils.getLocItem('isLongInsuranceFlag')) console.log("是否是长险", this.$CacheUtils.getLocItem('isLongInsuranceFlag'))
if (this.$CacheUtils.getLocItem('isLongInsuranceFlag') === 'N') { if (this.$CacheUtils.getLocItem('isLongInsuranceFlag') === 'N') {
return true; isNeedSignFlag = false;
} }
const bankCode = JSON.parse(window.localStorage.getItem('underWriteData')).bankCode;
// 1.微信支付方式 2.银行卡支付 且 招商银行卡 需要签约
if (!((this.radio == '' && ('CMB' == bankCode || '308' == bankCode)) || this.radio == '3')){
isNeedSignFlag = false;
}
this.$toast.clear() this.$toast.clear()
this.$toast.loading({ this.$toast.loading({
duration: 0, // 持续展示 toast duration: 0, // 持续展示 toast
@@ -423,25 +431,27 @@ export default {
}) })
//校验 //校验
let data = { orderNo: this.orderNo } let data = { orderNo: this.orderNo }
console.log("orderNo", data) return new Promise((resolve) => {
return new Promise((resolve, reject) => { if (!isNeedSignFlag) {
resolve(true)
return
}
getBankCardSignState(data).then(checkRes => { getBankCardSignState(data).then(checkRes => {
if (checkRes.result == '0') { if (checkRes.result == '0') {
this.$toast.clear() this.$toast.clear()
console.log("=========", checkRes) console.log("=========", checkRes)
if (checkRes.signState == '2') { if (checkRes.signState == '2' || checkRes.needSign == '0') {
// 不需签约 或 已签约 不做处理 发起支付 // 不需签约 或 已签约 不做处理 可以发起支付
localStorage.removeItem('changeCard') localStorage.removeItem('changeCard')
resolve(true); resolve(true);
} else { } else if (checkRes.needSign == '1'){
const bankCode = JSON.parse(window.localStorage.getItem('underWriteData')).bankCode; // 需要签约
const shortUrl = checkRes.shortUrl; const shortUrl = checkRes.shortUrl;
// 招商银行卡 提示去官微签约 if(checkRes.signState == '1'){
if(checkRes.signState == '1' && checkRes.needSign == '1' && this.radio == '' && ('CMB' == bankCode || '308' == bankCode)){ // 需签约 且 未签约
this.bankSignJump(shortUrl) this.bankSignJump(shortUrl)
resolve(false); resolve(false);
} }else if (checkRes.signState == '4') {
if (checkRes.signState == '4') {
// 签约中 // 签约中
this.$toast('亲,您的银行卡正在签约中,请稍后再试') this.$toast('亲,您的银行卡正在签约中,请稍后再试')
resolve(false); resolve(false);
@@ -466,12 +476,10 @@ export default {
// on cancel // on cancel
resolve(false); resolve(false);
}); });
} else if (checkRes.signState == '1' && checkRes.needSign == '1' && this.radio == '3') {
// 需签约 且 未签约
// 提示去签约
this.bankSignJump(shortUrl)
resolve(false);
} }
} else {
this.$toast(checkRes.resultMessage)
resolve(false);
} }
}else{ }else{
this.$toast(checkRes.resultMessage) this.$toast(checkRes.resultMessage)