作者 陈程

cc-1

@@ -12,6 +12,7 @@ use app\common\controller\Backend; @@ -12,6 +12,7 @@ use app\common\controller\Backend;
12 class Staff extends Backend 12 class Staff extends Backend
13 { 13 {
14 14
  15 +
15 /** 16 /**
16 * Staff模型对象 17 * Staff模型对象
17 * @var \app\admin\model\verification\Staff 18 * @var \app\admin\model\verification\Staff
@@ -71,4 +72,91 @@ class Staff extends Backend @@ -71,4 +72,91 @@ class Staff extends Backend
71 return $this->view->fetch(); 72 return $this->view->fetch();
72 } 73 }
73 74
  75 +
  76 + /**
  77 + * 查看
  78 + */
  79 + public function brokerage()
  80 + {
  81 + $verification_store_id = request()->param('verification_store_id');
  82 + $send_user_id = request()->param('send_user_id');
  83 + $params = request()->param('params');
  84 + //当前是否为关联查询
  85 + $offset = request()->param('offset');
  86 + $this->relationSearch = true;
  87 + //设置过滤方法
  88 +
  89 + $this->request->filter(['strip_tags', 'trim']);
  90 + if ($this->request->isAjax()) {
  91 + list($where1, $sort, $order, $offset, $limit) = $this->buildparams();
  92 + if(!empty($params)){
  93 + $ids = request()->param('ids');
  94 + $paramsA = explode('=',$params);
  95 + $r = \think\Db::name('verification_brokerage_record')->where(['id'=>$ids])->update(['send_result'=>$paramsA[1]]);
  96 + return json(['code'=>$r]);
  97 + }
  98 + //如果发送的来源是Selectpage,则转发到Selectpage
  99 + $where['a.send_user_id'] = $send_user_id;
  100 + $where['a.verification_store_id'] = $verification_store_id;
  101 + $field = "a.id,a.commission,a.send_user_id,a.send_createtime,a.send_result,a.send_reason,a.order_id,
  102 + b.price";
  103 + $list = \think\Db::name('verification_brokerage_record')
  104 + ->alias('a')
  105 + ->field($field)
  106 + ->join('cv_verification_order b','a.order_id=b.id','left')
  107 + ->where($where)
  108 + ->order('a.id desc')
  109 + ->paginate($limit);
  110 +
  111 + $row = $list->items();
  112 +
  113 + foreach($row as $k=>$v){
  114 + $row[$k]['send_createtime'] = date('Y-m-d H:i:s',$v['send_createtime']);
  115 + $row[$k]['send_result_text'] = $v['send_result']==1?'成功':'失败';
  116 + $row[$k]['send_result_view'] = $v['send_result']==1?'normal':'hidden';
  117 + }
  118 +
  119 + $result = array("total" => $list->total(), "rows" => $row);
  120 + return json($result);
  121 + }
  122 + return $this->view->fetch();
  123 + }
  124 +
  125 +
  126 + /**
  127 + * 查看
  128 + */
  129 + public function share_list()
  130 + {
  131 + $verification_store_id = request()->param('verification_store_id');
  132 + $send_user_id = request()->param('send_user_id');
  133 +
  134 +
  135 + $this->request->filter(['strip_tags', 'trim']);
  136 + if ($this->request->isAjax()) {
  137 +
  138 + $where['a.pid'] = $send_user_id;
  139 + $where['a.verification_store_id'] = $verification_store_id;
  140 + $field = "a.*";
  141 +
  142 + $list = \think\Db::name('user')
  143 + ->alias('a')
  144 + ->field($field)
  145 +
  146 + ->where($where)
  147 + ->order('a.id desc')
  148 + ->paginate();
  149 +
  150 + $row = $list->items();
  151 +
  152 + foreach($row as $k=>$v){
  153 + $row[$k]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
  154 + }
  155 +
  156 + $result = array("total" => $list->total(), "rows" => $row);
  157 + return json($result);
  158 + }
  159 + return $this->view->fetch();
  160 + }
  161 +
74 } 162 }
@@ -13,5 +13,15 @@ return [ @@ -13,5 +13,15 @@ return [
13 'Type 3' => '代理人&核销员', 13 'Type 3' => '代理人&核销员',
14 'Type 4' => '电销', 14 'Type 4' => '电销',
15 'Store.name' => '门店名称', 15 'Store.name' => '门店名称',
16 - 'User.nickname' => '用户名' 16 + 'User.nickname' => '用户名',
  17 + 'Commission' => '发送金额',
  18 + 'SendCreatetime' => '发送时间',
  19 + 'SendResult' => '发送结果',
  20 + 'SendReason' => '发送缘由',
  21 + 'OrderIdPrice' => '订单金额',
  22 + 'SendReason' => '发送缘由',
  23 + 'SendR' => '操作',
  24 + 'Hidden' => '未支付',
  25 + 'Normal' => '已支付',
  26 + 'Updatetime' => '绑定时间'
17 ]; 27 ];
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  10 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('verification/staff/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('verification/staff/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  12 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('verification/staff/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  13 +
  14 +
  15 + <div class="dropdown btn-group {:$auth->check('verification/staff/multi')?'':'hide'}">
  16 + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
  17 + <ul class="dropdown-menu text-left" role="menu">
  18 + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
  19 + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
  20 + </ul>
  21 + </div>
  22 +
  23 +
  24 + </div>
  25 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  26 +
  27 + data-operate-editstate="{:$auth->check('verification/staff/edit_state_url')}"
  28 + width="100%">
  29 + </table>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 + </div>
  35 +</div>
  36 +<script>
  37 +
  38 +
  39 +
  40 +
  41 +
  42 +
  43 +</script>
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  10 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('verification/staff/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('verification/staff/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  12 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('verification/staff/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  13 +
  14 +
  15 + <div class="dropdown btn-group {:$auth->check('verification/staff/multi')?'':'hide'}">
  16 + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
  17 + <ul class="dropdown-menu text-left" role="menu">
  18 + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
  19 + <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
  20 + </ul>
  21 + </div>
  22 +
  23 +
  24 + </div>
  25 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  26 +
  27 + data-operate-editstate=""
  28 + width="100%">
  29 + </table>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 + </div>
  35 +</div>
  36 +<script>
  37 +
  38 +
  39 +
  40 +
  41 +
  42 +
  43 +</script>
@@ -33,7 +33,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -33,7 +33,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
33 {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3'),"4":__('Type 4')}, formatter: Table.api.formatter.normal}, 33 {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3'),"4":__('Type 4')}, formatter: Table.api.formatter.normal},
34 {field: 'store.name', title: __('Store.name'), operate: 'LIKE'}, 34 {field: 'store.name', title: __('Store.name'), operate: 'LIKE'},
35 {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, 35 {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
36 - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 36 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  37 + buttons:[
  38 + {
  39 + name: 'cv_verification_receive',
  40 + text:"查看红包",
  41 + title: function (row) {
  42 + return "查看《"+row.name +"》的发送红包记录"
  43 + },
  44 + extend:'data-area=["94%","94%"]',
  45 + classname: 'btn btn-xs btn-success btn-dialog',
  46 + icon: 'fa fa-reorder',
  47 + url: 'verification/staff/brokerage?verification_store_id={verification_store_id}&send_user_id={user_id}',
  48 + visible: function (row) {
  49 + return true;
  50 + },
  51 + },
  52 + {
  53 + name: 'cv_verification_receive',
  54 + text:"查看分销",
  55 + title: function (row) {
  56 + return "查看《"+row.name +"》的分销记录"
  57 + },
  58 + extend:'data-area=["94%","94%"]',
  59 + classname: 'btn btn-xs btn-success btn-dialog',
  60 + icon: 'fa fa-reorder',
  61 + url: 'verification/staff/share_list?verification_store_id={verification_store_id}&send_user_id={user_id}',
  62 + visible: function (row) {
  63 + return true;
  64 + },
  65 + }
  66 + ]
  67 + }
37 ] 68 ]
38 ] 69 ]
39 }); 70 });
@@ -47,11 +78,82 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -47,11 +78,82 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
47 edit: function () { 78 edit: function () {
48 Controller.api.bindevent(); 79 Controller.api.bindevent();
49 }, 80 },
50 - api: {  
51 - bindevent: function () {  
52 - Form.api.bindevent($("form[role=form]"));  
53 - }  
54 - } 81 +
  82 + brokerage: function () {
  83 + // 初始化表格参数配置
  84 + Table.api.init({
  85 + extend: {
  86 + brokerage_url: 'verification/staff/brokerage' + location.search,
  87 + table: 'verification_staff',
  88 +
  89 + }
  90 + });
  91 +
  92 + var table = $("#table");
  93 +
  94 + // 初始化表格
  95 + table.bootstrapTable({
  96 + url: $.fn.bootstrapTable.defaults.extend.brokerage_url,
  97 + pk: 'id',
  98 + sortName: 'id',
  99 + columns: [
  100 + [
  101 + {checkbox: true},
  102 + {field: 'id', title: __('Id')},
  103 + {field: 'commission', title: __('Commission'), operate: 'LIKE'},
  104 + {field: 'send_createtime', title: __('SendCreatetime'), operate: 'LIKE'},
  105 + {field: 'send_result_text', title: __('SendResult'), operate: 'LIKE'},
  106 + {field: 'send_reason', title: __('SendReason')},
  107 + {field: 'price', title: __('OrderIdPrice')},
  108 +
  109 + {
  110 + field: 'send_result', title: __('SendR'),
  111 + formatter: Table.api.formatter.toggle,
  112 +
  113 +
  114 + },
  115 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  116 +
  117 + ]
  118 + ]
  119 + });
  120 +
  121 + // 为表格绑定事件
  122 +
  123 + Table.api.bindevent(table);
  124 + },
  125 + share_list: function () {
  126 + // 初始化表格参数配置
  127 + Table.api.init({
  128 + extend: {
  129 + share_list_url: 'verification/staff/share_list' + location.search,
  130 + table: 'user',
  131 +
  132 + }
  133 + });
  134 +
  135 + var table = $("#table");
  136 +
  137 + // 初始化表格
  138 + table.bootstrapTable({
  139 + url: $.fn.bootstrapTable.defaults.extend.share_list_url,
  140 + pk: 'id',
  141 + sortName: 'id',
  142 + columns: [
  143 + [
  144 + {checkbox: true},
  145 +
  146 + {field: 'nickname', title: __('User.nickname'), operate: 'LIKE'},
  147 + {field: 'updatetime', title: __('Updatetime'), operate: 'LIKE'},
  148 + ]
  149 + ]
  150 + });
  151 +
  152 + // 为表格绑定事件
  153 +
  154 + Table.api.bindevent(table);
  155 + },
  156 +
55 }; 157 };
56 return Controller; 158 return Controller;
57 }); 159 });