123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- @extends('layouts.admin.app_iframe')
- @section('plug-css')
- <link href="{{ asset('js/bootstrap-table/dist/bootstrap-table.css') }}" rel="stylesheet">
- @endsection
- @section('content')
- <form id="searchForm" class="form-inline">
- <div class="">
- <div class="form-group">
- <label for="name" class="label-css"> ID:</label>
- <input class="form-control" type="text" name="id">
- </div>
- <div class="form-group">
- <label for="name" class="label-css"> 昵称:</label>
- <input class="form-control" type="text" name="nickname">
- </div>
- <div class="form-group">
- <label for="name" class="label-css"> 手机号:</label>
- <input class="form-control" type="text" name="phone">
- </div>
- <button type="button" class="btn btn-primary">查询</button>
- </div>
- </form>
- <hr class="hr-css">
- <div>
- <div id="toolbar">
- <div class="columns columns-left btn-group pull-left">
- </div>
- </div>
- <table id="ContentTable"></table>
- <div class="pull-right" style="padding-top: 20px">
- <button class="btn btn-danger"
- title="" data-toggle="tooltip" type="button" id="delIds"
- data-original-title="清除">清除
- </button>
- <button class="btn btn-primary"
- title="" data-toggle="tooltip" type="button" id="selectAllIds"
- data-original-title="全选">全选
- </button>
- <button class="btn btn-primary"
- title="" data-toggle="tooltip" type="button" id="setIds"
- data-original-title="确定">确定
- </button>
- </div>
- </div>
- @endsection
- @section('plug-js')
- <script src="{{ asset('js/bootstrap-table/dist/bootstrap-table.js') }}"></script>
- <script src="{{ asset('table_admin/js/common.js') }}"></script>
- <script src="{{ asset('js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js') }}"></script>
- <script src="{{ asset('js/jquery-validation1.16/dist/jquery.validate.min.js') }}"></script>
- <script src="{{ asset('js/jquery-validation1.16/dist/additional-methods.min.js') }}"></script>
- <script src="{{ asset('js/jquery-validation1.16/src/localization/messages_zh.js') }}"></script>
- @endsection
- @section('scripts')
- <script>
- function getUrlParam(name) {
- let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
- let r = window.location.search.substr(1).match(reg); //匹配目标参数
- if (r != null) return unescape(r[2]); return null; //返回参数值
- }
- $(function () {
- //商品选择绑定
- $('#setIds').click(function (){
- window.top.setUserIds(userIds);
- layer.closeAll();
- });
- //全选绑定
- $('#selectAllIds').click(function (){
- let data= $('#searchForm').serializeArray();
- sendajax("{{ route('admin.member.member-ids') }}",data,function (ret){
- let userIds=[];
- if(ret.code*1===1){
- userIds=ret.data.join(',');
- userIds=userIds.split(',');
- }
- console.log(ret)
- window.top.setUserIds(userIds);
- layer.closeAll();
- })
- });
- //请求参数获取
- let userIds= window.top.getUserIds();
- console.log(userIds)
- if(!userIds){
- userIds=[];
- }
- $('#delIds').click(function (){
- userIds = [];
- let data= $('#ContentTable').bootstrapTable('getData');
- data.forEach((value, key) => {
- value.checkbox = false
- $('#ContentTable').bootstrapTable('updateRow', {
- index: key,
- row: value
- });
- })
- });
- BootStrapInit.init('tableGood', 'ContentTable', {
- searchForm: 'searchForm', // 表单搜索id 省略默认 'searchForm'
- url: "{{ route('admin.member.ajax.index',['no_purchases'=>1]) }}",
- method: 'post',
- toolbar: '#toolbar',
- idField: '', // 指定主键列
- uniqueId: "id", // 这里需要指定当前查询表唯一主键字段
- onCheckAll: function (rowsAfter) {
- console.log(rowsAfter)
- rowsAfter.forEach((v,k)=>{
- let id_key = userIds.indexOf(v.id + '')
- if (id_key <0) {
- userIds.push(v.id + '')
- }
- });
- console.log(userIds)
- },
- onUncheckAll:function (rowsAfter){
- console.log(rowsAfter)
- rowsAfter.forEach((v,k)=>{
- let id_key = userIds.indexOf(v.id + '')
- if (id_key >= 0) {
- userIds.splice(id_key, 1)
- }
- });
- console.log(userIds)
- },
- onCheck: function (row) {
- userIds.push(row.id+'')
- },
- onUncheck: function (row) {
- let id_key=userIds.indexOf(row.id+'')
- if(id_key>=0){
- userIds.splice(id_key,1)
- }
- },
- onLoadSuccess:function (data){
- console.log(data)
- data.rows.forEach((value,key)=>{
- if(userIds.indexOf(value.id+'')>=0){
- value.checkbox=true
- }else {
- value.checkbox=false
- }
- $('#ContentTable').bootstrapTable('updateRow', {
- index: key,
- row: value
- });
- })
- },
- columns: [
- {
- align: 'center',
- field: 'checkbox',
- checkbox: true,
- formatter: stateFormatter,
- },
- {
- field: 'id',
- title: 'ID',
- align: 'center',
- valign: 'middle',
- },
- {
- field: 'nickname',
- title: '会员昵称',
- align: 'center',
- valign: 'middle',
- },
- {
- field: 'phone',
- title: '会员电话',
- align: 'center',
- valign: 'middle',
- },
- {
- field: 'head_img',
- title: '头像',
- align: 'center',
- valign: 'middle',
- formatter:thumbFormatter
- },
- {
- field: 'created_at',
- title: '注册时间',
- align: 'center',
- valign: 'middle',
- },
- ]
- });
- });
- </script>
- @endsection
|