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/ajax-bd-info.php

274 lines
12 KiB

5 years ago
<form id="nonform">
<input type="hidden" name="id" value="<?=$info?$info->id:''?>">
<input type="hidden" name="order_id" value="<?=$order_info?$order_info->id:''?>">
<input type="hidden" name="fixId" value="<?=$fixId?>">
<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>
<!-- 为空的状态-->
<!-- 为14的状态-->
<?php if(($order_info && $order_info->status_id==14) || $order_info==''):?>
<tr>
<td height="22" colspan="6" align="center" class="td_bg">
<input type=button class="ACT_btn non-baocun" name="next-btn" value=" 保存 "/>
<input type=button class="ACT_btn non-submit-btn" name=Submit2 value=" 提交 "/>
<!-- <input type="button" class="ACT_btn back-btn" name="Submit3" value=" 返回 ">-->
</td>
</tr>
<?php endif;?>
</table>
</form>
<div id="non_list"></div>
<script type="text/javascript" language="javascript">
function repl(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 SaveOrderNon(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 = $('#nonform').serialize();
params = params + '&status_id=' + status_id;
$.post('/non-auto-insurance/ajax-bd-save',params,function(obj){
if(obj.success) {
if(status_id > 14) {
// $('.back-btn').click();
alert('进入非车险核保');
window.location.reload();
}else{
alert(obj.msg);
gotoPage('/non-auto-insurance/ajax-bd-info?id=' + obj.id + '&ordid='+obj.ordid+ '&fixId='+<?=$fixId?>,'non_info');
// 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')
})
//提交
$('.non-submit-btn').click(function(){
if(confirm('是否提交此保单?')) {
SaveOrderNon(15);
}
});
//返回
// $('.back-btn').click(function(){
// window.location.href = '/non-auto-insurance/bd-index';
// });
//下一个
//保存
$(".non-baocun").click(function(){
SaveOrderNon(14);
});
});
</script>