作者 jinglong

增加后台用户晒单模块

@@ -29,7 +29,7 @@ class Goods extends Backend @@ -29,7 +29,7 @@ class Goods extends Backend
29 $res = Db::name('btype')->field('id,name,address')->select(); 29 $res = Db::name('btype')->field('id,name,address')->select();
30 $arr = []; 30 $arr = [];
31 foreach($res as $value){ 31 foreach($res as $value){
32 - $arr[$value['id']] = $value['name'].'  '.$value['address']; 32 + $arr[$value['id']] = $value['name'].'------'.$value['address'];
33 } 33 }
34 $this->assign('btype',$arr); 34 $this->assign('btype',$arr);
35 35
  1 +<?php
  2 +
  3 +namespace app\admin\controller;
  4 +
  5 +use app\common\controller\Backend;
  6 +use think\Db;
  7 +/**
  8 + * 用户晒单管理
  9 + *
  10 + * @icon fa fa-circle-o
  11 + */
  12 +class Ulist extends Backend
  13 +{
  14 +
  15 + /**
  16 + * Ulist模型对象
  17 + * @var \app\admin\model\Ulist
  18 + */
  19 + protected $model = null;
  20 +
  21 + public function _initialize()
  22 + {
  23 + parent::_initialize();
  24 + $this->model = new \app\admin\model\Ulist;
  25 + //品类分类名称
  26 + $res = Db::name('goods')->field('id,type_name,name')->select();
  27 + $arr = [];
  28 + foreach($res as $value){
  29 + $arr[$value['id']] = $value['name'].'------'.$value['type_name'];
  30 + }
  31 + $this->assign('goods',$arr);
  32 + }
  33 +
  34 + /**
  35 + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  36 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  37 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  38 + */
  39 +
  40 +
  41 + /**
  42 + * 查看
  43 + */
  44 + public function index()
  45 + {
  46 + //当前是否为关联查询
  47 + $this->relationSearch = true;
  48 + //设置过滤方法
  49 + $this->request->filter(['strip_tags', 'trim']);
  50 + if ($this->request->isAjax())
  51 + {
  52 + //如果发送的来源是Selectpage,则转发到Selectpage
  53 + if ($this->request->request('keyField'))
  54 + {
  55 + return $this->selectpage();
  56 + }
  57 + list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  58 + $total = $this->model
  59 + ->with(['goods'])
  60 + ->where($where)
  61 + ->order($sort, $order)
  62 + ->count();
  63 +
  64 + $list = $this->model
  65 + ->with(['goods'])
  66 + ->where($where)
  67 + ->order($sort, $order)
  68 + ->limit($offset, $limit)
  69 + ->select();
  70 +
  71 + foreach ($list as $row) {
  72 + $row->visible(['id','title','nickname','image','address','createtime']);
  73 + $row->visible(['goods']);
  74 + $row->getRelation('goods')->visible(['name','type_name']);
  75 + }
  76 + $list = collection($list)->toArray();
  77 + $result = array("total" => $total, "rows" => $list);
  78 +
  79 + return json($result);
  80 + }
  81 + return $this->view->fetch();
  82 + }
  83 +}
