...
|
...
|
@@ -21,9 +21,8 @@ Page({ |
|
|
name: ['受益人1', '受益人2'],
|
|
|
unit: ''
|
|
|
}],
|
|
|
// 已选择的受益人
|
|
|
beneficiaryList:[],
|
|
|
beneficiaryindex: -1,
|
|
|
tempfavoree: [],// 已选择的受益人
|
|
|
beneficiaryList:[], beneficiaryindex: -1,
|
|
|
beneficiary_name: '',
|
|
|
imgs: [],
|
|
|
main_risk: [],
|
...
|
...
|
@@ -40,8 +39,13 @@ Page({ |
|
|
project_time:'',
|
|
|
time: 1
|
|
|
}],
|
|
|
main_array:[]
|
|
|
|
|
|
main_array: [],
|
|
|
warranty_one: [],
|
|
|
warranty_two: [],
|
|
|
guarantee_name: '',
|
|
|
long_money: [],
|
|
|
time_name: '',
|
|
|
type_money: '',
|
|
|
},
|
|
|
|
|
|
//投保人
|
...
|
...
|
@@ -88,14 +92,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) {
|
...
|
...
|
@@ -104,17 +108,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: '选择保障项目',
|
...
|
...
|
@@ -147,7 +151,7 @@ Page({ |
|
|
this.setData({
|
|
|
projectlist: res.data.data.def
|
|
|
})
|
|
|
console.log(this.data.projectlist)
|
|
|
// console.log(this.data.projectlist)
|
|
|
}
|
|
|
})
|
|
|
},
|
...
|
...
|
@@ -173,12 +177,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({
|
...
|
...
|
@@ -191,10 +193,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
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//确认选择的推荐方案
|
...
|
...
|
@@ -203,11 +205,12 @@ 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 != '') {
|
...
|
...
|
@@ -215,18 +218,21 @@ 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++) {
|
...
|
...
|
@@ -251,10 +257,35 @@ 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)
|
|
|
var index = e.currentTarget.dataset.mindex
|
|
|
|
|
|
var beneficiary_list = Object.assign(this.data.beneficiary_list,{});
|
|
|
// 获取当前已选择的收益人
|
|
|
let tempBenefice = Object.assign(this.data.beneficiaryList,{})
|
...
|
...
|
@@ -288,11 +319,14 @@ Page({ |
|
|
// console.log(tempRangArry)
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
beneficiary_list: beneficiary_list,
|
|
|
beneficiaryList: tempBenefice
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
//添加收益比例
|
|
|
addUnit(e) {
|
|
|
// console.log(e)
|
...
|
...
|
@@ -327,8 +361,35 @@ Page({ |
|
|
this.setData({
|
|
|
beneficiary_list: list
|
|
|
})
|
|
|
console.log(this.data.beneficiary_list)
|
|
|
},
|
|
|
//重组添加受益人
|
|
|
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
|
|
|
})
|
|
|
|
|
|
}
|
|
|
},
|
|
|
// 删除受益人
|
|
|
|
|
|
|
|
|
//删除收益人
|
|
|
deletebenefict(e){
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let tempbenefict = Object.assign(this.data.beneficiary_list, {});
|
...
|
...
|
@@ -343,15 +404,15 @@ Page({ |
|
|
beneficiary_list: tempbenefict
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//添加附加险
|
|
|
addRisk(){
|
|
|
var risk_list = Object.assign(this.data.risk_list,{});
|
|
|
var len=risk_list.length
|
|
|
//添加附加险
|
|
|
addRisk() {
|
|
|
var risk_list = Object.assign(this.data.risk_list, {});
|
|
|
var len = risk_list.length
|
|
|
risk_list[len] = {
|
|
|
name: '',
|
|
|
projectlist: [],
|
|
|
project_time: ''
|
|
|
project_time: '',
|
|
|
time:''
|
|
|
}
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
...
|
...
|
@@ -372,7 +433,7 @@ Page({ |
|
|
wx.chooseImage({
|
|
|
count: 6,
|
|
|
sizeType: ['original', 'compressed'],
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
let successUp = 0; //成功个数
|
|
|
let failUp = 0; //失败个数
|
|
|
let i = 0; //第几个
|
...
|
...
|
@@ -384,7 +445,7 @@ Page({ |
|
|
})
|
|
|
that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)
|
|
|
},
|
|
|
fail: function(res) {}
|
|
|
fail: function (res) { }
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -400,7 +461,7 @@ Page({ |
|
|
'strtime': strtime,
|
|
|
'token': app.strTime(strtime)
|
|
|
},
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
wx.hideNavigationBarLoading()
|
|
|
wx.hideLoading()
|
|
|
if (res.statusCode == '200') {
|
...
|
...
|
@@ -431,7 +492,7 @@ Page({ |
|
|
})
|
|
|
}
|
|
|
},
|
|
|
fail: function(res) {
|
|
|
fail: function (res) {
|
|
|
wx.hideNavigationBarLoading()
|
|
|
wx.hideLoading()
|
|
|
},
|
...
|
...
|
@@ -493,7 +554,7 @@ Page({ |
|
|
selectUnit4(e) {
|
|
|
var unit = e.currentTarget.dataset.unit;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let risk_list = Object.assign(this.data.risk_list,{});
|
|
|
let risk_list = Object.assign(this.data.risk_list, {});
|
|
|
risk_list[index].time = unit
|
|
|
this.setData({
|
|
|
risk_list: risk_list
|
...
|
...
|
@@ -715,56 +776,56 @@ Page({ |
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
onLoad: function (options) {
|
|
|
this.ensureProjectList()
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
onReady: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
onShow: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
onHide: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
onUnload: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|