作者 张佳

  1 +<?php
  2 +namespace app\common\model\serviceapi;
  3 +use app\common\model\ServiceApi;
  4 +
  5 +/**
  6 + * 功能描述 用户管理
  7 + * Class Product
  8 + * @package app\common\model\commapi
  9 + * Date: 2020/11/2
  10 + * Time: 16:33
  11 + * @author nyq
  12 + */
  13 +class Department extends ServiceApi
  14 +{
  15 + protected $table = "sos_user_department";
  16 + protected $pk = "id";
  17 +
  18 +
  19 + /**
  20 + * 函数功能描述 添加用户
  21 + * Date: 2020/11/2
  22 + * Time: 15:00
  23 + * @author nyq
  24 + */
  25 + public function add($data)
  26 + {
  27 + $res = static::insertGetId($data);
  28 + return $res;
  29 + }
  30 +
  31 + /**
  32 + * Notes:函数功能描述 获取机构列表
  33 + * User: 张佳
  34 + * DateTime: 2021/6/9 18:19
  35 + */
  36 + public function getDepartmentList($where)
  37 + {
  38 + $list = static::where($where)->select();
  39 + return $list;
  40 + }
  41 + /**
  42 + * 函数功能描述 获取商品列表
  43 + * Date: 2020/11/2
  44 + * Time: 16:40
  45 + * @author nyq
  46 + */
  47 +
  48 + public function getUserlist($code,$offset,$rows){
  49 + $user = static::alias("user")->where($code)->limit($offset,$rows);
  50 + $res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
  51 + ->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
  52 + ->select();
  53 + return $res;
  54 + }
  55 +
  56 + public function getUserlistToEx(){
  57 + $user = static::alias("user");
  58 + $res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
  59 + ->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
  60 + ->select();
  61 + return $res;
  62 + }
  63 +
  64 +
  65 +
  66 +
  67 +
  68 +
  69 +
  70 +
  71 +
  72 +
  73 +
  74 +
  75 +
  76 +
  77 +
  78 +
  79 +}
  1 +<?php
  2 +namespace app\products\controller;
  3 +
  4 +use app\web\controller\BaseController;
  5 +use think\Db;
  6 +use think\Request;
  7 +use util\MCurl;
  8 +use think\Cookie;
  9 +use think\Session;
  10 +use app\common\model\products\department as departmentModel;
  11 +header("Content-type: text/html; charset=utf-8");
  12 +header('Access-Control-Allow-Origin:*');
  13 +header('Content-Type: application/json; charset=utf-8');
  14 +header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
  15 +header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
  16 +/**
  17 + * 功能描述 妇记通获客
  18 + * Class Product
  19 + * @package app\FuJiTong\controller
  20 + * Date: 2021/5/6
  21 + * Time: 10:00
  22 + * @author nyq
  23 + */
  24 +class Department extends BaseController
  25 +{
  26 +
  27 + /**
  28 + * Notes:函数功能描述 获取部门列表
  29 + * User: 张佳
  30 + * DateTime: 2021/6/9 18:00
  31 + */
  32 + public function department_list(Request $request)
  33 + {
  34 + $data = $request->param();
  35 + $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
  36 + $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
  37 + $offset=($page-1)*$rows;
  38 + $data['offset']=$offset;
  39 + $data['rows']=$rows;
  40 + $where=[];
  41 +
  42 + if(!empty($data['result'])){
  43 + $where['departmentName']=['like', '%' . $data['result'] . '%'];
  44 + }
  45 + //$org_id = session('organization.org_id');
  46 + $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();
  47 + $total= Db::table('sos_user_department')->where($where)->count();
  48 +
  49 + foreach($list as $key=>$val ){
  50 + $list[$key]['createTime']=$val['createTime'] == ''? '' : date('Y-m-d H:i:s',$val['createTime']);
  51 + }
  52 + $result["total"] =$total;
  53 + $result['rows']=$list;
  54 + echo json_encode($result);
  55 + }
  56 +
  57 + /**
  58 + * Notes:函数功能描述 新增部门
  59 + * User: 张佳
  60 + * DateTime: 2021/6/10 10:55
  61 + */
  62 + public function department_add(Request $request)
  63 + {
  64 + $data = $request->param();
  65 + if(isset($data['id'])){
  66 +
  67 + $info = [
  68 + 'mechanismId'=>$data['mechanism'],
  69 + 'departmentName'=>$data['name'],
  70 + ];
  71 +
  72 + $res = Db::table('sos_user_department')->where(['id'=>$data['id']])->update($info);
  73 + if($res){
  74 + return json(['code'=>200,'msg'=>'修改部门成功']);
  75 + }else{
  76 + return json(['code'=>100,'msg'=>'修改部门失败']);
  77 + }
  78 + }
  79 + $info = [
  80 + 'mechanismId'=>$data['mechanism'],
  81 + 'departmentName'=>$data['name'],
  82 + 'createTime'=>time()
  83 + ];
  84 + $res = Db::table('sos_user_department')->insert($info);
  85 + if($res){
  86 + return json(['code'=>200,'msg'=>'新增部门成功']);
  87 + }else{
  88 + return json(['code'=>100,'msg'=>'新增部门失败']);
  89 + }
  90 + }
  91 +
  92 + /**
  93 + * Notes:函数功能描述 获取部门详情
  94 + * User: 张佳
  95 + * DateTime: 2021/6/10 11:07
  96 + */
  97 + public function getDepartment(Request $request)
  98 + {
  99 + $data = $request->param();
  100 + $res = Db::table('sos_user_department')->where(['id'=>$data['id']])->find();
  101 + return $res;
  102 + }
  103 +
  104 +
  105 +}
  1 +<?php
  2 +
  3 +
  4 +namespace app\products\model;
  5 +
  6 +use app\common\model\serviceapi\Department as DepartmentModel;
  7 +
  8 +/**3
  9 + * Notes:功能描述 机构表
  10 + * User: 张佳
  11 + * DateTime: 2021/6/9 18:03
  12 + * Class Mechanism
  13 + * @package app\products\model
  14 + */
  15 +class Department extends DepartmentModel
  16 +{
  17 +
  18 +
  19 +}
  1 +<?php
  2 +
  3 +namespace app\web\controller;
  4 +
  5 +use think\Session;
  6 +use think\Cookie;
  7 +use think\Request;
  8 +use app\web\validate\User as UserValidate;
  9 +
  10 +/**
  11 + * 部门管理
  12 + * Class FuJiTong
  13 + * @package app\web\controller
  14 + */
  15 +class Department extends BaseController
  16 +{
  17 + //列表
  18 + public function index()
  19 + {
  20 + $this->view->engine->layout(false);
  21 + return $this->fetch();
  22 + }
  23 +
  24 +}
  1 +<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>表单填写</title>
  6 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
  7 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
  8 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
  9 + <link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
  10 + <link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
  11 + <script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
  12 + <script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
  13 + <script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
  14 + <!-- 插件调用 --->
  15 + <script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
  16 + <script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
  17 + <!-- 基础 JS 调用 -->
  18 + <script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
  19 + <script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
  20 + <style>
  21 + #fm>div {
  22 + width: 100%;
  23 + display: flex;
  24 + justify-content: space-around;
  25 + margin: 10px 0;
  26 + }
  27 + #fm>div input{
  28 + width: 180px;
  29 + }
  30 + </style>
  31 +</head>
  32 +<body style="margin-bottom: 54px;">
  33 + <div class="easyui-layout" data-options="fit:true">
  34 + <div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="部门列表" id="saveBox" style="width:100%;">
  35 + <div class="easyui-panel" style="width:100%;max-width:100%;padding: 5px 5px">
  36 + <div style="margin-bottom:5px;">
  37 + <a id="name_add_but" href="#" data-options="iconCls:'icon-add'" class="my_but" style="vertical-align: middle;">新增</a>
  38 + </div>
  39 + </div>
  40 + <table id="dg" style="width: 100%; height: 100%"
  41 + data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'">
  42 +
  43 + </table>
  44 +
  45 + <div id="tb" style="padding:5px;height:auto">
  46 + <div>
  47 + 部门名称: <input class="easyui-textbox" type="text" id='departmentNames' name='departmentNames'>
  48 + <a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a>
  49 + </div>
  50 + </div>
  51 + </div>
  52 + </div>
  53 + <div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons">
  54 + <form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
  55 + <table style="padding: 10px 20px;" cellspacing="10">
  56 + <tr>
  57 + <td>部门名称:</td>
  58 + <td><input class="easyui-textbox" type="text" name="name" id="name" /></td>
  59 + <input class="easyui-textbox" type="hidden" name="id" id="id" />
  60 + </tr>
  61 +
  62 + <tr>
  63 + <td>所属机构:</td>
  64 + <td>
  65 +
  66 + <input id="cc1" name="mechanism" class="easyui-combobox" data-options="
  67 + valueField: 'id',
  68 + textField: 'mechanismName',
  69 + url: '/products/role/getMechanism',
  70 + onSelect: function(rec){
  71 + var url = '/products/role/getDepartment?id='+rec.id;
  72 + $.ajax({
  73 + url:url,
  74 + success:function(a){
  75 + var arr1=JSON.parse(a);
  76 + console.log(JSON.parse(a))
  77 + $('#cc2').combobox({
  78 + data:JSON.parse(a),
  79 + valueField:'id',
  80 + textField: 'departmentName',
  81 + });
  82 +
  83 + }
  84 + })
  85 +
  86 + }">
  87 +
  88 + </td>
  89 + </tr>
  90 +
  91 +
  92 + <div id="dlg-buttons" style="display: block">
  93 + <a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">提交</a>
  94 + <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#win').dialog('close')" style="width: 90px">取消</a>
  95 + </div>
  96 +
  97 +
  98 + </table>
  99 + </form>
  100 + </div>
  101 +
  102 +</body>
  103 +<tbody id="html_table"></tbody>
  104 +<script type="text/javascript" src="/assets/web/js/src/common_fu.js"></script>
  105 +
  106 +<script>
  107 +
  108 + //添加
  109 + $('#name_add_but').linkbutton({
  110 + onClick: function () {
  111 +
  112 + addFile();
  113 + }
  114 + });
  115 + //下拉框搜索
  116 + init_datagrid('/products/department/department_list', 0);
  117 +
  118 + //下拉框搜索
  119 +
  120 +
  121 + $('#search_buttn').bind('click', function() {
  122 +
  123 + var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存
  124 + if(_data && _data.options){
  125 + _data.options.pageNumber = 1; // 修改缓存
  126 + }
  127 + $.data($('#dg')[0], 'datagrid', _data); // 把修改写回去
  128 +
  129 +
  130 + var result=$('#departmentNames').textbox('getValue');
  131 + console.log(result)
  132 + //ajax请求数据
  133 + $.ajax({
  134 + type: "post",
  135 + data: result,
  136 + async: false,
  137 + url: "/products/department/department_list",
  138 + success: function(data) {
  139 + console.log(data)
  140 + //
  141 +
  142 + },
  143 + error:function(data){
  144 + console.log(data)
  145 + }
  146 + });
  147 + var result = {
  148 + result,
  149 + }
  150 + // console.log(result);return false;
  151 + init_datagrid('/products/department/department_list', result);
  152 +
  153 +
  154 +
  155 +
  156 + });
  157 +
  158 +
  159 + function init_datagrid(data_url, res) {
  160 +
  161 + //表头字段
  162 + var arr_columns = dg_columns();
  163 + $("#dg").datagrid({
  164 + rownumbers:true,
  165 + singleSelect:true,
  166 + pagination:true,
  167 + url:data_url,
  168 + queryParams: res,
  169 + method:'post',
  170 + columns: [arr_columns],
  171 + loadMsg: '正在加载数据',
  172 + emptyMsg: '列表为空',
  173 + });
  174 + }
  175 + function dg_columns() {
  176 + var arr = new Array();
  177 + arr.push({
  178 + field: 'mechanismName',
  179 + title: '所属机构',
  180 + width: 200,
  181 + align: 'center'
  182 + });
  183 + arr.push({
  184 + field: 'departmentName',
  185 + title: '部门名称',
  186 + width: 300,
  187 + align: 'center'
  188 + });
  189 + arr.push({
  190 + field: 'createTime',
  191 + title: '创建时间',
  192 + width: 200,
  193 + align: 'center'
  194 + });
  195 + arr.push({
  196 + field: 'id',
  197 + title: '操作',
  198 + width: 90,
  199 + align: 'center',
  200 + formatter:formatOper
  201 + });
  202 + //操作框
  203 + function formatOper(val, row, index) {
  204 +
  205 + return '<a href="javascript:void(0)" onclick="showUser(' + val+','+ row.id + ')">编辑</a> ';
  206 +
  207 + }
  208 + // console.log(arr)
  209 + return arr;
  210 + }
  211 + function addFile(){
  212 + rule_id='';
  213 + $('#entryTime').textbox({disabled:false})
  214 + $('#win').form('clear')
  215 + $('#win').dialog({
  216 + title: '新增部门',
  217 + width: 800,
  218 + height: "auto",
  219 + top:20,
  220 + closed: false,//显示对话框
  221 + cache: false,
  222 + modal: true
  223 + });
  224 + }
  225 +
  226 + //修改
  227 + function showUser(val,row){
  228 + if(row){
  229 + console.log(row)
  230 +
  231 + var result = {
  232 + id:row
  233 + }
  234 + $("#win").dialog("open").dialog("setTitle","部门信息修改");
  235 +
  236 + //ajax请求数据
  237 + $.ajax({
  238 + type: "post",
  239 + data: result,
  240 + async: false,
  241 + url: "/products/department/getDepartment",
  242 + success: function(data) {
  243 + var arr = data;
  244 + console.log(arr)
  245 + $('#name').textbox('setValue',arr.departmentName);
  246 + $('#id').textbox('setValue',arr.id);
  247 +
  248 + $('#cc1').combobox('select',arr.mechanismId);
  249 + //
  250 +
  251 + },
  252 + error:function(data){
  253 + console.log(data)
  254 + }
  255 + });
  256 + }
  257 + }
  258 + function submitForm(){
  259 + $('#fm').form('submit', {
  260 + url:'/products/department/department_add',
  261 + onSubmit: function(){
  262 + console.log($(this))
  263 + // do some check
  264 + // return false to prevent submit;
  265 + },
  266 + success:function(data){
  267 + console.log(data);
  268 + var arr = JSON.parse(data);
  269 + $.messager.alert("提示", arr.msg);
  270 + $('#dg').datagrid('reload');
  271 + // console.log(data);
  272 + //$.messager.alert('',msg);
  273 + //console.log(data);
  274 + //alert(data)
  275 + }
  276 + });
  277 + $('#win').dialog({
  278 + closed: true, // 隱藏列表
  279 + });
  280 + }
  281 +
  282 +</script>
  283 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta charset="utf-8"/>
  5 + <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  6 + <title>登录</title>
  7 + <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8 + <meta name="renderer" content="webkit"/>
  9 + <meta http-equiv="Cache-Control" content="no-siteapp"/>
  10 + <meta name="apple-mobile-web-app-title" content="联通销售系统"/>
  11 + <meta name="robots" content="all" />
  12 + <link href="/assets/web/css/bootstrap.min.css" rel="stylesheet" />
  13 + <link href="/assets/web/css/login.min.css" rel="stylesheet" />
  14 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/default/easyui.css" />
  15 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
  16 + <link rel="bookmark" href="/favicon.ico"/>
  17 + <script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
  18 + <script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
  19 + <script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
  20 + <script type="text/javascript" src="/assets/web/js/src/operation.login.js"></script>
  21 +
  22 + <script type="text/javascript">
  23 + if (window.top !== window.self) {
  24 + window.top.location = window.location
  25 + };
  26 + </script>
  27 + <style type="text/css">
  28 + .browser-happy {position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100%;z-index:999;background:#24a6fa}
  29 + .browser-happy .content {text-align:center;color:#fff;font-size:24px;padding-top:100px}
  30 + .browser-happy .content a {display:inline-block;padding:10px 20px;border:2px solid #fff;text-decoration:none;color:#fff}
  31 + body {font-family:Microsoft YaHei;}
  32 + </style>
  33 +</head>
  34 +<body class="signin">
  35 +<div class="signinpanel">
  36 + <div class="row">
  37 + <div class="col-sm-7">
  38 + <div class="signin-info">
  39 + <div class="logopanel m-b">
  40 + <h1>
  41 + 永保抽奖管理系统
  42 + <span style="font-size:.3em;"></span>
  43 + </h1>
  44 + </div>
  45 + <div class="m-b"></div>
  46 + <h5>旗舰版V202005</h5>
  47 + <ul class="m-b">
  48 + <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>专注于用户体验创新</li>
  49 + <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>打造智能互联网式体验设计</li>
  50 + <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>专注于用户体验策略与研究</li>
  51 + <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>为用户提供全面系统的服务</li>
  52 + <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>开启互联网营销新时代</li>
  53 + </ul>
  54 + </div>
  55 + </div>
  56 + <div class="col-sm-5">
  57 +
  58 + <form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
  59 + <table style="padding: 10px 20px;" cellspacing="10">
  60 + <h4 class="no-margins">用户登录</h4>
  61 + <p class="m-t-md"></p>
  62 + <input type="text" class="form-control uname" name="name" maxlength="20" placeholder="用户名" />
  63 + <input type="password" class="form-control pword m-b" name="pwd" maxlength="12" placeholder="密码" />
  64 +
  65 + <button type="button" class="btn btn-success btn-block" onclick="submitForm()">登录</button>
  66 + </table>
  67 + </form>
  68 +
  69 +
  70 + </div>
  71 + </div>
  72 + <div class="signup-footer"><div class="pull-left">&copy; 2020 JITNRY.COM All Rights Reserved. ******** 科技有限公司 客服热线: ***********</div></div>
  73 +</div>
  74 +</body>
  75 +<script>
  76 +
  77 + function submitForm(){
  78 + $('#fm').form('submit', {
  79 + url:'/web/prize/tologin',
  80 + onSubmit: function(){
  81 + console.log($(this))
  82 +
  83 + },
  84 + success:function(data){
  85 +
  86 + var arr = JSON.parse(data);
  87 + if(arr.code == 100){
  88 + $.messager.alert("提示", arr.msg);
  89 + }else{
  90 + $.messager.alert("提示", arr.msg);
  91 + window.location.href="/";
  92 + }
  93 +
  94 + console.log(arr);
  95 + }
  96 + });
  97 + }
  98 +
  99 +</script>
  100 +</html>
  1 +<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>表单填写</title>
  6 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
  7 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
  8 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
  9 + <link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
  10 + <link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
  11 + <script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
  12 + <script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
  13 + <script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
  14 + <!-- 插件调用 --->
  15 + <script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
  16 + <script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
  17 + <!-- 基础 JS 调用 -->
  18 + <script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
  19 + <script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
  20 +
  21 +
  22 + <!--富文本编辑器-->
  23 + <link rel="stylesheet" href="/assets/kindeditor/themes/default/default.css" />
  24 + <script src="/assets/kindeditor/kindeditor.js"></script>
  25 + <script src="/assets/kindeditor/kindeditor-all.js"></script>
  26 + <script src="/assets/kindeditor/kindeditor-all-min.js"></script>
  27 + <script charset="utf-8" src="/assets/kindeditor/kindeditor-min.js"></script>
  28 + <script charset="utf-8" src="/assets/kindeditor/lang/zh_CN.js"></script>
  29 +
  30 +</head>
  31 +<body style="margin-bottom: 54px;">
  32 +
  33 +
  34 +
  35 + <div class="easyui-layout" data-options="fit:true">
  36 + <!-- <div data-options="region:'north',title:'头部',split:true" style="height:100px;"> -->
  37 + <!-- </div> -->
  38 + <!-- <div data-options="region:'east',title:'确认信息',split:true" style="width:100px;"></div> -->
  39 + <div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="订单列表" id="saveBox" style="width:100%;">
  40 +
  41 + <div class="easyui-panel" style="width:100%;max-width:100%;padding: 20px 10px">
  42 + <div style="margin-bottom:5px;">
  43 + <a id="derive_btn" href="/products/product/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>
  44 + </div>
  45 + </div>
  46 +
  47 + <table id="dg" style="width: 100%; height: 75%"
  48 + data-options="rownumbers:true,singleSelect:true,pagination:true,url:'/products/product/get_order_list',method:'get',
  49 + onDblClickRow :function(rowIndex,rowData){
  50 + memnerid = rowData;
  51 + showSelectedSurveryDataOnMap(rowData);
  52 + }">
  53 + <thead>
  54 + <tr>
  55 + <th data-options="field:'order_code',width:150,align:'center'">订单编号</th>
  56 + <th data-options="field:'goods_name',width:150,align:'center'">商品名称</th>
  57 + <th data-options="field:'name',width:100,align:'center'">用户名</th>
  58 + <th data-options="field:'phone',width:150,align:'center'">电话</th>
  59 + <th data-options="field:'address',width:250,align:'center'">详细地址</th>
  60 + <th data-options="field:'num',width:80,align:'center'">产品数量</th>
  61 + <th data-options="field:'price',width:100,align:'center'">总金额</th>
  62 + <th data-options="field:'addTime',width:200,align:'center'">下单时间</th>
  63 + <th width="50" data-options="field:'id',formatter:formatOper">操作</th>
  64 + </tr>
  65 + </thead>
  66 + </table>
  67 + </div>
  68 + <!-- <div data-options="region:'south',title:'South Title',split:true" style="height:100px;"></div> -->
  69 + </div>
  70 +</body>
  71 +<tbody id="html_table"></tbody>
  72 +<script type="text/javascript" src="/assets/web/js/src/common_product.js"></script>
  73 +
  74 +<script>
  75 +
  76 + function formatOper(val, row, index) {
  77 +
  78 + return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">删除</a>';
  79 + }
  80 +
  81 + //删除
  82 + function showUser(row){
  83 + if(confirm("确实要删除?")){
  84 + var result = {
  85 + id:row
  86 + }
  87 + $.ajax({
  88 + url:'/products/product/order_del',
  89 + type: "post",
  90 + data: result,
  91 + success: function (data) {
  92 + console.log(data);
  93 + $('#dg').datagrid('reload');
  94 + $.messager.alert("提示", data.msg);
  95 + },
  96 + error:function(data){
  97 + console.log(data)
  98 + }
  99 + })
  100 + }
  101 +
  102 + }
  103 +
  104 +</script>
  105 +</html>
  1 +<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>表单填写</title>
  6 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
  7 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
  8 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
  9 + <link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
  10 + <link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
  11 + <script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
  12 + <script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
  13 + <script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
  14 + <!-- 插件调用 --->
  15 + <script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
  16 + <script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
  17 + <!-- 基础 JS 调用 -->
  18 + <script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
  19 + <script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
  20 +</head>
  21 +<body style="margin-bottom: 54px;">
  22 + <div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="false" buttons="#dlg-buttons">
  23 + <form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
  24 + <table style="padding: 10px 20px;" cellspacing="10">
  25 +<!-- <tr style="">-->
  26 +<!-- <td>名称:</td>-->
  27 +<!-- <td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>-->
  28 +<!-- <input class="easyui-textbox" id="prize_id" name="prize_id" type="hidden">-->
  29 +<!-- </tr>-->
  30 +
  31 +
  32 + <tr>
  33 + <td>重置资格:</td>
  34 + <td> <a id="name_add_but" href="#" data-options="iconCls:'icon-edit'" class="my_but" style="vertical-align: middle;">重置</a></td>
  35 + </tr>
  36 +
  37 + <tr>
  38 + <td>抽奖次数:</td>
  39 + <td><input class="easyui-textbox" type="number" name="number" id="old_number" /></td>
  40 + <input class="easyui-textbox" id="rule_id" name="rule_id" type="hidden">
  41 + </tr>
  42 +
  43 + <tr>
  44 + <td>是否开启:</td>
  45 + <td><input id="statusId" name="open" class="easyui-switchbutton" style="height:30px"></td>
  46 + </tr>
  47 +
  48 + <tr>
  49 + <td>抽奖规则:</td>
  50 + <td><input class="easyui-textbox" id="title" name="title" data-options="multiline:true" style="height:100px;width: 500px"></td>
  51 + </tr>
  52 +
  53 +
  54 +
  55 +<!-- <div id="html_table"></div>-->
  56 + <div id="dlg-buttons" style="display: block">
  57 + <a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">修改</a>
  58 +<!-- <a id="name_add_but111" href="#" data-options="iconCls:'icon-edit'" class="my_but" style="vertical-align: middle;">重置</a>-->
  59 + </div>
  60 + </table>
  61 + </form>
  62 + </div>
  63 +
  64 +
  65 +</body>
  66 +<tbody id="html_table"></tbody>
  67 +<script type="text/javascript" src="/assets/web/js/src/common_prize.js"></script>
  68 +<script>
  69 +
  70 + $(function(){
  71 + addFile();
  72 + })
  73 + function addFile(){
  74 + $('#win').dialog({
  75 + title: '规则设置',
  76 + width: 800,
  77 + height: "auto",
  78 + top:150,
  79 + closed: false,//显示对话框
  80 + cache: false,
  81 + modal: true,
  82 + closable:false
  83 + });
  84 + var result='';
  85 + $.ajax({
  86 + type: "post",
  87 + data: result,
  88 + async: false,
  89 + url: "/products/prize/prize_rule",
  90 + success: function(arr) {
  91 + //var arr = JSON.parse(data);
  92 + // console.log(arr);
  93 + $('#rule_id').textbox('setValue',arr.id);
  94 + $('#old_number').textbox('setValue',arr.number);
  95 +
  96 + if(arr.open == "1") {
  97 + $('#statusId').switchbutton('check');
  98 + }else {
  99 + $('#statusId').switchbutton('uncheck');
  100 + }
  101 +
  102 + $('#title').textbox('setValue',arr.title);
  103 +
  104 + },
  105 + error:function(data){
  106 + console.log(data)
  107 + }
  108 + });
  109 +
  110 + }
  111 +//提交
  112 + function submitForm(){
  113 + $('#fm').form('submit', {
  114 + url:'/products/prize/prize_rule_edit',
  115 + onSubmit: function(){
  116 + console.log($(this))
  117 +
  118 + },
  119 + success:function(data){
  120 + var arr = JSON.parse(data);
  121 + console.log(arr);
  122 + $.messager.alert("提示", arr.msg);
  123 + }
  124 + });
  125 + }
  126 +
  127 + //添加
  128 + $('#name_add_but').linkbutton({
  129 +
  130 + onClick: function () {
  131 + editFile();
  132 + }
  133 + });
  134 + function editFile(){
  135 + var id='';
  136 + if(confirm("确实要重置抽奖资格?")){
  137 + $.ajax({
  138 + url:'/products/prize/prize_reset',
  139 + type: "POST",
  140 + data: id,
  141 + contentType: false,
  142 + processData: false,
  143 + success: function (data) {
  144 + console.log(data);
  145 + $.messager.alert("提示", data.msg);
  146 + },
  147 + error:function(data){
  148 + console.log(data)
  149 + }
  150 + })
  151 + }else {
  152 + alert("已经取消了操作");
  153 + }
  154 + }
  155 +
  156 +
  157 +
  158 +
  159 +</script>
  160 +</html>
  1 +<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>表单填写</title>
  6 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
  7 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
  8 + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
  9 + <link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
  10 + <link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
  11 + <script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
  12 + <script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
  13 + <script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
  14 + <!-- 插件调用 --->
  15 + <script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
  16 + <script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
  17 + <!-- 基础 JS 调用 -->
  18 + <script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
  19 + <script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
  20 +</head>
  21 +<body style="margin-bottom: 54px;">
  22 +<div class="easyui-layout" data-options="fit:true">
  23 + <div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" id="saveBox" style="width:100%;">
  24 + <table class="easyui-datagrid" title="中奖用户列表" id="dg" style="width: 100%; height: 75%"
  25 + data-options="rownumbers:true,singleSelect:true,pagination:true,url:'/products/prize/prize_user_list',method:'get',
  26 + onDblClickRow :function(rowIndex,rowData){
  27 + memnerid = rowData;
  28 + showSelectedSurveryDataOnMap(rowData);
  29 + },toolbar:'#tb'">
  30 + <thead>
  31 + <tr>
  32 + <th data-options="field:'uname',width:250,align:'center'">名称</th>
  33 + <th data-options="field:'phone',width:200,align:'center'">电话</th>
  34 + <th data-options="field:'prizeName',width:250,align:'center'">奖品名称</th>
  35 + <th data-options="field:'source',width:200,align:'center'">部门</th>
  36 + <th data-options="field:'addTime',width:300,align:'center'">中奖时间</th>
  37 + <th width="50" data-options="field:'id',formatter:formatOper">操作</th>
  38 + </tr>
  39 + </thead>
  40 + </table>
  41 + <div id="tb" style="padding:5px;height:auto">
  42 + <div>
  43 + 部门:
  44 + <input class="easyui-combobox" style="width:125px" name="materialname" id="materialname"
  45 + data-options="valueField:'id',
  46 + textField:'text',
  47 + data:
  48 + [{ 'id':'',
  49 + 'text':'全部' ,
  50 + selected:true
  51 + },{
  52 + 'id':'department1',
  53 + 'text':'区部一'
  54 + },{
  55 + 'id':'department2',
  56 + 'text':'区部二'
  57 + }] ,panelHeight:'auto',onChange:function(){getweight();}
  58 + "/>
  59 + Date From: <input class="easyui-datebox" id='start' name='start' style="width:180px">
  60 + To: <input class="easyui-datebox" id='end' name='end' style="width:180px">
  61 + Phone: <input class="easyui-numberbox" type="text" id='phone' name='phone'>
  62 + <a href="#" class="easyui-linkbutton" id="search_btn" iconCls="icon-search">搜索</a>
  63 + <a id="derive_btn" href="/products/prize/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>
  64 + </div>
  65 + </div>
  66 + </div>
  67 +</div>
  68 +
  69 +</body>
  70 +<tbody id="html_table"></tbody>
  71 +
  72 +<script>
  73 + //设置操作按钮
  74 + function formatOper(val, row, index) {
  75 + return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">删除</a>';
  76 + }
  77 + //删除
  78 + function showUser(row){
  79 + if(confirm("确实要删除?")){
  80 + var result = {
  81 + id:row
  82 + }
  83 + $.ajax({
  84 + url:'/products/prize/del_user',
  85 + type: "post",
  86 + data: result,
  87 + success: function (data) {
  88 + console.log(data);
  89 + $('#dg').datagrid('reload');
  90 + $.messager.alert("提示", data.msg);
  91 + },
  92 + error:function(data){
  93 + console.log(data)
  94 + }
  95 + })
  96 + }
  97 +
  98 + }
  99 +
  100 + //下拉框搜索
  101 + function getweight(){
  102 + var source=$('#materialname').combobox('getValue');
  103 + var start = $("#start").val();
  104 + var end = $("#end").val();
  105 + var phone = $("#phone").val();
  106 + if(phone.length>0){
  107 + if(phone.length!=11){
  108 + $.messager.alert('检索手机号','手机号格式错误,请重新输入');
  109 + return false;
  110 + }
  111 + }
  112 + var result = {
  113 + source,
  114 + start,
  115 + end,
  116 + phone
  117 + }
  118 + init_datagrid('/products/prize/prize_user_list', result);
  119 + }
  120 + //时间搜索
  121 + //搜索按钮
  122 + $('#search_btn').bind('click', function() {
  123 +
  124 + var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存
  125 + if(_data && _data.options){
  126 + _data.options.pageNumber = 1; // 修改缓存
  127 + }
  128 + $.data($('#dg')[0], 'datagrid', _data); // 把修改写回去
  129 +
  130 +
  131 + var source=$('#materialname').combobox('getValue');
  132 + var start = $("#start").val();
  133 + var end = $("#end").val();
  134 + var phone = $("#phone").val();
  135 + if(phone.length>0){
  136 + if(phone.length!=11){
  137 + $.messager.alert('检索手机号','手机号格式错误,请重新输入');
  138 + return false;
  139 + }
  140 + }
  141 + var result = {
  142 + source,
  143 + start,
  144 + end,
  145 + phone
  146 + }
  147 + // console.log(result);return false;
  148 + init_datagrid('/products/prize/prize_user_list', result);
  149 + });
  150 +
  151 + function init_datagrid(data_url, res) {
  152 +
  153 + //表头字段
  154 + var arr_columns = dg_columns();
  155 + $("#dg").datagrid({
  156 + rownumbers:true,
  157 + singleSelect:true,
  158 + pagination:true,
  159 + url:data_url,
  160 + queryParams: res,
  161 + method:'post',
  162 + columns: [arr_columns],
  163 + loadMsg: '正在加载数据',
  164 + emptyMsg: '列表为空',
  165 + });
  166 + }
  167 + function dg_columns() {
  168 + var arr = new Array();
  169 + arr.push({
  170 + field: 'uname',
  171 + title: '名称',
  172 + width: 250,
  173 + align: 'center'
  174 + });
  175 + arr.push({
  176 + field: 'phone',
  177 + title: '电话',
  178 + width: 200,
  179 + align: 'center'
  180 + });
  181 + arr.push({
  182 + field: 'prizeName',
  183 + title: '奖品名称',
  184 + width: 250,
  185 + align: 'center'
  186 + });
  187 + arr.push({
  188 + field: 'source',
  189 + title: '部门',
  190 + width: 200,
  191 + align: 'center'
  192 + });
  193 + arr.push({
  194 + field: 'addTime',
  195 + title: '中奖时间',
  196 + width: 200,
  197 + align: 'center'
  198 + });
  199 + arr.push({
  200 + field: 'id',
  201 + formatter:formatOper,
  202 + title: '操作',
  203 + width: 200,
  204 + align: 'center'
  205 + });
  206 + // console.log(arr)
  207 + return arr;
  208 + }
  209 + //添加
  210 + $('#name_add_but').linkbutton({
  211 + onClick: function () {
  212 + addFile();
  213 + }
  214 + });
  215 + function addFile(){
  216 + var id='';
  217 + if(confirm("确实要重置抽奖次数?")){
  218 + $.ajax({
  219 + url:'/products/prize/prize_reset',
  220 + type: "POST",
  221 + data: id,
  222 + contentType: false,
  223 + processData: false,
  224 + success: function (data) {
  225 + console.log(data);
  226 + $.messager.alert("提示", data.msg);
  227 +
  228 + },
  229 + error:function(data){
  230 + console.log(data)
  231 + }
  232 + })
  233 + }else {
  234 + alert("已经取消了操作");
  235 + }
  236 + }
  237 +
  238 +</script>
  239 +</html>