From 10e0522be743c78c67d665ce164772c58e94f544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=9E=E5=85=B4=E6=9C=88?= <120277894@qq.com> Date: Wed, 7 Apr 2021 11:47:28 +0800 Subject: [PATCH] =?UTF-8?q?feature/GFRS-2301=E3=80=90=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E3=80=91=E5=81=A5=E5=BA=B7=E9=99=A9=E6=B8=A0=E9=81=93=E5=9B=BD?= =?UTF-8?q?=E5=AF=8C=E6=97=A0=E5=BF=A7=E5=8D=A1=E9=87=91=E6=8E=8C=E6=A1=82?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=9A=84=E9=9C=80=E6=B1=82--=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9C=B0=E5=9D=80=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B8=82=E8=BE=96=E5=8C=BA=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=9C=9F=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8A=95=E4=BF=9D?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=A1=AE=E8=AE=A4=E9=A1=B5-=E4=BF=9D?= =?UTF-8?q?=E9=99=A9=E8=B4=A3=E4=BB=BB-=E4=BF=9D=E8=B4=B9=E6=9C=9F?= =?UTF-8?q?=E9=97=B4-=E6=9C=89=E6=95=88=E6=9C=9F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9--=E6=8F=90=E4=BA=A4=E4=BA=BA=E5=BA=9E?= =?UTF-8?q?=E5=85=B4=E6=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/js/utils/area.js | 1 + src/assets/js/utils/getAfterDate.js | 14 +++++++ src/views/ebiz/cardList/cardDetail.vue | 53 +++++++++++++++---------- src/views/ebiz/cardList/information.vue | 29 ++++---------- 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/src/assets/js/utils/area.js b/src/assets/js/utils/area.js index 815650d6a..5e80336dc 100644 --- a/src/assets/js/utils/area.js +++ b/src/assets/js/utils/area.js @@ -2587,6 +2587,7 @@ export default { 445321: '新兴县', 445322: '郁南县', 445381: '罗定市', + 450101: '市辖区', 450102: '兴宁区', 450103: '青秀区', 450105: '江南区', diff --git a/src/assets/js/utils/getAfterDate.js b/src/assets/js/utils/getAfterDate.js index 85278511d..af4a7d5a0 100644 --- a/src/assets/js/utils/getAfterDate.js +++ b/src/assets/js/utils/getAfterDate.js @@ -13,5 +13,19 @@ export default { //获取“多少天数”之后的时间 例如28天后 即days=28 let currentTime = new Date().getTime() return new Date(Number(currentTime) + 1000 * 60 * 60 * 24 * days) + }, + isLeapYear: function(year) { + var cond1 = year % 4 == 0 //条件1:年份必须要能被4整除 + var cond2 = year % 100 != 0 //条件2:年份不能是整百数 + var cond3 = year % 400 == 0 //条件3:年份是400的倍数 + //当条件1和条件2同时成立时,就肯定是闰年,所以条件1和条件2之间为“与”的关系。 + //如果条件1和条件2不能同时成立,但如果条件3能成立,则仍然是闰年。所以条件3与前2项为“或”的关系。 + //所以得出判断闰年的表达式: + var cond = (cond1 && cond2) || cond3 + if (cond) { + return 366 + } else { + return 365 + } } } diff --git a/src/views/ebiz/cardList/cardDetail.vue b/src/views/ebiz/cardList/cardDetail.vue index 6a191360a..f691b4e78 100644 --- a/src/views/ebiz/cardList/cardDetail.vue +++ b/src/views/ebiz/cardList/cardDetail.vue @@ -26,10 +26,15 @@

产品信息

- - + +
+ +
+
+ +
- +
注:{{productDate}}
@@ -44,6 +49,7 @@ import { Field, GoodsAction, GoodsActionIcon, GoodsActionButton, Icon } from 'vant' import { getOrderDetail, information, underWrite } from '@/api/ebiz/sale/sale' import getAreaName from '@/assets/js/utils/getAreaNameForSale' +import afterDate from '@/assets/js/utils/getAfterDate.js' export default { name: 'cardDetail', components: { @@ -70,38 +76,33 @@ export default { productDate: '' } }, - created() { + created() { this.appntInfo = this.orderDTO.appntDTO this.appntInfo.homeName = getAreaName([{ code: this.appntInfo.homeProvince }, { code: this.appntInfo.homeCity }, { code: this.appntInfo.homeArea }]) this.insuredInfo = this.orderDTO.insuredDTOs[0] this.insuredInfo.homeName = getAreaName([{ code: this.insuredInfo.homeProvince }, { code: this.insuredInfo.homeCity }, { code: this.insuredInfo.homeArea }]) - + let insuYear = (this.riskDTO = this.orderDTO.insuredDTOs[0].riskDTOLst[0]) let currentDataArr = insuYear.cvaliDate.split('-') let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日' - let insuYearM, productDate, productDateTime,insuYearD; - + let insuYearM, productDate, productDateTime, insuYearD, hoDate + switch (insuYear.insuYearFlag) { case 'D': - let hoDate = Date.parse(insuYear.cvaliDate) / 1000 + insuYear['insuYear'] * 24 * 3600 - productDate = new Date(parseInt(hoDate) * 1000) - insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 - insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() - productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' - this.productDate = currentData + '0时至' + productDateTime + '24时止' + this.riskDTO.dateCN = '天' + hoDate = Date.parse(insuYear.cvaliDate) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 break case 'Y': - productDate = new Date(insuYear.cvaliDate) - insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 - insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() - productDateTime = parseInt(productDate.getFullYear()) + parseInt(insuYear['insuYear']) + '年' + insuYearM + '月' + insuYearD + '日' - this.productDate = currentData + '0时至' + productDateTime + '24时止' - break - case 'M': - productDateTime = this.GetNextMonthDay(insuYear.cvaliDate, insuYear['insuYear']) - this.productDate = currentData + '0时至' + productDateTime + '24时止' + this.riskDTO.dateCN = '年' + hoDate = Date.parse(insuYear.cvaliDate) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(insuYear.cvaliDate).getFullYear()) - 1) break } + + productDate = new Date(parseInt(hoDate) * 1000) + insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 + insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() + productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' + this.productDate = currentData + '0时至' + productDateTime + '24时止' }, methods: { nextStep() { @@ -128,4 +129,12 @@ export default { color: #333; padding: 15px; } +.duty{ + .van-field__label{ + width: 60vw; + } + .van-field__control{ + text-align: center; + } +} \ No newline at end of file diff --git a/src/views/ebiz/cardList/information.vue b/src/views/ebiz/cardList/information.vue index 8c7244b38..154a0f5b1 100644 --- a/src/views/ebiz/cardList/information.vue +++ b/src/views/ebiz/cardList/information.vue @@ -418,8 +418,7 @@ export default { } } } - underWrite(data).then(res => { - console.log(res) + underWrite(data).then(res => { if (res.result == '0') { this.$toast.clear() if (res.uwResult == '33') { @@ -440,9 +439,9 @@ export default { } }) return true - } else { - return false + } else { this.$toast(res.resultMessage) + return false } }) }, @@ -722,13 +721,13 @@ export default { let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日' let insuYear = JSON.parse(localStorage.insuYear) let insuYearM, productDate, productDateTime - let insuYearD, hoDate + let insuYearD, hoDate switch (insuYear.insuYearFlag) { case 'D': hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 break - case 'Y': - hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * 364 + case 'Y': + hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear())-1) break } productDate = new Date(parseInt(hoDate) * 1000) @@ -740,20 +739,6 @@ export default { break } }, - isLeapYear(year) { - var cond1 = year % 4 == 0 //条件1:年份必须要能被4整除 - var cond2 = year % 100 != 0 //条件2:年份不能是整百数 - var cond3 = year % 400 == 0 //条件3:年份是400的倍数 - //当条件1和条件2同时成立时,就肯定是闰年,所以条件1和条件2之间为“与”的关系。 - //如果条件1和条件2不能同时成立,但如果条件3能成立,则仍然是闰年。所以条件3与前2项为“或”的关系。 - //所以得出判断闰年的表达式: - var cond = (cond1 && cond2) || cond3 - if (cond) { - return 366 - } else { - return 365 - } - }, GetNextMonthDay(date, monthNum) { var dateArr = date.split('-') var year = dateArr[0] //获取当前日期的年份 @@ -815,7 +800,7 @@ export default { this.userInfo.homeProvince = data.homeProvince //家庭省 this.userInfo.homeCity = data.homeCity //家庭市 this.userInfo.homeArea = data.homeArea //家庭区 - if (data.homeProvince && data.homeCity && data.homeArea) { + if (data.homeProvince && data.homeCity && data.homeArea) { this.userInfo.homeName = getAreaName([{ code: data.homeProvince }, { code: data.homeCity }, { code: data.homeArea }]) //家庭地址 } this.userInfo.homeAddress = data.homeAddress //家庭详细地址