新增导出

master
chenzhi 5 years ago
parent 2a4541569d
commit d6ec8e0248

@ -61,8 +61,7 @@ class PartnerController extends ThinkController
//获取分页数据
$query = $model->alias('p')
->field("p.partner,p.matche_platform,p.invoice_rate,p.settlement_type,p.bank_account,
p.opening_bank,p.id,p.contract_start_time,p.contract_end_time,p.remark,p.company_type,p.has_game_evidence,p.is_sign_contract")
->field("p.*")
->where($map)
->order("id desc");
if($is_export){
@ -143,18 +142,25 @@ class PartnerController extends ThinkController
$parseData = array();
foreach ($partners as $key =>$value) {
$tmpr = D("CompanyRelation")->getCompanyRelation(1,$value['id']);
if(!$tmpr){
$value['settlement_type'] = '未配置';
$value['is_collection'] = "未配置";
}else{
$value['is_collection'] = $tmpr['collection'] ? '是' : '否';
if ($tmpr['settlement_type'] == 1) {
$value['settlement_type'] = '周结';
} elseif ($tmpr['settlement_type'] == 2) {
$value['settlement_type'] = '月结';
}else{
$value['settlement_type'] = '无';
}
}
$value['game'] = $parseGames[$value['id']];
$value['has_game_evidence'] = $value['has_game_evidence'] ? '是' : '否';
$value['is_sign_contract'] = $value['is_sign_contract'] ? '是' : '否';
$value['has_advance_charge'] = $value['has_advance_charge'] ? '是' : '否';
$value['channel_rate'] *= 100;
$value['invoice_rate'] *= 100;
if ($value['settlement_type'] == 0) {
$value['settlement_type'] = '未配置';
} elseif ($value['settlement_type'] == 1) {
$value['settlement_type'] = '周结';
} elseif ($value['settlement_type'] == 2) {
$value['settlement_type'] = '月结';
}
$value['company_type'] = $value['company_type'] == 2 ? '个人' : '公司';
$contract_start_time = $value['contract_start_time'] ?
time_format($value['contract_start_time'], 'Y/m/d') : '-';
@ -163,17 +169,13 @@ class PartnerController extends ThinkController
$value['contract_time'] = $contract_start_time . '-' . $contract_end_time;
$row2 = array_sum(array_column($value['game'], 'row')) ;
$value['row'] = empty($row2) ? 1: $row2;
$parseData[$value['partner_id']][] = $value;
$parseData[] = $value;
}
$parseData = array_values($parseData);
// dd($parseData);
if($is_export){
$this->assign('listData', $parseData[0]);
$this->assign('listData', $parseData);
$GetData = $_GET;
unset($GetData['export']);
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"游戏-游戏管理-合作方管理-导出"]);
$this->display("export");
die();
}
@ -190,8 +192,7 @@ class PartnerController extends ThinkController
$this->assign('_page', $page);
}
$this->checkListOrCountAuthRestMap($map,[]);
// dd($parseData[0]);
$this->assign('listData', $parseData[0]);
$this->assign('listData', $parseData);
$this->assign('count', $count);
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find());
$this->meta_title = '合作方管理';

@ -0,0 +1,32 @@
<?php
namespace Admin\Model;
use Think\Model;
class CompanyRelationModel extends Model
{
protected $db = 'company_relation';
// 数据表前缀
protected $tablePrefix = 'tab_';
public $InvoiceType=[
"1"=>"专票",
"2"=>"普票"
];
//返回公司基础信息
public function getCompanyRelation($company_type,$company_id)
{
$res = $this->where("(first_company_type = '{$company_type}' AND first_company_id = '{$company_id}') OR (second_company_type = '{$company_type}' AND second_company_id = '{$company_id}')")->find();
if(empty($res)){
return false;
}else{
if($res["first_company_type"] == $company_type){
$s = ($res['collection'] == 1 ? 1 :0);
}else{
$s = ($res['collection'] == 2 ? 1 :0);
}
return ['company_id'=>$company_id,"settlement_type"=>$res['settlement_type'],"collection"=>$s,"invoice_type"=>$this->InvoiceType[$res['invoice_type']],"invoice_content"=>$res['invoice_content'],"is_payment"=>$res['is_payment']];
}
}
}

