扩展推广公司添加

master
chenzhi 5 years ago
parent afbba4d20b
commit 6a612565c6

@ -91,7 +91,7 @@ class PromoteCompanyController extends ThinkController
if (empty(I('post.contact_phone'))) {
$this->error('请输入联系人电话');
}
$pattern = "/^1[3|5|7|8]\\d{9}$/i";
$pattern = "/^1[3|4|5|6|7|8|9]\\d{9}$/i";
if(!preg_match($pattern, I('post.contact_phone'))) {
$this->error("手机号码格式不合法");
return false;
@ -178,7 +178,7 @@ class PromoteCompanyController extends ThinkController
if (empty(I('post.contact_phone'))) {
$this->error('请输入联系人电话');
}
$pattern = "/^1[3|5|7|8]\\d{9}$/i";
$pattern = "/^1[3|4|5|6|7|8|9]\\d{9}$/i";//手机号验证修改
if(!preg_match($pattern, I('post.contact_phone'))) {
$this->error("手机号码格式不合法");
return false;
@ -278,4 +278,48 @@ class PromoteCompanyController extends ThinkController
$this->success('删除成功', U('lists'));
}
//处理上传图片
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,20 @@
<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>
<style>
.coin-detail{
display: block;
float: left;
text-align: center;
line-height: 35px;
width: 100px;
height: 35px;
font-size: 14px;
border-radius: 4px;
cursor: pointer;
}
</style>
<!-- 标签页导航 -->
<div class="tab-wrap">
@ -24,7 +37,7 @@
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="form" action="{:U('add')}" method="post" class="form-horizontal">
<!-- <form id="form" action="{:U('add')}" method="post" class="form-horizontal"> -->
<!-- 基础 -->
<div id="tab1" class="tab-pane in tab1 ">
<table border="0" cellspacing="0" cellpadding="0">
@ -35,6 +48,73 @@
<input type="text" class="txt " name="company_name" value="" placeholder="请输入推广公司名称">
</td>
</tr>
<tr>
<td class="l">对应平台(简称):</td>
<td class="r" >
<input type="text" class="txt " name="platform_name" value="" placeholder="请输入对应平台">
</td>
</tr>
<tr>
<td class="l">合同期限:</td>
<td class="r" >
<div class="input-list" style="margin:0;">
<input type="text" readonly id="contact_begin" name="contact_begin" class="" value="{:I('contact_begin')}"
placeholder="合同开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="contact_end" name="contact_end" class="" value="{:I('contact_end')}"
placeholder="合同结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
</td>
</tr>
<tr>
<td class="l">开票税点:</td>
<td class="r" >
<input type="number" class="txt" name="fax_ratio" value="" placeholder="请输入开票税点">
<span>%</span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>公司性质:</td>
<td class="r" >
<div class="input-list input-list-server search_label_rehab" style="margin:0;">
<select id="company_type" name="company_type" class="select_gallery" style="width: 215px;">
<option value="">请选择公司性质</option>
<option value="1">公司</option>
<option value="2">个人</option>
</select>
</div>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>是否签署合同:</td>
<td class="r" >
<div class="input-list input-list-server search_label_rehab" style="margin:0;">
<select id="is_sign_contact" name="is_sign_contact" class="select_gallery" style="width: 215px;">
<option value="">请选择是否签署合同</option>
<option value="0"></option>
<option value="1"></option>
</select>
</div>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>团体归属:</td>
<td class="r" >
<div class="input-list input-list-server search_label_rehab" style="margin:0;">
<select id="company_belong" name="company_belong" class="select_gallery" style="width: 215px;">
<option value="">请选择团体归属</option>
<option value="0">内团</option>
<option value="1">外团</option>
<option value="2">外团-分发</option>
<option value="3">其他</option>
</select>
</div>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>联系结算人:</td>
<td class="r" >
@ -97,18 +177,30 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo">文档管理</td>
<td class="r table_radio">
<div class="coin-detail" data-url="{:U('PromoteCompany/addfile')}" style="margin:0px;background: #fff;color: #333;font-weight: 400;border: 1px solid #777;">
添加
</div>
</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;">
<div class="form-item cf" style="margin-bottom: 40px;">
<button class="submit_btn " id="submit" style="margin-left:210px;">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:history.back(-1);" >
返回
</a>
</div>
</form>
<!-- </form> -->
</div>
</div>
<div class="common_settings">
@ -119,7 +211,29 @@
</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>
<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">
@ -130,4 +244,71 @@
$('#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
});
});
var PROMOTE = {
juicerFun(){
var tpl =$("#doctpl").html();
var html = juicer(tpl, {list:doc});
$("#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('PromoteCompany/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>

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<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__/module.css">
<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">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px;
}
</style>
<body>
<div id="main" class="main" style="min-height: 342px;margin-top: 20px;padding-left: 50px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr style="padding: 10px;height: 50px;">
<td class="l" style="width: 100px;">文件名称:</td>
<td class="r" style="margin-left: 10px;">
<input type="text" id="filename" name="company_name" value="" placeholder="请输入文件名称">
</td>
</tr>
<tr style="padding: 10px;height: 50px;">
<td class="l">文件选择:</td>
<td >
<input type="file" id="fileinput" name="file">
</td>
</tr>
</table>
<div class="jssearch search_list fl cf">
<div class="input-list">
<div class="sch-btn uploadfile" style="width: 100px;padding: 5px;">确认添加</div>
</div>
</div>
</div>
<script>
$(function(){
$(".uploadfile").on("click",function(){
var formData = new FormData();
var filename = $("#filename").val();
if(filename == ''){
layer.msg("文件名不能为空");
return false;
}
formData.append("file_name", filename);
formData.append("file", document.getElementById("fileinput").files[0]);
var index = layer.load();
$.ajax({
url:"{:U('PromoteCompany/saveFile')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
window.parent.addFile(data);
}else{
layer.alert(data.info);
}
},
error:function(e){
}
});
})
});
</script>
</body>
</html>