@@ -7,6 +7,7 @@ return [ @@ -7,6 +7,7 @@ return [
7 'File' => '商品视频', 7 'File' => '商品视频',
8 'Name' => '商品名称', 8 'Name' => '商品名称',
9 'Name_en' => '商品名称(英文)', 9 'Name_en' => '商品名称(英文)',
  10 + 'Image' => '商品图片',
10 'New_price' => '新人价格', 11 'New_price' => '新人价格',
11 'Sale_price' => '销售价格', 12 'Sale_price' => '销售价格',
12 'Market_price' => '市场价格', 13 'Market_price' => '市场价格',
@@ -7,6 +7,7 @@ return [ @@ -7,6 +7,7 @@ return [
7 'File' => '商品视频', 7 'File' => '商品视频',
8 'Name' => '商品名称', 8 'Name' => '商品名称',
9 'Name_en' => '商品名称(英文)', 9 'Name_en' => '商品名称(英文)',
  10 + 'Image' => '商品图片',
10 'New_price' => '新人价格', 11 'New_price' => '新人价格',
11 'Sale_price' => '销售价格', 12 'Sale_price' => '销售价格',
12 'Market_price' => '市场价格', 13 'Market_price' => '市场价格',
  1 +<?php
  2 +
  3 +return [
  4 + 'Id' => 'ID',
  5 + 'G_id' => '选择商品',
  6 + 'Title' => '文章标题',
  7 + 'Images' => '晒单图',
  8 + 'Nickname' => '用户昵称',
  9 + 'Image' => '用户头像',
  10 + 'Address' => '用户归属地',
  11 + 'Detail' => '文章详情',
  12 + 'Createtime' => '创建时间',
  13 + 'Updatetime' => '更新时间',
  14 + 'Deletetime' => '删除时间',
  15 + 'Goods.name' => '商品名称',
  16 + 'Goods.type_name' => '商品品类/品牌'
  17 +];
  1 +<?php
  2 +
  3 +namespace app\admin\model;
  4 +
  5 +use think\Model;
  6 +use traits\model\SoftDelete;
  7 +
  8 +class Ulist extends Model
  9 +{
  10 +
  11 + use SoftDelete;
  12 +
  13 +
  14 +
  15 + // 表名
  16 + protected $name = 'ulist';
  17 +
  18 + // 自动写入时间戳字段
  19 + protected $autoWriteTimestamp = 'int';
  20 +
  21 + // 定义时间戳字段名
  22 + protected $createTime = 'createtime';
  23 + protected $updateTime = 'updatetime';
  24 + protected $deleteTime = 'deletetime';
  25 +
  26 + // 追加属性
  27 + protected $append = [
  28 +
  29 + ];
  30 +
  31 +
  32 +
  33 +
  34 +
  35 +
  36 +
  37 +
  38 +
  39 +
  40 + public function goods()
  41 + {
  42 + return $this->belongsTo('Goods', 'g_id', 'id', [], 'LEFT')->setEagerlyType(0);
  43 + }
  44 +}
  1 +<?php
  2 +
  3 +namespace app\admin\validate;
  4 +
  5 +use think\Validate;
  6 +
  7 +class Ulist extends Validate
  8 +{
  9 + /**
  10 + * 验证规则
  11 + */
  12 + protected $rule = [
  13 + ];
  14 + /**
  15 + * 提示消息
  16 + */
  17 + protected $message = [
  18 + ];
  19 + /**
  20 + * 验证场景
  21 + */
  22 + protected $scene = [
  23 + 'add' => [],
  24 + 'edit' => [],
  25 + ];
  26 +
  27 +}
@@ -39,6 +39,20 @@ @@ -39,6 +39,20 @@
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group"> 41 <div class="form-group">
  42 + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
  43 + <div class="col-xs-12 col-sm-8">
  44 + <div class="input-group">
  45 + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text">
  46 + <div class="input-group-addon no-border no-padding">
  47 + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  48 + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  49 + </div>
  50 + <span class="msg-box n-right" for="c-image"></span>
  51 + </div>
  52 + <ul class="row list-inline plupload-preview" id="p-image"></ul>
  53 + </div>
  54 + </div>
  55 + <div class="form-group">
42 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>
43 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
44 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="0.00"> 58 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="0.00">
@@ -39,6 +39,20 @@ @@ -39,6 +39,20 @@
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group"> 41 <div class="form-group">
  42 + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
  43 + <div class="col-xs-12 col-sm-8">
  44 + <div class="input-group">
  45 + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
  46 + <div class="input-group-addon no-border no-padding">
  47 + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  48 + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  49 + </div>
  50 + <span class="msg-box n-right" for="c-image"></span>
  51 + </div>
  52 + <ul class="row list-inline plupload-preview" id="p-image"></ul>
  53 + </div>
  54 + </div>
  55 + <div class="form-group">
42 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>
43 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
44 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="{$row.new_price|htmlentities}"> 58 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="{$row.new_price|htmlentities}">
@@ -39,6 +39,20 @@ @@ -39,6 +39,20 @@
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group"> 41 <div class="form-group">
  42 + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
  43 + <div class="col-xs-12 col-sm-8">
  44 + <div class="input-group">
  45 + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text">
  46 + <div class="input-group-addon no-border no-padding">
  47 + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  48 + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  49 + </div>
  50 + <span class="msg-box n-right" for="c-image"></span>
  51 + </div>
  52 + <ul class="row list-inline plupload-preview" id="p-image"></ul>
  53 + </div>
  54 + </div>
  55 + <div class="form-group">
42 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>
43 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
44 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="0.00"> 58 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="0.00">
@@ -39,6 +39,20 @@ @@ -39,6 +39,20 @@
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group"> 41 <div class="form-group">
  42 + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
  43 + <div class="col-xs-12 col-sm-8">
  44 + <div class="input-group">
  45 + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
  46 + <div class="input-group-addon no-border no-padding">
  47 + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  48 + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  49 + </div>
  50 + <span class="msg-box n-right" for="c-image"></span>
  51 + </div>
  52 + <ul class="row list-inline plupload-preview" id="p-image"></ul>
  53 + </div>
  54 + </div>
  55 + <div class="form-group">
42 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>
43 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
44 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="{$row.new_price|htmlentities}"> 58 <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="{$row.new_price|htmlentities}">
  1 +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('G_id')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + {:build_select('row[g_id]', $goods, null, ['class'=>'form-control', 'required'=>''])}
  7 + </div>
  8 + </div>
  9 + <div class="form-group">
  10 + <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
  16 + <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
  17 + <div class="col-xs-12 col-sm-8">
  18 + <div class="input-group">
  19 + <input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text">
  20 + <div class="input-group-addon no-border no-padding">
  21 + <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  22 + <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  23 + </div>
  24 + <span class="msg-box n-right" for="c-images"></span>
  25 + </div>
  26 + <ul class="row list-inline plupload-preview" id="p-images"></ul>
  27 + </div>
  28 + </div>
  29 + <div class="form-group">
  30 + <label class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
  31 + <div class="col-xs-12 col-sm-8">
  32 + <input id="c-nickname" data-rule="required" class="form-control" name="row[nickname]" type="text">
  33 + </div>
  34 + </div>
  35 + <div class="form-group">
  36 + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
  37 + <div class="col-xs-12 col-sm-8">
  38 + <div class="input-group">
  39 + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text">
  40 + <div class="input-group-addon no-border no-padding">
  41 + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  42 + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  43 + </div>
  44 + <span class="msg-box n-right" for="c-image"></span>
  45 + </div>
  46 + <ul class="row list-inline plupload-preview" id="p-image"></ul>
  47 + </div>
  48 + </div>
  49 + <div class="form-group">
  50 + <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
  51 + <div class="col-xs-12 col-sm-8">
  52 + <input id="c-address" data-rule="required" class="form-control" name="row[address]" type="text">
  53 + </div>
  54 + </div>
  55 + <div class="form-group">
  56 + <label class="control-label col-xs-12 col-sm-2">{:__('Detail')}:</label>
  57 + <div class="col-xs-12 col-sm-8">
  58 + <textarea id="c-detail" data-rule="required" class="form-control editor" rows="5" name="row[detail]" cols="50"></textarea>
  59 + </div>
  60 + </div>
  61 + <div class="form-group layer-footer">
  62 + <label class="control-label col-xs-12 col-sm-2"></label>
  63 + <div class="col-xs-12 col-sm-8">
  64 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  65 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  66 + </div>
  67 + </div>
  68 +</form>
  1 +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('G_id')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + {:build_select('row[g_id]', $goods, $row.g_id, ['class'=>'form-control', 'required'=>''])}
  7 + </div>
  8 + </div>
  9 + <div class="form-group">
  10 + <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
  16 + <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
  17 + <div class="col-xs-12 col-sm-8">
  18 + <div class="input-group">
  19 + <input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
  20 + <div class="input-group-addon no-border no-padding">
  21 + <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  22 + <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  23 + </div>
  24 + <span class="msg-box n-right" for="c-images"></span>
  25 + </div>
  26 + <ul class="row list-inline plupload-preview" id="p-images"></ul>
  27 + </div>
  28 + </div>
  29 + <div class="form-group">
  30 + <label class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
  31 + <div class="col-xs-12 col-sm-8">
  32 + <input id="c-nickname" data-rule="required" class="form-control" name="row[nickname]" type="text" value="{$row.nickname|htmlentities}">
  33 + </div>
  34 + </div>
  35 + <div class="form-group">
  36 + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
  37 + <div class="col-xs-12 col-sm-8">
  38 + <div class="input-group">
  39 + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
  40 + <div class="input-group-addon no-border no-padding">
  41 + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  42 + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  43 + </div>
  44 + <span class="msg-box n-right" for="c-image"></span>
  45 + </div>
  46 + <ul class="row list-inline plupload-preview" id="p-image"></ul>
  47 + </div>
  48 + </div>
  49 + <div class="form-group">
  50 + <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
  51 + <div class="col-xs-12 col-sm-8">
  52 + <input id="c-address" data-rule="required" class="form-control" name="row[address]" type="text" value="{$row.address|htmlentities}">
  53 + </div>
  54 + </div>
  55 + <div class="form-group">
  56 + <label class="control-label col-xs-12 col-sm-2">{:__('Detail')}:</label>
  57 + <div class="col-xs-12 col-sm-8">
  58 + <textarea id="c-detail" data-rule="required" class="form-control editor" rows="5" name="row[detail]" cols="50">{$row.detail|htmlentities}</textarea>
  59 + </div>
  60 + </div>
  61 + <div class="form-group layer-footer">
  62 + <label class="control-label col-xs-12 col-sm-2"></label>
  63 + <div class="col-xs-12 col-sm-8">
  64 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  65 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  66 + </div>
  67 + </div>
  68 +</form>
  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('ulist/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('ulist/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('ulist/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  13 + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('ulist/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
  14 +
  15 + <!--<div class="dropdown btn-group {:$auth->check('ulist/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 + <a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('ulist/recyclebin')?'':'hide'}" href="ulist/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
  24 + </div>
  25 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  26 + data-operate-edit="{:$auth->check('ulist/edit')}"
  27 + data-operate-del="{:$auth->check('ulist/del')}"
  28 + width="100%">
  29 + </table>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 + </div>
  35 +</div>
  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 + {:build_toolbar('refresh')}
  10 + <a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('ulist/restore')?'':'hide'}" href="javascript:;" data-url="ulist/restore" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
  11 + <a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('ulist/destroy')?'':'hide'}" href="javascript:;" data-url="ulist/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
  12 + <a class="btn btn-success btn-restoreall {:$auth->check('ulist/restore')?'':'hide'}" href="javascript:;" data-url="ulist/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
  13 + <a class="btn btn-danger btn-destroyall {:$auth->check('ulist/destroy')?'':'hide'}" href="javascript:;" data-url="ulist/destroy" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
  14 + </div>
  15 + <table id="table" class="table table-striped table-bordered table-hover"
  16 + data-operate-restore="{:$auth->check('ulist/restore')}"
  17 + data-operate-destroy="{:$auth->check('ulist/destroy')}"
  18 + width="100%">
  19 + </table>
  20 + </div>
  21 + </div>
  22 +
  23 + </div>
  24 + </div>
  25 +</div>
@@ -30,6 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -30,6 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
30 30
31 {field: 'name', title: __('Name')},//商品名称 31 {field: 'name', title: __('Name')},//商品名称
32 {field: 'name_en', title: __('Name_en')},//商品名称(英文) 32 {field: 'name_en', title: __('Name_en')},//商品名称(英文)
  33 + {field: 'image', title: __('Image'),events: Table.api.events.image, formatter: Table.api.formatter.image},//商品图
33 {field: 'is_design', title: __('Is_design'),formatter: Table.api.formatter.label, searchList: {0: __('否'), 1: __('是')}},//是否设计师作品 34 {field: 'is_design', title: __('Is_design'),formatter: Table.api.formatter.label, searchList: {0: __('否'), 1: __('是')}},//是否设计师作品
34 {field: 'new_price', title: __('New_price'), operate:'BETWEEN'},//新人价格 35 {field: 'new_price', title: __('New_price'), operate:'BETWEEN'},//新人价格
35 {field: 'sale_price', title: __('Sale_price'), operate:'BETWEEN'},//销售价格 36 {field: 'sale_price', title: __('Sale_price'), operate:'BETWEEN'},//销售价格
@@ -31,6 +31,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -31,6 +31,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
31 31
32 {field: 'name', title: __('Name')},//商品名称 32 {field: 'name', title: __('Name')},//商品名称
33 {field: 'name_en', title: __('Name_en')},//商品名称(英文) 33 {field: 'name_en', title: __('Name_en')},//商品名称(英文)
  34 + {field: 'image', title: __('Image'),events: Table.api.events.image, formatter: Table.api.formatter.image},//商品图
34 {field: 'is_design', title: __('Is_design'),formatter: Table.api.formatter.label, searchList: {0: __('否'), 1: __('是')}},//是否设计师作品 35 {field: 'is_design', title: __('Is_design'),formatter: Table.api.formatter.label, searchList: {0: __('否'), 1: __('是')}},//是否设计师作品
35 {field: 'new_price', title: __('New_price'), operate:'BETWEEN'},//新人价格 36 {field: 'new_price', title: __('New_price'), operate:'BETWEEN'},//新人价格
36 {field: 'sale_price', title: __('Sale_price'), operate:'BETWEEN'},//销售价格 37 {field: 'sale_price', title: __('Sale_price'), operate:'BETWEEN'},//销售价格
  1 +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2 +
  3 + var Controller = {
  4 + index: function () {
  5 + // 初始化表格参数配置
  6 + Table.api.init({
  7 + extend: {
  8 + index_url: 'ulist/index' + location.search,
  9 + add_url: 'ulist/add',
  10 + edit_url: 'ulist/edit',
  11 + del_url: 'ulist/del',
  12 + multi_url: 'ulist/multi',
  13 + table: 'ulist',
  14 + }
  15 + });
  16 +
  17 + var table = $("#table");
  18 +
  19 + // 初始化表格
  20 + table.bootstrapTable({
  21 + url: $.fn.bootstrapTable.defaults.extend.index_url,
  22 + pk: 'id',
  23 + sortName: 'id',
  24 + columns: [
  25 + [
  26 + {checkbox: true},
  27 + {field: 'id', title: __('Id')},
  28 + {field: 'title', title: __('Title')},
  29 + {field: 'nickname', title: __('Nickname')},
  30 + {field: 'image', title: __('Image'), events: Table.api.events.image, formatter: Table.api.formatter.image},
  31 + {field: 'address', title: __('Address')},
  32 + {field: 'goods.name', title: __('Goods.name')},
  33 + {field: 'goods.type_name', title: __('Goods.type_name')},
  34 + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  35 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  36 + ]
  37 + ]
  38 + });
  39 +
  40 + // 为表格绑定事件
  41 + Table.api.bindevent(table);
  42 + },
  43 + recyclebin: function () {
  44 + // 初始化表格参数配置
  45 + Table.api.init({
  46 + extend: {
  47 + 'dragsort_url': ''
  48 + }
  49 + });
  50 +
  51 + var table = $("#table");
  52 +
  53 + // 初始化表格
  54 + table.bootstrapTable({
  55 + url: 'ulist/recyclebin' + location.search,
  56 + pk: 'id',
  57 + sortName: 'id',
  58 + columns: [
  59 + [
  60 + {checkbox: true},
  61 + {field: 'id', title: __('Id')},
  62 + {field: 'title', title: __('Title'), align: 'left'},
  63 + {
  64 + field: 'deletetime',
  65 + title: __('Deletetime'),
  66 + operate: 'RANGE',
  67 + addclass: 'datetimerange',
  68 + formatter: Table.api.formatter.datetime
  69 + },
  70 + {
  71 + field: 'operate',
  72 + width: '130px',
  73 + title: __('Operate'),
  74 + table: table,
  75 + events: Table.api.events.operate,
  76 + buttons: [
  77 + {
  78 + name: 'Restore',
  79 + text: __('Restore'),
  80 + classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  81 + icon: 'fa fa-rotate-left',
  82 + url: 'ulist/restore',
  83 + refresh: true
  84 + },
  85 + {
  86 + name: 'Destroy',
  87 + text: __('Destroy'),
  88 + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  89 + icon: 'fa fa-times',
  90 + url: 'ulist/destroy',
  91 + refresh: true
  92 + }
  93 + ],
  94 + formatter: Table.api.formatter.operate
  95 + }
  96 + ]
  97 + ]
  98 + });
  99 +
  100 + // 为表格绑定事件
  101 + Table.api.bindevent(table);
  102 + },
  103 + add: function () {
  104 + Controller.api.bindevent();
  105 + },
  106 + edit: function () {
  107 + Controller.api.bindevent();
  108 + },
  109 + api: {
  110 + bindevent: function () {
  111 + Form.api.bindevent($("form[role=form]"));
  112 + }
  113 + }
  114 + };
  115 + return Controller;
  116 +});