合作方

master
liuweiwen 5 years ago
parent ada2913cdc
commit 8462f80777

@ -77,6 +77,7 @@ class PartnerController extends ThinkController
public function add()
{
if ($_POST) {
dd($_REQUEST);
$partner = I('post.partner', '');
$status = intval(I('post.status', 1));
@ -119,6 +120,19 @@ class PartnerController extends ThinkController
$save['bank_account'] = I('bank_account');
$save['opening_bank'] = I('opening_bank');
$save['matche_platform'] = I('matche_platform');
$save['contract_start_time'] = strtotime(I('contract_start_time'));
$save['contract_end_time'] = strtotime(I('contract_end_time'));
$save['channel_rate'] = I('channel_rate');
$save['invoice_rate'] = I('invoice_rate');
$save['is_sign_contract'] = I('is_sign_contract');
$save['settlement_type'] = I('settlement_type');
$save['has_game_evidence'] = I('has_game_evidence');
$save['remark'] = I('remark');
if (isset($save['file_info'])) {
$save['file_info'] = json_encode($save['file_info'],JSON_UNESCAPED_UNICODE);
}
$save['uid'] = UID;
$save['create_time'] = $time;
$save['last_up_time'] = $time;
@ -245,4 +259,56 @@ class PartnerController extends ThinkController
$this->success('删除成功', U('lists'));
}
public function addfile()
{
$this->meta_title = '文档添加';
return $this->display();
}
//处理上传图片
public function saveFile()
{
$path = '/Uploads/';
$upload = new \Think\Upload();// 实例化上传类
$upload->maxSize = 0 ;// 设置附件上传大小
$upload->exts = '';// 设置附件上传类型
$upload->rootPath = '.'.$path; // 设置附件上传根目录
$upload->savePath = ''; // 设置附件上传(子)目录
// 上传文件
$info = $upload->upload();
// dump($info);
if(!$info) {// 上传错误提示错误信息
$msg = $upload->getError();
$array= array('status' => 0, 'info' => $msg);
}else{// 上传成功
$array=array(
"info"=>"上传成功",
"status"=>1,
"file_path"=>$path.$info['file']['savepath'].$info['file']['savename'],
"file_name"=>$_POST['file_name'],
"file_type"=>$_FILES['file']['type'],
"file_size"=>$_FILES['file']['size'],
"upload_time"=>date("Y-m-d H:i:s",time())
);
}
$this->ajaxReturn($array);
}
//删除图片
public function delFile()
{
$id = $_REQUEST['id'];
$index = $_REQUEST['index'] ?: false;
$file_path = $_REQUEST['file_path'] ?: false;
if($id == 0){
//未存入数据库,不用管
unlink("./".$file_path);
$this->ajaxReturn(array(
'status' => 1,
'info' => "删除成功"
));
}
# code...
}
}

