Commit f5aa405b authored by wangjiangze's avatar wangjiangze

update

parent dbff03f1
...@@ -27,6 +27,7 @@ class SpAction extends CommonAction{ ...@@ -27,6 +27,7 @@ class SpAction extends CommonAction{
$model = D("Sp"); $model = D("Sp");
$spModel = D("Sp"); $spModel = D("Sp");
$confTypeModel = D("ConfType");
$regionModel = D("Region"); $regionModel = D("Region");
if($id){ if($id){
...@@ -34,9 +35,11 @@ class SpAction extends CommonAction{ ...@@ -34,9 +35,11 @@ class SpAction extends CommonAction{
$this->info = $info; $this->info = $info;
} }
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
$conf_type_lists = $confTypeModel->join(" A left join sh_sp_config B on A.`code` = B.type_code and B.sp_id = $id ")->field("A.id,A.`name`,A.`code`,B.`v`")->select();
$region_lists = $regionModel->where("pid = 1 and `status`=0")->select(); $region_lists = $regionModel->where("pid = 1 and `status`=0")->select();
$region_city_lists = $regionModel->where("pid > 1 and `status`=0")->select(); $region_city_lists = $regionModel->where("pid > 1 and `status`=0")->select();
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->conf_type_lists = $conf_type_lists;
$this->region_lists = $region_lists; $this->region_lists = $region_lists;
$this->region_city_lists = $region_city_lists; $this->region_city_lists = $region_city_lists;
$this->display(); $this->display();
...@@ -44,6 +47,7 @@ class SpAction extends CommonAction{ ...@@ -44,6 +47,7 @@ class SpAction extends CommonAction{
//添加处理 //添加处理
public function addHandle(){ public function addHandle(){
$model = D("Sp"); $model = D("Sp");
$confModel = D("Conf");
$id = I('id','',int); $id = I('id','',int);
$data['name'] = I("name"); $data['name'] = I("name");
...@@ -53,11 +57,21 @@ class SpAction extends CommonAction{ ...@@ -53,11 +57,21 @@ class SpAction extends CommonAction{
$data['remark'] = I("remark"); $data['remark'] = I("remark");
$data['status'] = I("status"); $data['status'] = I("status");
$data['push_type'] = I("push_type"); $data['push_type'] = I("push_type");
$conf = $_POST['conf'];
if($id){ if($id){
$data['id'] = $id; $data['id'] = $id;
$data["updatetime"]=date('Y-m-d H:i:s'); $data["updatetime"]=date('Y-m-d H:i:s');
$r = $model->save($data); $r = $model->save($data);
if($conf){
$confData = array();
$confModel->where("sp_id = $id")->delete();
foreach($conf as $key => $value){
$confData[] = array("sp_id"=>$id,"type_code"=>$key,"name"=>key($value),"v"=>$value[key($value)],"addtime"=>date('Y-m-d H:i:s'));
}
$confModel->addAll($confData);
}
if($r){ if($r){
echo 'true'; echo 'true';
}else{ }else{
...@@ -67,6 +81,14 @@ class SpAction extends CommonAction{ ...@@ -67,6 +81,14 @@ class SpAction extends CommonAction{
$data["addtime"]=date('Y-m-d H:i:s'); $data["addtime"]=date('Y-m-d H:i:s');
$id = $model->add($data); $id = $model->add($data);
if($conf){
$confData = array();
foreach($conf as $key => $value){
$confData[] = array("sp_id"=>$id,"type_code"=>$key,"name"=>$data['name'].key($value),"v"=>$value[key($value)],"addtime"=>date('Y-m-d H:i:s'));
}
$confModel->addAll($confData);
}
if($id){ if($id){
echo 'true'; echo 'true';
}else{ }else{
......
...@@ -19,32 +19,32 @@ body{padding:20px} ...@@ -19,32 +19,32 @@ body{padding:20px}
<form class="form-horizontal" role="form" id="ff" action="{:U('/Sp/Sp/addHandle')}" method="POST"> <form class="form-horizontal" role="form" id="ff" action="{:U('/Sp/Sp/addHandle')}" method="POST">
<input name="id" type="hidden" value="{$info.id}"/> <input name="id" type="hidden" value="{$info.id}"/>
<div class="form-group"> <div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">合作方名称</label> <label for="inputEmail3" class="col-sm-4 control-label">合作方名称</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入合作方名称" value="{$info.name}" name="name"> <input type="text" class="form-control" id="inputEmail3" placeholder="请输入合作方名称" value="{$info.name}" name="name">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">合作方代码</label> <label for="inputEmail3" class="col-sm-4 control-label">合作方代码</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入合作方代码" name="code" value="{$info.code}"> <input type="text" class="form-control" id="inputEmail3" placeholder="请输入合作方代码" name="code" value="{$info.code}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">邮箱地址</label> <label for="inputEmail3" class="col-sm-4 control-label">邮箱地址</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入邮箱地址" name="email" value="{$info.email}"> <input type="text" class="form-control" id="inputEmail3" placeholder="请输入邮箱地址" name="email" value="{$info.email}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">手机号</label> <label for="inputEmail3" class="col-sm-4 control-label">手机号</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入手机号" name="mobile" value="{$info.mobile}"> <input type="text" class="form-control" id="inputEmail3" placeholder="请输入手机号" name="mobile" value="{$info.mobile}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">是否推送</label> <label for="inputPassword3" class="col-sm-4 control-label">是否推送</label>
<div class="col-sm-9"> <div class="col-sm-6">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="push_type" id="optionsRadios4" value="1"> 推送 <input type="radio" name="push_type" id="optionsRadios4" value="1"> 推送
</label> </label>
...@@ -53,15 +53,23 @@ body{padding:20px} ...@@ -53,15 +53,23 @@ body{padding:20px}
</label> </label>
</div> </div>
</div> </div>
<volist name="conf_type_lists" id="item">
<div class="form-group"> <div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">备注</label> <label for="inputPassword3" class="col-sm-4 control-label">{$item.name}</label>
<div class="col-sm-9"> <div class="col-sm-6">
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入{$item.name}" name="conf[{$item.code}][{$item.name}]" value="{$item.v}">
</div>
</div>
</volist>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">备注</label>
<div class="col-sm-6">
<textarea class="form-control" rows="3" name="remark">{$info.remark}</textarea> <textarea class="form-control" rows="3" name="remark">{$info.remark}</textarea>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">状态</label> <label for="inputPassword3" class="col-sm-4 control-label">状态</label>
<div class="col-sm-9"> <div class="col-sm-6">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="status" id="optionsRadios4" value="1"> 禁用 <input type="radio" name="status" id="optionsRadios4" value="1"> 禁用
</label> </label>
...@@ -70,7 +78,7 @@ body{padding:20px} ...@@ -70,7 +78,7 @@ body{padding:20px}
</label> </label>
</div> </div>
</div> </div>
<div class="btnSp col-sm-5 control-label"> <div class="btnSp col-sm-7 control-label">
<input name="" type="button" class="btn btn-success" value="确定" onclick="submitForm()" {:buttonAuth('Sp','Sp','addhandle')}/>   <input name="" type="button" class="btn btn-success" value="确定" onclick="submitForm()" {:buttonAuth('Sp','Sp','addhandle')}/>  
<input name="" type="reset" class="btn btn-warning" value="取消" onclick="parentDialog.close();"/>   <input name="" type="reset" class="btn btn-warning" value="取消" onclick="parentDialog.close();"/>  
</div> </div>
...@@ -89,10 +97,10 @@ function submitForm(){ ...@@ -89,10 +97,10 @@ function submitForm(){
alert("请选择省份/城市");return; alert("请选择省份/城市");return;
} }
if(!name_v){ if(!name_v){
alert("请输入酒店名称");return; alert("请输入合作方名称");return;
} }
if(!code_v){ if(!code_v){
alert("请输入合作方酒店标识");return; alert("请输入合作方代码");return;
} }
$('#ff').form('submit', { $('#ff').form('submit', {
url:'/Sp/Sp/addHandle/', url:'/Sp/Sp/addHandle/',
......
...@@ -143,12 +143,12 @@ function enable(status){ ...@@ -143,12 +143,12 @@ function enable(status){
} }
} }
function add(){ function add(){
pop(800,450,true,'dg','datagrid','/Sp/Sp/add/') pop(800,600,true,'dg','datagrid','/Sp/Sp/add/')
} }
function edit(){ function edit(){
var row = $('#dg').datagrid('getSelected'); var row = $('#dg').datagrid('getSelected');
if (row){ if (row){
pop(800,450,true,'dg','datagrid','/Sp/Sp/add/id/'+row.id); pop(800,600,true,'dg','datagrid','/Sp/Sp/add/id/'+row.id);
}else{ }else{
$.messager.alert('提示', '请选择要操作的记录!','info'); $.messager.alert('提示', '请选择要操作的记录!','info');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment