You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/frontend/views/non-auto-insurance/add-bd-info.php

422 lines
20 KiB

5 years ago
<?php
use \common\libs\MyLib;
use \common\models\PriceT;
$my = $this->context->my;
?>
<link href="/css/tabs.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript" src="/js/common2.js"></script>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<tr>
<td height="22" colspan="2" class="td_bg">
<table width="100%" align="center" height="120" border="0" cellpadding="0" cellspacing="0" id="mainTable">
<tr>
<td height="120" valign="top" class="td_bg">
<!--预约信息-->
<table>
<tbody>
<tr>
<TD height="30" align="center" class=tab-on id=navcell onclick=open_up(1) name="navcell">▼非车险信息</TD>
</tr>
</tbody>
</table>
<TABLE id=tb1 cellSpacing=1 cellPadding=0 width="100%" border=0 name="tb">
<TR>
<TD vAlign=top>
<form id="myform">
<input type="hidden" name="id" value="<?=$info?$info->id:''?>">
<input type="hidden" name="order_id" value="<?=$order_info?$order_info->id:''?>">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" style="table-layout: fixed;">
<tr>
<td width="100" height="25" class="bg_tr">被保险人姓名</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->insurant_name:''?>" name="insurant_name" class="insurant_name"/></td>
<td width="100" height="25" class="bg_tr">证件号</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->insurant_number:''?>" name="insurant_number" class="insurant_number"/></td>
<td width="100" height="25" class="bg_tr">电话 <span class="insurantPo">[+]</span></td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->insurant_phone:''?>" name="insurant_phone" class="insurant_phone"/><span class="insurantPo_ad"><?php if($info &&$info->insurant_phone1): ?><input type="text" value="<?=$info->insurant_phone1?>" name="insurant_phone1" class="insurant_phone1"/><?php endif;?></span></td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">投保人姓名</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->policy_holder_name:''?>" name="policy_holder_name" class="policy_holder_name"/></td>
<td width="100" height="25" class="bg_tr">证件号</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->policy_holder_number:''?>" name="policy_holder_number" class="policy_holder_number"/></td>
<td width="100" height="25" class="bg_tr">电话<span class="policyPo">[+]</span></td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->policy_holder_phone:''?>" name="policy_holder_phone" class="policy_holder_phone"/><span class="policyPo_ad"><?php if($info &&$info->policy_holder_phone1): ?><input type="text" value="<?=$info->policy_holder_phone1?>" name="policy_holder_phone1" class="policy_holder_phone1"/><?php endif;?></span></td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">受益人姓名</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->beneficiary_name:''?>" name="beneficiary_name" class="beneficiary_name"/></td>
<td width="100" height="25" class="bg_tr">证件号</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->beneficiary_number:''?>" name="beneficiary_number" class="beneficiary_number"/></td>
<td width="100" height="25" class="bg_tr">电话<span class="beneficiaryPo">[+]</span></td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->beneficiary_phone:''?>" name="beneficiary_phone" class="beneficiary_phone"/><span class="beneficiaryPo_ad"><?php if($info &&$info->insurant_phone1): ?><input type="text" value="<?=$info->beneficiary_phone1?>" name="beneficiary_phone1" class="beneficiary_phone1"/><?php endif;?></span></td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">产品方案</td>
<td height="25" class="td_bg">
<select name="scheme_id" id="scheme_id">
<option value="">请选择</option>
<?php foreach($scheme_items as $item) {?>
<option value="<?=$item->id?>" <?php if($info){if($item->id==$info->scheme_id) echo 'selected';}?>><?=$item->name?></option>
<?php }?>
</select>
</td>
<td width="100" height="25" class="bg_tr">总保额</td>
<td height="25" class="td_bg baoer"></td>
<td width="100" height="25" class="bg_tr">保险费用</td>
<td height="25" class="td_bg feiyong"></td>
</tr>
<tr>
<td width="100" height="25" class="bg_tr">起保日期</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->insurer_date_start:''?>" name="insurer_date_start" onClick="WdatePicker()" class="insurer_date_start"/></td>
<td width="100" height="25" class="bg_tr">投保份数</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->num:''?>" name="num" class="num"/></td>
<td width="100" height="25" class="bg_tr">座位数</td>
<td height="25" class="td_bg"><input type="text" value="<?=$info?$info->seat:''?>" name="seat"/></td>
</tr>
<tr>
<td height="22" colspan="6" align="center" class="td_bg">
<input type=button class="ACT_btn baocun" name="next-btn" value=" 保存 "/>
<input type=button class="ACT_btn submit-btn" name=Submit2 value=" 提交 "/>
<input type="button" class="ACT_btn back-btn" name="Submit3" value=" 返回 ">
</td>
</tr>
</table>
</form>
</TD>
</TR>
</TABLE>
<div id="non_list"></div>
<!--保单信息-->
<table>
<tbody>
<tr>
<TD height="30" align="center" class=tab-off id=navcell onclick=open_up(2) name="navcell">▲核保信息</TD>
</tr>
</tbody>
</table>
<TABLE id=tb2 cellSpacing=1 cellPadding=0 width="100%" border=0 name="tb" class="hide-table">
<TR>
<TD vAlign=top>
<form id="orderFrm">
<table width="98%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>
</form>
</TD>
</TR>
<tr>
<td align="center">
<!-- <input type=button class="ACT_btn save-btn" name=Submit1 value=" 保存 "/>-->
<!---->
<!-- <input type=button class="ACT_btn submit-btn" name=Submit2 value=" 提交 "/>-->
<!-- <input type=button class="ACT_btn next-btn" name=Submit5 value=" 下一个 "/>-->
<!-- <input type="button" class="ACT_btn back-btn" name="Submit3" value=" 返回 ">-->
</td>
</tr>
</TABLE>
<!--操作记录-->
<table>
<tbody>
<tr>
<TD height="30" align="center" class=tab-off id=navcell onclick=open_up(3) name="navcell">▲操作记录</TD>
</tr>
</tbody>
</table>
<TABLE id=tb3 cellSpacing=1 cellPadding=0 width="100%" border=0 name="tb" class="hide-table">
<TR>
<TD vAlign=top>
<div id="car_history_list"></div>
</TD>
</TR>
<tr>
<td align="center">
<!-- <input type=button class="ACT_btn next-btn" name=Submit5 value=" 下一个 "/>-->
<!-- <input type="button" class="ACT_btn back-btn" name="Submit3" value=" 返回 ">-->
</td>
</tr>
</TABLE>
<!--历史保单-->
</td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
function repl(obj){
// console.log(obj);
var insurant_number =$('.dst'+obj+' .bs2').html()
var insurant_phone =$('.dst'+obj+' .bs3').html()
var policy_holder_name =$('.dst'+obj+' .bs4').html()
var policy_holder_number =$('.dst'+obj+' .bs5').html()
var policy_holder_phone =$('.dst'+obj+' .bs6').html()
var beneficiary_name =$('.dst'+obj+' .bs7').html()
var beneficiary_number =$('.dst'+obj+' .bs8').html()
var beneficiary_phone =$('.dst'+obj+' .bs9').html()
$('.insurant_number').val(insurant_number)
$('.insurant_phone').val(insurant_phone)
$('.policy_holder_name').val(policy_holder_name)
$('.policy_holder_number').val(policy_holder_number)
$('.policy_holder_phone').val(policy_holder_phone)
$('.beneficiary_name').val(beneficiary_name)
$('.beneficiary_number').val(beneficiary_number)
$('.beneficiary_phone').val(beneficiary_phone)
// $.post('/non-auto-insurance/ajax-non-index',{id:id},function(obj){
// if(obj.success) {
////
//
//
// }else{
// $('#non_list').html('');
//// $('.baoer').html('');
//// $('.feiyong').html('');
// }
// },'json')
}
//报价计算
function calc() {
var total1_clear = Number($('#total1_clear').val());
var total1 = Number($('#total1').val());
var total2_clear = Number($('#total2_clear').val());
var total2 = Number($('#total2').val());
var total3 = Number($('#total3').val());
var total1_real = Number($('#total1_real').val());
var total1_dis = Number($('#total1_dis').val());
var total1_percent = Number($('#total1_percent').val());
var total_all = Number($('#total_all').val());
var total_real = Number($('#total_real').val());
total1 = 1.06 * total1_clear;
total2 = 1.06 * total2_clear;
total_all = total1 + total2 + total3;
total1_dis = total1_clear - total1_real;
total_real = total_all - total1_dis;
total1_percent = parseFloat(total1_real/total1_clear);
$('#total1').val(total1.toFixed(2));
$('#total2').val(total2.toFixed(2));
$('#total1_dis').val(total1_dis.toFixed(2));
$('#total1_percent').val(total1_percent.toFixed(2));
$('#total_all').val(total_all.toFixed(2));
$('#total_real').val(total_real.toFixed(2));
}
//保单处理
function SaveOrder(status_id) {
var insurant_name=$('.insurant_name').val()
var insurant_number=$('.insurant_number').val()
var insurant_phone=$('.insurant_phone').val()
var policy_holder_name=$('.policy_holder_name').val()
var policy_holder_number=$('.policy_holder_number').val()
var policy_holder_phone=$('.policy_holder_phone').val()
var beneficiary_name=$('.beneficiary_name').val()
var beneficiary_number=$('.beneficiary_number').val()
var beneficiary_phone=$('.beneficiary_phone').val()
var scheme_id=$('#scheme_id').val()
var insurer_date_start=$('.insurer_date_start').val()
var num=$('.num').val()
if(isNull(insurant_name && insurant_number && insurant_phone)){
alert('被保险人相关信息必填项!');
return false;
}
if(isNull(policy_holder_name && policy_holder_number && policy_holder_phone)){
alert('投保人相关信息必填项!');
return false;
}
if(isNull(beneficiary_name && beneficiary_number && beneficiary_phone)){
alert('受益人相关信息必填项!');
return false;
}
if(isNull(scheme_id)){
alert('产品方案必填项!');
return false;
}
if(isNull(insurer_date_start)){
alert('起保日期必填项!');
return false;
}
if(isNull(num)){
alert('投保份数必填项!');
return false;
}
var params = $('#myform').serialize();
params = params + '&status_id=' + status_id;
$.post('/non-auto-insurance/add-bd-save',params,function(obj){
if(obj.success) {
if(status_id > 14) {
$('.back-btn').click();
}else{
alert(obj.msg);
// window.location.href = '/non-auto-insurance/add-bd-info?id=' + obj.id + '&ordid='+obj.ordid;
}
} else {
alert(obj.msg);
}
},'json');
}
//判断是否填写了选项
function isNull(data){
if(data == "" || data == undefined || data == null){
return true;
}else{
return false;
}
}
function get_category(id){
$.post('/scheme/chaxun',{id:id},function(obj){
if(obj.success) {
$('.baoer').html(obj.info.baoer);
$('.feiyong').html(obj.info.baofei);
}else{
$('.baoer').html('');
$('.feiyong').html('');
}
},'json')
}
$(function(){
get_category(<?=$info?$info->scheme_id:''?>);
$(document).on("change",'#scheme_id',function(){
get_category($(this).val());
})
$('.insurantPo').click(function(){
var ht='<input type="text" value="" name="insurant_phone1" class="insurant_phone1"/>'
$('.insurantPo_ad').html(ht);
})
$('.policyPo').click(function(){
var ht='<input type="text" value="" name="policy_holder_phone1" class="policy_holder_phone1"/>'
$('.policyPo_ad').html(ht);
})
$('.beneficiaryPo').click(function(){
var ht='<input type="text" value="" name="beneficiary_phone1" class="beneficiary_phone1"/>'
$('.beneficiaryPo_ad').html(ht);
})
$('.insurant_name').blur(function(){
// alert($(this).val())
var in_name=$(this).val();
$.post('/non-auto-insurance/ajax-non-index',{in_name:in_name},function(obj){
if(obj.success) {
// $('.insurant_number').val(obj.result.insurant_number)
// $('.insurant_phone').val(obj.result.insurant_phone)
// $('.policy_holder_name').val(obj.result.policy_holder_name)
// $('.policy_holder_number').val(obj.result.policy_holder_number)
// $('.policy_holder_phone').val(obj.result.policy_holder_phone)
// $('.beneficiary_name').val(obj.result.beneficiary_name)
// $('.beneficiary_number').val(obj.result.beneficiary_number)
// $('.beneficiary_phone').val(obj.result.beneficiary_phone)
$('#non_list').html(obj.html);
}else{
$('#non_list').html('');
// $('.baoer').html('');
// $('.feiyong').html('');
}
},'json')
})
//操作历史
gotoPage('/non-auto-insurance/ajax-history-index?non_id=<?=$info?$info->id:''?>&page=1&t='+Math.random(),'car_history_list');
//添加自费礼品
//添加联系人
// $('.add-linkman-btn').click(function(){
// if(confirm('是否确认提交?')) {
// var params = $("#linkmanFrm").serialize();
// $.post('/car/linkman-save',params,function(obj){
// alert(obj.msg);
// if(obj.success) {
// $('#linkmanFrm')[0].reset();
// gotoPage('/car/ajax-linkman-index?car_id=<?//=$car_info->id?>//&t='+Math.random(),'linkman_list');
// }
// },'json');
// }
// });
//提交
$('.submit-btn').click(function(){
if(confirm('是否提交此保单?')) {
SaveOrder(15);
}
});
//返回
// $('.back-btn').click(function(){
// window.location.href = '/non-auto-insurance/bd-index';
// });
$('.back-btn').click(function(){
<?php
$url = '';
$return=isset($_GET['returnType'])?$_GET['returnType']:0;
if($return == 1){
$url = '/insurer/non-my-return-list';
}else{
$url = '/non-auto-insurance/bd-index';
}
echo 'window.location.href = "'.$url.'"';
?>
});
//下一个
//保存
$(".baocun").click(function(){
SaveOrder(14);
});
});
</script>