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/car/order-add.php

457 lines
25 KiB

<?php
use \common\libs\MyLib;
use common\models\PriceT;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<form class="form-horizontal" id="orderFrm">
<input type="hidden" name="car_id" value="<?=$order_info->car_id?>">
<input type="hidden" name="id" value="<?=$order_info->id?>">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>险种</h5>
</div>
<div class="ibox-content">
<table class="table table-bordered">
<tr>
<?php
$len = count($insurer_type_items);
for($i = 0; $i < $len; $i++) {
$item = $insurer_type_items[$i];
$order_id = $order_info->id;
if(!$order_id)
$order_id = 0;
$tmp_row = PriceT::find()
->where('order_id='.$order_id.' and type_id='.$item->id)
->one();
?>
<th class="bg-warning">
<?=$item->name?>(<?=$item->code?>)
</th>
<td>
<?php
if($item->content != '') {
$tmp_items = explode(',',$item->content);
echo '<select name="types['.$item->id.']" class="form-control">';
$tmp_items = explode(',',$item->content);
foreach($tmp_items as $tmp_item) {
echo '<option';
if(!empty($tmp_row) && $tmp_row->val == $tmp_item)
echo ' selected ';
echo '>'.$tmp_item.'</option>';
}
echo '</select>';
} else {
echo '<input name="types['.$item->id.']" class="form-control" style="width:100px;" type="text"';
if(!empty($tmp_row))
echo ' value="'.$tmp_row->val.'" ';
echo '>';
}
?>
</td>
<td>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="nopays[<?=$item->id?>]" id="nopays_<?=$item->id?>" value="1" <?=(!empty($tmp_row) && $tmp_row->is_nopay == 1)?'checked':''?>>
<label for="nopays_<?=$item->id?>"> 不计免赔 </label>
</div>
</td>
<?php
if(($i+1)%3==0) {
echo '</tr>';
echo '<tr>';
}
}
?>
</tr>
</table>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>保费信息</h5>
</div>
<div class="ibox-content">
<table class="table table-bordered">
<tr>
<th class="bg-warning">商业总净保费</th>
<td><input name="total1_clear" id="total1_clear" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total1_clear?>"></td>
<th class="bg-warning">商业含税总保费</th>
<td><input name="total1" id="total1" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total1?>"></td>
<th class="bg-warning">车船税</th>
<td><input name="total3" id="total3" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total3?>"></td>
</tr>
<tr>
<th class="bg-warning">交强总净保费</th>
<td><input name="total2_clear" id="total2_clear" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total2_clear?>"></td>
<th class="bg-warning">交强含税总保费</th>
<td><input name="total2" id="total2" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total2?>"></td>
<th class="bg-warning">&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th class="bg-warning">折扣后商业净保费</th>
<td><input name="total1_real" id="total1_real" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total1_real?>"></td>
<th class="bg-warning">减免金额</th>
<td><input name="total1_dis" id="total1_dis" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total1_dis?>"></td>
<th class="bg-warning">商业折扣率</th>
<td><input name="total1_percent" id="total1_percent" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total1_percent?>"></td>
</tr>
<tr>
<th class="bg-warning">共计签单</th>
<td><input name="total_all" id="total_all" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total_all?>"></td>
<th class="bg-warning">应收</th>
<td><input name="total_real" id="total_real" class="form-control" style="width:120px;" type="text" value="<?=$order_info->total_real?>"></td>
<th class="bg-warning">&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th class="bg-warning">备注</th>
<td colspan="5"><input name="price_remark" id="price_remark" class="form-control" style="width:100%;" type="text" value="<?=$order_info->price_remark?>"></td>
</tr>
<tr>
<th class="bg-warning">短信</th>
<td colspan="5">
<div class="row">
<div class="col-sm-12">
<textarea name="sms-msg" id="sms-msg" class="form-control"></textarea>
</div>
</div>
<div class="row" style="margin-top: 8px;">
<div class="col-sm-12 form-inline">
<label>手机号码</label>
<input type="text" name="sms-tel" id="sms-tel" class="form-control">
<button type="button" class="btn btn-primary sms-make-btn">生成短信</button>
<button type="button" class="btn btn-danger sms-send-btn">发送短信</button>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>订单信息</h5>
</div>
<div class="ibox-content">
<table class="table table-bordered">
<tr>
<th class="bg-warning">车牌号</th>
<td><input name="car_no" class="form-control" style="width:100%;" type="text" value="<?=$order_info->car_no!='' ? $order_info->car_no:$car_info->car_no?>"></td>
<th class="bg-warning" nowrap>初登日期</th>
<td><input name="register_date" class="form-control" style="width:100%;" type="text" value="<?=$car_info->register_date?>"></td>
<th class="bg-warning" nowrap>座位数</th>
<td><input name="seats" class="form-control" style="width:100%;" type="text" value="<?=$order_info->seats ? $order_info->seats:$car_info->seats?>"></td>
<th class="bg-warning" nowrap>电子邮件</th>
<td><input name="email" class="form-control" style="width:100%;" type="text" value="<?=$order_info->email?>"></td>
</tr>
<tr>
<th class="bg-warning">车主</th>
<td><input name="car_man" class="form-control" style="width:100%;" type="text" value="<?=$order_info->car_man!='' ? $order_info->car_man:$car_info->car_man?>"></td>
<th class="bg-warning">证件类型</th>
<td>
<select name="car_man_type" class="form-control">
<option value="身份证">身份证</option>
<option value="营业执照">营业执照</option>
</select>
</td>
<th class="bg-warning" nowrap>证件号码</th>
<td><input name="car_man_number" class="form-control" style="width:100%;" type="text" value="<?=$order_info->car_man_number!='' ? $order_info->car_man_number:$car_info->car_man_number?>"></td>
<th class="bg-warning">联系电话</th>
<td><input name="car_man_phone" class="form-control" style="width:100%;" type="text" value="<?=$order_info->car_man_phone!='' ? $order_info->car_man_phone:$car_info->phone?>"></td>
</tr>
<tr>
<th class="bg-warning">被保险人</th>
<td><input name="id_man" class="form-control" style="width:100%;" type="text" value="<?=$order_info->id_man!='' ? $order_info->id_man:$car_info->id_man?>"></td>
<th class="bg-warning">证件类型</th>
<td>
<select name="id_man_type" class="form-control">
<option value="身份证">身份证</option>
<option value="营业执照">营业执照</option>
</select>
</td>
<th class="bg-warning">证件号码</th>
<td><input name="id_man_number" class="form-control" style="width:100%;" type="text" value="<?=$order_info->id_man_number!='' ? $order_info->id_man_number:$car_info->id_number?>"></td>
<th class="bg-warning">联系电话</th>
<td><input name="id_man_phone" class="form-control" style="width:100%;" type="text" value="<?=$order_info->id_man_phone!='' ? $order_info->id_man_phone:$car_info->id_phone?>"></td>
</tr>
<tr>
<th class="bg-warning">投保人</th>
<td><input name="link_man" class="form-control" style="width:100%;" type="text" value="<?=$order_info->link_man!='' ? $order_info->link_man:''?>"></td>
<th class="bg-warning">证件类型</th>
<td>
<select name="link_man_type" class="form-control">
<option value="身份证">身份证</option>
<option value="营业执照">营业执照</option>
</select>
</td>
<th class="bg-warning">证件号码</th>
<td><input name="link_man_number" class="form-control" style="width:100%;" type="text" value="<?=$order_info->link_man_number!='' ? $order_info->link_man_number:''?>"></td>
<th class="bg-warning">联系电话</th>
<td><input name="link_man_phone" class="form-control" style="width:100%;" type="text" value="<?=$order_info->link_man_phone!='' ? $order_info->link_man_phone:''?>"></td>
</tr>
<tr>
<th class="bg-warning" nowrap>商业起保日期</th>
<td>
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" name="insurer1_begin_date" class="form-control" value="<?=$order_info->insurer1_begin_date?>">
</div>
</td>
<th class="bg-warning" nowrap>交强起保日期</th>
<td>
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" name="insurer2_begin_date" class="form-control" value="<?=$order_info->insurer2_begin_date?>">
</div>
</td>
<th class="bg-warning">保险公司</th>
<td>
<select name="company2_id" id="company2_id" class="form-control">
<option value="0">---请选择---</option>
<?php
foreach($insurer_company2_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $order_info->company2_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</td>
<th class="bg-warning">付款方式</th>
<td class="form-inline" nowrap>
<select name="shoufei_id" id="shoufei_id" class="form-control">
<option value="">收费方式</option>
<option value="1">上门收费</option>
<option value="2">在线支付</option>
<option value="3">客户自上门</option>
</select>
<select name="pay_type_id" id="pay_type_id" class="form-control">
<option value="">请选择</option>
<?php
foreach($pay_type_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $order_info->pay_type_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<th class="bg-warning">领款人</th>
<td><input name="money_man" class="form-control" style="width:100%;" type="text" value="<?=$order_info->money_man?>"></td>
<th class="bg-warning">开户行</th>
<td><input name="money_bank" class="form-control" style="width:100%;" type="text" value="<?=$order_info->money_bank?>"></td>
<th class="bg-warning">银行账号</th>
<td><input name="money_no" class="form-control" style="width:100%;" type="text" value="<?=$order_info->money_no?>"></td>
<th class="bg-warning" nowrap>成功理由</th>
<td>
<select name="success_id" id="success_id" class="form-control">
<option value="0">---请选择---</option>
<?php
foreach($success_items as $item) {
echo '<option value="'.$item->id.'"';
if($order_info->success_id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<th class="bg-warning" nowrap>送单日期</th>
<td>
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" name="send_date" class="form-control" value="<?=$order_info->send_date?>">
</div>
</td>
<th class="bg-warning">送单地址</th>
<td colspan="5" class="form-inline">
<select name="send_city_id" class="form-control">
<option value="0">选择城市</option>
<?php
foreach($city_items as $item) {
echo '<option value="'.$item->id.'"';
if($order_info->send_city_id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
<select name="send_district_id" class="form-control">
<option value="0">选择区县</option>
<?php
foreach($district_items as $item) {
echo '<option value="'.$item->id.'"';
if($order_info->send_district_id == $item->id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
<input type="text" name="send_address" class="form-control" style="width:70%;" value="<?=$order_info->send_address?>">
</td>
</tr>
<tr>
<th class="bg-warning">备注</th>
<td colspan="7"><input name="order_remark" class="form-control" style="width:100%;" type="text" value="<?=$order_info->remark?>"></td>
</tr>
</table>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button type="button" class="btn btn-primary btn-save" type="button">
<strong>保 存</strong>
</button>
<button type="button" class="btn btn-primary btn-submit" type="button">
<strong>提 交</strong>
</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script>
var o = {};
//判断是否填写了选项
function isNull(data){
if(data == "" || data == undefined || data == null){
return true;
}else{
return false;
}
}
//报价计算
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 params = $('#orderFrm').serialize();
params = params + '&status_id=' + status_id;
$.post('/car/order-save',params,function(obj){
parent.layer.msg(obj.msg);
if(obj.success && status_id>1) {
layer_close();
}
},'json');
}
$(function() {
$('#total1_clear').blur(function(){
calc();
refreshCompanyGift();
});
$('#total2_clear').blur(function(){
calc();
});
$('#total3').blur(function(){
calc();
});
$('#total1_dis').blur(function(){
calc();
});
$('#total1_real').blur(function(){
calc();
});
$('.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
calendarWeeks: true,
autoclose: true
});
//生成短信内容
$('.sms-make-btn').click(function(){
var params = $('#orderFrm').serialize();
var baoxiangs=$('#company2_id').val();
var smstel=$('#sms-tel').val();
if(isNull(smstel)){
parent.layer.msg('请填写电话号码');
return ;
}
if(baoxiangs==0){
parent.layer.msg('请选择保险公司');
return ;
}
$.post('/car/sms-make',params,function(obj){
if(obj.success) {
$('#sms-msg').val(obj.msg);
} else {
parent.layer.msg(obj.msg);
}
},'json');
});
//发送短信内容
$('.sms-send-btn').click(function(){
var tel = $('#sms-tel').val();
var msg = $('#sms-msg').val();
var baoxiangs=$('#company2_id').val();
var smstel=$('#sms-tel').val();
var smsmsg=$('#sms-msg').val();
if(smsmsg==''){
parent.layer.msg('短信内容不能为空,请生成短信');
return ;
}
if(isNull(smstel)){
parent.layer.msg('请填写电话号码');
return ;
}
if(baoxiangs==0){
parent.layer.msg('请选择保险公司');
return ;
}
// return;
$.post('/car/sms-send',{tel:tel,msg:msg,company2_id:baoxiangs},function(obj){
parent.layer.msg(obj.msg);
},'json');
});
$('.btn-save').click(function(){
saveOrder(1);
});
$('.btn-submit').click(function(){
saveOrder(2);
});
});
</script>
<?php $this->endBlock(); ?>