@ -14,7 +14,7 @@
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<!-- 标签页导航 -->
<div class="tab-wrap">
@ -54,14 +54,14 @@
<tr>
<td class="l"><!--<i class="mustmark" style="margin-left:-7px">*</i>-->渠道费率:</td>
<td class="r" >
<input type="text" class="txt " name="channel_rate" value="" placeholder="请输入渠道费率">
<input type="text" class="txt " name="channel_rate" value="" placeholder="请输入渠道费率">%
</td>
</tr>
<tr>
<td class="l"><!--<i class="mustmark" style="margin-left:-7px">*</i>-->开票税点:</td>
<td class="r" >
<input type="text" class="txt " name="Invoice_rate" value="" placeholder="请输入开票税点">
<input type="text" class="txt " name="inoice_rate" value="" placeholder="请输入开票税点">
</td>
</tr>
@ -153,14 +153,7 @@
<tr>
<td class="l">备注:</td>
<td class="r">
<textarea name="remark" class="txt_area">{$data.remark}</textarea>
</td>
</tr>
<tr>
<td class="l">文档管理:</td>
<td class="r" >
<input type="text" class="txt " name="file_info" value="" placeholder="请输入文档管理">
<input type="text" name="remark" class="txt" value="" placeholder="请输入备注">
</td>
</tr>
@ -178,11 +171,22 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo">文档管理</td>
<td class="r table_radio">
<input type="button" class="coin-detail" data-url="{:U('Partner/addfile')}" value="添加"
style="border-radius:5%;background: #fff;color: #333;font-weight: 400;border: 1px solid #777;width: 100px;height: 35px">
</td>
</tr>
</tbody>
</table>
<table border="1" style="width: 600px;text-align: center;" cellspacing="0" cellpadding="0" id="docShow">
</table>
</div>
<div class="form-item cf">
<button class="submit_btn ajax-post" id="submit" type="submit" target-form="form-horizontal" style="margin-left:210px;">
<button class="submit_btn ajax-post" id="submit" target-form="form-horizontal" style="margin-left:210px;">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="{:U('Partner/lists')}" >
@ -201,6 +205,27 @@
<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>
<script type="text/html" id="doctpl">
{@each list as it,index}
{@if index==0}
<thead>
<tr>
<th>文档名称</th>
<th>上传时间</th>
<th style="width:150px;">操作</th>
</tr>
</thead>
{@/if}
<tr>
<td style="padding:0;">${it.file_name}</td>
<td>${it.upload_time}</td>
<td>
<a class="filedown" data-index="${index}" data-path="${it.file_path}">下载</a>
<a class="filedel" data-index="${index}" data-path="${it.file_path}">删除</a>
</td>
</tr>
{@/each}
</script>
</block>
<block name="script">
@ -243,8 +268,129 @@
//导航高亮
highlight_subnav("{:U('Partner/lists')}");
$('#submit').click(function(){
$('#form').submit();
</script>
<script>
var doc = [];
function addFile(info) {
doc.push(info);
layer.closeAll();
PROMOTE.juicerFun();
// window.parent.addFile(info);
}
$(".coin-detail").click(function () {
var url = $(this).data('url');
var title = '文档添加';
layer.open({
type: 2,
title: title,
shadeClose: true,
shade: 0.8,
area: ['40%', '60%'],
content: url
});
});
$("#submit").on("click",function(){
// var obj = {
// "company_name":["required","推广公司名称不允许为空"],
// "platform_name":["nocheck"],
// "contact_begin":["date","合同开始时间不能为空"],
// "contact_end":["date","合同结束时间不能为空"],
// "fax_ratio":["number","开票税率必须是数字如果无此项请填0"],
// "company_type":["required","公司性质不能为空","select"],
// "is_sign_contact":["required","是否签署合同项不能为空","select"],
// "company_belong":["required","团体归属不能为空","select"],
// "settlement_contact":["required","结算联系人不能为空"],
// "contact_phone":["phone","联系人电话格式不对或不能为空"],
// "address":["required","联系人地址不能为空"],
// "bank_card":["bankid","银行卡格式错误或不能为空"],
// "bank_name":["required","银行名称不能为空"],
// "bank_address":["required","银行开户网点不能为空"],
// "content":["nocheck"],
// "status":["nocheck","","radio"]
// }
var cres = CIC.checkAddInput(obj);
if(!cres){
return false;
}
if (Date.parse(cres.contact_begin) > Date.parse(cres.contact_end)) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
//验证通过
if(doc.length > 0){
cres.resources = doc;
}
//添加
$.ajax({
url:"{:U('partner/add')}",
type:"post",
data:cres,
dataType:"json",
success:function(data){
if(data.status == 1){
layer.msg(data.info,function(){
window.location.href="{:U('partner/lists')}";
});
}else{
layer.msg(data.info);
}
},
error:function(e){
}
});
})
var PROMOTE = {
juicerFun(){
console.log(333);
var tpl =$("#doctpl").html();
console.log(tpl);
var html = juicer(tpl, {list:doc});
console.log(html);
$("#docShow").html(html);
PROMOTE.juicerEvent();
},
juicerEvent(){
$(".filedown,.filedel").off("click");
$(".filedown").on("click",function(){
var url = window.location.protocol+"//"+window.location.host+$(this).data("path");
// window.open(url,"_blank");
var link = document.createElement('a');
link.setAttribute("download", "");
link.href = url;
link.click()
});
$(".filedel").on("click",function(){
var path = $(this).data("path");
var index = $(this).data("index");
console.log(index);
var id = 0;
$.ajax({
url:"{:U('Partner/delFile')}",
type:"post",
data:{
"id":0,
"file_path":path
},
dataType:"json",
success:function(data){
if(data.status == 1){
doc.splice(index,1)
PROMOTE.juicerFun();
}else{
layer.alert(data.info);
}
},
error:function(e){
}
});
})
}
}
</script>
</block>

Loading…
Cancel
Save