作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

提现

<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 商户余额变动
*
* @icon fa fa-circle-o
*/
class UserMoneyLog extends Backend
{
/**
* UserMoneyLog模型对象
* @var \app\admin\model\UserMoneyLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\UserMoneyLog;
$this->view->assign("typeList", $this->model->getTypeList());
}
/**
* 默认生成的控制器所继承的父类中有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();
}
$admin_id = $this->auth->id;
$where2['admin_id'] = ['eq',$admin_id];
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->where($where2)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->where($where2)
->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 EasyWeChat\Foundation\Application;
use fast\Random;
use think\Db;
/**
* 商户余额变动
*
* @icon fa fa-circle-o
*/
class UserMoneyLogAudit extends Backend
{
/**
* UserMoneyLogAudit模型对象
* @var \app\admin\model\UserMoneyLogAudit
*/
protected $model = null;
protected $searchFields = 'admin.merchant_title,admin.merchant_name,admin.merchant_mobile';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\UserMoneyLogAudit;
$this->view->assign("typeList", $this->model->getTypeList());
}
/**
* 默认生成的控制器所继承的父类中有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']);
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(['admin'])
->where($where)
->where(['type'=>1])
->order($sort, $order)
->count();
$list = $this->model
->with(['admin'])
->where($where)
->where(['type'=>1])
->order($sort, $order)
->limit($offset, $limit)
->select();
foreach ($list as $row) {
$row->getRelation('admin')->visible(['id','username','nickname','merchant_title','merchant_name']);
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
if(empty($params['type'])){
$this->error("请选择审核状态");
}
// $result = $row->allowField(true)->save($params);
if($params['type'] == 2){
//审核通过
$user = Db::name('user')->where(['id'=>$row['user_id']])->find();
$third = Db::name('third')->where(['id'=>$row['user_id']])->find();
//红包券充值比例
$exp_ratio = Db::name('exp_ratio')->where(['id'=>1])->find();
$withdraw = $this->merchantPay($third['openid'],$user['nickname'],$row['money']*$exp_ratio['ratio']*0.01,'商户提现');
if($withdraw['return_code'] == 'SUCCESS') {
if ($withdraw['result_code'] == 'SUCCESS') {
// 提现成功,将余额扣除
dump($withdraw);
}
}
}
exit();
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
public function merchantPay($openid,$user_name,$price,$desc){
$options = [
'app_id' => config('wechat.app_id'),
'secret' => config('wechat.app_secret'),
'payment' => [
'merchant_id' => config('wechat.merchant_id'),
'key' => config('wechat.key'),
'cert_path' => config('wechat.cert_path'),
'key_path' => config('wechat.key_path'),
],
];
$app = new Application($options);
$merchantPay = $app->merchant_pay;
$merchantPayData = [
'partner_trade_no' => date("YmdHis") . Random::alnum(6), //随机字符串作为订单号,跟红包和支付一个概念。
'openid' => $openid, //收款人的openid
'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK
're_user_name'=>$user_name, //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交
'amount' => $price*100, //单位为分
'desc' => $desc,
'spbill_create_ip' => $this->request->ip(0,true), //发起交易的IP地址
];
$result = $merchantPay->send($merchantPayData);
return $result;
}
}
... ...
<?php
return [
'Admin_id' => '商户id',
'Before_money' => '余额变动前',
'Money' => '变动余额',
'After_money' => '余额变动后',
'Type' => '类型:1=体现待审核,2体现审核通过,3提现审核失败,4充值,5用户答题消耗,6用户答题上级用户消耗',
'Createtime' => '创建时间',
'Goods_id' => '商品id(只有type字段为5,6才会有值)',
'User_id' => '商品id(只有type字段为5)'
];
... ...
<?php
return [
'Admin_id' => '商户id',
'Before_money' => '余额变动前',
'Money' => '变动余额',
'After_money' => '余额变动后',
'Type' => '类型:1=体现待审核,2体现审核通过,3提现审核失败,4充值,5用户答题消耗,6用户答题上级用户消耗',
'Createtime' => '创建时间',
'Goods_id' => '商品id(只有type字段为5,6才会有值)',
'User_id' => '商品id(只有type字段为5)',
'Admin.id' => 'ID',
'Admin.username' => '用户名',
'Admin.nickname' => '昵称'
];
... ...
<?php
namespace app\admin\model;
use think\Model;
class UserMoneyLog extends Model
{
// 表名
protected $name = 'user_money_log';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
'type_text'
];
public function getTypeList()
{
return ['6' => __('Type 6'), '5' => __('Type 5'), '4' => __('Type 4'), '3' => __('Type 3'), '2' => __('Type 2'), '1' => __('Type 1')];
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
}
... ...
<?php
namespace app\admin\model;
use think\Model;
class UserMoneyLogAudit extends Model
{
// 表名
protected $name = 'user_money_log';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
'type_text'
];
public function getTypeList()
{
return ['6' => __('Type 6'), '5' => __('Type 5'), '4' => __('Type 4'), '3' => __('Type 3'), '2' => __('Type 2'), '1' => __('Type 1')];
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function admin()
{
return $this->belongsTo('Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}
... ...
<?php
namespace app\admin\validate;
use think\Validate;
class UserMoneyLog extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate;
use think\Validate;
class UserMoneyLogAudit 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">{:__('Before_money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-before_money" data-rule="required" class="form-control" step="0.01" name="row[before_money]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('After_money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-after_money" data-rule="required" class="form-control" step="0.01" name="row[after_money]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_id" data-rule="required" data-source="goods/index" class="form-control selectpage" name="row[goods_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 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">{:__('Before_money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-before_money" data-rule="required" class="form-control" step="0.01" name="row[before_money]" type="number" value="{$row.before_money|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('After_money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-after_money" data-rule="required" class="form-control" step="0.01" name="row[after_money]" type="number" value="{$row.after_money|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_id" data-rule="required" data-source="goods/index" class="form-control selectpage" name="row[goods_id]" type="text" value="{$row.goods_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 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('user_money_log/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('user_money_log/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('user_money_log/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('user_money_log/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('user_money_log/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('user_money_log/edit')}"
data-operate-del="{:$auth->check('user_money_log/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">{:__('Before_money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-before_money" data-rule="required" class="form-control" step="0.01" name="row[before_money]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('After_money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-after_money" data-rule="required" class="form-control" step="0.01" name="row[after_money]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_id" data-rule="required" data-source="goods/index" class="form-control selectpage" name="row[goods_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 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="">
<table class="table table-striped">
<thead>
<tr>
<th>{:__('Title')}</th>
<th>{:__('Content')}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{:__('商家名称')}:</td>
<td>{$row.admin.merchant_title}</td>
</tr>
<tr>
<td>{:__('商家联系人')}:</td>
<td>{$row.admin.merchant_name}</td>
</tr>
<tr>
<td>{:__('商家联系电话')}:</td>
<td>{$row.admin.merchant_mobile}</td>
</tr>
<tr>
<td>{:__('提现金额')}:</td>
<td>{$row.money}</td>
</tr>
<tr>
<td>{:__('审核状态')}:</td>
<td>
<div class="radio">
<label for="row[type]-2" class=""><input id="row[type]-2" name="row[type]" type="radio" value="2" {in name="2" value="$row.type" }checked{/in}/>审核通过</label>
<label for="row[type]-3" class=""><input id="row[type]-3" name="row[type]" type="radio" value="3" {in name="3" value="$row.type" }checked{/in}/>审核失败</label>
</div>
</td>
</tr>
</tbody>
</table>
<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('user_money_log_audit/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('user_money_log_audit/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('user_money_log_audit/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('user_money_log_audit/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('user_money_log_audit/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('user_money_log_audit/edit')}"
data-operate-del="{:$auth->check('user_money_log_audit/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: 'user_money_log/index' + location.search,
// add_url: 'user_money_log/add',
// edit_url: 'user_money_log/edit',
// del_url: 'user_money_log/del',
multi_url: 'user_money_log/multi',
table: 'user_money_log',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
search:false,
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
// {checkbox: true},
{field: 'id', title: __('Id'), operate:false},
{field: 'admin_id', title: __('Admin_id'), operate:false, visible:false},
{field: 'before_money', title: __('Before_money'), operate:false},
{field: 'money', title: __('Money'), operate:false},
{field: 'after_money', title: __('After_money'), operate:false},
{field: 'type', title: __('类型'), searchList: {"6":__('用户上级获得'),"5":__('用户答题'),"4":__('充值'),"3":__('提现审核失败'),"2":__('体现审核通过'),"1":__('提现待审核')}, formatter: Table.api.formatter.label},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'goods_id', title: __('Goods_id'), operate:false, visible:false},
{field: 'user_id', title: __('User_id'), operate:false, visible:false},
{field: 'operate', title: __('Operate'), visible:false, 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: 'user_money_log_audit/index' + location.search,
// add_url: 'user_money_log_audit/add',
edit_url: 'user_money_log_audit/edit',
// del_url: 'user_money_log_audit/del',
multi_url: 'user_money_log_audit/multi',
table: 'user_money_log',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
search:true,
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'), operate:false},
{field: 'admin_id', title: __('Admin_id')},
{field: 'before_money', title: __('Before_money'), operate:false, visible:false},
{field: 'money', title: __('提现金额'), operate:'BETWEEN'},
{field: 'after_money', title: __('After_money'), operate:false, visible:false},
{field: 'type', title: __('类型'), operate:false, visible:false, searchList: {"6":__('用户上级获得'),"5":__('用户答题'),"4":__('充值'),"3":__('提现审核失败'),"2":__('体现审核通过'),"1":__('提现待审核')}, formatter: Table.api.formatter.label},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'goods_id', title: __('Goods_id'), operate:false, visible:false},
{field: 'user_id', title: __('User_id'), operate:false, visible:false},
{field: 'admin.id', title: __('Admin.id'), operate:false, visible:false},
{field: 'admin.merchant_title', title: __('商家名称')},
{field: 'admin.merchant_name', title: __('商家联系人')},
{field: 'admin.merchant_mobile', title: __('商家联系人电话')},
{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
... ...