@ -7,9 +7,7 @@
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script src="__STATIC__/table2excel.js"></script>
<style>
html{
display: none;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
@ -38,37 +36,34 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
</div>
<!-- 数据列表 -->
<div class="data_list data_game_list">
<div style="margin:auto;font-size: 20px;color: red;line-height: 3;padding: 20px;">
<!-- <div style="margin:auto;font-size: 20px;color: red;line-height: 3;padding: 20px;">
导出进行中。。。<br/>
如果导出成功你也可以手动关闭此页面
</div>
</div> -->
<div class="">
<table border="1" id="exporttable" style="opacity: 0;">
<table border="1">
<!-- 表头 -->
<thead>
<tr>
<!-- <th style="width:5%;min-width:10px;">操作</th>-->
<th>合同合作方名称</th>
<th>公司性质</th>
<th>对应平台</th>
<th>合同期限</th>
<th>开票税点</th>
<th>结算周期</th>
<th>银行账号</th>
<th>开户行</th>
<th>备注</th>
<th>是否有游戏资质</th>
<th>是否签署合同</th>
<th>公司性质</th>
<th>产品类型</th>
<th>原包名</th>
<th>现包名</th>
<th colspan="2">合作方分成比例</th>
<th>产品类型</th>
<th colspan="2">游戏分成比例</th>
<th>结算周期</th>
<th>帐户名</th>
<th>银行账号</th>
<th>收款银行</th>
<th>是否有预付款</th>
<th>是否为收款方</th>
</tr>
</thead>
@ -79,83 +74,80 @@
<else />
<volist name="listData" id="data">
<tr>
<!-- <td rowspan="{$data.row}">-->
<!-- <a href="{:U('edit',array('id'=>$data['id']))}">编辑</a>-->
<!-- <a href="{:U('edit',array('id'=>$data['id'],'action' => 'show'))}">查看</a>-->
<!-- <a href="{:U('del',array('id'=>$data['id']))}" class="confirm ajax-get">删除</a>-->
<!-- </td>-->
<td rowspan="{$data.row}">{$data.partner}</td>
<td rowspan="{$data.row}">{$data.company_type}</td>
<td rowspan="{$data.row}">{$data.matche_platform}</td>
<td rowspan="{$data.row}">{$data.contract_time}</td>
<td rowspan="{$data.row}">{$data.invoice_rate}%</td>
<td rowspan="{$data.row}">{$data.company_type}</td>
<notempty name="data.game">
<td rowspan="{$data['game'][0]['row']}">{$data['game'][0]['original_package_name']}</td>
<td rowspan="{$data['game'][0]['row']}">{$data['game'][0]['relation_game_name']}</td>
<td rowspan="{$data['game'][0]['row']}">{$data['game'][0]['game_type_name']}</td>
<notempty name="data['game'][0]['game_ratio']">
<td>{$data['game'][0]['game_ratio'][0]['name']}</td>
<td>{$data['game'][0]['game_ratio'][0]['ratio']}%</td>
<else />
<td >-</td>
<td>-</td>
</notempty>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
<td rowspan="{$data.row}">{$data.settlement_type}</td>
<td rowspan="{$data.row}">&nbsp;{$data.bank_account}</td>
<td rowspan="{$data.row}">{$data.payee_name}</td>
<td rowspan="{$data.row}">{$data.bank_account}</td>
<td rowspan="{$data.row}">{$data.opening_bank}</td>
<td rowspan="{$data.row}">{$data.remark}</td>
<td rowspan="{$data.row}">{$data.has_game_evidence}</td>
<td rowspan="{$data.row}">{$data.is_sign_contract}</td>
<notempty name="data.game">
<foreach name="data['game']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td rowspan="{$game.row}">{$game['game_type_name']}</td>
<td rowspan="{$game.row}">{$game['original_package_name']}</td>
<td rowspan="{$game.row}">{$game['relation_game_name']}</td>
<notempty name="game.game_ratio">
<foreach name="game['game_ratio']" item="ratio" key="ratiokey">
<if condition="$ratiokey gt 0">
<tr>
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}%</td>
</tr>
<else />
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}%</td>
</if>
</foreach>
<else />
<td >-</td>
<td>-</td>
</notempty>
</tr>
<else />
<td rowspan="{$game.row}">{$game['game_type_name']}</td>
<td rowspan="{$game.row}">{$game['original_package_name']}</td>
<td rowspan="{$game.row}">{$game['relation_game_name']}</td>
<notempty name="game.game_ratio">
<foreach name="game['game_ratio']" item="ratio" key="ratiokey">
<if condition="$ratiokey gt 0">
<td rowspan="{$data.row}">{$data.has_advance_charge}</td>
<td rowspan="{$data.row}">{$data.is_collection}</td>
</tr>
<if condition="$data['game'][0]['row'] gt 1">
<foreach name="data['game'][0]['game_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']}</td>
<td>{$game_ratio['ratio']}%</td>
</tr>
</if>
</foreach>
</if>
<notempty name="data['game'][1]">
<foreach name="data['game']" item="game" key="gkey">
<if condition="$gkey gt 0">
<tr>
<td rowspan="{$game['row']}">{$game['original_package_name']}</td>
<td rowspan="{$game['row']}">{$game['relation_game_name']}</td>
<td rowspan="{$game['row']}">{$game['game_type_name']}</td>
<notempty name="game['game_ratio']">
<td>{$game['game_ratio'][0]['name']}</td>
<td>{$game['game_ratio'][0]['ratio']}%</td>
<else />
<td >-</td>
<td>-</td>
</notempty>
</tr>
<if condition="$game['row'] gt 1">
<foreach name="game['game_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}%</td>
<td>{$game_ratio['name']}</td>
<td>{$game_ratio['ratio']}%</td>
</tr>
<else />
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}%</td>
</if>
</foreach>
</if>
<else />
<td >-</td>
<td>-</td>
</notempty>
</if>
</foreach>
</if>
</foreach>
<else />
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
</notempty>
</notempty>
</tr>
</volist>
</empty>
</tbody>
@ -165,15 +157,7 @@
<div class="page">
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$meta_title}">
<input type="hidden" name="url" value="Partner/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
@ -203,9 +187,9 @@
$(".select_gallery").select2();
</script>
<script type="text/javascript">
$("#exporttable").table2excel({
filename: "合作方.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
// $("#exporttable").table2excel({
// filename: "合作方.xls", // do include extension
// preserveColors: false // set to true if you want background colors and font colors preserved
// });
</script>
</block>

@ -142,11 +142,12 @@
</notempty>
<td rowspan="{$data.row}">{$data.settlement_type}</td>
<td rowspan="{$data.row}">{$data.contract_time}</td>
<td rowspan="{$data.row}">{$data.invoice_rate}%</td>
<td rowspan="{$data.row}">{$data.payee_name}</td>
<td rowspan="{$data.row}">{$data.bank_account}</td>
<td rowspan="{$data.row}">{$data.has_game_evidence}</td>
<td rowspan="{$data.row}">{$data.is_sign_contract}</td>
<td rowspan="{$data.row}">{$data.opening_bank}</td>
<td rowspan="{$data.row}">{$data.has_advance_charge}</td>
<td rowspan="{$data.row}">{$data.is_collection}</td>
<td rowspan="{$data.row}">
<a href="{:U('edit',array('id'=>$data['id']))}">编辑</a>

Loading…
Cancel
Save