|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
<meta charset="UTF-8">
|
|
|
<title></title>
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
|
|
|
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
|
|
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
|
|
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
|
|
|
|
|
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
|
|
|
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
|
|
|
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
|
|
|
</head>
|
|
|
<style>
|
|
|
html {
|
|
|
min-width:100%;
|
|
|
}
|
|
|
body {
|
|
|
padding: 0px 0px 150px;
|
|
|
width: 960px;
|
|
|
margin: auto;
|
|
|
}
|
|
|
.tabcon1711 table{
|
|
|
width: 480px;
|
|
|
}
|
|
|
table{
|
|
|
|
|
|
margin: auto;
|
|
|
}
|
|
|
.hidebox{
|
|
|
display: none;
|
|
|
}
|
|
|
.r{
|
|
|
width: 300px;
|
|
|
}
|
|
|
.l{
|
|
|
width: 180px;
|
|
|
}
|
|
|
.select2-container--default .select2-selection--single {
|
|
|
color: #000;
|
|
|
resize: none;
|
|
|
border-width: 1px;
|
|
|
border-style: solid;
|
|
|
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
|
|
box-shadow: 0px 3px 3px #F7F8F9 inset;
|
|
|
height: 35px;
|
|
|
height: 28px;
|
|
|
border-radius: 3px;
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
|
|
|
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
|
|
line-height: 35px;
|
|
|
line-height: 28px;
|
|
|
}
|
|
|
|
|
|
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
|
|
height: 26px;
|
|
|
}
|
|
|
|
|
|
.select2-container--default .select2-search--dropdown .select2-search__field {
|
|
|
height: 26px;
|
|
|
line-height: 26px;
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
|
|
|
.select2-results__option[aria-selected] {
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
.input-list, .i_list {
|
|
|
float: left;
|
|
|
margin: 0;
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
<body>
|
|
|
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
|
|
|
海南万盟天下科技有限公司
|
|
|
</div> -->
|
|
|
<div style="display: flex;margin: auto;">
|
|
|
<div class="tab-content tabcon1711" id="firstPartBaseInfo">
|
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td class="l">甲方:</td>
|
|
|
<td class="r">
|
|
|
<div class="input-list input-list-game search_label_rehab">
|
|
|
<select id="first_partner_id" name="partner_id" class="select_gallery">
|
|
|
<option value="0" selected>海南万盟天下科技有限公司</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tbody id="first_part_bser_info_show">
|
|
|
<tr>
|
|
|
<td class="l">联系人:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="link_man" value="" placeholder="请输入联系人">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">联系电话:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="link_phone" value="" placeholder="请输入联系电话">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">邮寄地址:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="address" value="" placeholder="请输入地址">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">公司税号:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="company_tax_no" value="" placeholder="请输入公司税号">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="tab-content tabcon1711" id="secondPartBaseInfo">
|
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td class="l">乙方:</td>
|
|
|
<td class="r">
|
|
|
<div class="input-list input-list-game search_label_rehab">
|
|
|
<select id="second_partner_id" name="partner_id" class="select_gallery">
|
|
|
<option value="">请选择合作公司</option>
|
|
|
|
|
|
<volist name=":getPartner()" id="vo">
|
|
|
<option partner-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option>
|
|
|
</volist>
|
|
|
</select>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tbody id="second_part_bser_info_show">
|
|
|
<tr>
|
|
|
<td class="l">联系人:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="link_man" value="" disabled="disabled" placeholder="请先选择合作公司">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">联系电话:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="link_phone" value="" disabled="disabled" placeholder="请先选择合作公司">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">邮寄地址:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="address" value="" disabled="disabled" placeholder="请先选择合作公司">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">公司税号:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="company_tax_no" value="" disabled="disabled" placeholder="请先选择合作公司">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="padding: 30px 0px 10px;display: block;height:30px;">
|
|
|
<div class="input-list input-list-server search_label_rehab">
|
|
|
<p style="font-size: 20px;font-weight: 600;">支付给:</p>
|
|
|
</div>
|
|
|
<div class="input-list input-list-server search_label_rehab" style="margin-left: 20px;">
|
|
|
<select id="statement_type" name="statement_type" class="select_gallery" style="width: 215px;">
|
|
|
<option value="">请选择合作公司</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="search_list" style="display: block;line-height: 30px;height: 10px;">
|
|
|
<div class="input-list input-list-server search_label_rehab">
|
|
|
<p>请选择需要生成结算订单的月份:</p>
|
|
|
</div>
|
|
|
<div class="input-list" style="margin-left: 20px;">
|
|
|
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}"
|
|
|
placeholder="开始时间" />
|
|
|
-
|
|
|
<div class="input-append date" id="datetimepicker" style="display:inline-block">
|
|
|
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}"
|
|
|
placeholder="结束时间" />
|
|
|
<span class="add-on"><i class="icon-th"></i></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="input-list" style="margin-left: 30px;">
|
|
|
<a class="sch-btn" href="javascript:;" id="getSpendStatement" style="width: 100px;">生成</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="font-size: 12px;color:#777;">仅当选择时间为每月的1号至当月的最后一天才满足月结梯度分成比例,否则默认比例为最低分成比例。</div>
|
|
|
<div class="data_list box_mt" style="margin-top: 10px;">
|
|
|
<div class="">
|
|
|
<table>
|
|
|
<!-- 表头 -->
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th rowspan="2" style="border-right: solid 1px #b6cad2;">结算时间</th>
|
|
|
<th rowspan="2" style="border-right: solid 1px #b6cad2;">产品</th>
|
|
|
<th rowspan="2" style="border-right: solid 1px #b6cad2;">平台总额</th>
|
|
|
<th colspan=2 style="border-right: solid 1px #b6cad2;">分成比例</th>
|
|
|
|
|
|
<th rowspan="2" style="border-right: solid 1px #b6cad2;">渠道费率</th>
|
|
|
<th rowspan="2" style="border-right: solid 1px #b6cad2;">税费费率</th>
|
|
|
|
|
|
<th >结算金额</th>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th style="border-right: solid 1px #b6cad2;min-width: 50px;">甲方</th>
|
|
|
<th style="min-width: 50px;">乙方</th>
|
|
|
<th style="font-size: 10px;font-weight: 400;max-width: 100px;line-height: 1.2;">结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率)</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
<tbody id="statementInit" class="">
|
|
|
<tr style="height: 100px;">
|
|
|
<td colspan=8>
|
|
|
请先选择生成条件后点击生成对账数据
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
|
|
|
<tbody id="statementShow">
|
|
|
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div id="partpatinfo" style="display: flex;margin: auto;">
|
|
|
<div class="tab-content tabcon1711" id="skf_payinfo">
|
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td class="l">收款方名称:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="" disabled="disabled" placeholder="请先选择支付给谁" value="">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">银行账号:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">开户行:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="password" value="" disabled="disabled" placeholder="请先选择支付给谁">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="tab-content tabcon1711" id="fkf_payinfo">
|
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td class="l">付款方名称:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">银行账号:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="password" value="" disabled="disabled" placeholder="请先选择支付给谁">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">开户行:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt" name="" value="" disabled="disabled" placeholder="请先选择支付给谁">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="search_list" style="display: flex;justify-content:flex-end;width:960px;">
|
|
|
<div class="input-list" style="margin-left: 30px;float: right;">
|
|
|
<a class="sch-btn" href="javascript:;" id="createStatement" style="width: 150px;">生成对账单</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script type="text/html" id="partbasetpl">
|
|
|
<tr>
|
|
|
<td class="l">联系人:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" data-change="${type}.link_man" name="link_man" value="${link_man|nonull}" placeholder="请输入联系人">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">联系电话:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" name="link_phone" data-change="${type}.link_phone" value="${link_phone|nonull}" placeholder="请输入联系电话">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">邮寄地址:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" name="address" data-change="${type}.address" value="${address|nonull}" placeholder="请输入地址">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">公司税号:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" name="company_tax_no" data-change="${type}.company_tax_no" value="${company_tax_no|nonull}" placeholder="请输入公司税号">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</script>
|
|
|
<script type="text/html" id="partpaytpl">
|
|
|
<div class="tab-content tabcon1711" id="skf_payinfo">
|
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td class="l">收款方名称:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" placeholder="请输入收款方名称" data-change="${'skf'|setChange}.payee_name" name="payee_name" value="${skfdata.payee_name|nonull}">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">银行账号:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" placeholder="请输入银行账号" name="bank_account" data-change="${'skf'|setChange}.bank_account" value="${skfdata.bank_account|nonull}">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">开户行:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" placeholder="请输入开户行" data-change="${'skf'|setChange}.opening_bank" value="${skfdata.opening_bank|nonull}" name="opening_bank">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="tab-content tabcon1711" id="fkf_payinfo">
|
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td class="l">付款方名称:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" placeholder="请输入付款方名称" data-change="${'fkf'|setChange}.payee_name" name="payee_name" value="${fkfdata.payee_name|nonull}">
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">银行账号:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" placeholder="请输入银行账号" data-change="${'fkf'|setChange}.bank_account" name="bank_account" value="${fkfdata.bank_account|nonull}" >
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l">开户行:</td>
|
|
|
<td class="r">
|
|
|
<input type="text" class="txt normalchange" placeholder="请输入开户行" data-change="${'fkf'|setChange}.opening_bank" value="${fkfdata.opening_bank|nonull}" name="opening_bank">
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
</script>
|
|
|
<script type="text/html" id="statementTpl">
|
|
|
{@each list as it,index}
|
|
|
<tr>
|
|
|
<td>${it.statement_begin_time}-${it.statement_end_time}</td>
|
|
|
<td>${it.game_name}</td>
|
|
|
<td>${it.pay_amount}元</td>
|
|
|
<td><input type="text" class="txt statementchange" name="first_ratio" data-index ="${index}" data-change="statement_info[${index}]['first_ratio']" value="${it.first_ratio}" style="width: 30px;">%</td>
|
|
|
<td><input type="text" class="txt statementchange" name="second_ratio" data-index ="${index}" data-change="statement_info[${index}]['second_ratio']" value="${it.second_ratio}" style="width: 30px;">%</td>
|
|
|
<td><input type="text" class="txt statementchange" name="promote_ratio" data-index ="${index}" data-change="statement_info[${index}]['promote_ratio']" value="${it.promote_ratio}" style="width: 30px;">%</td>
|
|
|
<td><input type="text" class="txt statementchange" name="fax_ratio" data-index ="${index}" data-change="statement_info[${index}]['fax_ratio']" value="${it.fax_ratio}" style="width: 30px;">%</td>
|
|
|
<td>${it.sum_money}元</td>
|
|
|
</tr>
|
|
|
{@/each}
|
|
|
<tr>
|
|
|
<td></td>
|
|
|
<td>罚款</td>
|
|
|
<td><input type="text" class="txt statementchange" name="fine" data-change="fine" value="${fine}" style="width: 50px;">元</td>
|
|
|
<td></td>
|
|
|
<td></td>
|
|
|
<td></td>
|
|
|
<td></td>
|
|
|
<td>${fine}元</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>合计</td>
|
|
|
<td></td>
|
|
|
<td>${count.pay_amount}元</td>
|
|
|
<td></td>
|
|
|
<td></td>
|
|
|
<td></td>
|
|
|
<td></td>
|
|
|
<td>${count.sum_money}元</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td colspan=7>本月分成总金额(人民币大写):</td>
|
|
|
<td>${count.sum_money|number_chinese}</td>
|
|
|
</tr>
|
|
|
</script>
|
|
|
<script>
|
|
|
$(function(){
|
|
|
TPLSHOW.juicerInit();
|
|
|
$(".select_gallery").select2();
|
|
|
$('#time_start').datetimepicker({
|
|
|
format: 'yyyy-mm-dd',
|
|
|
language: "zh-CN",
|
|
|
minView: 2,
|
|
|
autoclose: true,
|
|
|
endDate:new Date()
|
|
|
});
|
|
|
|
|
|
$('#datetimepicker').datetimepicker({
|
|
|
format: 'yyyy-mm-dd',
|
|
|
language: "zh-CN",
|
|
|
minView: 2,
|
|
|
endDate:new Date(),
|
|
|
autoclose: true,
|
|
|
pickerPosition: 'bottom-left'
|
|
|
})
|
|
|
EVENT.changeCompany();
|
|
|
EVENT.createStatement();
|
|
|
$("#first_partner_id").change();//默认甲方只能是我们公司
|
|
|
|
|
|
});
|
|
|
//基础类
|
|
|
var PUBLIC = {
|
|
|
CompanyKeyName:{
|
|
|
id:"公司表id",
|
|
|
partner:"公司名称",
|
|
|
link_man:'联系人',
|
|
|
link_phone:"联系电话",
|
|
|
address:'邮寄地址',
|
|
|
company_tax_no:'公司税号',
|
|
|
payee_name:'名称',
|
|
|
bank_account:"银行账号",
|
|
|
opening_bank:"开户行"
|
|
|
},
|
|
|
checkCompanyKey(type,key){
|
|
|
//获取公司名
|
|
|
var company = '';
|
|
|
if(key == "payee_name" || key == "bank_account" || key == "opening_bank"){
|
|
|
if((DATAOBJ.statement_type == 0 && type == "first_party_info") || (DATAOBJ.statement_type == 1 && type == "second_party_info")){
|
|
|
company = "收款方";
|
|
|
}
|
|
|
if((DATAOBJ.statement_type == 0 && type == "second_party_info")|| (DATAOBJ.statement_type == 1 && type == "first_party_info")){
|
|
|
company = "付款方";
|
|
|
}
|
|
|
}else{
|
|
|
if(type == "first_party_info"){
|
|
|
company = "甲方";
|
|
|
}else{
|
|
|
company = "乙方";
|
|
|
}
|
|
|
}
|
|
|
//获取键名
|
|
|
try {
|
|
|
var keyname = company+PUBLIC.CompanyKeyName[key];
|
|
|
} catch (error) {
|
|
|
var keyname = false;
|
|
|
}
|
|
|
//验证
|
|
|
if(DATAOBJ[type][key] ===''){
|
|
|
layer.msg(keyname+"不能为空");
|
|
|
return false;
|
|
|
}
|
|
|
if(key == "link_phone" && !CHECK.mobile.test(DATAOBJ[type][key])){
|
|
|
layer.msg(keyname+"格式错误");
|
|
|
return false;
|
|
|
}
|
|
|
if(key == "bank_account" && !CHECK.BankNo.test(DATAOBJ[type][key])){
|
|
|
layer.msg(keyname+"格式错误");
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
postData(url,data,callback){
|
|
|
$.ajax({
|
|
|
url:url,
|
|
|
data:data,
|
|
|
type:"post",
|
|
|
dataType:"json",
|
|
|
success:function(data){
|
|
|
callback(data)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
floatAdd(a,b){
|
|
|
return Math.round(a*100+b*100)/100;
|
|
|
},
|
|
|
floatCut(a,b){
|
|
|
return Math.round(a*100-b*100)/100;
|
|
|
}
|
|
|
}
|
|
|
//数据类
|
|
|
var DATAOBJ = {
|
|
|
first_part_company:false,
|
|
|
second_part_company:false,
|
|
|
|
|
|
statement_type:false,
|
|
|
first_party_info:false,
|
|
|
second_party_info:false,
|
|
|
statement_info:false,
|
|
|
statement_count:false,
|
|
|
fine:0,
|
|
|
statement_begin_time:false,
|
|
|
statement_end_time:false
|
|
|
}
|
|
|
//事件类
|
|
|
var EVENT = {
|
|
|
changeCompany(){
|
|
|
$("#first_partner_id").on("change",function(){
|
|
|
//获取数据
|
|
|
var comid = $(this).find("option:selected").val();
|
|
|
//获取基础数据
|
|
|
var url = "{:U('getCpCompanyInfo')}";
|
|
|
PUBLIC.postData(url,{company_id:comid},function(data){
|
|
|
console.log(data);
|
|
|
DATAOBJ.first_part_company = data.success.partner;
|
|
|
DATAOBJ.first_party_info = data.success;
|
|
|
data.success.type = "first_party_info";
|
|
|
TPLSHOW.firstPartInfo(data.success);
|
|
|
})
|
|
|
})
|
|
|
$("#second_partner_id").on("change",function(){
|
|
|
//获取数据
|
|
|
var comid = $(this).find("option:selected").val();
|
|
|
//获取基础数据
|
|
|
var url = "{:U('getCpCompanyInfo')}";
|
|
|
PUBLIC.postData(url,{company_id:comid},function(data){
|
|
|
DATAOBJ.second_part_company = data.success.partner;
|
|
|
DATAOBJ.second_party_info = data.success;
|
|
|
data.success.type = "second_party_info";
|
|
|
TPLSHOW.secondPartInfo(data.success);
|
|
|
})
|
|
|
})
|
|
|
//生成订单
|
|
|
$("#getSpendStatement").on("click",function(){
|
|
|
//获取开始结束时间
|
|
|
var time_start = $("#time_start").val();
|
|
|
var time_end = $("#time_end").val();
|
|
|
if(time_start == '' || time_end == '' || DATAOBJ.statement_type === false){
|
|
|
layer.msg("收款方或账单开始结束时间均不允许为空");
|
|
|
return false;
|
|
|
}
|
|
|
if (Date.parse(time_start) > Date.parse(time_end)){
|
|
|
layer.msg('开始时间必须小于等于结束时间');
|
|
|
return false;
|
|
|
}
|
|
|
//发起查询
|
|
|
var selectData = {
|
|
|
"time_start":time_start,
|
|
|
"time_end":time_end,
|
|
|
"statement_type":DATAOBJ.statement_type,
|
|
|
"company_id": $("#second_partner_id").find("option:selected").val()
|
|
|
}
|
|
|
var url = "{:U('getSpendStatement')}";
|
|
|
PUBLIC.postData(url,selectData,function(data){
|
|
|
if(data.code > 0){
|
|
|
layer.alert(data.error);
|
|
|
return false;
|
|
|
}else{
|
|
|
DATAOBJ.statement_begin_time = time_start;
|
|
|
DATAOBJ.statement_end_time = time_end;
|
|
|
DATAOBJ.statement_info = data.success;
|
|
|
DATAOBJ.statement_count = data.count;
|
|
|
TPLSHOW.showStatementList(true);
|
|
|
}
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
},
|
|
|
createStatement(){
|
|
|
$("#createStatement").on("click",function(){
|
|
|
//验证信息
|
|
|
for (const key in DATAOBJ) {
|
|
|
if(DATAOBJ[key] === false){
|
|
|
layer.msg('页面中的参数均是必填项目,请先填满');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
//验证甲方信息
|
|
|
for (const key in DATAOBJ.first_party_info) {
|
|
|
var t = DATAOBJ.first_party_info;
|
|
|
var flag = PUBLIC.checkCompanyKey("first_party_info",key);
|
|
|
if(!flag){
|
|
|
return flag;
|
|
|
}
|
|
|
}
|
|
|
//乙方
|
|
|
for (const key in DATAOBJ.second_party_info) {
|
|
|
var t = DATAOBJ.second_party_info;
|
|
|
var flag = PUBLIC.checkCompanyKey("second_party_info",key);
|
|
|
if(!flag){
|
|
|
return flag;
|
|
|
}
|
|
|
}
|
|
|
layer.load(2);
|
|
|
$("#createStatement").off("click");//自我解绑
|
|
|
|
|
|
PUBLIC.postData("{:U('doAddCpStatement')}",DATAOBJ,function(data){
|
|
|
if(data.success){
|
|
|
layer.closeAll('loading');
|
|
|
layer.msg('添加成功');
|
|
|
setTimeout(function(){
|
|
|
window.parent.reload();
|
|
|
},350);
|
|
|
}else{
|
|
|
alert("添加失败,请联系管理员")
|
|
|
}
|
|
|
});
|
|
|
//发送添加请求
|
|
|
|
|
|
})
|
|
|
},
|
|
|
normalchange(){
|
|
|
$(".normalchange").off("blur");
|
|
|
$(".normalchange").on("blur",function(){
|
|
|
var val = $(this).val();
|
|
|
var index = $(this).data("change");
|
|
|
var str = "DATAOBJ."+index+"='"+val+"';";
|
|
|
eval(str);
|
|
|
})
|
|
|
},
|
|
|
statementchange(){
|
|
|
$(".statementchange").off("blur");
|
|
|
$(".statementchange").on("blur",function(){
|
|
|
|
|
|
var sort = $(this).data("change");
|
|
|
var val = $(this).val();
|
|
|
var vdata = eval("DATAOBJ."+sort);//原先值
|
|
|
var dom = $(this);
|
|
|
|
|
|
if(!CHECK.number.test(val)){
|
|
|
layer.msg('结算单中的罚款和税率必须是数字,且不能为空');
|
|
|
dom.val(vdata);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var str = "DATAOBJ."+sort+"='"+val+"';";
|
|
|
|
|
|
if(sort != 'fine'){
|
|
|
if(val > 100 || val < 0){
|
|
|
layer.msg('结算单中的税率不允许大于100和小于0');
|
|
|
dom.val(vdata);
|
|
|
return false;
|
|
|
}
|
|
|
eval(str);
|
|
|
var index = $(this).data("index");
|
|
|
var td = DATAOBJ.statement_info[index];
|
|
|
|
|
|
if( $(this).attr("name") == "first_ratio"){
|
|
|
td['second_ratio'] = 100-val;
|
|
|
}
|
|
|
if( $(this).attr("name") == "second_ratio"){
|
|
|
td['first_ratio'] = 100-val;
|
|
|
}
|
|
|
|
|
|
if(DATAOBJ.statement_type == 0){
|
|
|
var ratio = td['first_ratio']/100;
|
|
|
}else{
|
|
|
var ratio = td['second_ratio']/100;
|
|
|
}
|
|
|
DATAOBJ.statement_count['sum_money'] = PUBLIC.floatCut(DATAOBJ.statement_count['sum_money'],td['sum_money']);
|
|
|
|
|
|
td['sum_money'] = Math.round((td['pay_amount']*(100-td['promote_ratio'])/100*ratio*(100-td['fax_ratio'])/100)* 100) / 100 ;
|
|
|
|
|
|
DATAOBJ.statement_count['sum_money']=PUBLIC.floatAdd(DATAOBJ.statement_count['sum_money'],td['sum_money']);
|
|
|
|
|
|
}else{
|
|
|
DATAOBJ.fine = Math.round(DATAOBJ.fine * 100) / 100 ;
|
|
|
if(!CHECK.money.test(val)){
|
|
|
layer.msg('罚款金额格式错误');
|
|
|
$(this).val(DATAOBJ.fine);
|
|
|
return false;
|
|
|
}
|
|
|
if(val > DATAOBJ.statement_count['sum_money']){
|
|
|
layer.msg('罚款金额过大,总计不允许为负数');
|
|
|
$(this).val(DATAOBJ.fine);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
DATAOBJ.statement_count['sum_money'] =PUBLIC.floatAdd(DATAOBJ.statement_count['sum_money'],DATAOBJ.fine);
|
|
|
DATAOBJ.statement_count['pay_amount'] = PUBLIC.floatAdd(DATAOBJ.statement_count['pay_amount'],DATAOBJ.fine);
|
|
|
eval(str);
|
|
|
DATAOBJ.statement_count['sum_money'] =PUBLIC.floatCut(DATAOBJ.statement_count['sum_money'],DATAOBJ.fine);
|
|
|
DATAOBJ.statement_count['pay_amount'] = PUBLIC.floatCut(DATAOBJ.statement_count['pay_amount'],DATAOBJ.fine);
|
|
|
}
|
|
|
TPLSHOW.showStatementList(true);
|
|
|
})
|
|
|
},
|
|
|
changeStatementType(){
|
|
|
$("#statement_type").off("change")
|
|
|
$("#statement_type").on("change",function(){
|
|
|
//获取数据
|
|
|
var statement_type = $(this).find("option:selected").val();
|
|
|
if(statement_type == ''){
|
|
|
statement_type = false;
|
|
|
}
|
|
|
DATAOBJ.statement_type = statement_type;
|
|
|
//获取账单信息
|
|
|
TPLSHOW.showStatementList(false);
|
|
|
TPLSHOW.showPartPayInfo();
|
|
|
|
|
|
|
|
|
})
|
|
|
$(".select_gallery").select2();
|
|
|
}
|
|
|
}
|
|
|
var CHECK = {
|
|
|
number: /^\d+(\.{1}\d+)?$/,
|
|
|
mobile:/^1[3456789]\d{9}$/,
|
|
|
BankNo:/^([1-9]{1})(\d{15}|\d{18})$/,
|
|
|
money:/((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/
|
|
|
}
|
|
|
//
|
|
|
var TPLSHOW = {
|
|
|
juicerInit(){
|
|
|
var nonull = function(data) {
|
|
|
if(!data){
|
|
|
return '';
|
|
|
}
|
|
|
return data;
|
|
|
};
|
|
|
var setChange = function(typestr) {
|
|
|
if(DATAOBJ.statement_type == 0){
|
|
|
if(typestr == "fkf"){
|
|
|
return 'second_party_info';
|
|
|
}else{
|
|
|
return 'first_party_info';
|
|
|
}
|
|
|
}else{
|
|
|
if(typestr == "fkf"){
|
|
|
return 'first_party_info';
|
|
|
}else{
|
|
|
return 'second_party_info';
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
var number_chinese = function (str) {
|
|
|
var num = parseFloat(str);
|
|
|
var strOutput = "",
|
|
|
strUnit = '仟佰拾亿仟佰拾万仟佰拾元角分';
|
|
|
num += "00";
|
|
|
var intPos = num.indexOf('.');
|
|
|
if (intPos >= 0){
|
|
|
num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
|
|
|
}
|
|
|
strUnit = strUnit.substr(strUnit.length - num.length);
|
|
|
for (var i=0; i < num.length; i++){
|
|
|
strOutput += '零壹贰叁肆伍陆柒捌玖'.substr(num.substr(i,1),1) + strUnit.substr(i,1);
|
|
|
}
|
|
|
return strOutput.replace(/零角零分$/, '整').replace(/零[仟佰拾]/g, '零').replace(/零{2,}/g, '零').replace(/零([亿|万])/g, '$1').replace(/零+元/, '元').replace(/亿零{0,3}万/, '亿').replace(/^元/, "零元")
|
|
|
|
|
|
}
|
|
|
juicer.register('nonull', nonull);
|
|
|
juicer.register('setChange', setChange);
|
|
|
juicer.register('number_chinese', number_chinese);
|
|
|
},
|
|
|
//
|
|
|
firstPartInfo(data){
|
|
|
var tpl =$("#partbasetpl").html();
|
|
|
var html = juicer(tpl, data);
|
|
|
$("#first_part_bser_info_show").html(html);
|
|
|
TPLSHOW.pushStatementTypeOption();
|
|
|
},
|
|
|
secondPartInfo(data){
|
|
|
var tpl =$("#partbasetpl").html();
|
|
|
var html = juicer(tpl, data);
|
|
|
$("#second_part_bser_info_show").html(html);
|
|
|
TPLSHOW.pushStatementTypeOption();
|
|
|
},
|
|
|
//支付给公司
|
|
|
pushStatementTypeOption(){
|
|
|
|
|
|
EVENT.normalchange();
|
|
|
|
|
|
DATAOBJ.statement_type = false;//重新选择
|
|
|
TPLSHOW.showStatementList(false);
|
|
|
|
|
|
if(DATAOBJ.first_part_company && DATAOBJ.second_part_company){
|
|
|
var str = "<option value=''>请选择合作公司</option><option value='0' >"+DATAOBJ.first_part_company+"</option>";
|
|
|
str += ("<option value='1' selected>"+DATAOBJ.second_part_company+"</option>");//默认支付给乙方
|
|
|
$("#statement_type").html(str);
|
|
|
EVENT.changeStatementType();
|
|
|
$("#statement_type").change();//默认支付给乙方
|
|
|
// TPLSHOW.showPartPayInfo();//查看底下是否有值
|
|
|
}
|
|
|
},
|
|
|
//支付信息显示
|
|
|
showPartPayInfo(){
|
|
|
var data = {};
|
|
|
if(DATAOBJ.statement_type !== false){
|
|
|
if(DATAOBJ.statement_type == 1){
|
|
|
data.fkfdata = DATAOBJ.first_party_info;
|
|
|
data.skfdata = DATAOBJ.second_party_info;
|
|
|
}else{
|
|
|
data.skfdata = DATAOBJ.first_party_info;
|
|
|
data.fkfdata = DATAOBJ.second_party_info;
|
|
|
}
|
|
|
data.type = DATAOBJ.statement_type;
|
|
|
|
|
|
}else{
|
|
|
data.skfdata = {};
|
|
|
data.fkfdata = {};
|
|
|
}
|
|
|
var tpl =$("#partpaytpl").html();
|
|
|
var html = juicer(tpl, data);
|
|
|
$("#partpatinfo").html(html);
|
|
|
EVENT.normalchange();
|
|
|
|
|
|
},
|
|
|
//订单信息显示
|
|
|
showStatementList(flag){
|
|
|
if(flag){
|
|
|
var data = {list:DATAOBJ.statement_info,count:DATAOBJ.statement_count,fine:DATAOBJ.fine};
|
|
|
$("#statementInit").addClass("hidebox");
|
|
|
var tpl =$("#statementTpl").html();
|
|
|
var html = juicer(tpl, data);
|
|
|
$("#statementShow").html(html);
|
|
|
EVENT.statementchange();
|
|
|
}else{
|
|
|
DATAOBJ.statement_info = false;
|
|
|
DATAOBJ.statement_count = false;
|
|
|
DATAOBJ.fine = 0;
|
|
|
$("#statementInit").removeClass("hidebox");
|
|
|
$("#statementShow").html('');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
</html>
|