@ -1203,3 +1203,14 @@ ALTER TABLE `tab_promote_company`
ADD COLUMN `bank_name` VARCHAR(60) NOT NULL DEFAULT '0' COMMENT '收款银行' AFTER `bank_cardname`,
ADD COLUMN `bank_address` VARCHAR(60) NOT NULL DEFAULT '0' COMMENT '开户网点' AFTER `bank_name`,
ADD COLUMN `content` VARCHAR(255) NULL DEFAULT '' COMMENT '备注' AFTER `bank_address`;
--2020-02-11 chenzhi 广--
ALTER TABLE `tab_promote_company`
ADD COLUMN `platform_name` VARCHAR(60) NOT NULL DEFAULT '0' COMMENT '平台名称' AFTER `bank_address`,
ADD COLUMN `contact_begin` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '合同开始时间' AFTER `platform_name`,
ADD COLUMN `contact_end` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '合同结束时间' AFTER `contact_begin`,
ADD COLUMN `fax_ratio` VARCHAR(20) NOT NULL DEFAULT '0' COMMENT '开票税率' AFTER `contact_end`,
ADD COLUMN `company_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '公司性质1-公司 2-个人' AFTER `fax_ratio`,
ADD COLUMN `is_sign_contact` tinyint(3) NOT NULL DEFAULT 0 COMMENT '是否签署合同:0-未签署 1-签署' AFTER `company_type`,
ADD COLUMN `company_belong` tinyint(1) UNSIGNED NOT NULL DEFAULT 3 COMMENT '工会归属0-内团1-外团 2-分发联盟 3 无' AFTER `is_sign_contact`,
ADD COLUMN `resources` VARCHAR(2000) NULL DEFAULT '' COMMENT '文档' AFTER `company_belong`;
Loading…
Cancel
Save