作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

合并分支 'heshupeng' 到 'master'

社区活动报名管理



查看合并请求 !391
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 社区活动报名管理
*
* @icon fa fa-circle-o
*/
class HouseJoin extends Backend
{
/**
* HouseJoin模型对象
* @var \app\admin\model\HouseJoin
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\HouseJoin;
$this->view->assign("payStatusList", $this->model->getPayStatusList());
$this->view->assign("joinStatusList", $this->model->getJoinStatusList());
$this->view->assign("specTypeList", $this->model->getSpecTypeList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = false;
//设置过滤方法
$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
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
foreach ($list as $row) {
$row->visible(['id','order_no','contact','mobile','total_price','pay_price','pay_status','pay_time','join_status','createtime']);
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
public function detail(){
$param = $this->request->param();
$row = $this->model->get($param['ids']);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}
... ...
<?php
return [
'Id' => '订单ID',
'Order_no' => '订单号',
'Contact' => '联系人姓名',
'Mobile' => '联系方式',
'Remark' => '备注信息',
'Total_price' => '活动报名费用',
'Pay_price' => '订单总支付金额',
'Pay_status' => '支付状态',
'Pay_status 0' => '未支付',
'Pay_status 1' => '已支付',
'Pay_time' => '支付时间',
'Join_status' => '报名状态',
'Join_status 0' => '未报名',
'Join_status 1' => '已报名',
'Transaction_id' => '微信支付ID',
'User_id' => '报名用户ID',
'House_activity_id' => '活动ID',
'Price' => '活动报名费用',
'Total_num' => '活动报名数量',
'Title' => '活动标题',
'Content' => '活动描述详情',
'Spec_type' => '活动规格',
'Spec_type 0' => '无规格(免费)',
'Spec_type 1' => '单规格',
'Spec_type 2' => '多规格',
'Start_time' => '活动开始时间',
'End_time' => '活动结束时间',
'Spec_sku_id' => '活动sku',
'House_activity_spec_id' => '活动规格ID',
'Activity_attr' => '活动规格描述',
'Createtime' => '生成时间'
];
... ...
<?php
namespace app\admin\model;
use think\Model;
class HouseJoin extends Model
{
// 表名
protected $name = 'house_join';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
'pay_status_text',
'pay_time_text',
'join_status_text',
'spec_type_text',
'start_time_text',
'end_time_text'
];
public function getPayStatusList()
{
return ['0' => __('Pay_status 0'), '1' => __('Pay_status 1')];
}
public function getJoinStatusList()
{
return ['0' => __('Join_status 0'), '1' => __('Join_status 1')];
}
public function getSpecTypeList()
{
return ['0' => __('Spec_type 0'), '1' => __('Spec_type 1'), '2' => __('Spec_type 2')];
}
public function getPayStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['pay_status']) ? $data['pay_status'] : '');
$list = $this->getPayStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getPayTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['pay_time']) ? $data['pay_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getJoinStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['join_status']) ? $data['join_status'] : '');
$list = $this->getJoinStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getSpecTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['spec_type']) ? $data['spec_type'] : '');
$list = $this->getSpecTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getStartTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getEndTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
protected function setPayTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setStartTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setEndTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
public function user()
{
return $this->belongsTo('user');
}
}
... ...
<?php
namespace app\admin\validate;
use think\Validate;
class HouseJoin extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<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">{:__('Order_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_no" data-rule="required" class="form-control" name="row[order_no]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Contact')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-contact" data-rule="required" class="form-control" name="row[contact]" type="text" value="">
</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="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-remark" data-rule="required" class="form-control" name="row[remark]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Total_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-total_price" data-rule="required" class="form-control" step="0.01" name="row[total_price]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pay_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pay_price" data-rule="required" class="form-control" step="0.01" name="row[pay_price]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pay_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="payStatusList" item="vo"}
<label for="row[pay_status]-{$key}"><input id="row[pay_status]-{$key}" name="row[pay_status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pay_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[pay_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Join_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="joinStatusList" item="vo"}
<label for="row[join_status]-{$key}"><input id="row[join_status]-{$key}" name="row[join_status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-transaction_id" data-rule="required" data-source="transaction/index" class="form-control selectpage" name="row[transaction_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('House_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-house_activity_id" data-rule="required" data-source="house/activity/index" class="form-control selectpage" name="row[house_activity_id]" 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" step="0.01" name="row[price]" type="number" value="0.00">
</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">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" 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">
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Spec_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-spec_type" data-rule="required" class="form-control selectpicker" name="row[spec_type]">
{foreach name="specTypeList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Spec_sku_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-spec_sku_id" data-rule="required" data-source="spec/sku/index" class="form-control selectpage" name="row[spec_sku_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('House_activity_spec_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-house_activity_spec_id" data-rule="required" data-source="house/activity/spec/index" class="form-control selectpage" name="row[house_activity_spec_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Activity_attr')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-activity_attr" data-rule="required" class="form-control" name="row[activity_attr]" 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="send-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<style>
.padding{
float:left;
}
</style>
<fieldset>
<legend>
报名信息
</legend>
<!-- 订单信息 -->
<div class="col-md-10 col-md-offset-1 col-sm-12">
<div class="box radius-none">
<div class="box-header with-border">
{:__('Order_no')}:{$vo.order_no} ( 下单时间 {$vo.createtime|date="Y-m-d H:i:s",###})
</div>
<div class="box-body">
<div class="panel panel-default">
<div class="panel-heading">活动详情</div>
<table class="table">
<tr>
<td>{$vo.title}</td>
<td>{$vo.activity_attr}</td>
<td>{$vo.price}元</td>
<td>数量:{$vo.total_num}</td>
</tr>
</table>
</div>
<div class="row" style="margin:1em 0;">
<div class="col-md-4 padding">
<span class="label label-danger">{:__('Pay_status')}</span> :
{$vo.pay_status_text}
</div>
<div class="col-md-4 padding">
<span class="label label-danger">{:__('Pay_time')}</span> :
{if ($vo.pay_time==0)}
{else}
{$vo.pay_time|date="Y-m-d H:i:s",###}
{/if}
</div>
<div class="col-md-4 padding">
<span class="label label-danger">{:__('Pay_price')}</span> :
{$vo.pay_price}
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">备注</div>
<table class="table">
<tr>
<td>{$vo.remark|default='未填写'}</td>
</tr>
</table>
</div>
<div class="col-md-12 padding">
<fieldset>
<legend><h4> </h4></legend>
<div class="col-md-6 col-md-offset-6 padding">
<div class="col-md-8 padding" style="text-align: right;">
<span class="label label-success">下单微信昵称:</span><br><br>{$vo.user.nickname}
</div>
<div class="col-md-4 padding" style="text-align: left;">
<img style="width: 78px;" class="img-circle" src="{$vo.user.avatar}"/>
</div>
</div>
</fieldset>
</div>
</div>
</div>
</div>
<!-- 订单信息 -->
</fieldset>
</form>
\ No newline at end of file
... ...
<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">{:__('Order_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_no" data-rule="required" class="form-control" name="row[order_no]" type="text" value="{$row.order_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Contact')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-contact" data-rule="required" class="form-control" name="row[contact]" type="text" value="{$row.contact|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">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-remark" data-rule="required" class="form-control" name="row[remark]" type="text" value="{$row.remark|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Total_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-total_price" data-rule="required" class="form-control" step="0.01" name="row[total_price]" type="number" value="{$row.total_price|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pay_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pay_price" data-rule="required" class="form-control" step="0.01" name="row[pay_price]" type="number" value="{$row.pay_price|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pay_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="payStatusList" item="vo"}
<label for="row[pay_status]-{$key}"><input id="row[pay_status]-{$key}" name="row[pay_status]" type="radio" value="{$key}" {in name="key" value="$row.pay_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pay_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[pay_time]" type="text" value="{:$row.pay_time?datetime($row.pay_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Join_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="joinStatusList" item="vo"}
<label for="row[join_status]-{$key}"><input id="row[join_status]-{$key}" name="row[join_status]" type="radio" value="{$key}" {in name="key" value="$row.join_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-transaction_id" data-rule="required" data-source="transaction/index" class="form-control selectpage" name="row[transaction_id]" type="text" value="{$row.transaction_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('House_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-house_activity_id" data-rule="required" data-source="house/activity/index" class="form-control selectpage" name="row[house_activity_id]" type="text" value="{$row.house_activity_id|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" step="0.01" name="row[price]" type="number" value="{$row.price|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">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|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">
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Spec_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-spec_type" data-rule="required" class="form-control selectpicker" name="row[spec_type]">
{foreach name="specTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.spec_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-start_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row.start_time?datetime($row.start_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row.end_time?datetime($row.end_time):''}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Spec_sku_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-spec_sku_id" data-rule="required" data-source="spec/sku/index" class="form-control selectpage" name="row[spec_sku_id]" type="text" value="{$row.spec_sku_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('House_activity_spec_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-house_activity_spec_id" data-rule="required" data-source="house/activity/spec/index" class="form-control selectpage" name="row[house_activity_spec_id]" type="text" value="{$row.house_activity_spec_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Activity_attr')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-activity_attr" data-rule="required" class="form-control" name="row[activity_attr]" type="text" value="{$row.activity_attr|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('house_join/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('house_join/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('house_join/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('house_join/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('house_join/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="false"
data-operate-del="{:$auth->check('house_join/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'house_join/index' + location.search,
add_url: 'house_join/add',
edit_url: 'house_join/edit',
del_url: 'house_join/del',
multi_url: 'house_join/multi',
table: 'house_join',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'order_no', title: __('Order_no')},
{field: 'contact', title: __('Contact')},
{field: 'mobile', title: __('Mobile')},
{field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
{field: 'pay_price', title: __('Pay_price'), operate:'BETWEEN'},
{field: 'pay_status', title: __('Pay_status'), searchList: {"0":__('Pay_status 0'),"1":__('Pay_status 1')}, formatter: Table.api.formatter.status},
{field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'join_status', title: __('Join_status'), searchList: {"0":__('Join_status 0'),"1":__('Join_status 1')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, buttons: [
{name: 'send', text: __('view'), icon: 'fa fa-eye', classname: 'btn btn-xs btn-warning btn-dialog chakan', url: 'house_join/detail'},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
detail: function(){
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
\ No newline at end of file
... ...