作者 LXY

修改细节

... ... @@ -6,7 +6,7 @@
<input placeholder='搜索姓名或标签' bindinput='setKeyWord'></input>
</view>
</view>
<view bindtap='getdata'>搜索</view>
<view bindtap='getInfo'>搜索</view>
</view>
<view class='line_box'></view>
<view class='content_box'>
... ...
... ... @@ -51,7 +51,7 @@
</view>
<view class='list_input'>
<picker class='picker' mode="date" value='{{list.birthday}}' bindchange='birthDate'>
<input placeholder='请选择出生日期' value='{{list.birthday}}' disabled='true'></input>
<input placeholder='请选择真实出生日期,才能准确生日提醒' value='{{list.birthday}}' disabled='true'></input>
</picker>
</view>
</view>
... ... @@ -67,10 +67,10 @@
<input type='text' placeholder='请输入单位地址' value='{{list.work_address}}' bindinput='setworkAddress'></input>
</view>
</view>
<view class='item_list'>
<view class='item_list' style='align-items: flex-start;min-height:80rpx;'>
<view class='list_title'>家庭地址 </view>
<view class='list_input'>
<input type='text' placeholder='请输入家庭地址' value='{{list.address}}' bindinput='setSddress'></input>
<textarea type='text' placeholder='请输入家庭地址' value='{{list.address}}' bindinput='setSddress'></textarea>
</view>
</view>
... ... @@ -101,17 +101,17 @@
<!-- 上传图片 -->
<view class='upload_box'>
<view class='popup_img' wx:if='{{hasimg}}' bindtap='chooseImg'>
<image src='{{list.picurl}}' bindtap='viewImg' mode='WidthFix'></image>
<image src='{{list.picurl}}' mode='widthFix'></image>
</view>
<view bindtap='chooseImg' wx:else>
<view class='iconfont icon-add'></view>
<view>上传客户照片</view>
<view style='margin-bottom:25rpx;'>上传客户照片</view>
</view>
</view>
</view>
<view class='content_item'>
<view class='item_list'>
<view class='list_title'>户描述</view>
<view class='list_title'>户描述</view>
</view>
<view class='list_textarea'>
<textarea placeholder='请在此添加对用户的描述' value='{{list.text}}' placeholder-class='font_color' bindinput='descript'></textarea>
... ... @@ -119,7 +119,7 @@
</view>
<view class='content_item'>
<view class='item_list'>
<view class='list_title'>添加用户标签</view>
<view class='list_title' style='width: 100%;text-align: center;'>客户画像</view>
</view>
<view class='item_list item_label_box' wx:for='{{label_list}}' wx:key='' wx:for-index='mindex'>
<view class='list_label_title'>{{item.label}} </view>
... ...
... ... @@ -11,6 +11,7 @@ page {
}
.item_list {
width: 100%;
display: flex;
align-items: center;
border-bottom: 1rpx dashed #ebebeb;
... ... @@ -24,9 +25,10 @@ page {
}
.list_title {
width: 185rpx;
width: 170rpx;
font-size: 29rpx;
color: #000;
}
.list_label_title {
... ... @@ -125,25 +127,33 @@ page {
background: #fff;
margin-top: 16rpx;
text-align: center;
padding: 36rpx 0;
/* padding: 36rpx 0; */
border-radius: 10rpx;
box-shadow: 2rpx 0rpx 3rpx rgba(235, 235, 235, 1);
overflow: hidden;
}
.upload_box .icon-add {
font-size: 64rpx;
}
.popup_img {
position: relative;
width: 100%;
height: 100%;
/* position: relative; */
}
.popup_img image {
/* width: 100%; */
/* height: 100%; */
}
.icon-guanbi {
/* .icon-guanbi {
position: absolute;
top: 10rpx;
right: 20rpx;
color: #ccc;
}
.upload_box .icon-add {
font-size: 64rpx;
}
} */
.content_info {
font-size: 24rpx;
... ... @@ -227,6 +237,3 @@ page {
color: #fff;
background: rgba(2, 134, 255, 1);
}
.popup_img image{
width: 100%
}
... ...
... ... @@ -30,7 +30,9 @@
<view class='item_list'>
<view class='list_title'>个人年收入</view>
<view class='list_input'>
<input type='text' placeholder='' value='{{list.money}}' disabled='true' disabled='true'></input>
<!-- <input type='text' placeholder='' value='{{list.money}}' disabled='true' disabled='true'></input> -->
<text>{{list.money}}</text>
<text>万</text>
</view>
</view>
<view class='item_list'>
... ... @@ -106,7 +108,7 @@
</view>
<view class='content_item'>
<view class='item_list'>
<view class='list_title'>户描述</view>
<view class='list_title'>户描述</view>
</view>
<view class='list_textarea'>
<textarea placeholder='' value='{{list.text}}' placeholder-class='font_color' bindinput='descript' disabled='true'></textarea>
... ... @@ -114,12 +116,12 @@
</view>
<view class='content_item'>
<view class='item_list'>
<view class='list_title'>添加用户标签</view>
<view class='list_title' style='width: 100%;text-align: center;'>客户画像</view>
</view>
<view class='item_list item_label_box' wx:for='{{label_list}}' wx:key='' wx:for-index='mindex'>
<view class='item_list item_label_box' wx:for='{{label_list}}' wx:key='' wx:for-index='mindex'>
<view class='list_label_title'>{{item.label}} </view>
<view class='list_label'>
<view class="address_btn {{sub_its.status?'unit_address':''}}" data-id='{{sub_its.id}}' data-status='{{sub_its.status}}' wx:for='{{item.data}}' wx:for-item='sub_its' wx:key='' wx:for-index='sindex' data-sindex='{{sindex}}' data-mindex='{{mindex}}'>{{sub_its.name}}</view>
<view class="address_btn {{sub_its.status?'unit_address':''}}" data-id='{{sub_its.id}}' data-status='{{sub_its.status}}' wx:for='{{item.data}}' wx:for-item='sub_its' wx:key='' wx:for-index='sindex' data-sindex='{{sindex}}' data-mindex='{{mindex}}' wx:if='{{sub_its.status!=0}}'>{{sub_its.name}}</view>
</view>
</view>
</view>
... ...
... ... @@ -48,6 +48,8 @@ page {
width: 75%;
display: flex;
align-items: center;
font-size: 29rpx;
color: #000;
}
.list_input input {
... ...
// pages/addListDetail/addListDetail.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
recognizee: ['被保人', '被保人2'],
recognizee_index: 0,
period_time: ['10年', '20年'],
period_index: -1,
compact_time: '',
impletion_time: '',
popup_state: false,
projectlist: [],
label_state: false,
insure: ['投保人', '投保人2'],
insureindex: -1,
beneficiary_list: [{
name_array: ['受益人1', '受益人2'],
unit: ''
}],
beneficiaryindex: -1,
tempfavoree: [], // 已选择的受益人
beneficiaryList: [],
name: '', //受益人的名字,
beneficiary_name: '',
imgs: [],
main_risk: [],
unit: '',
unit2: '',
unit3: '',
unit4: '',
applicant_name: '',
recognizee_name: '',
rang_beneficiary: [],
risk_list: [{
name: '',
mo: [],
project_time: '',
title: '',
num: ''
}],
main_array: [],
warranty_one: '',
warranty_two: {},
guarantee_name: '',
long_money: {},
time_name: '',
type_money: '',
more: [],
guarantee: [],
InfoId: 0,
def_id: '',
edit_state: false,
risk_listitm: '',
storge_state: false,
},
//保单号
policyNum(e) {
/**
* 页面的初始数据
*/
data: {
recognizee: ['被保人', '被保人2'],
recognizee_index: 0,
period_time: ['10年', '20年'],
period_index: -1,
compact_time: '',
impletion_time: '',
popup_state: false,
projectlist: [],
label_state: false,
insure: ['投保人', '投保人2'],
insureindex: -1,
beneficiary_list: [{
name_array: ['受益人1', '受益人2'],
unit: ''
}],
beneficiaryindex: -1,
tempfavoree: [], // 已选择的受益人
beneficiaryList: [],
name: '', //受益人的名字,
beneficiary_name: '',
imgs: [],
main_risk: [],
unit: '',
unit2: '',
unit3: '',
unit4: '',
applicant_name: '',
recognizee_name: '',
rang_beneficiary: [],
risk_list: [{
name: '',
mo: [],
project_time: '',
title: '',
num: ''
}],
main_array: [],
warranty_one: '',
warranty_two: {},
guarantee_name: '',
long_money: {},
time_name: '',
type_money: '',
more: [],
guarantee: [],
InfoId: 0,
def_id: '',
edit_state: false,
risk_listitm: '',
storge_state: false,
},
//保单号
policyNum(e) {
this.setData({
in_num: e.detail.value,
})
},
//保单号
setFirm(e) {
this.setData({
firm: e.detail.value,
})
},
//投保人
insureSelect(e) {
var insure = this.data.insure
this.setData({
insureindex: e.detail.value,
applicant_name: insure[e.detail.value],
})
},
//选择被保险人
recognizeeSelect(e) {
var recognizee = this.data.recognizee
this.setData({
recognizeeindex: e.detail.value,
recognizee_name: recognizee[e.detail.value]
})
},
//主险名称
setRiskName(e) {
// console.log(e)
this.setData({
main_risks: e.detail.value,
})
// console.log(this.data.main_risks)
},
//保费
yearMoney(e) {
this.setData({
year_money: e.detail.value,
})
},
//设置银行
setBank(e) {
this.setData({
bank: e.detail.value,
})
},
//设置账号
setBankNum(e) {
this.setData({
bank_num: e.detail.value,
})
},
//合同生效日
compactTime(e) {
this.setData({
compact_time: e.detail.value,
})
this.countImpletionTime()
this.countImpletionTime2()
},
//缴费期满日
impletionTime(e) {
this.setData({
impletion_time: e.detail.value,
})
},
//主险保障期
periodTime(e) {
this.setData({
period_index: e.detail.value,
})
},
//保障项目弹窗
ensureProject(e) {
this.setData({
edit_state: false
})
let that = this;
let type = e.currentTarget.dataset.type;
let index = e.currentTarget.dataset.xulie;
let tempProjectlist = Object.assign(this.data.projectlist, {});
// 已经添加的附加险
let risk_list = Object.assign(this.data.risk_list, {});
console.log(risk_list)
let tempRist = risk_list[index].mo;
console.log(tempRist)
// 已经添加的主险
let tempMain_list = Object.assign(this.data.main_array, {})
console.log(type)
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) {
tempProjectlist[i].choose_status = true
for (let g in tempProjectlist[i].title) {
tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''
}
}
}
}
}
} else {
if (tempRist.length) {
for (let i in tempProjectlist) {
for (let j in tempRist) {
if (tempProjectlist[i].id == tempRist[j].id) {
tempProjectlist[i].choose_status = true
for (let g in tempProjectlist[i].title) {
console.log(tempProjectlist[i].title[g])
tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''
}
}
}
}
}
}
wx.setNavigationBarTitle({
title: '选择保障项目',
})
this.setData({
popup_state: true,
addType: type,
xulie: index,
projectlist: tempProjectlist
})
},
// 调取保障项目接口
ensureProjectList() {
var main_risk = this.data.main_risk
let url = 'counselor/sageguard'
let params = {}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
var projectlist = res.data.data.def;
for (var i = 0; i < projectlist.length; i++) {
projectlist[i].choose_status = false
for (var j = 0; j < projectlist[i].title.length; j++) {
projectlist[i].title[j].label_state = false
}
projectlist[i].title[0].current = 0
projectlist[i].title[0].label_state = true
}
this.setData({
in_num: e.detail.value,
projectlist: res.data.data.def
})
},
//保单号
setFirm(e) {
this.setData({
firm: e.detail.value,
// console.log(this.data.projectlist)
}
})
},
//保障项目单位
getUnit(e) {
var main_risk = this.data.main_risk
var index = e.currentTarget.dataset.index;
var sindex = e.currentTarget.dataset.sindex;
var projectlist = this.data.projectlist;
var title = projectlist[index].title
for (var i = 0; i < title.length; i++) {
title[i].current = ''
if (title[i].current == '') {
title[i].label_state = false
}
}
projectlist[index].title[sindex].current = sindex
if (projectlist[index].title[sindex].current == sindex) {
projectlist[index].title[sindex].label_state = true
}
this.setData({
projectlist: projectlist,
})
},
//保障项目金额
popupNum(e) {
var index = e.currentTarget.dataset.index;
var projectlist = this.data.projectlist;
if (projectlist[index].choose_status) {
projectlist[index].num = e.detail.value
}
this.setData({
projectlist: projectlist
})
},
//选择保障项目
popupState(e) {
var index = e.currentTarget.dataset.index;
var projectlist = this.data.projectlist;
projectlist[index].choose_status = !projectlist[index].choose_status;
// console.log(projectlist)
this.setData({
projectlist: projectlist,
})
if (this.data.inforid != 0) {
edit_state: false
}
},
//确认选择的推荐方案
confirmCase() {
let index = this.data.xulie;
let type = this.data.addType;
var that = this
var main_array = []
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])
console.log(main_array)
}
}
if (main_array != '') {
wx.showToast({
title: '添加成功',
icon: 'none'
})
if (type == 'fujiaxian') {
let tempRist = that.data.risk_list;
console.log(tempRist)
tempRist[index]['mo'] = main_array;
that.setData({
risk_list: tempRist,
risk_listitm: tempRist
})
},
//投保人
insureSelect(e) {
var insure = this.data.insure
this.setData({
insureindex: e.detail.value,
applicant_name: insure[e.detail.value],
console.log(this.data.risk_list)
} else {
that.setData({
main_array: main_array,
})
},
//选择被保险人
recognizeeSelect(e) {
var recognizee = this.data.recognizee
this.setData({
recognizeeindex: e.detail.value,
recognizee_name: recognizee[e.detail.value]
}
console.log(this.data.main_array)
}
setTimeout(function() {
that.ensureProjectList()
that.setData({
popup_state: false
})
wx.setNavigationBarTitle({
title: '添加保单',
})
}, 800)
console.log(this.data.risk_list)
},
//重组主险的保障项目
tempMain() {
var main_array = this.data.main_array
var warranty_one1 = []
// console.log(main_array)
for (var i = 0; i < main_array.length; i++) {
var temp = {}
for (var j = 0; j < main_array[i].title.length; j++) {
if (main_array[i].choose_status) {
if (main_array[i].title[j].label_state) {
temp.id = main_array[i].id
temp.name = main_array[i].name
temp.num = main_array[i].num
temp.title = main_array[i].title[j].name
temp.t_id = main_array[i].title[j].t_id
}
}
}
warranty_one1.push(temp)
this.setData({
guarantee: warranty_one1
})
}
},
//主险名称
addRiskName(e) {
var risk_list = this.data.risk_list
var index = e.currentTarget.dataset.index
risk_list[index].name = e.detail.value
this.setData({
risk_list: risk_list
})
},
//主险保障其
addRiskUnit(e) {
var risk_list = this.data.risk_list
var index = e.currentTarget.dataset.index
risk_list[index].num = e.detail.value
this.setData({
risk_list: risk_list
})
},
//重组附加险整体数据结构
tempAddRisk() {
var risk_list = this.data.risk_list
var sub_array = []
var temp_risk = this.data.risk_listitm;
var temp = this.data.risk_listitm;
for (var i = 0; i < temp.length; i++) {
for (var j = 0; j < temp[i].mo.length; j++) {
for (var k = 0; k < temp[i].mo[j].title.length; k++) {
if (temp[i].name != '') {
// var temp = {}
// var subtemp = {}
if (temp[i].mo[j].choose_status) {
if (temp[i].mo[j].title[k].label_state) {
temp_risk[i].name = temp[i].name
temp_risk[i].num = temp[i].num
temp_risk[i].title = temp[i].title
temp_risk[i].mo[j].t_id = temp[i].mo[j].title[k].t_id
temp_risk[i].mo[j].id = temp[i].mo[j].id
temp_risk[i].mo[j].name = temp[i].mo[j].name
temp_risk[i].mo[j].num = temp[i].mo[j].num
temp_risk[i].mo[j].title = temp[i].mo[j].title[k].name
console.log(temp_risk)
}
}
}
}
}
this.setData({
more: temp_risk
})
}
},
//选择受益人姓名
beneficiarySelect(e) {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
var index = e.currentTarget.dataset.mindex
var beneficiary_list = Object.assign(this.data.beneficiary_list, {});
// 获取当前已选择的收益人
let tempBenefice = Object.assign(this.data.beneficiaryList, {})
// 当前选择的收益人
let nowPerson = beneficiary_list[index].name_array[e.detail.value];
// 判断受益人是否已经添加
const add = tempBenefice.every((tempBenefice) => {
return tempBenefice != nowPerson
})
if (add) {
beneficiary_list[index].beneficiary_name = nowPerson;
tempBenefice.push(nowPerson)
} else {
wx.showToast({
title: '请不要重复添加受益人',
icon: 'none'
})
}
this.setData({
beneficiary_list: beneficiary_list,
beneficiaryList: tempBenefice
})
},
//添加收益比例
addUnit(e) {
var beneficiary_list = this.data.beneficiary_list;
beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value;
this.setData({
beneficiary_list: beneficiary_list,
})
},
//添加受益人
addPersons(e) {
var list = this.data.beneficiary_list;
var len = list.length
if (list[len - 1].beneficiary_name == undefined) {
wx.showToast({
title: '请选择受益人',
icon: 'none'
})
} else if (list[len - 1].unit == '') {
console.log('unit')
wx.showToast({
title: '请输入收益比',
icon: 'none'
})
} else {
list[len] = {
name_array: this.data.insure,
unit: ''
}
}
this.setData({
beneficiary_list: list
})
console.log(this.data.beneficiary_list)
},
//重组添加受益人
tempBeneficiary() {
var beneficiary_list = this.data.beneficiary_list
var len = beneficiary_list.length;
var tempfavoree1 = [];
for (var i = 0; i < beneficiary_list.length; i++) {
var temp = {}
if (beneficiary_list[i].unit != '') {
temp.name = beneficiary_list[i].beneficiary_name
temp.unit = beneficiary_list[i].unit;
}
tempfavoree1.push(temp)
this.setData({
tempfavoree: tempfavoree1
})
}
},
//删除收益人
deletebenefict(e) {
let index = e.currentTarget.dataset.index;
let tempbenefict = Object.assign(this.data.beneficiary_list, {});
let beneficiaryList = Object.assign(this.data.beneficiaryList, {});
// 获取当前选项的受益人
let person = tempbenefict[index].beneficiary_name;
tempbenefict.splice(index, 1);
if (person) beneficiaryList.splice(beneficiaryList.indexOf(person), 1)
this.setData({
beneficiaryList: beneficiaryList,
beneficiary_list: tempbenefict
})
},
//添加附加险
addRisk() {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
var risk_list = Object.assign(this.data.risk_list, {});
var len = risk_list.length
risk_list[len] = {
name: '',
mo: [],
project_time: '',
title: '',
num: ''
}
this.setData({
risk_list: risk_list
})
},
//删除附加险
deleteRisk(e) {
let index = e.currentTarget.dataset.index;
let risk_list = Object.assign(this.data.risk_list, {});
risk_list.splice(index, 1);
this.setData({
risk_list: risk_list
})
},
//上传图片
uploadImage() {
let that = this;
wx.chooseImage({
count: 6,
sizeType: ['original', 'compressed'],
success: function(res) {
let successUp = 0; //成功个数
let failUp = 0; //失败个数
let i = 0; //第几个
let tempFilePaths = res.tempFilePaths //总文件
let length = res.tempFilePaths.length //总共个数
wx.showNavigationBarLoading()
wx.showLoading({
title: '上传中',
})
that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)
},
//主险名称
setRiskName(e) {
// console.log(e)
this.setData({
main_risks: e.detail.value,
})
// console.log(this.data.main_risks)
fail: function(res) {}
})
},
//上传图片接口调取
uploadAllfile(filePaths, successUp, failUp, i, length) {
let that = this
let strtime = +new Date()
wx.uploadFile({
url: 'https://insurance.w.broteam.cn/pubilc/upload', //仅为示例,非真实的接口地址
filePath: filePaths[i],
name: 'picurl',
formData: {
'strtime': strtime,
'token': app.strTime(strtime)
},
//保费
yearMoney(e) {
this.setData({
year_money: e.detail.value,
})
success: function(res) {
wx.hideNavigationBarLoading()
wx.hideLoading()
if (res.statusCode == '200') {
let imgTemp = that.data.imgs;
let curImg = JSON.parse(res.data).data.picurl;
if (imgTemp.length < 6) {
imgTemp.push("http://" + curImg)
that.setData({
imgs: imgTemp
})
wx.showToast({
title: '上传成功',
icon: 'none',
duration: 2000,
})
} else {
wx.showToast({
title: '图片上限6张',
icon: 'none',
duration: 2000,
})
}
} else {
wx.showModal({
title: '提示',
content: res.msg,
showCancel: false
})
}
},
//设置银行
setBank(e) {
this.setData({
bank: e.detail.value,
})
fail: function(res) {
wx.hideNavigationBarLoading()
wx.hideLoading()
},
//设置账号
setBankNum(e) {
this.setData({
bank_num: e.detail.value,
})
complete: () => {
i++;
if (i == length) {
// console.log('总共' + successUp + '张上传成功,' + failUp + '张上传失败!');
} else { //递归调用uploadDIY函数
this.uploadAllfile(filePaths, successUp, failUp, i, length);
}
},
//合同生效日
compactTime(e) {
})
},
//预览图片
viewImg(e) {
var imgs = this.data.imgs
var current = e.currentTarget.dataset.index
wx.previewImage({
//当前显示图片
current: imgs[current],
//所有图片
urls: imgs
})
},
//删除图片
deleteImg(e) {
var imgs = this.data.imgs;
var index = e.currentTarget.dataset.index;
imgs.splice(index, 1);
this.setData({
imgs: imgs
});
},
//保障期
warrantyTwo(e) {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
var guarantee_name = e.detail.value
this.setData({
guarantee_name: e.detail.value
})
this.countImpletionTime2()
},
//选择各项单位
selectUnit(e) {
var unit = e.currentTarget.dataset.unit
this.setData({
unit: unit
})
this.countImpletionTime2()
},
//重组保障期数据格式
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
this.setData({
warranty_two: warranty_two
})
},
//计算缴费期满日,主线保障其
countImpletionTime2() {
var guarantee_name = parseInt(this.data.guarantee_name)
var unit = this.data.unit
var compact_time = this.data.compact_time
var year = parseInt(new Date(compact_time).getFullYear())
console.log(year)
var month = parseInt(new Date(compact_time).getMonth() + 1)
var day = parseInt(new Date(compact_time).getDate())
// var impletion_time = this.data.impletion_time
var warranty_one = this.data.warranty_one
var tempbirth_time = ''
var birthday = '1995-04-20'
var birthday_year = parseInt(new Date(birthday).getFullYear())
if (compact_time == '') {
wx.showToast({
title: '请选择合同生效日',
icon: 'none'
})
} else {
if (unit == '年') {
var temp_year = (year + guarantee_name)
var temp_day = day - 1
if (month < 10) month = "0" + month;
if (temp_day < 10) temp_day = "0" + temp_day;
// impletion_time = temp_year + '-' + month + '-' + temp_day
warranty_one = temp_year + '-' + month + '-' + temp_day
} else if (unit == '岁') {
var temp_year = (birthday_year + guarantee_name - 1)
var temp_year2 = (birthday_year + guarantee_name)
var temp_month = month
if (temp_month < 10) temp_month = "0" + temp_month;
if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;
// impletion_time = temp_year + '-' + temp_month + '-' + day
warranty_one = temp_year2 + '-' + month + '-' + day
} else if (unit == '终身') {
// impletion_time = '终身缴费'
warranty_one = '终身'
}
this.setData({
// impletion_time: impletion_time,
warranty_one: warranty_one
})
}
},
//缴费时长
burningTime(e) {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
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
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() + 1)
var day = parseInt(new Date(compact_time).getDate())
var impletion_time = this.data.impletion_time
// var warranty_one = this.data.warranty_one
var tempbirth_time = ''
var birthday = '1995-04-20'
var birthday_year = parseInt(new Date(birthday).getFullYear())
if (compact_time == '') {
wx.showToast({
title: '请选择合同生效日',
icon: 'none'
})
} else {
if (unit == '年') {
var temp_year = (year + time_name)
var temp_day = day - 1
if (month < 10) month = "0" + month;
if (temp_day < 10) temp_day = "0" + temp_day;
impletion_time = temp_year + '-' + month + '-' + temp_day
// warranty_one = temp_year + '-' + month + '-' + temp_day
} else if (unit == '岁') {
var temp_year = (birthday_year + time_name - 1)
var temp_year2 = (birthday_year + time_name)
var temp_month = month
if (temp_month < 10) temp_month = "0" + temp_month;
if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;
impletion_time = temp_year + '-' + temp_month + '-' + day
// warranty_one = temp_year2 + '-' + month + '-' + day
} else if (unit == '终身') {
impletion_time = '终身缴费'
// warranty_one = '终身'
}
this.setData({
impletion_time: impletion_time,
// warranty_one: warranty_one
})
}
},
//缴费方式
selectUnit3(e) {
var unit = e.currentTarget.dataset.unit
this.setData({
unit3: unit,
type_money: unit
})
},
//附加险保障其
selectUnit4(e) {
var unit = e.currentTarget.dataset.unit;
let index = e.currentTarget.dataset.index;
let risk_list = Object.assign(this.data.risk_list, {});
risk_list[index].title = unit
this.setData({
risk_list: risk_list
})
},
//家庭成员
familyMember(id) {
var FamilyId = this.data.FamilyId
let url = 'counselor/familyname'
let params = {
FamilyId: FamilyId || id,
}
app.post(url, params).then((res) => {
// console.log(res)
var beneficiary_list = this.data.beneficiary_list
for (var i in beneficiary_list) {
beneficiary_list[i].name_array = res.data.data.list
}
// console.log(beneficiary_list)
if (res.data.code == 200) {
this.setData({
compact_time: e.detail.value,
insure: res.data.data.list,
recognizee: res.data.data.list,
beneficiary_list: beneficiary_list,
})
this.countImpletionTime()
this.countImpletionTime2()
},
//缴费期满日
impletionTime(e) {
this.setData({
impletion_time: e.detail.value,
}
})
},
//设置缓存
setStorge(e) {
this.tempBeneficiary()
this.tempWarranty()
this.tempburningTime()
this.tempMain()
this.tempAddRisk()
var favoree = JSON.stringify(this.data.tempfavoree)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.more)
var guarantee = JSON.stringify(this.data.guarantee)
var warn = ""; //弹框时提示的内容
var in_num = this.data.in_num
var firm = this.data.firm
var applicant = this.data.applicant_name
var recognizee = this.data.recognizee_name
var main_risks = this.data.main_risks
var year_money = this.data.year_money
var compact_time = this.data.compact_time
var impletion_time = this.data.impletion_time
var warranty_one = JSON.stringify(this.data.warranty_one)
var type_money = this.data.type_money
var bank = this.data.bank
var bank_num = this.data.bank_num
var picurl = JSON.stringify(this.data.imgs)
let url = 'counselor/inforsave'
let params = {
// InfoId: this.data.inforid,
def_id: this.data.def_id,
in_num: in_num,
firm: firm,
applicant: applicant,
recognizee: recognizee,
favoree: favoree,
main_risks: main_risks,
guarantee: guarantee,
year_money: year_money,
warranty_two: warranty_two,
compact_time: compact_time,
impletion_time: impletion_time,
warranty_one: warranty_one,
long_money: long_money,
type_money: type_money,
bank: bank,
bank_num: bank_num,
more: more,
picurl: picurl,
}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
wx.navigateBack({
delta: 1,
})
},
//主险保障期
periodTime(e) {
this.setData({
period_index: e.detail.value,
storge_state: true
})
},
var storge_state = true
wx.setStorageSync('storge_state', storge_state)
}
})
},
//获取缓存内容
getStorage() {
let url = 'counselor/inforCopy'
let params = {
def_id: this.data.def_id,
}
app.post(url, params).then((res) => {
console.log(res)
if (res.data.code == 200) {
var warranty_two = res.data.data.def.warranty_two
var unit = this.data.unit
unit = warranty_two.title
var long_money = res.data.data.def.long_money
var unit2 = this.data.unit2
unit2 = long_money.title
var type_money = res.data.data.def.type_money
var unit3 = this.data.unit3
unit3 = type_money
var beneficiary_list = res.data.data.def.favoree
for (var obj in beneficiary_list) {
beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
beneficiary_list[obj].name_array = this.data.insure
}
//保障项目弹窗
ensureProject(e) {
this.setData({
edit_state: false
imgs: res.data.data.def.picurl,
type_money: res.data.data.def.type_money,
unit3: unit3,
year_money: res.data.data.def.year_money,
long_money: res.data.data.def.long_money,
unit2: unit2,
in_num: res.data.data.def.in_num,
firm: res.data.data.def.firm,
main_risks: res.data.data.def.main_risks,
main_array: res.data.data.def.guarantee,
applicant_name: res.data.data.def.applicant,
recognizee_name: res.data.data.def.recognizee,
warranty_one: res.data.data.def.warranty_one,
warranty_two: res.data.data.def.warranty_two,
unit: unit,
compact_time: res.data.data.def.compact_time,
impletion_time: res.data.data.def.impletion_time,
bank: res.data.data.def.bank,
bank_num: res.data.data.def.bank_num,
risk_list: res.data.data.def.more,
beneficiary_list: beneficiary_list,
edit_state: true,
})
let that = this;
let type = e.currentTarget.dataset.type;
let index = e.currentTarget.dataset.xulie;
let tempProjectlist = Object.assign(this.data.projectlist, {});
// 已经添加的附加险
let risk_list = Object.assign(this.data.risk_list, {});
console.log(risk_list)
let tempRist = risk_list[index].mo;
console.log(tempRist)
// 已经添加的主险
let tempMain_list = Object.assign(this.data.main_array, {})
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) {
tempProjectlist[i].choose_status = true
for (let g in tempProjectlist[i].title) {
tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''
}
}
}
}
}
} else {
if (tempRist.length) {
for (let i in tempProjectlist) {
for (let j in tempRist) {
if (tempProjectlist[i].id == tempRist[j].id) {
tempProjectlist[i].choose_status = true
for (let g in tempProjectlist[i].title) {
console.log(tempProjectlist[i].title[g])
tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id ? tempProjectlist[i].title[g].label_state = true : ''
}
}
}
}
}
}
wx.setNavigationBarTitle({
title: '选择保障项目',
})
this.setData({
popup_state: true,
addType: type,
xulie: index,
projectlist: tempProjectlist
})
},
// 调取保障项目接口
ensureProjectList() {
var main_risk = this.data.main_risk
let url = 'counselor/sageguard'
let params = {}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
var projectlist = res.data.data.def;
for (var i = 0; i < projectlist.length; i++) {
projectlist[i].choose_status = false
for (var j = 0; j < projectlist[i].title.length; j++) {
projectlist[i].title[j].label_state = false
}
projectlist[i].title[0].current = 0
projectlist[i].title[0].label_state = true
}
this.setData({
projectlist: res.data.data.def
})
// console.log(this.data.projectlist)
}
})
},
//保障项目单位
getUnit(e) {
var main_risk = this.data.main_risk
var index = e.currentTarget.dataset.index;
var sindex = e.currentTarget.dataset.sindex;
var projectlist = this.data.projectlist;
var title = projectlist[index].title
for (var i = 0; i < title.length; i++) {
title[i].current = ''
if (title[i].current == '') {
title[i].label_state = false
}
}
projectlist[index].title[sindex].current = sindex
if (projectlist[index].title[sindex].current == sindex) {
projectlist[index].title[sindex].label_state = true
}
this.setData({
projectlist: projectlist,
}
})
},
//完成保单添加
listVerify(e) {
if (this.data.inforid == 0 || this.data.inforid == undefined) {
this.tempBeneficiary()
this.tempWarranty()
this.tempburningTime()
this.tempMain()
this.tempAddRisk()
var favoree = JSON.stringify(this.data.tempfavoree)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.more)
var guarantee = JSON.stringify(this.data.guarantee)
} else if (this.data.edit_state) {
var favoree = JSON.stringify(this.data.beneficiary_list)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.risk_list)
var guarantee = JSON.stringify(this.data.main_array)
} else {
this.tempBeneficiary()
this.tempWarranty()
this.tempburningTime()
this.tempMain()
this.tempAddRisk()
var favoree = JSON.stringify(this.data.tempfavoree)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.more)
var guarantee = JSON.stringify(this.data.guarantee)
}
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 main_risks = e.detail.value.main_risks
var year_money = e.detail.value.year_money
var compact_time = this.data.compact_time
var impletion_time = this.data.impletion_time
var warranty_one = JSON.stringify(this.data.warranty_one)
var type_money = this.data.type_money
var bank = e.detail.value.bank
var bank_num = e.detail.value.bank_num
var picurl = JSON.stringify(this.data.imgs)
var continue1 = e.detail.target.dataset.type
var complete = e.detail.target.dataset.type
if (in_num == '') {
warn = '请输入保单号!'
} else if (firm == '') {
warn = '请输入所属公司!'
} else if (applicant == '') {
warn = '请输入投保人!'
} else if (recognizee == '') {
warn = '请输入被保险人!'
} else if (favoree == '') {
warn = '请输入受益人!'
} else if (main_risks == '') {
warn = '请输入主险名称!'
} else if (year_money == '') {
warn = '请输入年交保费!'
} else if (compact_time == '') {
warn = '请输入合同生效日!'
} else if (warranty_two.num == '') {
warn = '请输入保障期!'
} else if (long_money.num == '') {
warn = '请输入缴费时长!'
} else if (type_money == '') {
warn = '请输入缴费方式!'
} else if (bank == '') {
warn = '请输入续费银行!'
} else if (bank_num == '') {
warn = '请输入续费账号!'
} else if (!(/^[0-9]+.?[0-9]*/.test(bank_num))) {
warn = '请输入正确续费账号!'
} else if (impletion_time == '') {
warn = '请输入缴费期满日!'
} else if (warranty_one == '') {
warn = '请输入主险保障期!'
} else if (more == '') {
warn = '请输入附加险!'
} else if (picurl.length == 2) {
warn = '请选择图片!'
} else {
flag = false
// 添加、修改保单接口调取
let url = 'counselor/inforuodate'
let params = {
InfoId: this.data.inforid,
def_id: this.data.def_id,
in_num: in_num,
firm: firm,
applicant: applicant,
recognizee: recognizee,
favoree: favoree,
main_risks: main_risks,
guarantee: guarantee,
year_money: year_money,
warranty_two: warranty_two,
compact_time: compact_time,
impletion_time: impletion_time,
warranty_one: warranty_one,
long_money: long_money,
type_money: type_money,
bank: bank,
bank_num: bank_num,
more: more,
picurl: picurl,
}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
if (continue1 == 'continue1') {
wx.showToast({
title: '添加成功',
icon: 'none',
duration: 2000,
})
},
//保障项目金额
popupNum(e) {
var index = e.currentTarget.dataset.index;
var projectlist = this.data.projectlist;
if (projectlist[index].choose_status) {
projectlist[index].num = e.detail.value
}
this.setData({
projectlist: projectlist
in_num: '',
firm: '',
applicant_name: '',
recognizee_name: '',
// beneficiary_list: [{
// name_array: [],
// unit: ''
// }],
main_risks: '',
main_array: '',
year_money: '',
compact_time: '',
warranty_two: '',
long_money: '',
bank: '',
bank_num: '',
impletion_time: '',
warranty_one: '',
// risk_list:'',
imgs: '',
unit: '',
unit2: '',
unit3: '',
unit4: '',
})
},
//选择保障项目
popupState(e) {
var index = e.currentTarget.dataset.index;
var projectlist = this.data.projectlist;
projectlist[index].choose_status = !projectlist[index].choose_status;
// console.log(projectlist)
this.setData({
projectlist: projectlist,
} else if (complete == 'complete') {
wx.showToast({
title: '添加成功',
icon: 'none',
duration: 2000,
})
if (this.data.inforid != 0) {
edit_state: false
}
},
//确认选择的推荐方案
confirmCase() {
let index = this.data.xulie;
let type = this.data.addType;
var that = this
var main_array = []
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])
console.log(main_array)
}
}
if (main_array != '') {
wx.showToast({
title: '添加成功',
icon: 'none'
})
if (type == 'fujiaxian') {
let tempRist = that.data.risk_list;
console.log(tempRist)
tempRist[index]['mo'] = main_array;
that.setData({
risk_list: tempRist,
risk_listitm: tempRist
})
console.log(this.data.risk_list)
} else {
that.setData({
main_array: main_array,
})
}
console.log(this.data.main_array)
}
setTimeout(function() {
that.ensureProjectList()
that.setData({
popup_state: false
})
wx.setNavigationBarTitle({
title: '添加保单',
})
}, 800)
console.log(this.data.risk_list)
},
//重组主险的保障项目
tempMain() {
var main_array = this.data.main_array
var warranty_one1 = []
// console.log(main_array)
for (var i = 0; i < main_array.length; i++) {
var temp = {}
for (var j = 0; j < main_array[i].title.length; j++) {
if (main_array[i].choose_status) {
if (main_array[i].title[j].label_state) {
temp.id = main_array[i].id
temp.name = main_array[i].name
temp.num = main_array[i].num
temp.title = main_array[i].title[j].name
temp.t_id = main_array[i].title[j].t_id
}
}
}
warranty_one1.push(temp)
this.setData({
guarantee: warranty_one1
})
}
},
//主险名称
addRiskName(e) {
var risk_list = this.data.risk_list
var index = e.currentTarget.dataset.index
risk_list[index].name = e.detail.value
this.setData({
risk_list: risk_list
})
},
//主险保障其
addRiskUnit(e) {
var risk_list = this.data.risk_list
var index = e.currentTarget.dataset.index
risk_list[index].num = e.detail.value
this.setData({
risk_list: risk_list
})
},
//重组附加险整体数据结构
tempAddRisk() {
var risk_list = this.data.risk_list
var sub_array = []
var temp_risk = this.data.risk_listitm;
var temp = this.data.risk_listitm;
for (var i = 0; i < temp.length; i++) {
for (var j = 0; j < temp[i].mo.length; j++) {
for (var k = 0; k < temp[i].mo[j].title.length; k++) {
if (temp[i].name != '') {
// var temp = {}
// var subtemp = {}
if (temp[i].mo[j].choose_status) {
if (temp[i].mo[j].title[k].label_state) {
temp_risk[i].name = temp[i].name
temp_risk[i].num = temp[i].num
temp_risk[i].title = temp[i].title
temp_risk[i].mo[j].t_id = temp[i].mo[j].title[k].t_id
temp_risk[i].mo[j].id = temp[i].mo[j].id
temp_risk[i].mo[j].name = temp[i].mo[j].name
temp_risk[i].mo[j].num = temp[i].mo[j].num
temp_risk[i].mo[j].title = temp[i].mo[j].title[k].name
console.log(temp_risk)
}
}
}
}
}
this.setData({
more: temp_risk
})
}
},
//选择受益人姓名
beneficiarySelect(e) {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
var index = e.currentTarget.dataset.mindex
var beneficiary_list = Object.assign(this.data.beneficiary_list, {});
// 获取当前已选择的收益人
let tempBenefice = Object.assign(this.data.beneficiaryList, {})
// 当前选择的收益人
let nowPerson = beneficiary_list[index].name_array[e.detail.value];
// 判断受益人是否已经添加
const add = tempBenefice.every((tempBenefice) => {
return tempBenefice != nowPerson
})
if (add) {
beneficiary_list[index].beneficiary_name = nowPerson;
tempBenefice.push(nowPerson)
} else {
wx.showToast({
title: '请不要重复添加受益人',
icon: 'none'
})
}
this.setData({
beneficiary_list: beneficiary_list,
beneficiaryList: tempBenefice
wx.navigateBack({
delta: 1,
})
},
//添加收益比例
addUnit(e) {
var beneficiary_list = this.data.beneficiary_list;
beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value;
this.setData({
beneficiary_list: beneficiary_list,
})
},
//添加受益人
addPersons(e) {
var list = this.data.beneficiary_list;
var len = list.length
if (list[len - 1].beneficiary_name == undefined) {
wx.showToast({
title: '请选择受益人',
icon: 'none'
})
} else if (list[len - 1].unit == '') {
console.log('unit')
wx.showToast({
title: '请输入收益比',
icon: 'none'
})
} else {
list[len] = {
name_array: this.data.insure,
unit: ''
}
}
this.setData({
beneficiary_list: list
})
console.log(this.data.beneficiary_list)
},
//重组添加受益人
tempBeneficiary() {
var beneficiary_list = this.data.beneficiary_list
var len = beneficiary_list.length;
var tempfavoree1 = [];
for (var i = 0; i < beneficiary_list.length; i++) {
var temp = {}
if (beneficiary_list[i].unit != '') {
temp.name = beneficiary_list[i].beneficiary_name
temp.unit = beneficiary_list[i].unit;
}
tempfavoree1.push(temp)
this.setData({
tempfavoree: tempfavoree1
})
}
},
//删除收益人
deletebenefict(e) {
let index = e.currentTarget.dataset.index;
let tempbenefict = Object.assign(this.data.beneficiary_list, {});
let beneficiaryList = Object.assign(this.data.beneficiaryList, {});
// 获取当前选项的受益人
let person = tempbenefict[index].beneficiary_name;
tempbenefict.splice(index, 1);
if (person) beneficiaryList.splice(beneficiaryList.indexOf(person), 1)
this.setData({
beneficiaryList: beneficiaryList,
beneficiary_list: tempbenefict
})
},
//添加附加险
addRisk() {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
var risk_list = Object.assign(this.data.risk_list, {});
var len = risk_list.length
risk_list[len] = {
name: '',
mo: [],
project_time: '',
title: '',
num: ''
}
this.setData({
risk_list: risk_list
})
},
//删除附加险
deleteRisk(e) {
let index = e.currentTarget.dataset.index;
let risk_list = Object.assign(this.data.risk_list, {});
risk_list.splice(index, 1);
this.setData({
risk_list: risk_list
})
},
//上传图片
uploadImage() {
let that = this;
wx.chooseImage({
count: 6,
sizeType: ['original', 'compressed'],
success: function(res) {
let successUp = 0; //成功个数
let failUp = 0; //失败个数
let i = 0; //第几个
let tempFilePaths = res.tempFilePaths //总文件
let length = res.tempFilePaths.length //总共个数
wx.showNavigationBarLoading()
wx.showLoading({
title: '上传中',
})
that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)
},
fail: function(res) {}
})
},
//上传图片接口调取
uploadAllfile(filePaths, successUp, failUp, i, length) {
let that = this
let strtime = +new Date()
wx.uploadFile({
url: 'https://insurance.w.broteam.cn/pubilc/upload', //仅为示例,非真实的接口地址
filePath: filePaths[i],
name: 'picurl',
formData: {
'strtime': strtime,
'token': app.strTime(strtime)
},
success: function(res) {
wx.hideNavigationBarLoading()
wx.hideLoading()
if (res.statusCode == '200') {
let imgTemp = that.data.imgs;
let curImg = JSON.parse(res.data).data.picurl;
if (imgTemp.length < 6) {
imgTemp.push("http://" + curImg)
that.setData({
imgs: imgTemp
})
wx.showToast({
title: '上传成功',
icon: 'none',
duration: 2000,
})
} else {
wx.showToast({
title: '图片上限6张',
icon: 'none',
duration: 2000,
})
}
} else {
wx.showModal({
title: '提示',
content: res.msg,
showCancel: false
})
}
},
fail: function(res) {
wx.hideNavigationBarLoading()
wx.hideLoading()
},
complete: () => {
i++;
if (i == length) {
// console.log('总共' + successUp + '张上传成功,' + failUp + '张上传失败!');
} else { //递归调用uploadDIY函数
this.uploadAllfile(filePaths, successUp, failUp, i, length);
}
},
})
},
//预览图片
viewImg(e) {
var imgs = this.data.imgs
var current = e.currentTarget.dataset.index
wx.previewImage({
//当前显示图片
current: imgs[current],
//所有图片
urls: imgs
})
},
//删除图片
deleteImg(e) {
var imgs = this.data.imgs;
var index = e.currentTarget.dataset.index;
imgs.splice(index, 1);
this.setData({
imgs: imgs
});
},
//保障期
warrantyTwo(e) {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
var guarantee_name = e.detail.value
this.setData({
guarantee_name: e.detail.value
})
this.countImpletionTime2()
},
//选择各项单位
selectUnit(e) {
var unit = e.currentTarget.dataset.unit
this.setData({
unit: unit
})
this.countImpletionTime2()
},
//重组保障期数据格式
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
this.setData({
warranty_two: warranty_two
})
},
//计算缴费期满日,主线保障其
countImpletionTime2() {
var guarantee_name = parseInt(this.data.guarantee_name)
var unit = this.data.unit
var compact_time = this.data.compact_time
var year = parseInt(new Date(compact_time).getFullYear())
console.log(year)
var month = parseInt(new Date(compact_time).getMonth() + 1)
var day = parseInt(new Date(compact_time).getDate())
// var impletion_time = this.data.impletion_time
var warranty_one = this.data.warranty_one
var tempbirth_time = ''
var birthday = '1995-04-20'
var birthday_year = parseInt(new Date(birthday).getFullYear())
if (compact_time == '') {
wx.showToast({
title: '请选择合同生效日',
icon: 'none'
})
} else {
if (unit == '年') {
var temp_year = (year + guarantee_name)
var temp_day = day - 1
if (month < 10) month = "0" + month;
if (temp_day < 10) temp_day = "0" + temp_day;
// impletion_time = temp_year + '-' + month + '-' + temp_day
warranty_one = temp_year + '-' + month + '-' + temp_day
} else if (unit == '岁') {
var temp_year = (birthday_year + guarantee_name - 1)
var temp_year2 = (birthday_year + guarantee_name)
var temp_month = month
if (temp_month < 10) temp_month = "0" + temp_month;
if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;
// impletion_time = temp_year + '-' + temp_month + '-' + day
warranty_one = temp_year2 + '-' + month + '-' + day
} else if (unit == '终身') {
// impletion_time = '终身缴费'
warranty_one = '终身'
}
this.setData({
// impletion_time: impletion_time,
warranty_one: warranty_one
})
}
},
//缴费时长
burningTime(e) {
if (this.data.inforid != 0) {
this.setData({
edit_state: false
})
}
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
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() + 1)
var day = parseInt(new Date(compact_time).getDate())
var impletion_time = this.data.impletion_time
// var warranty_one = this.data.warranty_one
var tempbirth_time = ''
var birthday = '1995-04-20'
var birthday_year = parseInt(new Date(birthday).getFullYear())
if (compact_time == '') {
wx.showToast({
title: '请选择合同生效日',
icon: 'none'
})
} else {
if (unit == '年') {
var temp_year = (year + time_name)
var temp_day = day - 1
if (month < 10) month = "0" + month;
if (temp_day < 10) temp_day = "0" + temp_day;
impletion_time = temp_year + '-' + month + '-' + temp_day
// warranty_one = temp_year + '-' + month + '-' + temp_day
} else if (unit == '岁') {
var temp_year = (birthday_year + time_name - 1)
var temp_year2 = (birthday_year + time_name)
var temp_month = month
if (temp_month < 10) temp_month = "0" + temp_month;
if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;
impletion_time = temp_year + '-' + temp_month + '-' + day
// warranty_one = temp_year2 + '-' + month + '-' + day
} else if (unit == '终身') {
impletion_time = '终身缴费'
// warranty_one = '终身'
}
this.setData({
impletion_time: impletion_time,
// warranty_one: warranty_one
})
}
},
//缴费方式
selectUnit3(e) {
var unit = e.currentTarget.dataset.unit
this.setData({
unit3: unit,
type_money: unit
})
},
//附加险保障其
selectUnit4(e) {
var unit = e.currentTarget.dataset.unit;
let index = e.currentTarget.dataset.index;
let risk_list = Object.assign(this.data.risk_list, {});
risk_list[index].title = unit
this.setData({
risk_list: risk_list
})
},
//家庭成员
familyMember(id) {
var FamilyId = this.data.FamilyId
let url = 'counselor/familyname'
let params = {
FamilyId: FamilyId||id,
}
app.post(url, params).then((res) => {
// console.log(res)
var beneficiary_list = this.data.beneficiary_list
for (var i in beneficiary_list) {
beneficiary_list[i].name_array = res.data.data.list
}
// console.log(beneficiary_list)
if (res.data.code == 200) {
this.setData({
insure: res.data.data.list,
recognizee: res.data.data.list,
beneficiary_list: beneficiary_list,
})
}
})
},
//设置缓存
setStorge(e) {
this.tempBeneficiary()
this.tempWarranty()
this.tempburningTime()
this.tempMain()
this.tempAddRisk()
var favoree = JSON.stringify(this.data.tempfavoree)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.more)
var guarantee = JSON.stringify(this.data.guarantee)
var warn = ""; //弹框时提示的内容
var in_num = this.data.in_num
var firm = this.data.firm
var applicant = this.data.applicant_name
var recognizee = this.data.recognizee_name
var main_risks = this.data.main_risks
var year_money = this.data.year_money
var compact_time = this.data.compact_time
var impletion_time = this.data.impletion_time
var warranty_one = JSON.stringify(this.data.warranty_one)
var type_money = this.data.type_money
var bank = this.data.bank
var bank_num = this.data.bank_num
var picurl = JSON.stringify(this.data.imgs)
let url = 'counselor/inforsave'
let params = {
// InfoId: this.data.inforid,
def_id: this.data.def_id,
in_num: in_num,
firm: firm,
applicant: applicant,
recognizee: recognizee,
favoree: favoree,
main_risks: main_risks,
guarantee: guarantee,
year_money: year_money,
warranty_two: warranty_two,
compact_time: compact_time,
impletion_time: impletion_time,
warranty_one: warranty_one,
long_money: long_money,
type_money: type_money,
bank: bank,
bank_num: bank_num,
more: more,
picurl: picurl,
}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
wx.navigateBack({
delta: 1,
})
this.setData({
storge_state: true
})
var storge_state = true
wx.setStorageSync('storge_state', storge_state)
}
})
},
//获取缓存内容
getStorage() {
let url = 'counselor/inforCopy'
let params = {
def_id: this.data.def_id,
}
app.post(url, params).then((res) => {
console.log(res)
if (res.data.code == 200) {
var warranty_two = res.data.data.def.warranty_two
var unit = this.data.unit
unit = warranty_two.title
var long_money = res.data.data.def.long_money
var unit2 = this.data.unit2
unit2 = long_money.title
var type_money = res.data.data.def.type_money
var unit3 = this.data.unit3
unit3 = type_money
var beneficiary_list = res.data.data.def.favoree
for (var obj in beneficiary_list) {
beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
beneficiary_list[obj].name_array = this.data.insure
}
this.setData({
imgs: res.data.data.def.picurl,
type_money: res.data.data.def.type_money,
unit3: unit3,
year_money: res.data.data.def.year_money,
long_money: res.data.data.def.long_money,
unit2: unit2,
in_num: res.data.data.def.in_num,
firm: res.data.data.def.firm,
main_risks: res.data.data.def.main_risks,
main_array: res.data.data.def.guarantee,
applicant_name: res.data.data.def.applicant,
recognizee_name: res.data.data.def.recognizee,
warranty_one: res.data.data.def.warranty_one,
warranty_two: res.data.data.def.warranty_two,
unit: unit,
compact_time: res.data.data.def.compact_time,
impletion_time: res.data.data.def.impletion_time,
bank: res.data.data.def.bank,
bank_num: res.data.data.def.bank_num,
risk_list: res.data.data.def.more,
beneficiary_list: beneficiary_list,
edit_state: true,
})
}
})
},
//完成保单添加
listVerify(e) {
if (this.data.inforid == 0 || this.data.inforid == undefined) {
this.tempBeneficiary()
this.tempWarranty()
this.tempburningTime()
this.tempMain()
this.tempAddRisk()
var favoree = JSON.stringify(this.data.tempfavoree)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.more)
var guarantee = JSON.stringify(this.data.guarantee)
} else if (this.data.edit_state) {
var favoree = JSON.stringify(this.data.beneficiary_list)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.risk_list)
var guarantee = JSON.stringify(this.data.main_array)
} else {
this.tempBeneficiary()
this.tempWarranty()
this.tempburningTime()
this.tempMain()
this.tempAddRisk()
var favoree = JSON.stringify(this.data.tempfavoree)
var warranty_two = JSON.stringify(this.data.warranty_two)
var long_money = JSON.stringify(this.data.long_money)
var more = JSON.stringify(this.data.more)
var guarantee = JSON.stringify(this.data.guarantee)
}
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 main_risks = e.detail.value.main_risks
var year_money = e.detail.value.year_money
var compact_time = this.data.compact_time
var impletion_time = this.data.impletion_time
var warranty_one = JSON.stringify(this.data.warranty_one)
var type_money = this.data.type_money
var bank = e.detail.value.bank
var bank_num = e.detail.value.bank_num
var picurl = JSON.stringify(this.data.imgs)
var continue1 = e.detail.target.dataset.type
var complete = e.detail.target.dataset.type
if (in_num == '') {
warn = '请输入保单号!'
} else if (firm == '') {
warn = '请输入所属公司!'
} else if (applicant == '') {
warn = '请输入投保人!'
} else if (recognizee == '') {
warn = '请输入被保险人!'
} else if (favoree == '') {
warn = '请输入受益人!'
} else if (main_risks == '') {
warn = '请输入主险名称!'
} else if (year_money == '') {
warn = '请输入年交保费!'
} else if (compact_time == '') {
warn = '请输入合同生效日!'
} else if (warranty_two.num == '') {
warn = '请输入保障期!'
} else if (long_money.num == '') {
warn = '请输入缴费时长!'
} else if (type_money == '') {
warn = '请输入缴费方式!'
} else if (bank == '') {
warn = '请输入续费银行!'
} else if (bank_num == '') {
warn = '请输入续费账号!'
} else if (!(/^[0-9]+.?[0-9]*/.test(bank_num))) {
warn = '请输入正确续费账号!'
} else if (impletion_time == '') {
warn = '请输入缴费期满日!'
} else if (warranty_one == '') {
warn = '请输入主险保障期!'
} else if (more == '') {
warn = '请输入附加险!'
} else if (picurl.length == 2) {
warn = '请选择图片!'
} else {
flag = false
// 添加、修改保单接口调取
let url = 'counselor/inforuodate'
let params = {
InfoId: this.data.inforid,
def_id: this.data.def_id,
in_num: in_num,
firm: firm,
applicant: applicant,
recognizee: recognizee,
favoree: favoree,
main_risks: main_risks,
guarantee: guarantee,
year_money: year_money,
warranty_two: warranty_two,
compact_time: compact_time,
impletion_time: impletion_time,
warranty_one: warranty_one,
long_money: long_money,
type_money: type_money,
bank: bank,
bank_num: bank_num,
more: more,
picurl: picurl,
}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
if (continue1 == 'continue1') {
wx.showToast({
title: '添加成功',
icon: 'none',
duration: 2000,
})
this.setData({
in_num: '',
firm: '',
applicant_name: '',
recognizee_name: '',
// beneficiary_list: [{
// name_array: [],
// unit: ''
// }],
main_risks: '',
main_array: '',
year_money: '',
compact_time: '',
warranty_two: '',
long_money: '',
bank: '',
bank_num: '',
impletion_time: '',
warranty_one: '',
// risk_list:'',
imgs: '',
unit: '',
unit2: '',
unit3: '',
unit4: '',
})
} else if (complete == 'complete') {
wx.showToast({
title: '添加成功',
icon: 'none',
duration: 2000,
})
wx.navigateBack({
delta: 1,
})
}
}
})
}
if (flag == true) {
wx.showToast({
title: warn,
icon: 'none'
})
}
},
//获取编辑保单接口
getlistVerify(id) {
let url = 'counselor/infordef'
let params = {
InfoId: this.data.inforid||id,
}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
var warranty_two = res.data.data.def.warranty_two
var unit = this.data.unit
unit = warranty_two.title
var long_money = res.data.data.def.long_money
var unit2 = this.data.unit2
unit2 = long_money.title
var type_money = res.data.data.def.type_money
var unit3 = this.data.unit3
unit3 = type_money
var beneficiary_list = res.data.data.def.favoree
for (var obj in beneficiary_list) {
beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
beneficiary_list[obj].name_array = this.data.insure
}
var risk_list = res.data.data.def.more
var projectlist = this.data.projectlist
for (var i = 0; i < risk_list.length; i++) {
for (var j = 0; j < projectlist.length; j++) {
for (var k = 0; k < projectlist[j].title.length; k++) {
if (risk_list[i].id == projectlist[j].id) {
if (risk_list[i].title == projectlist[j].title[k].name) {
var title = {}
title.name = projectlist[j].title[k]
}
}
}
}
}
}
})
}
if (flag == true) {
wx.showToast({
title: warn,
icon: 'none'
})
}
},
//获取编辑保单接口
getlistVerify(id) {
wx.setNavigationBarTitle({
title: '编辑保单',
})
let url = 'counselor/infordef'
let params = {
InfoId: this.data.inforid || id,
}
app.post(url, params).then((res) => {
if (res.data.code == 200) {
var warranty_two = res.data.data.def.warranty_two
var unit = this.data.unit
unit = warranty_two.title
var long_money = res.data.data.def.long_money
var unit2 = this.data.unit2
unit2 = long_money.title
var type_money = res.data.data.def.type_money
var unit3 = this.data.unit3
unit3 = type_money
var beneficiary_list = res.data.data.def.favoree
for (var obj in beneficiary_list) {
beneficiary_list[obj].beneficiary_name = beneficiary_list[obj].name
beneficiary_list[obj].name_array = this.data.insure
}
var risk_list = res.data.data.def.more
var projectlist = this.data.projectlist
for (var i = 0; i < risk_list.length; i++) {
for (var j = 0; j < projectlist.length; j++) {
for (var k = 0; k < projectlist[j].title.length; k++) {
if (risk_list[i].id == projectlist[j].id) {
if (risk_list[i].title == projectlist[j].title[k].name) {
var title = {}
title.name = projectlist[j].title[k]
}
var warranty_two = res.data.data.def.warranty_two
var guarantee_name = warranty_two.num
var long_money = res.data.data.def.long_money
var time_name = long_money.num
this.setData({
imgs: res.data.data.def.picurl,
type_money: res.data.data.def.type_money,
unit3: unit3,
year_money: res.data.data.def.year_money,
long_money: res.data.data.def.long_money,
unit2: unit2,
in_num: res.data.data.def.in_num,
firm: res.data.data.def.firm,
main_risks: res.data.data.def.main_risks,
main_array: res.data.data.def.guarantee,
applicant_name: res.data.data.def.applicant,
recognizee_name: res.data.data.def.recognizee,
warranty_one: res.data.data.def.warranty_one,
warranty_two: res.data.data.def.warranty_two,
unit: unit,
compact_time: res.data.data.def.compact_time,
impletion_time: res.data.data.def.impletion_time,
bank: res.data.data.def.bank,
bank_num: res.data.data.def.bank_num,
risk_list: risk_list,
beneficiary_list: beneficiary_list,
edit_state: true,
guarantee_name: guarantee_name,
time_name: time_name,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.ensureProjectList()
let that = this;
// this.setData({
// def_id: options.def_id,
// inforid: options.inforid,
// FamilyId: options.FamilyId,
// recognizee_name: options.name
// })
// if (options.inforid == undefined) {
// this.setData({
// inforid: 0
// })
// }
options.inforid ? (that.getlistVerify(options.inforid),that.setData({
inforid: options.inforid,
edit_state: true
})): ""
options.def_id ? that.setData({
def_id: options.def_id,
}) : ""
options.FamilyId ? (that.familyMember(options.FamilyId),that.setData({
FamilyId: options.FamilyId
})):'';
// if (options.FamilyId != '') {
// this.familyMember()
// }
// if (options.inforid != undefined) {
// this.getlistVerify()
// }
if (wx.getStorageSync('storge_state') && options.inforid == undefined) {
this.getStorage()
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
}
}
},
var warranty_two = res.data.data.def.warranty_two
var guarantee_name = warranty_two.num
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
var long_money = res.data.data.def.long_money
var time_name = long_money.num
}
})
\ No newline at end of file
this.setData({
imgs: res.data.data.def.picurl,
type_money: res.data.data.def.type_money,
unit3: unit3,
year_money: res.data.data.def.year_money,
long_money: res.data.data.def.long_money,
unit2: unit2,
in_num: res.data.data.def.in_num,
firm: res.data.data.def.firm,
main_risks: res.data.data.def.main_risks,
main_array: res.data.data.def.guarantee,
applicant_name: res.data.data.def.applicant,
recognizee_name: res.data.data.def.recognizee,
warranty_one: res.data.data.def.warranty_one,
warranty_two: res.data.data.def.warranty_two,
unit: unit,
compact_time: res.data.data.def.compact_time,
impletion_time: res.data.data.def.impletion_time,
bank: res.data.data.def.bank,
bank_num: res.data.data.def.bank_num,
risk_list: risk_list,
beneficiary_list: beneficiary_list,
edit_state: true,
guarantee_name: guarantee_name,
time_name: time_name,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.ensureProjectList()
let that = this;
// this.setData({
// def_id: options.def_id,
// inforid: options.inforid,
// FamilyId: options.FamilyId,
// recognizee_name: options.name
// })
// if (options.inforid == undefined) {
// this.setData({
// inforid: 0
// })
// }
options.inforid ? (that.getlistVerify(options.inforid), that.setData({
inforid: options.inforid,
edit_state: true
})) : ""
options.def_id ? that.setData({
def_id: options.def_id,
}) : ""
options.FamilyId ? (that.familyMember(options.FamilyId), that.setData({
FamilyId: options.FamilyId
})) : '';
// if (options.FamilyId != '') {
// this.familyMember()
// }
// if (options.inforid != undefined) {
// this.getlistVerify()
// }
if (wx.getStorageSync('storge_state') && options.inforid == undefined) {
this.getStorage()
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
... ... @@ -35,18 +35,18 @@
<view class='list_title'>主险名称</view>
<view class='list_input'>{{listdetail.main_risks}}</view>
</view>
<view class='item_list' style=' align-items: flex-start;'>
<!-- <view class='item_list' style=' align-items: flex-start;'>
<view class='list_title'>主险保障项</view>
<view class='list_input' wx:for='{{listdetail.guarantee}}' wx:key wx:for-item='its'>{{its.name}} {{its.num}}{{its.title}} </view>
</view>
</view> -->
<view class='item_list'>
<view class='list_title'>合同生效日</view>
<view class='list_input'>{{listdetail.compact_time}}</view>
</view>
<view class='item_list'>
<!-- <view class='item_list'>
<view class='list_title'>期满日</view>
<view class='list_input'>{{listdetail.impletion_time}}</view>
</view>
</view> -->
<view class='item_list'>
<view class='list_title'>年缴保费</view>
<view class='list_input'>{{listdetail.year_money}}</view>
... ... @@ -56,7 +56,7 @@
<view class='list_input'>{{listdetail.warranty_two.num}}{{listdetail.warranty_two.title}}</view>
</view>
<view class='item_list'>
<view class='list_title'>续费时长</view>
<view class='list_title'>缴费期</view>
<view class='list_input'>{{listdetail.long_money.num}}{{listdetail.long_money.title}}</view>
</view>
<view class='item_list'>
... ... @@ -75,18 +75,25 @@
<view class='list_title'>缴费期满日</view>
<view class='list_input'>{{listdetail.impletion_time}}</view>
</view>
<view class='item_list'>
<!-- <view class='item_list'>
<view class='list_title'>主险保障期</view>
<view class='list_input'>{{listdetail.warranty_one}}</view>
</view>
</view> -->
<view class='item_list' style=' align-items: flex-start;'>
<view class='list_title'>附加险名称 </view>
<view class='list_input' wx:for='{{listdetail.more}}' wx:key>
<view>{{item.name}}</view>
<view wx:for='{{item.mo}}' wx:key wx:for-item='its'>{{its.name}} {{its.num}}{{its.title}}</view>
<view class='item_list ' style='display:block;' wx:for='{{listdetail.more}}' wx:key>
<!-- <text class='list_input'> -->
<view>
<text class='list_title' style='margin-right:20rpx;'>附加险名称 </text>
<text>{{item.name}}</text>
</view>
<view>
<text class='list_title' style='margin-right:50rpx;'>保障项目 </text>
<text wx:for='{{item.mo}}' wx:key wx:for-item='its'>
<text style='margin-right:30rpx;'>{{its.name}} {{its.num}}{{its.title}}</text></text>
</view>
<!-- </text> -->
</view>
</view>
... ...
... ... @@ -306,7 +306,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
console.log(options)
if (options.status) {
this.setData({
status: options.status,
... ...
... ... @@ -13,7 +13,7 @@
"compileType": "miniprogram",
"libVersion": "2.4.0",
"appid": "wxac365079a43a66bb",
"projectname": "%E5%AE%B6%E5%BA%AD%E4%BF%9D%E9%99%A92",
"projectname": "%E5%AE%B6%E5%BA%AD%E4%BF%9D%E9%99%A9",
"debugOptions": {
"hidedInDevtools": []
},
... ... @@ -36,7 +36,7 @@
"list": []
},
"miniprogram": {
"current": 9,
"current": 10,
"list": [
{
"id": -1,
... ... @@ -95,7 +95,14 @@
{
"id": -1,
"name": "aa",
"pathName": "pages/index/inviteList/inviteList"
"pathName": "pages/index/inviteList/inviteList",
"query": ""
},
{
"id": -1,
"name": "aaf",
"pathName": "pages/index/policyListDetail/policyListDetail",
"query": "InId=25"
}
]
}
... ...