diff --git a/src/views/ebiz/agentEenter/Guarantee.vue b/src/views/ebiz/agentEenter/Guarantee.vue index d9866aa18..924052937 100644 --- a/src/views/ebiz/agentEenter/Guarantee.vue +++ b/src/views/ebiz/agentEenter/Guarantee.vue @@ -18,11 +18,15 @@
本人签字: - {{ + {{ appntSign.signState == '0' ? '签名' : '已签名' }} + {{ + appntSign.signState == '0' ? '未签名' : '已签名' + }}
- 下一步 + 下一步 + 提交 @@ -35,7 +39,10 @@ import { filtSignList, getAgreementNextPagePath } from './js/methods' export default { data() { + let isWeixin = this.$utils.device().isWeixin //判断环境 return { + // 是否在微信 + isWeixin, src: location.origin + '/pdfjs/web/viewer.html?file=', pdfUrl: '', radio: '', @@ -54,9 +61,15 @@ export default { // 是否签名 true 签名 false 未签名 isSign: false, isSignD: false, + //协议list + signList: [], + //当前页面协议签署后下一页路由 + nextPagePath: '', + //签署人 0-申请人 1-担保人 + code: '', //推荐人信息 agentInfo: {}, - // 推荐人签名信息 + // 签名信息 appntSign: { signState: '0', signStateD: '0' @@ -64,9 +77,9 @@ export default { //原生返回的加密包 base64: '', //担保人原生返回的加密包 - base64D: '', + base64D: '' // 是否重复签名 - isReSign: '0' + // isReSign: '0' } }, components: { @@ -84,6 +97,7 @@ export default { this.timeOut() } this.agreementQuery() + this.code = this.$route.query.code }, methods: { //获取签署协议人信息 @@ -105,20 +119,40 @@ export default { if (res.result == '0') { res.content.ebizAgreementDtoList.map(item => { console.log(item) - if (item.type == '12') { + if (item.type == '12' && item.documentType == this.code) { that.appntSign = item + // if (item.signState == '0') { + // this.isDisable = false + // this.isDisableD = false + // that.appntSign.signStateD = '0' + // that.appntSign.signState = '0' + // this.isReSign = '0' + // } else { + // this.isDisable = true + // this.isDisableD = true + // that.appntSign.signStateD = '1' + // that.appntSign.signState = '1' + // this.isReSign = '1' + // } + } + if (item.type == '12' && item.documentType == '0') { + //申请人签名信息 if (item.signState == '0') { this.isDisable = false - this.isDisableD = false - that.appntSign.signStateD = '0' that.appntSign.signState = '0' - this.isReSign = '0' } else { this.isDisable = true + that.appntSign.signState = '1' + } + } + if (item.type == '12' && item.documentType == '1') { + //担保人签名信息 + if (item.signState == '0') { + this.isDisableD = false + that.appntSign.signStateD = '0' + } else { this.isDisableD = true that.appntSign.signStateD = '1' - that.appntSign.signState = '1' - this.isReSign = '1' } } }) @@ -198,73 +232,97 @@ export default { loadingType: 'spinner', message: '加载中……' }) - EWebBridge.webCallAppInJs('ca_sign', { - //身份证号码 - number: localStorage.idNoD, - //姓名 - name: localStorage.idNameD, - //身份证号码id - type: '1', - keyword: '担保人签名', - pageNo: '1', - index: '1', - offset: '5', - pos: '3' - }).then(data => { - this.$toast.clear() - if (JSON.parse(data).state == '1') { - that.base64D = decodeURI(JSON.parse(data).sign) - that.appntSign.signStateD = '1' - if (that.appntSign.signStateD == '1') { - this.isDisabledComplite = false - this.isSignD = true - } else { - this.isDisabledComplite = true - this.isSignD = false + if (this.isWeixin) { + this.toAirSign('0', '担保人签名', '3', '1') + } else { + EWebBridge.webCallAppInJs('ca_sign', { + //身份证号码 + number: localStorage.idNoD, + //姓名 + name: localStorage.idNameD, + //身份证号码id + type: '1', + keyword: '担保人签名', + pageNo: '1', + index: '1', + offset: '5', + pos: '3' + }).then(data => { + this.$toast.clear() + if (JSON.parse(data).state == '1') { + that.base64D = decodeURI(JSON.parse(data).sign) + that.appntSign.signStateD = '1' + if (that.appntSign.signStateD == '1') { + this.isDisabledComplite = false + this.isSignD = true + } else { + this.isDisabledComplite = true + this.isSignD = false + } } - } - }) + }) + } + }, + //微信空签 + toAirSign(status, keyword, offset, originStatus) { + console.log('offset == ', offset) + localStorage.setItem( + 'signInfo', + JSON.stringify({ + originStatus: originStatus, + idNo: localStorage.idNoD, + name: localStorage.idNameD, + type: '1', + keyword: keyword, + status: status, + offset: offset, + originUrl: location.href + }) + ) + window.location.href = this.$mainUrl + '/sign/index.html' }, goNext() { let that = this - if (this.isSign && this.isReSign == '0') { - let data = { - // userModel: { - // mobile: '13000000000' - // }, - baseEncryp: that.base64, - otherBaseEncryp: that.base64D, - // baseEncryp: '123456', - ebizAgreementDto: that.appntSign - } - that.$toast.loading({ - duration: 0, // 持续展示 toast - forbidClick: true, // 禁用背景点击 - loadingType: 'spinner', - message: '加载中……' - }) - signAgreement(data).then(res => { - that.$toast.clear() - if (res.result == '0') { - this.$jump({ - flag: 'h5', - extra: { - url: location.origin + `/#/agentEenter/LetterOfKnow` - }, - routerInfo: { - path: `/agentEenter/LetterOfKnow` - } - }) - } else { - this.$toast(res.resultMessage) - } - }) - } else { - if (this.isReSign == '1') { - // 您已签名 - this.$toast('您已签名') - } + // if (this.isSign && this.isReSign == '0') { + let data = { + // userModel: { + // mobile: '13000000000' + // }, + baseEncryp: that.base64, + otherBaseEncryp: that.base64D, + // baseEncryp: '123456', + ebizAgreementDto: that.appntSign } + that.$toast.loading({ + duration: 0, // 持续展示 toast + forbidClick: true, // 禁用背景点击 + loadingType: 'spinner', + message: '加载中……' + }) + signAgreement(data).then(res => { + that.$toast.clear() + if (res.result == '0') { + let path = !this.isWeixin ? `/agentEenter/${that.nextPagePath}?code=${that.code}` : '/agentEenter/signContract' + this.$jump({ + flag: 'h5', + extra: { + url: location.origin + '/#' + path + }, + routerInfo: { + path: path + } + }) + } else { + this.$toast(res.resultMessage) + } + }) + // } + // else { + // if (this.isReSign == '1') { + // // 您已签名 + // this.$toast('您已签名') + // } + // } // this.$jump({ // flag: 'h5',