作者 张佳

<?php
namespace app\common\model\serviceapi;
use app\common\model\ServiceApi;
/**
* 功能描述 用户管理
* Class Product
* @package app\common\model\commapi
* Date: 2020/11/2
* Time: 16:33
* @author nyq
*/
class Department extends ServiceApi
{
protected $table = "sos_user_department";
protected $pk = "id";
/**
* 函数功能描述 添加用户
* Date: 2020/11/2
* Time: 15:00
* @author nyq
*/
public function add($data)
{
$res = static::insertGetId($data);
return $res;
}
/**
* Notes:函数功能描述 获取机构列表
* User: 张佳
* DateTime: 2021/6/9 18:19
*/
public function getDepartmentList($where)
{
$list = static::where($where)->select();
return $list;
}
/**
* 函数功能描述 获取商品列表
* Date: 2020/11/2
* Time: 16:40
* @author nyq
*/
public function getUserlist($code,$offset,$rows){
$user = static::alias("user")->where($code)->limit($offset,$rows);
$res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
->select();
return $res;
}
public function getUserlistToEx(){
$user = static::alias("user");
$res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
->select();
return $res;
}
}
\ No newline at end of file
... ...
<?php
namespace app\products\controller;
use app\web\controller\BaseController;
use think\Db;
use think\Request;
use util\MCurl;
use think\Cookie;
use think\Session;
use app\common\model\products\department as departmentModel;
header("Content-type: text/html; charset=utf-8");
header('Access-Control-Allow-Origin:*');
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
/**
* 功能描述 妇记通获客
* Class Product
* @package app\FuJiTong\controller
* Date: 2021/5/6
* Time: 10:00
* @author nyq
*/
class Department extends BaseController
{
/**
* Notes:函数功能描述 获取部门列表
* User: 张佳
* DateTime: 2021/6/9 18:00
*/
public function department_list(Request $request)
{
$data = $request->param();
$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$offset=($page-1)*$rows;
$data['offset']=$offset;
$data['rows']=$rows;
$where=[];
if(!empty($data['result'])){
$where['departmentName']=['like', '%' . $data['result'] . '%'];
}
//$org_id = session('organization.org_id');
$list= Db::table('sos_user_department')->alias('d')->join("sos_user_mechanism m", "m.id=d.mechanismId")->field('d.id,d.departmentName,d.createTime,mechanismName')->where($where)->limit($offset,$rows)->select()->toArray();
$total= Db::table('sos_user_department')->where($where)->count();
foreach($list as $key=>$val ){
$list[$key]['createTime']=$val['createTime'] == ''? '' : date('Y-m-d H:i:s',$val['createTime']);
}
$result["total"] =$total;
$result['rows']=$list;
echo json_encode($result);
}
/**
* Notes:函数功能描述 新增部门
* User: 张佳
* DateTime: 2021/6/10 10:55
*/
public function department_add(Request $request)
{
$data = $request->param();
if(isset($data['id'])){
$info = [
'mechanismId'=>$data['mechanism'],
'departmentName'=>$data['name'],
];
$res = Db::table('sos_user_department')->where(['id'=>$data['id']])->update($info);
if($res){
return json(['code'=>200,'msg'=>'修改部门成功']);
}else{
return json(['code'=>100,'msg'=>'修改部门失败']);
}
}
$info = [
'mechanismId'=>$data['mechanism'],
'departmentName'=>$data['name'],
'createTime'=>time()
];
$res = Db::table('sos_user_department')->insert($info);
if($res){
return json(['code'=>200,'msg'=>'新增部门成功']);
}else{
return json(['code'=>100,'msg'=>'新增部门失败']);
}
}
/**
* Notes:函数功能描述 获取部门详情
* User: 张佳
* DateTime: 2021/6/10 11:07
*/
public function getDepartment(Request $request)
{
$data = $request->param();
$res = Db::table('sos_user_department')->where(['id'=>$data['id']])->find();
return $res;
}
}
\ No newline at end of file
... ...
<?php
namespace app\products\model;
use app\common\model\serviceapi\Department as DepartmentModel;
/**3
* Notes:功能描述 机构表
* User: 张佳
* DateTime: 2021/6/9 18:03
* Class Mechanism
* @package app\products\model
*/
class Department extends DepartmentModel
{
}
\ No newline at end of file
... ...
<?php
namespace app\web\controller;
use think\Session;
use think\Cookie;
use think\Request;
use app\web\validate\User as UserValidate;
/**
* 部门管理
* Class FuJiTong
* @package app\web\controller
*/
class Department extends BaseController
{
//列表
public function index()
{
$this->view->engine->layout(false);
return $this->fetch();
}
}
\ No newline at end of file
... ...
<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>表单填写</title>
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
<style>
#fm>div {
width: 100%;
display: flex;
justify-content: space-around;
margin: 10px 0;
}
#fm>div input{
width: 180px;
}
</style>
</head>
<body style="margin-bottom: 54px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="部门列表" id="saveBox" style="width:100%;">
<div class="easyui-panel" style="width:100%;max-width:100%;padding: 5px 5px">
<div style="margin-bottom:5px;">
<a id="name_add_but" href="#" data-options="iconCls:'icon-add'" class="my_but" style="vertical-align: middle;">新增</a>
</div>
</div>
<table id="dg" style="width: 100%; height: 100%"
data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'">
</table>
<div id="tb" style="padding:5px;height:auto">
<div>
部门名称: <input class="easyui-textbox" type="text" id='departmentNames' name='departmentNames'>
<a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a>
</div>
</div>
</div>
</div>
<div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons">
<form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
<table style="padding: 10px 20px;" cellspacing="10">
<tr>
<td>部门名称:</td>
<td><input class="easyui-textbox" type="text" name="name" id="name" /></td>
<input class="easyui-textbox" type="hidden" name="id" id="id" />
</tr>
<tr>
<td>所属机构:</td>
<td>
<input id="cc1" name="mechanism" class="easyui-combobox" data-options="
valueField: 'id',
textField: 'mechanismName',
url: '/products/role/getMechanism',
onSelect: function(rec){
var url = '/products/role/getDepartment?id='+rec.id;
$.ajax({
url:url,
success:function(a){
var arr1=JSON.parse(a);
console.log(JSON.parse(a))
$('#cc2').combobox({
data:JSON.parse(a),
valueField:'id',
textField: 'departmentName',
});
}
})
}">
</td>
</tr>
<div id="dlg-buttons" style="display: block">
<a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#win').dialog('close')" style="width: 90px">取消</a>
</div>
</table>
</form>
</div>
</body>
<tbody id="html_table"></tbody>
<script type="text/javascript" src="/assets/web/js/src/common_fu.js"></script>
<script>
//添加
$('#name_add_but').linkbutton({
onClick: function () {
addFile();
}
});
//下拉框搜索
init_datagrid('/products/department/department_list', 0);
//下拉框搜索
$('#search_buttn').bind('click', function() {
var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存
if(_data && _data.options){
_data.options.pageNumber = 1; // 修改缓存
}
$.data($('#dg')[0], 'datagrid', _data); // 把修改写回去
var result=$('#departmentNames').textbox('getValue');
console.log(result)
//ajax请求数据
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/department/department_list",
success: function(data) {
console.log(data)
//
},
error:function(data){
console.log(data)
}
});
var result = {
result,
}
// console.log(result);return false;
init_datagrid('/products/department/department_list', result);
});
function init_datagrid(data_url, res) {
//表头字段
var arr_columns = dg_columns();
$("#dg").datagrid({
rownumbers:true,
singleSelect:true,
pagination:true,
url:data_url,
queryParams: res,
method:'post',
columns: [arr_columns],
loadMsg: '正在加载数据',
emptyMsg: '列表为空',
});
}
function dg_columns() {
var arr = new Array();
arr.push({
field: 'mechanismName',
title: '所属机构',
width: 200,
align: 'center'
});
arr.push({
field: 'departmentName',
title: '部门名称',
width: 300,
align: 'center'
});
arr.push({
field: 'createTime',
title: '创建时间',
width: 200,
align: 'center'
});
arr.push({
field: 'id',
title: '操作',
width: 90,
align: 'center',
formatter:formatOper
});
//操作框
function formatOper(val, row, index) {
return '<a href="javascript:void(0)" onclick="showUser(' + val+','+ row.id + ')">编辑</a> ';
}
// console.log(arr)
return arr;
}
function addFile(){
rule_id='';
$('#entryTime').textbox({disabled:false})
$('#win').form('clear')
$('#win').dialog({
title: '新增部门',
width: 800,
height: "auto",
top:20,
closed: false,//显示对话框
cache: false,
modal: true
});
}
//修改
function showUser(val,row){
if(row){
console.log(row)
var result = {
id:row
}
$("#win").dialog("open").dialog("setTitle","部门信息修改");
//ajax请求数据
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/department/getDepartment",
success: function(data) {
var arr = data;
console.log(arr)
$('#name').textbox('setValue',arr.departmentName);
$('#id').textbox('setValue',arr.id);
$('#cc1').combobox('select',arr.mechanismId);
//
},
error:function(data){
console.log(data)
}
});
}
}
function submitForm(){
$('#fm').form('submit', {
url:'/products/department/department_add',
onSubmit: function(){
console.log($(this))
// do some check
// return false to prevent submit;
},
success:function(data){
console.log(data);
var arr = JSON.parse(data);
$.messager.alert("提示", arr.msg);
$('#dg').datagrid('reload');
// console.log(data);
//$.messager.alert('',msg);
//console.log(data);
//alert(data)
}
});
$('#win').dialog({
closed: true, // 隱藏列表
});
}
</script>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>登录</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="renderer" content="webkit"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<meta name="apple-mobile-web-app-title" content="联通销售系统"/>
<meta name="robots" content="all" />
<link href="/assets/web/css/bootstrap.min.css" rel="stylesheet" />
<link href="/assets/web/css/login.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="bookmark" href="/favicon.ico"/>
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/operation.login.js"></script>
<script type="text/javascript">
if (window.top !== window.self) {
window.top.location = window.location
};
</script>
<style type="text/css">
.browser-happy {position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100%;z-index:999;background:#24a6fa}
.browser-happy .content {text-align:center;color:#fff;font-size:24px;padding-top:100px}
.browser-happy .content a {display:inline-block;padding:10px 20px;border:2px solid #fff;text-decoration:none;color:#fff}
body {font-family:Microsoft YaHei;}
</style>
</head>
<body class="signin">
<div class="signinpanel">
<div class="row">
<div class="col-sm-7">
<div class="signin-info">
<div class="logopanel m-b">
<h1>
永保抽奖管理系统
<span style="font-size:.3em;"></span>
</h1>
</div>
<div class="m-b"></div>
<h5>旗舰版V202005</h5>
<ul class="m-b">
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>专注于用户体验创新</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>打造智能互联网式体验设计</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>专注于用户体验策略与研究</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>为用户提供全面系统的服务</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>开启互联网营销新时代</li>
</ul>
</div>
</div>
<div class="col-sm-5">
<form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
<table style="padding: 10px 20px;" cellspacing="10">
<h4 class="no-margins">用户登录</h4>
<p class="m-t-md"></p>
<input type="text" class="form-control uname" name="name" maxlength="20" placeholder="用户名" />
<input type="password" class="form-control pword m-b" name="pwd" maxlength="12" placeholder="密码" />
<button type="button" class="btn btn-success btn-block" onclick="submitForm()">登录</button>
</table>
</form>
</div>
</div>
<div class="signup-footer"><div class="pull-left">&copy; 2020 JITNRY.COM All Rights Reserved. ******** 科技有限公司 客服热线: ***********</div></div>
</div>
</body>
<script>
function submitForm(){
$('#fm').form('submit', {
url:'/web/prize/tologin',
onSubmit: function(){
console.log($(this))
},
success:function(data){
var arr = JSON.parse(data);
if(arr.code == 100){
$.messager.alert("提示", arr.msg);
}else{
$.messager.alert("提示", arr.msg);
window.location.href="/";
}
console.log(arr);
}
});
}
</script>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>表单填写</title>
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
<!--富文本编辑器-->
<link rel="stylesheet" href="/assets/kindeditor/themes/default/default.css" />
<script src="/assets/kindeditor/kindeditor.js"></script>
<script src="/assets/kindeditor/kindeditor-all.js"></script>
<script src="/assets/kindeditor/kindeditor-all-min.js"></script>
<script charset="utf-8" src="/assets/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/assets/kindeditor/lang/zh_CN.js"></script>
</head>
<body style="margin-bottom: 54px;">
<div class="easyui-layout" data-options="fit:true">
<!-- <div data-options="region:'north',title:'头部',split:true" style="height:100px;"> -->
<!-- </div> -->
<!-- <div data-options="region:'east',title:'确认信息',split:true" style="width:100px;"></div> -->
<div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="订单列表" id="saveBox" style="width:100%;">
<div class="easyui-panel" style="width:100%;max-width:100%;padding: 20px 10px">
<div style="margin-bottom:5px;">
<a id="derive_btn" href="/products/product/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>
</div>
</div>
<table id="dg" style="width: 100%; height: 75%"
data-options="rownumbers:true,singleSelect:true,pagination:true,url:'/products/product/get_order_list',method:'get',
onDblClickRow :function(rowIndex,rowData){
memnerid = rowData;
showSelectedSurveryDataOnMap(rowData);
}">
<thead>
<tr>
<th data-options="field:'order_code',width:150,align:'center'">订单编号</th>
<th data-options="field:'goods_name',width:150,align:'center'">商品名称</th>
<th data-options="field:'name',width:100,align:'center'">用户名</th>
<th data-options="field:'phone',width:150,align:'center'">电话</th>
<th data-options="field:'address',width:250,align:'center'">详细地址</th>
<th data-options="field:'num',width:80,align:'center'">产品数量</th>
<th data-options="field:'price',width:100,align:'center'">总金额</th>
<th data-options="field:'addTime',width:200,align:'center'">下单时间</th>
<th width="50" data-options="field:'id',formatter:formatOper">操作</th>
</tr>
</thead>
</table>
</div>
<!-- <div data-options="region:'south',title:'South Title',split:true" style="height:100px;"></div> -->
</div>
</body>
<tbody id="html_table"></tbody>
<script type="text/javascript" src="/assets/web/js/src/common_product.js"></script>
<script>
function formatOper(val, row, index) {
return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">删除</a>';
}
//删除
function showUser(row){
if(confirm("确实要删除?")){
var result = {
id:row
}
$.ajax({
url:'/products/product/order_del',
type: "post",
data: result,
success: function (data) {
console.log(data);
$('#dg').datagrid('reload');
$.messager.alert("提示", data.msg);
},
error:function(data){
console.log(data)
}
})
}
}
</script>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>表单填写</title>
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
</head>
<body style="margin-bottom: 54px;">
<div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="false" buttons="#dlg-buttons">
<form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
<table style="padding: 10px 20px;" cellspacing="10">
<!-- <tr style="">-->
<!-- <td>名称:</td>-->
<!-- <td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>-->
<!-- <input class="easyui-textbox" id="prize_id" name="prize_id" type="hidden">-->
<!-- </tr>-->
<tr>
<td>重置资格:</td>
<td> <a id="name_add_but" href="#" data-options="iconCls:'icon-edit'" class="my_but" style="vertical-align: middle;">重置</a></td>
</tr>
<tr>
<td>抽奖次数:</td>
<td><input class="easyui-textbox" type="number" name="number" id="old_number" /></td>
<input class="easyui-textbox" id="rule_id" name="rule_id" type="hidden">
</tr>
<tr>
<td>是否开启:</td>
<td><input id="statusId" name="open" class="easyui-switchbutton" style="height:30px"></td>
</tr>
<tr>
<td>抽奖规则:</td>
<td><input class="easyui-textbox" id="title" name="title" data-options="multiline:true" style="height:100px;width: 500px"></td>
</tr>
<!-- <div id="html_table"></div>-->
<div id="dlg-buttons" style="display: block">
<a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">修改</a>
<!-- <a id="name_add_but111" href="#" data-options="iconCls:'icon-edit'" class="my_but" style="vertical-align: middle;">重置</a>-->
</div>
</table>
</form>
</div>
</body>
<tbody id="html_table"></tbody>
<script type="text/javascript" src="/assets/web/js/src/common_prize.js"></script>
<script>
$(function(){
addFile();
})
function addFile(){
$('#win').dialog({
title: '规则设置',
width: 800,
height: "auto",
top:150,
closed: false,//显示对话框
cache: false,
modal: true,
closable:false
});
var result='';
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/prize/prize_rule",
success: function(arr) {
//var arr = JSON.parse(data);
// console.log(arr);
$('#rule_id').textbox('setValue',arr.id);
$('#old_number').textbox('setValue',arr.number);
if(arr.open == "1") {
$('#statusId').switchbutton('check');
}else {
$('#statusId').switchbutton('uncheck');
}
$('#title').textbox('setValue',arr.title);
},
error:function(data){
console.log(data)
}
});
}
//提交
function submitForm(){
$('#fm').form('submit', {
url:'/products/prize/prize_rule_edit',
onSubmit: function(){
console.log($(this))
},
success:function(data){
var arr = JSON.parse(data);
console.log(arr);
$.messager.alert("提示", arr.msg);
}
});
}
//添加
$('#name_add_but').linkbutton({
onClick: function () {
editFile();
}
});
function editFile(){
var id='';
if(confirm("确实要重置抽奖资格?")){
$.ajax({
url:'/products/prize/prize_reset',
type: "POST",
data: id,
contentType: false,
processData: false,
success: function (data) {
console.log(data);
$.messager.alert("提示", data.msg);
},
error:function(data){
console.log(data)
}
})
}else {
alert("已经取消了操作");
}
}
</script>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>表单填写</title>
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
</head>
<body style="margin-bottom: 54px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" id="saveBox" style="width:100%;">
<table class="easyui-datagrid" title="中奖用户列表" id="dg" style="width: 100%; height: 75%"
data-options="rownumbers:true,singleSelect:true,pagination:true,url:'/products/prize/prize_user_list',method:'get',
onDblClickRow :function(rowIndex,rowData){
memnerid = rowData;
showSelectedSurveryDataOnMap(rowData);
},toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'uname',width:250,align:'center'">名称</th>
<th data-options="field:'phone',width:200,align:'center'">电话</th>
<th data-options="field:'prizeName',width:250,align:'center'">奖品名称</th>
<th data-options="field:'source',width:200,align:'center'">部门</th>
<th data-options="field:'addTime',width:300,align:'center'">中奖时间</th>
<th width="50" data-options="field:'id',formatter:formatOper">操作</th>
</tr>
</thead>
</table>
<div id="tb" style="padding:5px;height:auto">
<div>
部门:
<input class="easyui-combobox" style="width:125px" name="materialname" id="materialname"
data-options="valueField:'id',
textField:'text',
data:
[{ 'id':'',
'text':'全部' ,
selected:true
},{
'id':'department1',
'text':'区部一'
},{
'id':'department2',
'text':'区部二'
}] ,panelHeight:'auto',onChange:function(){getweight();}
"/>
Date From: <input class="easyui-datebox" id='start' name='start' style="width:180px">
To: <input class="easyui-datebox" id='end' name='end' style="width:180px">
Phone: <input class="easyui-numberbox" type="text" id='phone' name='phone'>
<a href="#" class="easyui-linkbutton" id="search_btn" iconCls="icon-search">搜索</a>
<a id="derive_btn" href="/products/prize/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>
</div>
</div>
</div>
</div>
</body>
<tbody id="html_table"></tbody>
<script>
//设置操作按钮
function formatOper(val, row, index) {
return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">删除</a>';
}
//删除
function showUser(row){
if(confirm("确实要删除?")){
var result = {
id:row
}
$.ajax({
url:'/products/prize/del_user',
type: "post",
data: result,
success: function (data) {
console.log(data);
$('#dg').datagrid('reload');
$.messager.alert("提示", data.msg);
},
error:function(data){
console.log(data)
}
})
}
}
//下拉框搜索
function getweight(){
var source=$('#materialname').combobox('getValue');
var start = $("#start").val();
var end = $("#end").val();
var phone = $("#phone").val();
if(phone.length>0){
if(phone.length!=11){
$.messager.alert('检索手机号','手机号格式错误,请重新输入');
return false;
}
}
var result = {
source,
start,
end,
phone
}
init_datagrid('/products/prize/prize_user_list', result);
}
//时间搜索
//搜索按钮
$('#search_btn').bind('click', function() {
var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存
if(_data && _data.options){
_data.options.pageNumber = 1; // 修改缓存
}
$.data($('#dg')[0], 'datagrid', _data); // 把修改写回去
var source=$('#materialname').combobox('getValue');
var start = $("#start").val();
var end = $("#end").val();
var phone = $("#phone").val();
if(phone.length>0){
if(phone.length!=11){
$.messager.alert('检索手机号','手机号格式错误,请重新输入');
return false;
}
}
var result = {
source,
start,
end,
phone
}
// console.log(result);return false;
init_datagrid('/products/prize/prize_user_list', result);
});
function init_datagrid(data_url, res) {
//表头字段
var arr_columns = dg_columns();
$("#dg").datagrid({
rownumbers:true,
singleSelect:true,
pagination:true,
url:data_url,
queryParams: res,
method:'post',
columns: [arr_columns],
loadMsg: '正在加载数据',
emptyMsg: '列表为空',
});
}
function dg_columns() {
var arr = new Array();
arr.push({
field: 'uname',
title: '名称',
width: 250,
align: 'center'
});
arr.push({
field: 'phone',
title: '电话',
width: 200,
align: 'center'
});
arr.push({
field: 'prizeName',
title: '奖品名称',
width: 250,
align: 'center'
});
arr.push({
field: 'source',
title: '部门',
width: 200,
align: 'center'
});
arr.push({
field: 'addTime',
title: '中奖时间',
width: 200,
align: 'center'
});
arr.push({
field: 'id',
formatter:formatOper,
title: '操作',
width: 200,
align: 'center'
});
// console.log(arr)
return arr;
}
//添加
$('#name_add_but').linkbutton({
onClick: function () {
addFile();
}
});
function addFile(){
var id='';
if(confirm("确实要重置抽奖次数?")){
$.ajax({
url:'/products/prize/prize_reset',
type: "POST",
data: id,
contentType: false,
processData: false,
success: function (data) {
console.log(data);
$.messager.alert("提示", data.msg);
},
error:function(data){
console.log(data)
}
})
}else {
alert("已经取消了操作");
}
}
</script>
</html>
\ No newline at end of file
... ...