作者 jinglong

增加后台会员注册VIP

... ... @@ -46,13 +46,13 @@ class Center extends Backend
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->where('id',4)
->where('id',5)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->where('id',4)
->where('id',5)
->order($sort, $order)
->limit($offset, $limit)
->select();
... ...
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 导入订单管理
*
* @icon fa fa-circle-o
*/
class Order extends Backend
{
/**
* Order模型对象
* @var \app\admin\model\Order
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\Order;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function order($ids)
{
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->where('r_id',$ids)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->where('r_id',$ids)
->order($sort, $order)
->limit($offset, $limit)
->select();
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
$this->assignconfig("r_id",$ids);
return $this->view->fetch();
}
}
... ...
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 会员注册
*
* @icon fa fa-circle-o
*/
class Register extends Backend
{
/**
* Platform模型对象
* @var \app\admin\model\Platform
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\Platform;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->where('id',4)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->where('id',4)
->order($sort, $order)
->limit($offset, $limit)
->select();
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
}
... ...
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
use app\api\controller\Common;
use Exception;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
use think\exception\PDOException;
use app\admin\library\Auth;
/**
* 会员注册管理
*
* @icon fa fa-circle-o
*/
class Registers extends Backend
{
/**
* Registers模型对象
* @var \app\admin\model\Registers
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\Registers;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField'))
{
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->with(['user'])
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with(['user'])
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname']);
$row->user->nickname = \app\admin\model\User::emoji_decode($row->user->nickname);
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
//通过
public function adopt($ids){
if ($ids) {
$pk = $this->model->getPk();
$res = $this->model->where($pk, '=', $ids)->update(['status'=>1]);//已处理
if($res){
$this->success('成功');
}else{
$this->error('失败');
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
//拒绝
public function reject($ids){
if ($ids) {
$pk = $this->model->getPk();
$res = $this->model->where($pk, '=', $ids)->update(['status'=>2]);
if($res){
$this->success('成功');
}else{
$this->error('失败');
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
//导入
public function import(){
$file = $this->request->request('file');
if (!$file) {
$this->error(__('Parameter %s can not be empty', 'file'));
}
$filePath = ROOT_PATH . DS . 'public' . DS . $file;
if (!is_file($filePath)) {
$this->error(__('No results were found'));
}
//实例化reader
$ext = pathinfo($filePath, PATHINFO_EXTENSION);
if (!in_array($ext, ['csv', 'xls', 'xlsx'])) {
$this->error(__('Unknown data format'));
}
if ($ext === 'csv') {
$file = fopen($filePath, 'r');
$filePath = tempnam(sys_get_temp_dir(), 'import_csv');
$fp = fopen($filePath, "w");
$n = 0;
while ($line = fgets($file)) {
$line = rtrim($line, "\n\r\0");
$encoding = mb_detect_encoding($line, ['utf-8', 'gbk', 'latin1', 'big5']);
if ($encoding != 'utf-8') {
$line = mb_convert_encoding($line, 'utf-8', $encoding);
}
if ($n == 0 || preg_match('/^".*"$/', $line)) {
fwrite($fp, $line . "\n");
} else {
fwrite($fp, '"' . str_replace(['"', ','], ['""', '","'], $line) . "\"\n");
}
$n++;
}
fclose($file) || fclose($fp);
$reader = new Csv();
} elseif ($ext === 'xls') {
$reader = new Xls();
} else {
$reader = new Xlsx();
}
//导入文件首行类型,默认是注释,如果需要使用字段名称请使用name
$importHeadType = isset($this->importHeadType) ? $this->importHeadType : 'comment';
$table = $this->model->getQuery()->getTable();
$database = \think\Config::get('database.database');
$fieldArr = [];
$list = db()->query("SELECT COLUMN_NAME,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?", [$table, $database]);
foreach ($list as $k => $v) {
if ($importHeadType == 'comment') {
$fieldArr[$v['COLUMN_COMMENT']] = $v['COLUMN_NAME'];
} else {
$fieldArr[$v['COLUMN_NAME']] = $v['COLUMN_NAME'];
}
}
//加载文件
$insert = [];
$order_flag = 0;//服务订单
try {
if (!$PHPExcel = $reader->load($filePath)) {
$this->error(__('Unknown data format'));
}
$currentSheet = $PHPExcel->getSheet(0); //读取文件中的第一个工作表
$allColumn = $currentSheet->getHighestDataColumn(); //取得最大的列号
$allRow = $currentSheet->getHighestRow(); //取得一共有多少行
$maxColumnNumber = Coordinate::columnIndexFromString($allColumn);
$fields = [];
for ($currentRow = 1; $currentRow <= 1; $currentRow++) {
for ($currentColumn = 1; $currentColumn <= $maxColumnNumber; $currentColumn++) {
$val = $currentSheet->getCellByColumnAndRow($currentColumn, $currentRow)->getValue();
$fields[] = $val;
}
}
for ($currentRow = 2; $currentRow <= $allRow; $currentRow++) {
$values = [];
for ($currentColumn = 1; $currentColumn <= $maxColumnNumber; $currentColumn++) {
$val = $currentSheet->getCellByColumnAndRow($currentColumn, $currentRow)->getValue();
$values[] = is_null($val) ? '' : $val;
}
$row = [];
$temp = array_combine($fields, $values);
foreach ($temp as $k => $v) {
if (isset($fieldArr[$k]) && $k !== '') {
$row[$fieldArr[$k]] = $v;
}
}
if ($row) {
//判断导入的数据是套餐订单还是服务订单
if(isset($row['order_sn'])){
$order_flag = 1;//套餐订单
}
$insert[] = $row;
}
}
} catch (Exception $exception) {
$this->error($exception->getMessage());
}
if (!$insert) {
$this->error(__('No rows were updated'));
}
try {
//是否包含admin_id字段
$has_admin_id = false;
foreach ($fieldArr as $name => $key) {
if ($key == 'admin_id') {
$has_admin_id = true;
break;
}
}
if ($has_admin_id) {
$auth = Auth::instance();
foreach ($insert as &$val) {
if (!isset($val['admin_id']) || empty($val['admin_id'])) {
$val['admin_id'] = $auth->isLogin() ? $auth->id : 0;
}
}
}
if($order_flag == 0){
//服务订单
}else{
//套餐订单
$orderModel = new \app\admin\model\Order();
var_dump($insert);exit;
$orderModel->saveAll($insert);
}
} catch (PDOException $exception) {
$msg = $exception->getMessage();
if (preg_match("/.+Integrity constraint violation: 1062 Duplicate entry '(.+)' for key '(.+)'/is", $msg, $matches)) {
$msg = "导入失败,包含【{$matches[1]}】的记录已存在";
};
$this->error($msg);
} catch (Exception $e) {
$this->error($e->getMessage());
}
$this->success();
}
}
... ...
<?php
return [
'Id' => 'ID',
'R_id' => '注册VIP人员id',
'Order_sn' => '订单编号',
'Price' => '订单价格',
'Content' => '购买服务内容',
'Total_num' => '购买次数',
'Use_num' => '已使用次数',
'Not_use_num' => '未使用次数',
'Advice' => '所属顾问',
'Address' => '详细地址',
'Organization' => '归属机构',
'Pin_user' => '品拓人员',
'Mark' => '备注',
'Createtime' => '创建时间',
'Updatetime' => '更新时间'
];
... ...
<?php
return [
'Id' => 'ID',
'Thumbnail' => '缩略图',
'Createtime' => '创建时间',
'Updatetime' => '更新时间'
];
... ...
<?php
return [
'Id' => 'ID',
'Status' => '状态',
'User_name' => '姓名',
'Mobile' => '电话',
'Province' => '省',
'City' => '市',
'District' => '区',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'User.nickname' => '昵称'
];
... ...
<?php
namespace app\admin\model;
use think\Model;
class Order extends Model
{
// 表名
protected $name = 'order';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
];
}
... ...
<?php
namespace app\admin\model;
use think\Model;
class Registers extends Model
{
// 表名
protected $name = 'registers';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
];
public function user()
{
return $this->belongsTo('User', 'uid', 'id', [], 'LEFT')->setEagerlyType(0);
}
}
... ...
<?php
namespace app\admin\validate;
use think\Validate;
class Order extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate;
use think\Validate;
class Register extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate;
use think\Validate;
class Registers extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
... ... @@ -9,7 +9,7 @@
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('free/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('free/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('free/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('free/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('free/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>
<a href="javascript:;" class="btn btn-success btn-export {:$auth->check('free/export')?'':'hide'}" title="{:__('Export')}" id="btn-export-file"><i class="fa fa-download"></i> {:__('Export')}</a>
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('R_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-r_id" data-rule="required" data-source="r/index" class="form-control selectpage" name="row[r_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_sn" data-rule="required" class="form-control" name="row[order_sn]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" data-rule="required" class="form-control" name="row[price]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-content" data-rule="required" class="form-control" name="row[content]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Total_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-total_num" data-rule="required" class="form-control" name="row[total_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Use_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-use_num" data-rule="required" class="form-control" name="row[use_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Not_use_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-not_use_num" data-rule="required" class="form-control" name="row[not_use_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Advice')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-advice" data-rule="required" class="form-control" name="row[advice]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required" class="form-control" name="row[address]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Organization')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-organization" data-rule="required" class="form-control" name="row[organization]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pin_user')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pin_user" data-rule="required" class="form-control" name="row[pin_user]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mark')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mark" data-rule="required" class="form-control" name="row[mark]" type="text" value="">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('R_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-r_id" data-rule="required" data-source="r/index" class="form-control selectpage" name="row[r_id]" type="text" value="{$row.r_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_sn" data-rule="required" class="form-control" name="row[order_sn]" type="text" value="{$row.order_sn|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" data-rule="required" class="form-control" name="row[price]" type="text" value="{$row.price|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-content" data-rule="required" class="form-control" name="row[content]" type="text" value="{$row.content|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Total_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-total_num" data-rule="required" class="form-control" name="row[total_num]" type="number" value="{$row.total_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Use_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-use_num" data-rule="required" class="form-control" name="row[use_num]" type="number" value="{$row.use_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Not_use_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-not_use_num" data-rule="required" class="form-control" name="row[not_use_num]" type="number" value="{$row.not_use_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Advice')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-advice" data-rule="required" class="form-control" name="row[advice]" type="text" value="{$row.advice|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required" class="form-control" name="row[address]" type="text" value="{$row.address|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Organization')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-organization" data-rule="required" class="form-control" name="row[organization]" type="text" value="{$row.organization|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pin_user')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pin_user" data-rule="required" class="form-control" name="row[pin_user]" type="text" value="{$row.pin_user|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mark')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mark" data-rule="required" class="form-control" name="row[mark]" type="text" value="{$row.mark|htmlentities}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('order/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>-->
<!--<div class="dropdown btn-group {:$auth->check('order/multi')?'':'hide'}">-->
<!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!--<ul class="dropdown-menu text-left" role="menu">-->
<!--<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>-->
<!--<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>-->
<!--</ul>-->
<!--</div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('order/edit')}"
data-operate-del="{:$auth->check('order/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text" value="{$row.thumbnail|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-thumbnail" class="btn btn-danger plupload" data-input-id="c-thumbnail" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnail"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-thumbnail" class="btn btn-primary fachoose" data-input-id="c-thumbnail" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-thumbnail"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-thumbnail"></ul>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('register/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('register/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('register/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('register/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>-->
<!--<div class="dropdown btn-group {:$auth->check('register/multi')?'':'hide'}">-->
<!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!--<ul class="dropdown-menu text-left" role="menu">-->
<!--<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>-->
<!--<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>-->
<!--</ul>-->
<!--</div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('register/edit')}"
data-operate-del="{:$auth->check('register/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Uid')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-uid" data-rule="required" class="form-control" name="row[uid]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-status" data-rule="required" class="form-control" name="row[status]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_name" data-rule="required" class="form-control" name="row[user_name]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" data-rule="required" class="form-control" name="row[province]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" name="row[city]" type="text"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" data-rule="required" class="form-control" name="row[district]" type="text">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Uid')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-uid" data-rule="required" class="form-control" name="row[uid]" type="number" value="{$row.uid|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-status" data-rule="required" class="form-control" name="row[status]" type="number" value="{$row.status|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_name" data-rule="required" class="form-control" name="row[user_name]" type="text" value="{$row.user_name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" data-rule="required" class="form-control" name="row[province]" type="text" value="{$row.province|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" name="row[city]" type="text" value="{$row.city|htmlentities}"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('District')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-district" data-rule="required" class="form-control" name="row[district]" type="text" value="{$row.district|htmlentities}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('registers/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('registers/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('registers/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('registers/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>
<!--<div class="dropdown btn-group {:$auth->check('registers/multi')?'':'hide'}">-->
<!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!--<ul class="dropdown-menu text-left" role="menu">-->
<!--<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>-->
<!--<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>-->
<!--</ul>-->
<!--</div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('registers/edit')}"
data-operate-del="{:$auth->check('registers/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
... ... @@ -38,7 +38,8 @@ class Index extends Api
"introduce": "http://mite.w.brotop.cn/uploads/20200107/e0bf0b8d402b5447575389b8bd57c225.png",//公司简介缩略图
"service": "http://mite.w.brotop.cn/uploads/20200107/b48a6582d12da1fdafce424afbb3384d.png",//服务介绍缩略图
"experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员中心缩略图
"register": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员注册缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//个人中心缩略图
}
}
})
... ... @@ -56,10 +57,12 @@ class Index extends Api
$introduce = Common::findWhereData('platform',['id'=>1],'id,thumbnail');//公司简介
$service = Common::findWhereData('platform',['id'=>2],'id,thumbnail');//服务介绍
$experience = Common::findWhereData('platform',['id'=>3],'id,thumbnail');//服务体验
$center = Common::findWhereData('platform',['id'=>4],'id,thumbnail');//会员中心
$register = Common::findWhereData('platform',['id'=>4],'id,thumbnail');//会员注册
$center = Common::findWhereData('platform',['id'=>5],'id,thumbnail');//个人中心
$arr['thumbnail']['introduce'] = Common::absolutionUrlOne($introduce['thumbnail']);
$arr['thumbnail']['service'] = Common::absolutionUrlOne($service['thumbnail']);
$arr['thumbnail']['experience'] = Common::absolutionUrlOne($experience['thumbnail']);
$arr['thumbnail']['register'] = Common::absolutionUrlOne($register['thumbnail']);
$arr['thumbnail']['center'] = Common::absolutionUrlOne($center['thumbnail']);
$this->success('成功',$arr);
}else{
... ...
... ... @@ -5,6 +5,7 @@ namespace app\api\controller;
use app\admin\model\Collection;
use app\admin\model\Free;
use app\admin\model\Rcoupon;
use app\admin\model\Registers;
use app\common\controller\Api;
use fast\Http;
use think\db\Query;
... ... @@ -104,7 +105,12 @@ class User extends Api
* @ApiParams (name="city", type="string", required=true, description="市")
* @ApiParams (name="district", type="string", required=true, description="区")
* @ApiParams (name="address", type="string", required=true, description="详细地址")
* @ApiReturn()
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578555060",
"data": null
})
*/
public function freeBook(){
if($this->request->isPost()){
... ... @@ -128,4 +134,49 @@ class User extends Api
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (会员注册)
* @ApiSummary (会员注册)
* @ApiMethod (POST)
* @ApiRoute (/api/user/userRegister)
* @ApiParams (name="user_name", type="string", required=true, description="姓名")
* @ApiParams (name="mobile", type="number", required=true, description="手机号")
* @ApiParams (name="province", type="string", required=true, description="省")
* @ApiParams (name="city", type="string", required=true, description="市")
* @ApiParams (name="district", type="string", required=true, description="区")
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578555060",
"data": null
})
*/
public function userRegister(){
if($this->request->isPost()){
$data = $this->request->post();
//验证表数据
$rule = config('verify.user_register');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$registersModel = new Registers();
$data['uid'] = $this->uid;
//查询是否注册
$res1 = Common::findWhereData('registers',['uid'=>$this->uid],'id');
if($res1){
$this->error('你已经注册过');
}
$res = $registersModel->create($data);
if($res){
$this->success('成功');
}else{
$this->error('失败');
}
}else{
$this->error('请求方式错误');
}
}
}
... ...
... ... @@ -39,4 +39,22 @@ return [
'address.require' => '详细地址不能为空',
]
],
//会员注册
'user_register' => [
'rule' => [
'user_name' => 'require',
'mobile' => ['require','regex'=>'/^0?1[3|4|5|6|7|8|9][0-9]\d{8}$/'],
'province' => 'require',
'city' => 'require',
'district' => 'require',
],
'msg' => [
'user_name.require'=> '姓名不能为空',
'mobile.require' => '手机号不能为空',
'mobile' => '手机号格式不正确',
'province.require' => '省不能为空',
'city.require' => '市不能为空',
'district.require' => '区不能为空',
]
],
];
\ No newline at end of file
... ...
... ... @@ -153,6 +153,7 @@
<div class="child collapse" id="个人中心接口">
<a href="javascript:;" data-id="4" class="list-group-item">小程序登录</a>
<a href="javascript:;" data-id="5" class="list-group-item">免费预约</a>
<a href="javascript:;" data-id="6" class="list-group-item">会员注册</a>
</div>
</div>
</div>
... ... @@ -265,7 +266,8 @@
"introduce": "http://mite.w.brotop.cn/uploads/20200107/e0bf0b8d402b5447575389b8bd57c225.png",//公司简介缩略图
"service": "http://mite.w.brotop.cn/uploads/20200107/b48a6582d12da1fdafce424afbb3384d.png",//服务介绍缩略图
"experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员中心缩略图
"register": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员注册缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//个人中心缩略图
}
}
}</pre>
... ... @@ -873,7 +875,167 @@
<div class="tab-pane" id="sample5">
<div class="row">
<div class="col-md-12">
<pre id="sample_response5"></pre>
<pre id="sample_response5">{
"code": 1,
"msg": "成功",
"time": "1578555060",
"data": null
}</pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-6">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion6" href="#collapseOne6"> 会员注册 <span class="text-muted">/api/user/userRegister</span></a>
</h4>
</div>
<div id="collapseOne6" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab6">
<li class="active"><a href="#info6" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox6" data-toggle="tab">在线测试</a></li>
<li><a href="#sample6" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info6">
<div class="well">
会员注册 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>user_name</td>
<td>string</td>
<td></td>
<td>姓名</td>
</tr>
<tr>
<td>mobile</td>
<td>number</td>
<td></td>
<td>手机号</td>
</tr>
<tr>
<td>province</td>
<td>string</td>
<td></td>
<td></td>
</tr>
<tr>
<td>city</td>
<td>string</td>
<td></td>
<td></td>
</tr>
<tr>
<td>district</td>
<td>string</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox6">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/userRegister" method="POST" name="form6" id="form6">
<div class="form-group">
<label class="control-label" for="user_name">user_name</label>
<input type="string" class="form-control input-sm" id="user_name" required placeholder="姓名" name="user_name">
</div>
<div class="form-group">
<label class="control-label" for="mobile">mobile</label>
<input type="number" class="form-control input-sm" id="mobile" required placeholder="手机号" name="mobile">
</div>
<div class="form-group">
<label class="control-label" for="province">province</label>
<input type="string" class="form-control input-sm" id="province" required placeholder="省" name="province">
</div>
<div class="form-group">
<label class="control-label" for="city">city</label>
<input type="string" class="form-control input-sm" id="city" required placeholder="市" name="city">
</div>
<div class="form-group">
<label class="control-label" for="district">district</label>
<input type="string" class="form-control input-sm" id="district" required placeholder="区" name="district">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="6">提交</button>
<button type="reset" class="btn btn-info" rel="6">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers6"></pre>
<pre id="response6"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample6">
<div class="row">
<div class="col-md-12">
<pre id="sample_response6">{
"code": 1,
"msg": "成功",
"time": "1578555060",
"data": null
}</pre>
</div>
</div>
</div><!-- #sample -->
... ... @@ -888,7 +1050,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-01-08 14:47:17 </div>
Generated on 2020-01-09 15:33:04 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...
... ... @@ -8,7 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
index_url: 'free/index' + location.search,
add_url: 'free/add',
// edit_url: 'free/edit',
del_url: 'free/del',
// del_url: 'free/del',
import_url: 'free/import',
multi_url: 'free/multi',
table: 'free',
... ... @@ -43,6 +43,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
showExport: false,//隐藏导出
columns: [
[
{checkbox: true},
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
order: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'order/index' + location.search,
add_url: 'order/add',
edit_url: 'order/edit',
del_url: 'order/del',
multi_url: 'order/multi',
// import_url: 'order/import',
table: 'order',
},
queryParams: function (params) { //自定义搜索条件
params.ids = Config.r_id;//将搜索过滤器和操作方法 都转为JSON字符串
return params;
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
showExport: false,//隐藏导出
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'order_sn', title: __('Order_sn')},
{field: 'price', title: __('Price')},
{field: 'content', title: __('Content')},
{field: 'total_num', title: __('Total_num')},
{field: 'use_num', title: __('Use_num')},
{field: 'not_use_num', title: __('Not_use_num')},
{field: 'advice', title: __('Advice')},
{field: 'address', title: __('Address')},
{field: 'organization', title: __('Organization')},
{field: 'pin_user', title: __('Pin_user')},
{field: 'mark', title: __('Mark')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
\ No newline at end of file
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'register/index' + location.search,
// add_url: 'register/add',
edit_url: 'register/edit',
// del_url: 'register/del',
multi_url: 'register/multi',
table: 'register',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'thumbnail', title: __('Thumbnail'),events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
\ No newline at end of file
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'registers/index' + location.search,
add_url: 'registers/add',
// edit_url: 'registers/edit',
// del_url: 'registers/del',
import_url: 'registers/import',
multi_url: 'registers/multi',
table: 'registers',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
showExport: false,//隐藏导出
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'user.nickname', title: __('User.nickname')},
{field: 'user_name', title: __('User_name')},
{field: 'mobile', title: __('Mobile')},
{field: 'province', title: __('Province')},
{field: 'city', title: __('City')},
{field: 'district', title: __('District')},
{field: 'status', title: __('Status'),formatter:
function(value,row,index){
var value1 = '';
if(row.status === 0){
value1 += '<span style="color:red">审核中</span>';
}else if(row.status === 1){
value1+= '<span style="color:green">通过</span>';
}else{
value1+= '<span style="color:darkred">未通过</span>';
}
return value1;
},searchList: { 0: __('审核中'), 1: __('通过'), 2: __('未通过')}
},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
{
name: 'detail',
text: __('通过'),
title: __('通过'),
classname: 'btn btn-xs btn-primary btn-ajax',
icon: 'fa fa-magic',
url: 'registers/adopt',
confirm: '确认通过?',
success: function (data, ret) {
$(".btn-refresh").trigger("click");
},
error: function (data, ret) {
return false;
},
visible: function (row) {
if(row.status == 0 || row.status == 2){
return true;
}else{
return false;
}
}
},
{
name: 'detail',
text: __('拒绝'),
title: __('拒绝'),
classname: 'btn btn-xs btn-primary btn-ajax',
icon: 'fa fa-magic',
url: 'registers/reject',
confirm: '确认拒绝?',
success: function (data, ret) {
$(".btn-refresh").trigger("click");
},
error: function (data, ret) {
return false;
},
visible: function (row) {
if(row.status == 0 || row.status == 1){
return true;
}else{
return false;
}
}
},
{
name: 'offline',
text: '订单列表',
title: '订单列表',
icon: 'fa fa-list',
classname: 'btn btn-xs btn-success btn-dialog',
url: "order/order"
},
]}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
\ No newline at end of file
... ...