作者 刘朕
1 个管道 的构建 通过 耗费 1 秒

合并分支 'Branch_liuzhen' 到 'master'

新入驻社区订单功能添加



查看合并请求 !398
  1 +<?php
  2 +
  3 +namespace app\admin\controller\store;
  4 +
  5 +use app\admin\model\House;
  6 +use app\common\controller\Backend;
  7 +use think\Db;
  8 +use think\exception\PDOException;
  9 +use think\exception\ValidateException;
  10 +
  11 +/**
  12 + * 开通新社区订单管理
  13 + *
  14 + * @icon fa fa-circle-o
  15 + */
  16 +class StoreOrder extends Backend
  17 +{
  18 +
  19 + /**
  20 + * StoreOrder模型对象
  21 + * @var \app\admin\model\store\StoreOrder
  22 + */
  23 + protected $model = null;
  24 +
  25 + public function _initialize()
  26 + {
  27 + parent::_initialize();
  28 + $this->model = new \app\admin\model\store\StoreOrder;
  29 + $this->view->assign("statusList", $this->model->getStatusList());
  30 + }
  31 +
  32 + /**
  33 + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  34 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  35 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  36 + */
  37 +
  38 +
  39 + /**
  40 + * 查看
  41 + */
  42 + public function index()
  43 + {
  44 + //当前是否为关联查询
  45 + $this->relationSearch = true;
  46 + //设置过滤方法
  47 + $this->request->filter(['strip_tags', 'trim']);
  48 + if ($this->request->isAjax())
  49 + {
  50 + //如果发送的来源是Selectpage,则转发到Selectpage
  51 + if ($this->request->request('keyField'))
  52 + {
  53 + return $this->selectpage();
  54 + }
  55 + list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  56 + $total = $this->model
  57 + ->with(['user','store'])
  58 + ->where($where)
  59 + ->order($sort, $order)
  60 + ->count();
  61 +
  62 + $list = $this->model
  63 + ->with(['user','store'])
  64 + ->where($where)
  65 + ->order($sort, $order)
  66 + ->limit($offset, $limit)
  67 + ->select();
  68 +
  69 + foreach ($list as $row) {
  70 +
  71 + $row->getRelation('user')->visible(['nickname']);
  72 + }
  73 + $list = collection($list)->toArray();
  74 + foreach ($list as &$v) {
  75 + $v['house_names'] = House::whereIn('id',$v['house_ids'])->column('name');
  76 + }
  77 + $result = array("total" => $total, "rows" => $list);
  78 +
  79 + return json($result);
  80 + }
  81 + return $this->view->fetch();
  82 + }
  83 +
  84 + /**
  85 + * 已支付
  86 + */
  87 + public function pay($ids = null)
  88 + {
  89 + if ($ids) {
  90 + $row = $this->model->get($ids);
  91 + if (!$row) {
  92 + $this->error(__('No Results were found'));
  93 + }
  94 + $adminIds = $this->getDataLimitAdminIds();
  95 + if (is_array($adminIds)) {
  96 + if (!in_array($row[$this->dataLimitField], $adminIds)) {
  97 + $this->error(__('You have no permission'));
  98 + }
  99 + }
  100 + $params = $this->request->param();
  101 +// if ($row->pay_type != 3) {
  102 +// $this->error('非线下支付无法修改支付状态');
  103 +// }
  104 + if ($row->status != 1) {
  105 + $this->error('该订单已支付');
  106 + }
  107 + $row->status = 2;
  108 + Db::startTrans();
  109 + try {
  110 + $result = $row->save();
  111 + // 修改或新增关联社区
  112 + $time = time();
  113 + $info = $row->toArray();
  114 + $store = Db::name('store')->where('id',$info['store_id'])->find();
  115 + $update = [
  116 + 'house_ids' => $store['house_ids'].$info['house_ids'].','
  117 + ];
  118 + $res_store = Db::name('store')->where('id',$info['store_id'])->update($update);
  119 + // 修改或新增社区有效期
  120 + foreach (explode(',',$info['house_ids']) as $v) {
  121 + if($v) {
  122 + $store_house = Db::name('store_house')->where(['user_id' => $info['user_id'], 'store_id' => $info['store_id'], 'house_id' => $v])->find();
  123 + if ($store_house) {
  124 + $house_update = [
  125 + 'id' => $store_house['id']
  126 + ];
  127 + if ($store_house['end_time'] > $time) {
  128 + $house_update['end_time'] = $store_house['end_time'] + config('site.house_valid') * 86400;
  129 + } else {
  130 + $house_update['end_time'] = $time + config('site.house_valid') * 86400;
  131 + }
  132 + $result_store_house = Db::name('store_house')->update(['id' => $store_house['id'], '']);
  133 + } else {
  134 + $insert = [
  135 + 'user_id' => $info['user_id'],
  136 + 'store_id' => $info['store_id'],
  137 + 'house_id' => $v,
  138 + 'start_time' => $time,
  139 + 'end_time' => $time + config('site.house_valid') * 86400,
  140 + 'createtime' => $time,
  141 + 'updatetime' => $time
  142 + ];
  143 + $result_store_house = Db::name('store_house')->insertGetId($insert);
  144 + }
  145 + if (!$result_store_house) {
  146 + Db::rollback();
  147 + }
  148 + }
  149 + }
  150 + if(!$result || !$res_store) {
  151 + Db::rollback();
  152 + } else {
  153 + Db::commit();
  154 + }
  155 + } catch (ValidateException $e) {
  156 + Db::rollback();
  157 + $this->error($e->getMessage());
  158 + } catch (PDOException $e) {
  159 + Db::rollback();
  160 + $this->error($e->getMessage());
  161 + } catch (\think\Exception $e) {
  162 + Db::rollback();
  163 + $this->error($e->getMessage());
  164 + }
  165 + if (!$result) {
  166 + $this->error('修改失败');
  167 + }
  168 + $this->success('修改成功');
  169 + }
  170 + }
  171 +}
  1 +<?php
  2 +
  3 +return [
  4 + 'Order_sn' => '订单编号',
  5 + 'User_id' => '用户id',
  6 + 'Store_id' => '店铺id',
  7 + 'House_ids' => '社区id',
  8 + 'House_names' => '所选社区',
  9 + 'Status' => '状态',
  10 + 'Status 1' => '待支付',
  11 + 'Status 2' => '已支付',
  12 + 'Status 3' => '审核驳回',
  13 + 'Money' => '支付金额',
  14 + 'Pay_time' => '支付时间',
  15 + 'Transaction_id' => '微信支付ID',
  16 + 'End_time' => '过期时间',
  17 + 'Createtime' => '生成时间',
  18 + 'Updatetime' => '更新时间',
  19 + 'User.nickname' => '昵称',
  20 + 'Store.store_name' => '店铺名称'
  21 +];
  1 +<?php
  2 +
  3 +namespace app\admin\model\store;
  4 +
  5 +use think\Model;
  6 +
  7 +
  8 +class StoreOrder extends Model
  9 +{
  10 +
  11 +
  12 +
  13 +
  14 +
  15 + // 表名
  16 + protected $name = 'store_order';
  17 +
  18 + // 自动写入时间戳字段
  19 + protected $autoWriteTimestamp = 'int';
  20 +
  21 + // 定义时间戳字段名
  22 + protected $createTime = 'createtime';
  23 + protected $updateTime = 'updatetime';
  24 + protected $deleteTime = false;
  25 +
  26 + // 追加属性
  27 + protected $append = [
  28 + 'status_text',
  29 + 'pay_time_text',
  30 + 'end_time_text'
  31 + ];
  32 +
  33 +
  34 +
  35 + public function getStatusList()
  36 + {
  37 + return ['1' => __('Status 1'), '2' => __('Status 2')];
  38 + }
  39 +
  40 +
  41 + public function getStatusTextAttr($value, $data)
  42 + {
  43 + $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
  44 + $list = $this->getStatusList();
  45 + return isset($list[$value]) ? $list[$value] : '';
  46 + }
  47 +
  48 +
  49 + public function getPayTimeTextAttr($value, $data)
  50 + {
  51 + $value = $value ? $value : (isset($data['pay_time']) ? $data['pay_time'] : '');
  52 + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
  53 + }
  54 +
  55 +
  56 + public function getEndTimeTextAttr($value, $data)
  57 + {
  58 + $value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : '');
  59 + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
  60 + }
  61 +
  62 + protected function setPayTimeAttr($value)
  63 + {
  64 + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
  65 + }
  66 +
  67 + protected function setEndTimeAttr($value)
  68 + {
  69 + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
  70 + }
  71 +
  72 +
  73 + public function user()
  74 + {
  75 + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
  76 + }
  77 +
  78 + public function store()
  79 + {
  80 + return $this->belongsTo('app\admin\model\store\Store', 'store_id', 'id', [], 'LEFT')->setEagerlyType(0);
  81 + }
  82 +}
  1 +<?php
  2 +
  3 +namespace app\admin\validate\store;
  4 +
  5 +use think\Validate;
  6 +
  7 +class StoreOrder extends Validate
  8 +{
  9 + /**
  10 + * 验证规则
  11 + */
  12 + protected $rule = [
  13 + ];
  14 + /**
  15 + * 提示消息
  16 + */
  17 + protected $message = [
  18 + ];
  19 + /**
  20 + * 验证场景
  21 + */
  22 + protected $scene = [
  23 + 'add' => [],
  24 + 'edit' => [],
  25 + ];
  26 +
  27 +}
  1 +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + <input id="c-order_sn" data-rule="required" class="form-control" name="row[order_sn]" type="text" value="''">
  7 + </div>
  8 + </div>
  9 + <div class="form-group">
  10 + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <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="">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
  16 + <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
  17 + <div class="col-xs-12 col-sm-8">
  18 + <input id="c-store_id" data-rule="required" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value="">
  19 + </div>
  20 + </div>
  21 + <div class="form-group">
  22 + <label class="control-label col-xs-12 col-sm-2">{:__('House_ids')}:</label>
  23 + <div class="col-xs-12 col-sm-8">
  24 + <input id="c-house_ids" data-rule="required" data-source="house/index" data-multiple="true" class="form-control selectpage" name="row[house_ids]" type="text" value="">
  25 + </div>
  26 + </div>
  27 + <div class="form-group">
  28 + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
  29 + <div class="col-xs-12 col-sm-8">
  30 +
  31 + <div class="radio">
  32 + {foreach name="statusList" item="vo"}
  33 + <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
  34 + {/foreach}
  35 + </div>
  36 +
  37 + </div>
  38 + </div>
  39 + <div class="form-group">
  40 + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
  41 + <div class="col-xs-12 col-sm-8">
  42 + <input id="c-money" data-rule="required" class="form-control" name="row[money]" type="number" value="0">
  43 + </div>
  44 + </div>
  45 + <div class="form-group">
  46 + <label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label>
  47 + <div class="col-xs-12 col-sm-8">
  48 + <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')}">
  49 + </div>
  50 + </div>
  51 + <div class="form-group">
  52 + <label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label>
  53 + <div class="col-xs-12 col-sm-8">
  54 + <input id="c-transaction_id" data-rule="required" data-source="transaction/index" class="form-control selectpage" name="row[transaction_id]" type="text" value="">
  55 + </div>
  56 + </div>
  57 + <div class="form-group">
  58 + <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
  59 + <div class="col-xs-12 col-sm-8">
  60 + <input id="c-end_time" 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')}">
  61 + </div>
  62 + </div>
  63 + <div class="form-group layer-footer">
  64 + <label class="control-label col-xs-12 col-sm-2"></label>
  65 + <div class="col-xs-12 col-sm-8">
  66 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  67 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  68 + </div>
  69 + </div>
  70 +</form>
  1 +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + <input id="c-order_sn" data-rule="required" class="form-control" name="row[order_sn]" type="text" value="{$row.order_sn|htmlentities}">
  7 + </div>
  8 + </div>
  9 + <div class="form-group">
  10 + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <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}">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
  16 + <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
  17 + <div class="col-xs-12 col-sm-8">
  18 + <input id="c-store_id" data-rule="required" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value="{$row.store_id|htmlentities}">
  19 + </div>
  20 + </div>
  21 + <div class="form-group">
  22 + <label class="control-label col-xs-12 col-sm-2">{:__('House_ids')}:</label>
  23 + <div class="col-xs-12 col-sm-8">
  24 + <input id="c-house_ids" data-rule="required" data-source="house/index" data-multiple="true" class="form-control selectpage" name="row[house_ids]" type="text" value="{$row.house_ids|htmlentities}">
  25 + </div>
  26 + </div>
  27 + <div class="form-group">
  28 + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
  29 + <div class="col-xs-12 col-sm-8">
  30 +
  31 + <div class="radio">
  32 + {foreach name="statusList" item="vo"}
  33 + <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
  34 + {/foreach}
  35 + </div>
  36 +
  37 + </div>
  38 + </div>
  39 + <div class="form-group">
  40 + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
  41 + <div class="col-xs-12 col-sm-8">
  42 + <input id="c-money" data-rule="required" class="form-control" name="row[money]" type="number" value="{$row.money|htmlentities}">
  43 + </div>
  44 + </div>
  45 + <div class="form-group">
  46 + <label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label>
  47 + <div class="col-xs-12 col-sm-8">
  48 + <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):''}">
  49 + </div>
  50 + </div>
  51 + <div class="form-group">
  52 + <label class="control-label col-xs-12 col-sm-2">{:__('Transaction_id')}:</label>
  53 + <div class="col-xs-12 col-sm-8">
  54 + <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}">
  55 + </div>
  56 + </div>
  57 + <div class="form-group">
  58 + <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
  59 + <div class="col-xs-12 col-sm-8">
  60 + <input id="c-end_time" 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):''}">
  61 + </div>
  62 + </div>
  63 + <div class="form-group layer-footer">
  64 + <label class="control-label col-xs-12 col-sm-2"></label>
  65 + <div class="col-xs-12 col-sm-8">
  66 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  67 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  68 + </div>
  69 + </div>
  70 +</form>
  1 +<div class="panel panel-default panel-intro">
  2 +
  3 + <div class="panel-heading">
  4 + {:build_heading(null,FALSE)}
  5 + <ul class="nav nav-tabs" data-field="status">
  6 + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
  7 + {foreach name="statusList" item="vo"}
  8 + <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
  9 + {/foreach}
  10 + </ul>
  11 + </div>
  12 +
  13 +
  14 + <div class="panel-body">
  15 + <div id="myTabContent" class="tab-content">
  16 + <div class="tab-pane fade active in" id="one">
  17 + <div class="widget-body no-padding">
  18 + <div id="toolbar" class="toolbar">
  19 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  20 +<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('store/store_order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
  21 +<!-- <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('store/store_order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
  22 +<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('store/store_order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
  23 +<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('store/store_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>-->
  24 +
  25 +<!-- <div class="dropdown btn-group {:$auth->check('store/store_order/multi')?'':'hide'}">-->
  26 +<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
  27 +<!-- <ul class="dropdown-menu text-left" role="menu">-->
  28 +<!-- <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>-->
  29 +<!-- <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>-->
  30 +<!-- </ul>-->
  31 +<!-- </div>-->
  32 +
  33 +
  34 + </div>
  35 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  36 + data-operate-edit="{:$auth->check('store/store_order/edit')}"
  37 + data-operate-del="{:$auth->check('store/store_order/del')}"
  38 + width="100%">
  39 + </table>
  40 + </div>
  41 + </div>
  42 +
  43 + </div>
  44 + </div>
  45 +</div>
  1 +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2 +
  3 + var Controller = {
  4 + index: function () {
  5 + // 初始化表格参数配置
  6 + Table.api.init({
  7 + extend: {
  8 + index_url: 'store/store_order/index' + location.search,
  9 + // add_url: 'store/store_order/add',
  10 + // edit_url: 'store/store_order/edit',
  11 + // del_url: 'store/store_order/del',
  12 + // multi_url: 'store/store_order/multi',
  13 + pay_url: 'store/store_order/pay',
  14 + table: 'store_order',
  15 + }
  16 + });
  17 +
  18 + var table = $("#table");
  19 +
  20 + // 初始化表格
  21 + table.bootstrapTable({
  22 + url: $.fn.bootstrapTable.defaults.extend.index_url,
  23 + pk: 'id',
  24 + sortName: 'id',
  25 + columns: [
  26 + [
  27 + {checkbox: true},
  28 + {field: 'id', title: __('Id')},
  29 + {field: 'order_sn', title: __('Order_sn')},
  30 + {field: 'user.nickname', title: __('User.nickname')},
  31 + {field: 'store.store_name', title: __('Store.store_name')},
  32 + {field: 'house_names', title: __('House_names'),operate:false, formatter: Table.api.formatter.label},
  33 + {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  34 + {field: 'money', title: __('Money'), operate:'BETWEEN'},
  35 + {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  36 + // {field: 'transaction_id', title: __('Transaction_id')},
  37 + // {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  38 + // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  39 + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  40 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  41 + buttons: [
  42 + {
  43 + name: 'pay',
  44 + text: __('设为已支付'),
  45 + title: __('设为已支付'),
  46 + classname: 'btn btn-xs btn-info btn-magic btn-ajax',
  47 + icon: '',
  48 + url: $.fn.bootstrapTable.defaults.extend.pay_url,
  49 + confirm: '是否确认该订单已线下支付?',
  50 + hidden: function (row) {
  51 + if (row.status != 1) {
  52 + return true;
  53 + }
  54 + },
  55 + success: function (data) {
  56 + table.bootstrapTable('refresh');
  57 + }
  58 + }
  59 + ], formatter: Table.api.formatter.operate}
  60 + ]
  61 + ]
  62 + });
  63 +
  64 + // 为表格绑定事件
  65 + Table.api.bindevent(table);
  66 + },
  67 + add: function () {
  68 + Controller.api.bindevent();
  69 + },
  70 + edit: function () {
  71 + Controller.api.bindevent();
  72 + },
  73 + api: {
  74 + bindevent: function () {
  75 + Form.api.bindevent($("form[role=form]"));
  76 + }
  77 + }
  78 + };
  79 + return Controller;
  80 +});