From bd7e9d69d0a840ab475c6a7dc57b2578d68e41f8 Mon Sep 17 00:00:00 2001 From: yunuo970428 <405378304@qq.com> Date: Thu, 10 Aug 2023 09:20:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=8F=B8=E5=AE=9A=E5=88=B6=E9=87=91?= =?UTF-8?q?=E8=9E=8D=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/publicPage/financialscheme.vue | 191 +++++++++--------- .../customizedfinancialsolutionsAdd.vue | 21 +- 2 files changed, 119 insertions(+), 93 deletions(-) diff --git a/anrui-riskcenter-ui/src/components/publicPage/financialscheme.vue b/anrui-riskcenter-ui/src/components/publicPage/financialscheme.vue index b6bd6c7cd2..e3d90396c3 100644 --- a/anrui-riskcenter-ui/src/components/publicPage/financialscheme.vue +++ b/anrui-riskcenter-ui/src/components/publicPage/financialscheme.vue @@ -26,10 +26,10 @@ *主车发票价元 - 融资票据元 - 挂车元 - 保险元 - 购置税元 + 配件元 + 挂车元 + 保险元 + 购置税元 @@ -80,7 +80,7 @@ *厂家贴息 - + @@ -100,7 +100,7 @@ - *月还金额 + 月还金额 {{ finance.loanPayMoney }} @@ -139,8 +139,8 @@ - *期数 - + 期数 + {{ finance.otherPolicyPeriod }} @@ -153,7 +153,7 @@ - *月还金额 + 月还金额 {{ finance.otherPolicyMonthlyRepay }} @@ -292,7 +292,7 @@ - + 代收费用合计 @@ -320,7 +320,7 @@ - + 抵顶费用合计 @@ -352,7 +352,8 @@ 车辆总价 - + {{ vehTotalPrice() }} + @@ -446,7 +447,6 @@ export default { }, // 是否打包 isPackChange() { - console.log(this.financeshi, 888888) selectList({ orgPath: window.sessionStorage.getItem('defaultOrgPath'), userSid: window.sessionStorage.getItem('defaultOrgPath'), isPack: this.finance.isPack }).then((resp) => { if (resp.success) { this.policy_list = resp.data @@ -466,6 +466,9 @@ export default { this.finance.loanPeriod = choose[0].period // 从金融产品政策中-- 获取贷款保证金比例 this.finance.bondRatio = choose[0].bondRatio + '%' + // 贴息用途赋值 + this.finance.factoryDiscountUse = '抵利息' + this.finance.factoryDiscountUseKey = '02' selectListByOther({ orgPath: window.sessionStorage.getItem('defaultOrgPath'), userSid: window.sessionStorage.getItem('defaultOrgPath'), sid: choose[0].sid }).then((res) => { if (res.success) { this.other_list = res.data @@ -478,18 +481,30 @@ export default { // 主方案 -- 融资项目总额 financingProject() { if (this.finance.mainVehicleAmount !== '') { - this.finance.loanTotal = parseInt(this.arguments(this.finance.mainVehicleAmount)) + parseInt(this.arguments(this.finance.accessoriesAmount)) + parseInt(this.arguments(this.finance.trailerAmount)) + parseInt(this.arguments(this.finance.premium)) + parseInt(this.arguments(this.finance.purchaseTax)) + this.finance.loanTotal = parseInt(this.arguments(this.finance.mainVehicleAmount)) + if (this.finance.mainVehicleAmount !== '' && this.finance.accessoriesAmountCb) { + this.finance.loanTotal = parseInt(this.arguments(this.finance.mainVehicleAmount)) + parseInt(this.arguments(this.finance.accessoriesAmount)) + } + if (this.finance.mainVehicleAmount !== '' && this.finance.accessoriesAmountCb && this.finance.trailerAmountCb) { + this.finance.loanTotal = parseInt(this.arguments(this.finance.mainVehicleAmount)) + parseInt(this.arguments(this.finance.accessoriesAmount)) + parseInt(this.arguments(this.finance.trailerAmount)) + } + if (this.finance.mainVehicleAmount !== '' && this.finance.accessoriesAmountCb && this.finance.trailerAmountCb && this.finance.premiumCb) { + this.finance.loanTotal = parseInt(this.arguments(this.finance.mainVehicleAmount)) + parseInt(this.arguments(this.finance.accessoriesAmount)) + parseInt(this.arguments(this.finance.trailerAmount)) + parseInt(this.arguments(this.finance.premium)) + } + if (this.finance.mainVehicleAmount !== '' && this.finance.accessoriesAmountCb && this.finance.trailerAmountCb && this.finance.premiumCb && this.finance.purchaseTaxCb) { + this.finance.loanTotal = parseInt(this.arguments(this.finance.mainVehicleAmount)) + parseInt(this.arguments(this.finance.accessoriesAmount)) + parseInt(this.arguments(this.finance.trailerAmount)) + parseInt(this.arguments(this.finance.premium)) + parseInt(this.arguments(this.finance.purchaseTax)) + } } else { this.finance.loanTotal = '' } // 首次计算出或修改融资项目总额 if (this.finance.loanTotal !== '') { // 主方案 -- 计算首付金额 - this.finance.downPayAmount = parseInt(this.arguments(this.finance.loanTotal)) * parseFloat(this.arguments(this.finance.downPayRatio)) / 100 + this.finance.downPayAmount = (parseInt(this.arguments(this.finance.loanTotal)) * parseFloat(this.arguments(this.finance.downPayRatio)) / 100).toFixed(0) // 主方案 -- 计算产品贷款金额 this.finance.loanAmount = parseInt(this.arguments(this.finance.loanTotal)) - parseInt(this.arguments(this.finance.downPayAmount)) // 主方案 -- 计算贷款保证金 - this.finance.bondAmount = parseFloat(this.arguments(this.finance.bondRatio)) * parseInt(this.arguments(this.finance.loanAmount)) / 100 + this.finance.bondAmount = (parseFloat(this.arguments(this.finance.bondRatio)) * parseInt(this.arguments(this.finance.loanAmount)) / 100).toFixed(0) // 主方案 -- 月还金额 this.monthlyPayment(this.finance.policyYearRatio, this.finance.loanPeriod, this.finance.loanAmount, 0, 0) } @@ -502,7 +517,7 @@ export default { // 重新计算产品贷款金额 this.finance.loanAmount = parseInt(this.arguments(this.finance.loanTotal)) - parseInt(this.arguments(this.finance.downPayAmount)) // 主方案 -- 贷款保证金 - this.finance.bondAmount = parseFloat(this.arguments(this.finance.bondRatio)) * parseInt(this.arguments(this.finance.loanAmount)) / 100 + this.finance.bondAmount = (parseFloat(this.arguments(this.finance.bondRatio)) * parseInt(this.arguments(this.finance.loanAmount)) / 100).toFixed(0) // 主方案 -- 月还金额 this.monthlyPayment(this.finance.policyYearRatio, this.finance.loanPeriod, this.finance.loanAmount, 0, 0) } @@ -516,7 +531,7 @@ export default { // 主方案 -- 计算月还金额 monthlyPayment(rate, nperiod, pv, fv, type) { var pmt = '' - rate = parseFloat(parseInt(rate) / 100) / 12 + rate = parseFloat(parseFloat(rate) / 100) / 12 if (pv !== '') { if (!fv) fv = 0 if (!type) type = 0 @@ -527,10 +542,56 @@ export default { pmt /= (1 + rate) } } - this.finance.loanPayMoney = pmt + this.finance.loanPayMoney = parseFloat(pmt).toFixed(0) // 根据月还金额 -- 计算利息总额 this.finance.loanInterest = parseInt(this.finance.loanPayMoney) * parseInt(nperiod) - parseInt(pv) }, + // 主方案 -- 厂家贴息(当厂家贴息大于0且贴息用途为抵利息时需重新计算利息总额、月还金额、年利率) + factoryDiscountInput() { + if (this.finance.factoryDiscount !== '' && this.finance.factoryDiscount != '0' && this.finance.factoryDiscountUseKey === '02') { + // 计算利息总额 + this.finance.loanInterest = parseInt(this.finance.loanInterest) - parseInt(this.finance.factoryDiscount) + // 计算月还金额 + this.finance.loanPayMoney = (parseInt(this.finance.loanPayMoney) - parseInt(this.finance.factoryDiscount)) / parseInt(this.finance.loanPeriod) + // 年利率 + this.finance.policyYearRatio = (parseFloat(this.rate(this.finance.loanPeriod, this.finance.loanPayMoney, this.finance.loanAmount, 0, 0, 0.01)) * 12).toFixed(2) + '%' + } + }, + // 主方案 -- 厂家贴息(当厂家贴息大于0且贴息用途为抵利息时需重新计算年利率) + rate(paymentsPerYear, paymentAmount, presentValue, futureValue, dueEndOrBeginning, interest) { + if (interest == null) interest = 0.01 + if (futureValue == null) futureValue = 0 + if (dueEndOrBeginning == null) dueEndOrBeginning = 0 + var FINANCIAL_MAX_ITERATIONS = 128 + var FINANCIAL_PRECISION = 0.0000001 + var y, y0, y1, x0, x1 = 0, f = 0, i = 0 + var rate = interest + if (Math.abs(rate) < FINANCIAL_PRECISION) { + y = presentValue * (1 + paymentsPerYear * rate) + paymentAmount * (1 + rate * dueEndOrBeginning) * paymentsPerYear + futureValue + } else { + f = Math.exp(paymentsPerYear * Math.log(1 + rate)) + y = presentValue * f + paymentAmount * (1 / rate + dueEndOrBeginning) * (f - 1) + futureValue + } + y0 = presentValue + paymentAmount * paymentsPerYear + futureValue + y1 = presentValue * f + paymentAmount * (1 / rate + dueEndOrBeginning) * (f - 1) + futureValue + i = x0 = 0.0 + x1 = rate + while ((Math.abs(y0 - y1) > FINANCIAL_PRECISION) && (i < FINANCIAL_MAX_ITERATIONS)) { + rate = (y1 * x0 - y0 * x1) / (y1 - y0) + x0 = x1 + x1 = rate + if (Math.abs(rate) < FINANCIAL_PRECISION) { + y = presentValue * (1 + paymentsPerYear * rate) + paymentAmount * (1 + rate * dueEndOrBeginning) * paymentsPerYear + futureValue + } else { + f = Math.exp(paymentsPerYear * Math.log(1 + rate)) + y = presentValue * f + paymentAmount * (1 / rate + dueEndOrBeginning) * (f - 1) + futureValue + } + y0 = y1 + y1 = y + ++i + } + return rate + }, // 主方案 -- 贴息用途 changeFactoryDiscountUse(value) { const choose = this.factoryDiscountUse_list.filter((item) => item.dictValue === value) @@ -539,6 +600,9 @@ export default { } else { this.finance.factoryDiscountUseKey = '' } + if (this.finance.factoryDiscountUseKey === '02') { + this.factoryDiscountInput() + } }, // 其它融--名称 changeOtherPolicy(value) { @@ -558,7 +622,7 @@ export default { // 其它融 -- 计算月还金额、利息总额 otherMonthlyPayment(rate, nperiod, pv, fv, type) { var pmt = '' - rate = parseInt(parseInt(rate) / 100) / 12 + rate = parseFloat(parseFloat(rate) / 100) / 12 if (pv !== '') { if (!fv) fv = 0 if (!type) type = 0 @@ -569,7 +633,7 @@ export default { pmt /= (1 + rate) } } - this.finance.otherPolicyMonthlyRepay = pmt + this.finance.otherPolicyMonthlyRepay = parseFloat(pmt).toFixed(0) // 根据月还金额 -- 计算利息总额 this.finance.otherPolicyInterest = parseInt(this.arguments(this.finance.otherPolicyMonthlyRepay)) * parseInt(nperiod) - parseInt(this.arguments(pv)) }, @@ -723,6 +787,18 @@ export default { } return this.finance.realTotal }, + // 应收明细 -- 车辆总价 + vehTotalPrice() { + if (this.finance.serviceAmount !== '') { + this.finance.receivableTotal = parseInt(this.arguments(this.finance.downPayAmounts)) + parseInt(this.arguments(this.finance.serviceAmount)) + parseInt(this.arguments(this.finance.proxyAccidentPremium)) + parseInt(this.arguments(this.finance.registerAmount)) + parseInt(this.arguments(this.finance.operationAmount)) + parseInt(this.arguments(this.finance.vehOtherPrice)) + parseInt(this.arguments(this.finance.otherAmount)) + parseInt(parseInt(this.finance.loanPayMoney) * parseInt(this.finance.loanPeriod)) + parseInt(parseInt(this.finance.otherPolicyMonthlyRepay) * parseInt(this.finance.otherPolicyPeriod)) + if (!this.finance.premiumCb) { + this.finance.receivableTotal = parseInt(this.arguments(this.finance.downPayAmounts)) + parseInt(this.arguments(this.finance.serviceAmount)) + parseInt(this.arguments(this.finance.proxyAccidentPremium)) + parseInt(this.arguments(this.finance.registerAmount)) + parseInt(this.arguments(this.finance.operationAmount)) + parseInt(this.arguments(this.finance.vehOtherPrice)) + parseInt(this.arguments(this.finance.otherAmount)) + parseInt(parseInt(this.finance.loanPayMoney) * parseInt(this.finance.loanPeriod)) + parseInt(parseInt(this.finance.otherPolicyMonthlyRepay) * parseInt(this.finance.otherPolicyPeriod)) + parseInt(this.finance.premium) + } + if (!this.finance.purchaseTaxCb) { + this.finance.receivableTotal = parseInt(this.arguments(this.finance.downPayAmounts)) + parseInt(this.arguments(this.finance.serviceAmount)) + parseInt(this.arguments(this.finance.proxyAccidentPremium)) + parseInt(this.arguments(this.finance.registerAmount)) + parseInt(this.arguments(this.finance.operationAmount)) + parseInt(this.arguments(this.finance.vehOtherPrice)) + parseInt(this.arguments(this.finance.otherAmount)) + parseInt(parseInt(this.finance.loanPayMoney) * parseInt(this.finance.loanPeriod)) + parseInt(parseInt(this.finance.otherPolicyMonthlyRepay) * parseInt(this.finance.otherPolicyPeriod)) + parseInt(this.finance.premium) + parseInt(this.finance.purchaseTax) + } + } + }, arguments(val) { if (val === '' || val === undefined) { val = 0 @@ -731,77 +807,8 @@ export default { return val } }, - handleReturn() { - this.finance = { - saleOrderSid: '', - isPack: '', - policyName: '', - mainVehicleAmount: '', - accessoriesAmount: '', - trailerAmount: '', - purchaseTax: '', - premium: '', - loanTotal: '', - - accessoriesAmountCb: false, - trailerAmountCb: false, - purchaseTaxCb: false, - premiumCb: false, - - downPayRatio: '', - downPayAmount: '', - loanAmount: '', - loanPeriod: '', - bondRatio: '', - bondAmount: '', - factoryDiscount: '', - factoryDiscountUse: '', - policyYearRatio: '', - loanPayMoney: '', - loanInterest: '', - otherPolicyState: false, - - otherPolicyName: '', - otherPolicyAmount: '', - otherPolicyPeriod: '', - - otherPolicyMonthlyRepay: '', - otherPolicyInterest: '', - otherPolicyYearRatio: '', - - loanDownPay: '', - downPayAmountsRatio: '', - loanAmountTotal: '', - period: '', - monthlyRepay: '', - interest: '', - returnTime: '', - - downPayAmounts: '', - bondAmounts: '', - depositPremium: '', - depositSettle: '', - serviceAmount: '', - proxyAccidentPremium: '', - registerAmount: '', - operationAmount: '', - vehOtherPrice: '', - otherAmount: '', - otherAmountRemark: '', - dealWay: '', - dealWayKey: '', - proxyPremium: '', - proxyPurchasetax: '', - offsetPremium: '', - offsetPurchasetax: '', - offsetTotal: '', - receivableTotal: '', - realTotal: '', - vehTotalPrice: '', - nominalPrice: '' - } - this.$refs['form_obj'].resetFields() - this.$emit('doback') + backData() { + this.$emit('backData', this.finance) } } } diff --git a/anrui-riskcenter-ui/src/views/customizedfinancialsolutions/customizedfinancialsolutionsAdd.vue b/anrui-riskcenter-ui/src/views/customizedfinancialsolutions/customizedfinancialsolutionsAdd.vue index 3f72b14855..9d807e542c 100644 --- a/anrui-riskcenter-ui/src/views/customizedfinancialsolutions/customizedfinancialsolutionsAdd.vue +++ b/anrui-riskcenter-ui/src/views/customizedfinancialsolutions/customizedfinancialsolutionsAdd.vue @@ -175,7 +175,7 @@ 消贷金融方案(说明:融资项目中保险为预估费用,必须小于保险发票票面金额,预估金额精确到百位。购置税=主车发票价/11.3,舍到个位,不足金额需要客户线下补交。) - + @@ -399,6 +399,7 @@ export default { bondAmount: '', factoryDiscount: '', factoryDiscountUse: '', + factoryDiscountUseKey: '', policyYearRatio: '', loanPayMoney: '', loanInterest: '', @@ -536,10 +537,17 @@ export default { vehTrailerRemark: '' } }, + // 金融方案返回的参数 + backData(value) { + this.formobj.loanTemplateSolutions = value + }, saveOrUpdate() { this.$refs['form_obj'].validate((valid) => { if (valid) { + this.$refs['divJRFA'].backData() + this.getUrl() this.submitdisabled = true + console.log(this.formobj) req.saveOrUpdate(this.formobj).then((res) => { if (res.success) { this.$message({ showClose: true, type: 'success', message: '保存成功' }) @@ -557,6 +565,17 @@ export default { resetState() { this.viewState = 1 }, + getUrl() { + if (this.image_list.length > 0) { + const aa = [] + for (var i = 0; i < this.image_list.length; i++) { + aa.push(this.image_list[i].url) + } + this.formobj.loanTemplateTrailer.vehTrailerCertificateFile = aa + } else { + this.formobj.loanTemplateTrailer.vehTrailerCertificateFile = [] + } + }, handleReturn(isreload) { if (isreload === 'true') this.$emit('reloadlist') this.formobj = {