作者 刘晓艳

保障期

... ... @@ -21,6 +21,7 @@ Page({
name: ['受益人1', '受益人2'],
unit: ''
}],
tempfavoree: [],
beneficiaryindex: -1,
beneficiary_name: '',
imgs: [],
... ... @@ -32,13 +33,18 @@ Page({
applicant_name: '',
recognizee_name: '',
rang_beneficiary: [],
risk_list:[{
name:'',
projectlist:[],
project_time:''
risk_list: [{
name: '',
projectlist: [],
project_time: ''
}],
main_array:[]
main_array: [],
warranty_one: [],
warranty_two: [],
guarantee_name: '',
long_money: [],
time_name: '',
type_money: '',
},
//投保人
... ... @@ -85,14 +91,14 @@ Page({
let that = this;
let type = e.currentTarget.dataset.type;
let index = e.currentTarget.dataset.xulie;
let tempProjectlist = Object.assign(this.data.projectlist, {}) ;
let tempProjectlist = Object.assign(this.data.projectlist, {});
// 已经添加的附加险
let rist_list = Object.assign(this.data.risk_list,{});
let rist_list = Object.assign(this.data.risk_list, {});
let tempRist = rist_list[index].projectlist;
// 已经添加的主险
let tempMain_list = Object.assign(this.data.main_array, {})
if(type=='zhuxian'){
if (tempMain_list.length>0) {
if (type == 'zhuxian') {
if (tempMain_list.length > 0) {
for (let i in tempProjectlist) {
for (let j in tempMain_list) {
if (tempProjectlist[i].id == tempMain_list[j].id) {
... ... @@ -101,17 +107,17 @@ Page({
}
}
}
}else{
if (tempRist.length){
} else {
if (tempRist.length) {
for (let i in tempProjectlist) {
for (let j in tempRist){
for (let j in tempRist) {
if (tempProjectlist[i].id == tempRist[j].id) {
tempProjectlist[i] = tempRist[j]
}
}
}
}
}
wx.setNavigationBarTitle({
title: '选择保障项目',
... ... @@ -144,7 +150,7 @@ Page({
this.setData({
projectlist: res.data.data.def
})
console.log(this.data.projectlist)
// console.log(this.data.projectlist)
}
})
},
... ... @@ -170,12 +176,10 @@ Page({
//保障项目金额
popupNum(e) {
// var main_risk = this.data.main_risk
var index = e.currentTarget.dataset.index;
var projectlist = this.data.projectlist;
if (projectlist[index].choose_status) {
projectlist[index].num = e.detail.value
// main_risk[index].num = projectlist[index].num
}
console.log(main_risk)
this.setData({
... ... @@ -188,10 +192,10 @@ Page({
var index = e.currentTarget.dataset.index;
var projectlist = this.data.projectlist;
projectlist[index].choose_status = !projectlist[index].choose_status;
console.log(projectlist)
// console.log(projectlist)
this.setData({
projectlist: projectlist
})
})
},
//确认选择的推荐方案
... ... @@ -200,11 +204,11 @@ Page({
let type = this.data.addType;
var that = this
var main_array = []
var projectlist = Object.assign(this.data.projectlist,{})
var projectlist = Object.assign(this.data.projectlist, {})
for (var i = 0; i < projectlist.length; i++) {
if (projectlist[i].choose_status) {
main_array.push(projectlist[i])
}
if (projectlist[i].choose_status) {
main_array.push(projectlist[i])
}
}
if (main_array != '') {
... ... @@ -212,18 +216,18 @@ Page({
title: '添加成功',
icon: 'none'
})
if(type=='fujiaxian'){
if (type == 'fujiaxian') {
let tempRist = that.data.risk_list;
tempRist[index]['projectlist'] = main_array;
that.setData({
risk_list: tempRist,
})
}else{
} else {
that.setData({
main_array: main_array,
})
}
console.log(this.data.main_array)
// var temp = main_array
// for (var i = 0; i < main_array.length; i++) {
// for (var j = 0; j < main_array[i].title.length; j++) {
... ... @@ -248,6 +252,30 @@ Page({
}, 1000)
},
//主线保障期
tempMain() {
// var main_array = this.data.main_array
// var warranty_one = this.data.warranty_one
// var temp = {}
// var len = main_array.length
// for (var i = 0; i < main_array.length; i++) {
// if (main_array[i].choose_status) {
// temp.num = main_array[i].beneficiary_name
// temp.title = main_array[i].name
// warranty_one.push(temp)
// }
// var hash = {};
// var temrecommend = warranty_one.reduce(function (item, next) {
// hash[next.name] ? '' : hash[next.name] = true && item.push(next);
// return item
// }, [])
// console.log(temrecommend)
// this.setData({
// warranty_one: temrecommend
// })
// }
},
//选择受益人姓名
beneficiarySelect(e) {
// console.log(e)
... ... @@ -269,8 +297,10 @@ Page({
beneficiaryindex: e.detail.value,
beneficiary_list: beneficiary_list
})
},
//添加收益比例
addUnit(e) {
// console.log(e)
... ... @@ -305,12 +335,39 @@ Page({
this.setData({
beneficiary_list: list
})
console.log(this.data.beneficiary_list)
},
//添加附加险
addRisk(){
var risk_list = Object.assign(this.data.risk_list,{});
var len=risk_list.length
//重组添加受益人
tempBeneficiary() {
var beneficiary_list = this.data.beneficiary_list
var tempfavoree = this.data.tempfavoree
var temp = {}
var len = beneficiary_list.length
for (var i = 0; i < beneficiary_list.length; i++) {
if (beneficiary_list[i].unit != '') {
temp.name = beneficiary_list[i].beneficiary_name
temp.unit = beneficiary_list[i].unit
tempfavoree.push(temp)
}
var hash = {};
var temrecommend = tempfavoree.reduce(function(item, next) {
hash[next.name] ? '' : hash[next.name] = true && item.push(next);
return item
}, [])
// console.log(temrecommend)
this.setData({
tempfavoree: temrecommend
})
}
},
//添加附加险
addRisk() {
var risk_list = Object.assign(this.data.risk_list, {});
var len = risk_list.length
risk_list[len] = {
name: '',
projectlist: [],
... ... @@ -321,9 +378,6 @@ Page({
})
},
//上传图片
uploadImage() {
let that = this;
... ... @@ -426,6 +480,14 @@ Page({
});
},
//保障期
warrantyTwo(e) {
var guarantee_name = e.detail.value
this.setData({
guarantee_name: guarantee_name
})
},
//选择各项单位
selectUnit(e) {
var unit = e.currentTarget.dataset.unit
... ... @@ -434,17 +496,88 @@ Page({
})
},
//重组保障期数据格式
tempWarranty() {
var guarantee_name = this.data.guarantee_name
var unit = this.data.unit
var warranty_two = this.data.warranty_two
warranty_two.num = guarantee_name
warranty_two.title = unit
// console.log(warranty_two)
this.setData({
warranty_two: warranty_two
})
},
//缴费时长
burningTime(e) {
var time_name = e.detail.value
this.setData({
time_name: time_name
})
this.countImpletionTime()
},
selectUnit2(e) {
var unit = e.currentTarget.dataset.unit
this.setData({
unit2: unit
})
this.countImpletionTime()
},
//重组缴费时长数据格式
tempburningTime() {
var time_name = this.data.time_name
var unit = this.data.unit2
var long_money = this.data.long_money
long_money.num = time_name
long_money.title = unit
console.log(long_money)
this.setData({
long_money: long_money
})
},
//计算缴费期满日
countImpletionTime() {
var time_name = parseInt(this.data.time_name)
var unit = this.data.unit2
var compact_time = this.data.compact_time
var year = parseInt(new Date(compact_time).getFullYear())
var month = parseInt(new Date(compact_time).getMonth())
var day = parseInt(new Date(compact_time).getDate())
var runnian = ''
var cha=''
var birthday='1995-04-20'
var birthday_year = parseInt(new Date(birthday).getFullYear())
if (unit == '年') {
runnian = parseInt(time_name / 4)
cha = time_name - runnian
var dateTemp = compact_time.split("-");
var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);
var millSeconds = Math.abs(nDate) + (((cha * 365) + (runnian*366) )* 24 * 60 * 60 * 1000) - (1 * 24 * 60 * 60 * 1000);
var rDate = new Date(millSeconds);
var year = rDate.getFullYear();
var month = rDate.getMonth() + 1;
if (month < 10) month = "0" + month;
var date = rDate.getDate();
if (date < 10) date = "0" + date;
console.log(year + "-" + month + "-" + date);
}else if(unit=='岁'){
}
},
//缴费方式
selectUnit3(e) {
var unit = e.currentTarget.dataset.unit
this.setData({
unit3: unit
unit3: unit,
type_money: unit
})
},
... ... @@ -455,39 +588,32 @@ Page({
})
},
// 保单验证&&上传保单
listVerify(e) {
// this.insureItem()
// var addlist = this.data.addlist
// if (addlist[0].name != '') {
// var name = addlist[addlist.length - 1].name
// var num = addlist[addlist.length - 1].num
// var title = addlist[addlist.length - 1].title
// if (name == '' || num == '' || title == '') {
// addlist.pop()
// this.setData({
// addlist: addlist
// })
// }
// }
this.tempBeneficiary()
this.tempWarranty()
this.tempburningTime()
var warn = ""; //弹框时提示的内容
var flag = true; //判断信息输入是否完整判断弹窗
var in_num = e.detail.value.policy_num
var firm = e.detail.value.company;
var applicant = this.data.applicant_name
var recognizee = this.data.recognizee_name
var favoree = this.data.tempfavoree
var main_risks = e.detail.value.main_risks
var year_money = e.detail.value.year_money
var compact_time = this.data.compact_time
var warranty_two = this.data.warranty_two
var type_money = this.data.type_money
var favoree = this.data.favoreename
var compact_time = this.data.compact_time
var warranty_one = this.data.main_array
var impletion_time = this.data.impletion_time
var warranty = e.detail.value.Guarantee_period
var bank = e.detail.value.Renew_bank
var bank_num = e.detail.value.renew_num
var year_money = e.detail.value.year_money
var main_risks = e.detail.value.main_risks
var coverage = e.detail.value.base_money
var picurl = JSON.stringify(this.data.imgs)
var guarantee = JSON.stringify(this.data.selectitem) //保障项目
... ...
... ... @@ -151,10 +151,10 @@
</view>
<view class='list_input_box'>
<view class='list_input'>
<input type='text' placeholder='请填写' name='beneficiary' value='{{listdetail.favoree}}'></input>
<input type='number' placeholder='请填写' name='year_money' value='{{year_money}}'></input>
</view>
<view class='list_input'>
<input class='income_input' type='text' placeholder='请填写' name='beneficiary' value='元/年' disabled='true'></input>
<input class='income_input' type='text' placeholder='请填写' value='元/年' disabled='true'></input>
</view>
</view>
</view>
... ... @@ -182,12 +182,12 @@
<view class='list_title'>保障期</view>
<view class='list_input_box'>
<view class='list_input'>
<input type='text' placeholder='请输入' name='beneficiary' value='{{listdetail.favoree}}'></input>
<input type='text' placeholder='请输入' name='beneficiary' value='{{listdetail.favoree}}' bindinput='warrantyTwo'></input>
</view>
<view class='list_label_box'>
<view class="list_label_item {{unit==1?'list_label_active':''}}" bindtap='selectUnit' data-unit='1'>年</view>
<view class="list_label_item {{unit==2?'list_label_active':''}}" bindtap='selectUnit' data-unit='2'>岁 </view>
<view class="list_label_item {{unit==3?'list_label_active':''}}" bindtap='selectUnit' data-unit='3'>终身</view>
<view class="list_label_item {{unit=='年'?'list_label_active':''}}" bindtap='selectUnit' data-unit='年'>年</view>
<view class="list_label_item {{unit=='岁'?'list_label_active':''}}" bindtap='selectUnit' data-unit='岁'>岁 </view>
<view class="list_label_item {{unit=='终身'?'list_label_active':''}}" bindtap='selectUnit' data-unit='终身'>终身</view>
</view>
</view>
</view>
... ... @@ -195,21 +195,21 @@
<view class='list_title'>缴费时长</view>
<view class='list_input_box'>
<view class='list_input'>
<input type='text' placeholder='请输入' name='beneficiary' value='{{listdetail.favoree}}'></input>
<input type='text' placeholder='请输入' name='beneficiary' value='{{}}' bindinput='burningTime'></input>
</view>
<view class='list_label_box'>
<view class="list_label_item {{unit2==4?'list_label_active':''}}" bindtap='selectUnit2' data-unit='4'>年</view>
<view class="list_label_item {{unit2==5?'list_label_active':''}}" bindtap='selectUnit2' data-unit='5'>岁 </view>
<view class="list_label_item {{unit2==6?'list_label_active':''}}" bindtap='selectUnit2' data-unit='6'>终身</view>
<view class="list_label_item {{unit2=='年'?'list_label_active':''}}" bindtap='selectUnit2' data-unit='年'>年</view>
<view class="list_label_item {{unit2=='岁'?'list_label_active':''}}" bindtap='selectUnit2' data-unit='岁'>岁 </view>
<view class="list_label_item {{unit2=='终身'?'list_label_active':''}}" bindtap='selectUnit2' data-unit='终身'>终身</view>
</view>
</view>
</view>
<view class='item_list'>
<view class='list_title'>缴费方式</view>
<view class='list_label_box'>
<view class="list_label_item {{unit3==7?'list_label_active':''}}" bindtap='selectUnit3' data-unit='7'>年交</view>
<view class="list_label_item {{unit3==8?'list_label_active':''}}" bindtap='selectUnit3' data-unit='8'>趸交(一次付清)</view>
<view class="list_label_item {{unit3==9?'list_label_active':''}}" bindtap='selectUnit3' data-unit='9'>年交</view>
<view class="list_label_item {{unit3=='年交'?'list_label_active':''}}" bindtap='selectUnit3' data-unit='年交'>年交</view>
<view class="list_label_item {{unit3=='趸交'?'list_label_active':''}}" bindtap='selectUnit3' data-unit='趸交'>趸交(一次付清)</view>
<view class="list_label_item {{unit3=='月交'?'list_label_active':''}}" bindtap='selectUnit3' data-unit='月交'>月交</view>
</view>
</view>
<view class='item_list'>
... ... @@ -221,7 +221,7 @@
</block>
<block wx:else> -->
<view class='list_input'>
<input type='text' placeholder='请填写' name='Renew_bank' value='{{nullNum}}'></input>
<input type='text' placeholder='请填写' name='bank' value='{{bank}}'></input>
</view>
<!-- </block> -->
</view>
... ... @@ -234,7 +234,7 @@
</block>
<block wx:else> -->
<view class='list_input'>
<input type='text' placeholder='请填写' name='renew_num' value='{{nullNum}}'></input>
<input type='text' placeholder='请填写' name='bank_num' value='{{bank_num}}'></input>
</view>
<!-- </block> -->
</view>
... ... @@ -250,11 +250,14 @@
</view>
</block>
<block wx:else> -->
<view class='list_input'>
<!-- <view class='list_input'>
<picker class='picker' mode="date" bindchange='impletionTime' value='{{impletion_time}}'>
<input placeholder='请选择' value='{{impletion_time}}' disabled='true'></input>
</picker>
<text class='iconfont icon-riqi'></text>
</view> -->
<view class='list_input'>
<input type='text' placeholder='自动计算' name='impletion_time' value='{{impletion_time}}'></input>
</view>
<!-- </block> -->
</view>
... ... @@ -269,7 +272,7 @@
<block wx:else> -->
<view class='list_input'>
<picker class='picker' range='{{period_time}}' value='{{period_index}}' bindchange='periodTime'>
<input placeholder='请选择' value='{{period_time[period_index]}}' disabled='true'></input>
<input placeholder='自动计算' value='{{period_time[period_index]}}' disabled='true'></input>
</picker>
<!-- <text class='iconfont icon-riqi'></text> -->
</view>
... ...
... ... @@ -13,7 +13,7 @@
"compileType": "miniprogram",
"libVersion": "2.4.0",
"appid": "wxac365079a43a66bb",
"projectname": "%E5%AE%B6%E5%BA%AD%E4%BF%9D%E9%99%A9",
"projectname": "%E5%AE%B6%E5%BA%AD%E4%BF%9D%E9%99%A92",
"debugOptions": {
"hidedInDevtools": []
},
... ...