Commit 9036604f authored by twj's avatar twj

twj

parent d7469316
......@@ -48,14 +48,14 @@ class Chargedevice extends Backend
*/
public function index()
{
if(isset($_GET['user_id'])){
$device_where = ['user_id'=>$_GET['user_id']];
}else{
if (isset($_GET['user_id'])) {
$device_where = ['user_id' => $_GET['user_id']];
} else {
$device_where = [];
}
if(get_charge_device_sn()){
if (get_charge_device_sn()) {
$charge_device_sn = get_charge_device_sn();
$device_where['charge_device_sn'] = ['in',$charge_device_sn];
$device_where['charge_device_sn'] = ['in', $charge_device_sn];
}
//设置过滤方法
......@@ -68,8 +68,10 @@ class Chargedevice extends Backend
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('users,agent')//,city,area,street
$list = $this->model->alias('cd')
->field('cd.id as id,cd.*,u.realname')
->join('ycz_users u', 'cd.user_id=u.id', 'left')
->with('users,agent') //,city,area,street
->where($where)
->where($device_where)
->order($sort, $order)
......@@ -110,11 +112,11 @@ class Chargedevice extends Backend
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$area_name = $this->SiteModel->where(['id' =>$params['site_id']])->value('area_name');
$area_name = $this->SiteModel->where(['id' => $params['site_id']])->value('area_name');
$params['area_name'] = $area_name;
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
} catch (ValidateException | PDOException | Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
......@@ -160,11 +162,11 @@ class Chargedevice extends Backend
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$area_name = $this->SiteModel->where(['id' =>$params['site_id']])->value('area_name');
$area_name = $this->SiteModel->where(['id' => $params['site_id']])->value('area_name');
$params['area_name'] = $area_name;
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
} catch (ValidateException | PDOException | Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
......@@ -177,7 +179,8 @@ class Chargedevice extends Backend
/**
* 收益详情
*/
public function detail($ids){
public function detail($ids)
{
$row = $this->model->get(['id' => $ids]);
if (!$row) {
$this->error(__('No Results were found'));
......
......@@ -61,7 +61,7 @@ class Chargegroup extends Backend
->order('remain_units desc')
->paginate($limit);
foreach ($list as $key => $val){
$list[$key]['remain_units'] = $this->Chargedevicemodel->where(['group_id' =>$val['id'],'authorizestatus' =>1])->count();
$list[$key]['remain_units'] = $this->Chargedevicemodel->where(['group_id' =>$val['id'],'user_id' =>0])->count();
}
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
......
......@@ -4,6 +4,7 @@ namespace app\admin\controller\order;
use app\common\controller\Backend;
use think\Db;
/**
* 订单管理
*
......@@ -44,14 +45,14 @@ class Order extends Backend
*/
public function index()
{
if(isset($_GET['device_sn'])){
$device_where = ['device_sign'=>$_GET['device_sn']];
}else{
if (isset($_GET['device_sn'])) {
$device_where = ['device_sign' => $_GET['device_sn']];
} else {
$device_where = [];
}
if(get_charge_device_sn()){
if (get_charge_device_sn()) {
$charge_device_sn = get_charge_device_sn();
$device_where['device_sign'] = ['in',$charge_device_sn];
$device_where['device_sign'] = ['in', $charge_device_sn];
}
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
......@@ -63,23 +64,28 @@ class Order extends Backend
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('usermoneylog')
$list = $this->model->alias('o')
->field('o.*,u.realname')
->join('ycz_users u', 'o.user_id=u.id')
->with('usermoneylog,users')
->where($where)
->where($device_where)
->order($sort, $order)
->paginate($limit);
$total_income = $this->model
$total_income = $this->model->alias('o')
->field('o.*,u.realname')
->join('ycz_users u', 'o.user_id=u.id')
->where($where)
->where($device_where)
->sum('need_pay');
$today_income = $this->model
$today_income = $this->model->alias('o')
->field('o.*,u.realname')
->join('ycz_users u', 'o.user_id=u.id')
->where($where)
->where($device_where)
->whereTime('createtime','today')
->whereTime('createtime', 'today')
->sum('need_pay');
$result = ['total' => $list->total(), 'rows' => $list->items(), 'total_income' => $total_income, 'today_income' => $today_income];
return json($result);
}
}
......@@ -61,7 +61,7 @@ class Agent extends Backend
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('area')
->with('area,users')
->where($where)
->order($sort, $order)
->paginate($limit);
......
......@@ -67,6 +67,7 @@ class Withdraw extends Backend
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('users')
->where($where)
->field('*,TRUNCATE(money/100, 2) as money')
->order($sort, $order)
......@@ -179,24 +180,25 @@ class Withdraw extends Backend
/**
* 提现审核
*/
public function batchaudit($ids = ''){
public function batchaudit($ids = '')
{
$ip = request()->ip();
$admin_id = get_admin_id();
if (!in_array($ip, ['183.217.150.48']) && $admin_id != 1) {
$this->error('非管理员禁止审核提现');
}
if($ids){
$row = $this->model->where(['status'=>0,'id' =>['in',explode(',',$ids)]])->select();
}else{
if ($ids) {
$row = $this->model->where(['status' => 0, 'id' => ['in', explode(',', $ids)]])->select();
} else {
$this->error(__('请批量勾选'));
// $row = $this->model->where(['status' =>0])->select();
// $row = $this->model->where(['status' =>0])->select();
}
$jsonMap = new ErrorInfo();
$wxpayConstants = new WXPayConstants();
$result = false;
// $row['money'] = sprintf("%.2f", $row['money'] / 100);
//提现固定扣除1%手续费
foreach ($row as $key => $val){
foreach ($row as $key => $val) {
$val['money'] = floor((int)$val['money'] - (int)$val['money'] * 0.01);
$withraw_money = $val['money'];
Db::startTrans();
......@@ -207,18 +209,18 @@ class Withdraw extends Backend
} else {
$desc = '普通用户提现';
}
$bankcard = $this->Bankcardmodel->where(['id' =>$val['bankcard_id']])->find();
switch ($val['withdraw_way']){
case 1://提现至零钱
$bankcard = $this->Bankcardmodel->where(['id' => $val['bankcard_id']])->find();
switch ($val['withdraw_way']) {
case 1: //提现至零钱
$result = $wxpayConstants->transfer($usersinfo['wx_openid'], $desc, $val['cash_sn'], $val['money'], $val['name'], $jsonMap);
break;
case 2://提现至银行卡
if($withraw_money <= 1000*100){
$val['money'] = $val['money'] - 1*100;
}else{
$val['money'] = floor($val['money'] - $withraw_money*0.001);
case 2: //提现至银行卡
if ($withraw_money <= 1000 * 100) {
$val['money'] = $val['money'] - 1 * 100;
} else {
$val['money'] = floor($val['money'] - $withraw_money * 0.001);
}
$result = $wxpayConstants->payForBank($val['cash_sn'], $val['money'], $val['bank_num'], $val['name'], $bankcard['wx_bank_code'],'企业付款到银行卡', $jsonMap);
$result = $wxpayConstants->payForBank($val['cash_sn'], $val['money'], $val['bank_num'], $val['name'], $bankcard['wx_bank_code'], '企业付款到银行卡', $jsonMap);
break;
default:
break;
......@@ -281,22 +283,22 @@ class Withdraw extends Backend
} else {
$desc = '普通用户提现';
}
$bankcard = $this->Bankcardmodel->where(['id' =>$row['bankcard_id']])->find();
if($row['status']!=0){
$bankcard = $this->Bankcardmodel->where(['id' => $row['bankcard_id']])->find();
if ($row['status'] != 0) {
Db::rollback();
$this->error($row['id'].'记录已审核');
$this->error($row['id'] . '记录已审核');
}
switch ($row['withdraw_way']){
case 1://提现至零钱
switch ($row['withdraw_way']) {
case 1: //提现至零钱
$result = $wxpayConstants->transfer($usersinfo['wx_openid'], $desc, $row['cash_sn'], $row['money'], $row['name'], $jsonMap);
break;
case 2://提现至银行卡
if($withraw_money <= 1000*100){
$row['money'] = $row['money'] - 1*100;
}else{
$row['money'] = floor($row['money'] - $withraw_money*0.001);
case 2: //提现至银行卡
if ($withraw_money <= 1000 * 100) {
$row['money'] = $row['money'] - 1 * 100;
} else {
$row['money'] = floor($row['money'] - $withraw_money * 0.001);
}
$result = $wxpayConstants->payForBank($row['cash_sn'], $row['money'], $row['bank_num'], $row['name'], $bankcard['wx_bank_code'],'企业付款到银行卡', $jsonMap);
$result = $wxpayConstants->payForBank($row['cash_sn'], $row['money'], $row['bank_num'], $row['name'], $bankcard['wx_bank_code'], '企业付款到银行卡', $jsonMap);
break;
default:
break;
......@@ -376,4 +378,102 @@ class Withdraw extends Backend
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 批量驳回提现
*/
public function batchdisapprove($ids = '', $status = -1)
{
if ($ids) {
$row = $this->model->where(['status' => 0, 'id' => ['in', explode(',', $ids)]])->select();
} else {
$this->error(__('请批量勾选'));
}
$result = false;
//提现固定扣除1%手续费
foreach ($row as $key => $val) {
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;
$val->validateFailException(true)->validate($validate);
}
$params['id'] = $val['id'];
$params['status'] = $status;
if ($val['status'] == 0) {
$money = sprintf("%.2f", $val['money'] / 100);
$this->usersmodel->where(['id' => $val['user_id']])->setInc('total_money', $money);
//更新详情
$result = $this->model->where(['status' => 0, 'id' => $val['id']])->update(['status' => -1]);
}
Db::commit();
} catch (ValidateException | PDOException | Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success('提现成功');
}
/**
* 核销提现
*/
public function verification($id = '', $status = 2)
{
$row = $this->model->get($id);
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'));
}
}
Db::startTrans();
try {
$params['status'] = $status;
$row->where(['id' => $id])->update($params);
Db::commit();
} catch (ValidateException | PDOException | Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
$this->success("核销成功");
}
/**
* 核销提现
*/
public function batchVerification($ids= '')
{
/* $ip = request()->ip();
$admin_id = get_admin_id();
if (!in_array($ip, ['183.217.150.48']) && $admin_id != 1) {
$this->error('非管理员禁止审核提现');
}*/
if($ids){
$row = $this->model->where(['status'=>0,'id' =>['in',explode(',',$ids)]])->select();
}else{
$this->error(__('请批量勾选'));
// $row = $this->model->where(['status' =>0])->select();
}
$params = [];
foreach ($row as $key => $val){
$params['status'] = 2;
$params['end_time'] = time();
$this->model->where(['id' => $val['id']])->update($params);
}
$this->success("核销成功");
}
}
......@@ -13,6 +13,7 @@ return [
'Status -1' => '已拒绝',
'Status 0' => '待审核',
'Status 1' => '已通过',
'Status 2' => '已核销',
'Start_time' => '提现时间',
'End_time' => '审核时间',
'Withdraw_way' => '提现方式',
......
<?php
/*
* @Author: taowj 965042433@qq.com
* @Date: 2024-01-27 13:57:45
* @LastEditors: taowj 965042433@qq.com
* @LastEditTime: 2024-02-01 17:46:53
* @FilePath: \introducer\application\admin\model\order\Order.php
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
namespace app\admin\model\order;
......@@ -8,13 +16,13 @@ use think\Model;
class Order extends Model
{
// 表名
protected $name = 'order';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
......@@ -29,9 +37,9 @@ class Order extends Model
'status_text',
'endtime_text'
];
public function getOrderTypeList()
{
return ['0' => __('Order_type 0'), '2' => __('Order_type 2'), '4' => __('Order_type 4'), '5' => __('Order_type 5'), '6' => __('Order_type 6'), '7' => __('Order_type 7'), '8' => __('Order_type 8')];
......@@ -70,8 +78,12 @@ class Order extends Model
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
public function usermoneylog(){
return self::hasOne("app\admin\model\users\Usermoneylog",'order_id',"id");
public function usermoneylog()
{
return self::hasOne("app\admin\model\users\Usermoneylog", 'order_id', "id");
}
public function users()
{
return self::hasOne("app\admin\model\users\Users", 'id', "user_id");
}
}
......@@ -3,7 +3,7 @@
* @Author: taowj 965042433@qq.com
* @Date: 2022-11-08 16:21:34
* @LastEditors: taowj 965042433@qq.com
* @LastEditTime: 2023-08-30 15:02:39
* @LastEditTime: 2024-02-01 17:48:06
* @FilePath: \introducer\application\admin\model\users\Agent.php
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -16,13 +16,13 @@ use think\Model;
class Agent extends Model
{
// 表名
protected $name = 'agent';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
......@@ -51,7 +51,7 @@ class Agent extends Model
public function getLevelList()
{
return ['0' => __('Level 0'),'1' => __('Level 1'),'2' => __('Level 2'),'3' => __('Level 3')];
return ['0' => __('Level 0'), '1' => __('Level 1'), '2' => __('Level 2'), '3' => __('Level 3')];
}
public function getTypeTextAttr($value, $data)
......@@ -77,9 +77,10 @@ class Agent extends Model
public function area()
{
return self::hasOne("app\admin\model\Addr",'ID',"area_id");
return self::hasOne("app\admin\model\Addr", 'ID', "area_id");
}
public function users()
{
return self::hasOne("app\admin\model\users\Users", 'id', "agent_user_id");
}
}
<?php
/*
* @Author: taowj 965042433@qq.com
* @Date: 2022-11-08 16:21:34
* @LastEditors: taowj 965042433@qq.com
* @LastEditTime: 2024-02-01 17:48:26
* @FilePath: \introducer\application\admin\model\users\Withdraw.php
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
namespace app\admin\model\users;
......@@ -8,13 +16,13 @@ use think\Model;
class Withdraw extends Model
{
// 表名
protected $name = 'withdraw';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
......@@ -30,9 +38,9 @@ class Withdraw extends Model
'end_time_text',
'withdraw_way_text'
];
public function getStatusList()
{
return ['-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1')];
......@@ -82,6 +90,8 @@ class Withdraw extends Model
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
public function users()
{
return self::hasOne("app\admin\model\users\Users", 'id', "user_id");
}
}
......@@ -3,7 +3,7 @@
<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" min="0" data-source="users/users/index" data-search-field="id,nickname,mobile,realname" data-primary-key="id" data-field="realname" data-format-item="{id} - {nickname} - {realname}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<input id="c-user_id" min="0" data-source="users/users/index" data-search-field="id,nickname,mobile,realname" data-primary-key="id" data-field="realname" data-format-item="{id} - {nickname} - {realname}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">
......@@ -45,7 +45,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Area_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-site_id" data-rule="required" min="0" data-source="device/site/index" data-search-field="id,agent_user_id,area_name" data-primary-key="id" data-field="area_name" data-format-item="{agent_user_id}-{area_name}" class="form-control selectpage" name="row[site_id]" type="text" value="{$row.site_id|htmlentities}">
<input id="c-site_id" min="0" data-source="device/site/index" data-search-field="id,agent_user_id,area_name" data-primary-key="id" data-field="area_name" data-format-item="{agent_user_id}-{area_name}" class="form-control selectpage" name="row[site_id]" type="text" value="{$row.site_id|htmlentities}">
</div>
</div>
<div class="form-group">
......@@ -93,7 +93,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Authorizetime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-authorizetime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[authorizetime]" type="text" value="{:$row.authorizetime?datetime($row.authorizetime):''}">
<input id="c-authorizetime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[authorizetime]" type="text" value="{:$row.authorizetime?datetime($row.authorizetime):''}">
</div>
</div>
<div class="form-group layer-footer">
......
......@@ -32,6 +32,8 @@
</span>
</a>
<a href="javascript:;" id="batchaudit" class="btn btn-info default" title="{:__('批量审核通过')}" ><i class="fa"></i> {:__('批量审核通过')}</a>
<a href="javascript:;" id="batchdisapprove" class="btn btn-info default" title="{:__('批量驳回')}" ><i class="fa"></i> {:__('批量驳回')}</a>
<a href="javascript:;" id="batchverification" class="btn btn-info default" title="{:__('批量核销')}" ><i class="fa"></i> {:__('批量核销')}</a>
<div class="dropdown btn-group {:$auth->check('users/withdraw/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">
......
......@@ -26,31 +26,34 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'user_id', title: __('User_id'),
formatter: function (value,row,index) {
if(row.users){
var html="id:"+row.user_id + "<br/> 昵称:" + row.users.nickname;
html = row.realname?html+"<br/> 姓名:" + row.realname:html;
html = row.users.mobile?html+"<br/> 电话:" + row.users.mobile:html;
{ checkbox: true },
{ field: 'id', title: __('Id') },
{
field: 'user_id', title: __('User_id'),
formatter: function (value, row, index) {
if (row.users) {
var html = "id:" + row.user_id + "<br/> 姓名:" + row.users.realname;
html = row.users.mobile ? html + "<br/> 电话:" + row.users.mobile : html;
return html;
} else {
return "id:" + row.user_id;
}
}},
{field: 'charge_device_name', title: __('Charge_device_name'), operate: 'LIKE'},
{field: 'charge_device_sn', title: __('Charge_device_sn'), operate: 'LIKE'},
{field: 'area_name', title: __('Area_name'), operate: 'LIKE', sortable:true},
{field: 'detail_address', title: __('Detail_address'), operate: 'LIKE'},
{field: 'charge_device_type', title: __('Charge_device_type'), operate: 'LIKE'},
{field: 'price', title: __('Price'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'authorizestatus', title: __('Authorizestatus'), searchList: {"1":__('Authorizestatus 1'),"2":__('Authorizestatus 2')}, formatter: Table.api.formatter.status},
{field: 'authorizetime', title: __('Authorizetime'), operate:'RANGE', sortable:true, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
}
},
{ field: 'realname', title: __('姓名'), visible: false, operate: 'LIKE' },
{ field: 'charge_device_name', title: __('Charge_device_name'), operate: 'LIKE' },
{ field: 'charge_device_sn', title: __('Charge_device_sn'), operate: 'LIKE' },
{ field: 'area_name', title: __('Area_name'), operate: 'LIKE', sortable: true },
{ field: 'detail_address', title: __('Detail_address'), operate: 'LIKE' },
{ field: 'charge_device_type', title: __('Charge_device_type'), operate: 'LIKE' },
{ field: 'price', title: __('Price'), operate: 'LIKE' },
{ field: 'status', title: __('Status'), searchList: { "1": __('Status 1'), "2": __('Status 2') }, formatter: Table.api.formatter.status },
{ field: 'authorizestatus', title: __('Authorizestatus'), searchList: { "1": __('Authorizestatus 1'), "2": __('Authorizestatus 2') }, formatter: Table.api.formatter.status },
{ field: 'authorizetime', title: __('Authorizetime'), operate: 'RANGE', sortable: true, addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'detail',
......@@ -60,7 +63,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
icon: 'fa fa-eye',
url: 'device/chargedevice/detail'
}
],}
],
}
]
]
});
......@@ -74,7 +78,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
edit: function () {
Controller.api.bindevent();
},
detail: function(){
detail: function () {
var device_sn = $('#device_sn').val();
// 初始化表格参数配置
Table.api.init({
......@@ -104,18 +108,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'order_sn', title: __('Order_sn'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
{field: 'need_pay', title: __('Need_pay'), operate:'BETWEEN'},
{field: 'device_sign', title: __('Device_sign'), operate: 'LIKE'},
{field: 'order_type', title: __('Order_type'), searchList: {"0":__('Order_type 0'),"2":__('Order_type 2'),"4":__('Order_type 4')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
{ checkbox: true },
{ field: 'id', title: __('Id') },
{ field: 'order_sn', title: __('Order_sn'), operate: 'LIKE' },
{ field: 'mobile', title: __('Mobile'), operate: 'LIKE' },
{ field: 'total_price', title: __('Total_price'), operate: 'BETWEEN' },
{ field: 'need_pay', title: __('Need_pay'), operate: 'BETWEEN' },
{ field: 'device_sign', title: __('Device_sign'), operate: 'LIKE' },
{ field: 'order_type', title: __('Order_type'), searchList: { "0": __('Order_type 0'), "2": __('Order_type 2'), "4": __('Order_type 4') }, formatter: Table.api.formatter.normal },
{ field: 'status', title: __('Status'), searchList: { "1": __('Status 1'), "2": __('Status 2'), "": __('Status 3'), "4": __('Status 4') }, formatter: Table.api.formatter.status },
{ field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'endtime', title: __('Endtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
]
]
});
......@@ -124,7 +128,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.bindevent(table);
},
api: {
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
......
......@@ -2,7 +2,7 @@
* @Author: taowj 965042433@qq.com
* @Date: 2024-01-27 13:57:45
* @LastEditors: taowj 965042433@qq.com
* @LastEditTime: 2024-01-27 14:07:39
* @LastEditTime: 2024-02-01 17:43:48
* @FilePath: \introducer\public\assets\js\backend\order\order.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -39,20 +39,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'order_sn', title: __('Order_sn'), operate: 'LIKE'},
{field: 'user_id', title: __('User_id'), operate: 'LIKE'},
{field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
{field: 'need_pay', title: __('Need_pay'), operate:'BETWEEN'},
{field: 'device_sign', title: __('Device_sign'), operate: 'LIKE'},
{field: 'num', title: __('Num'), operate: 'LIKE'},
{field: 'order_type', title: __('Order_type'), searchList: {"0":__('Order_type 0'),"2":__('Order_type 2'),"4":__('Order_type 4'),"5":__('Order_type 5'),"6":__('Order_type 6'),"7":__('Order_type 7'),"8":__('Order_type 8')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), visible: false, searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5')}, formatter: Table.api.formatter.status},
{field: 'usermoneylog.memo', title: __('备注'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
{ checkbox: true },
{ field: 'id', title: __('Id') },
{ field: 'order_sn', title: __('Order_sn'), operate: 'LIKE' },
{
field: 'user_id', title: __('User_id'), formatter: function (value, row, index) {
if (row.users) {
var html = "id:" + row.user_id + "<br/> 昵称:" + row.users.nickname;
html = row.realname ? html + "<br/> 姓名:" + row.realname : html;
html = row.users.mobile ? html + "<br/> 电话:" + row.users.mobile : html;
return html;
} else {
return "id:" + row.user_id;
}
}
},
{ field: 'name', visible: false, operate: 'LIKE' },
{ field: 'total_price', title: __('Total_price'), operate: 'BETWEEN' },
{ field: 'need_pay', title: __('Need_pay'), operate: 'BETWEEN' },
{ field: 'device_sign', title: __('Device_sign'), operate: 'LIKE' },
{ field: 'num', title: __('Num'), operate: 'LIKE' },
{ field: 'order_type', title: __('Order_type'), searchList: { "0": __('Order_type 0'), "2": __('Order_type 2'), "4": __('Order_type 4'), "5": __('Order_type 5'), "6": __('Order_type 6'), "7": __('Order_type 7'), "8": __('Order_type 8') }, formatter: Table.api.formatter.normal },
{ field: 'status', title: __('Status'), visible: false, searchList: { "0": __('Status 0'), "1": __('Status 1'), "2": __('Status 2'), "3": __('Status 3'), "4": __('Status 4'), "5": __('Status 5') }, formatter: Table.api.formatter.status },
{ field: 'usermoneylog.memo', title: __('备注'), operate: 'LIKE' },
{ field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'endtime', title: __('Endtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
]
]
});
......
......@@ -26,32 +26,35 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'agent_user_id', title: __('Agent_user_id'), operate: false,formatter: function (value,row,index) {
if(row){
var html="id:"+row.agent_user_id;
html = row.realname?html+"<br/> 姓名:" + row.realname:html;
html = row.mobile?html+"<br/> 电话:" + row.mobile:html;
return html;
} else {
return "id:" + row.agent_user_id;
}
{ checkbox: true },
{ field: 'id', title: __('Id') },
{
field: 'agent_user_id', title: __('Agent_user_id'), operate: false, formatter: function (value, row, index) {
if (row) {
var html = "id:" + row.agent_user_id;
html = row.realname ? html + "<br/> 姓名:" + row.realname : html;
html = row.mobile ? html + "<br/> 电话:" + row.mobile : html;
return html;
} else {
return "id:" + row.agent_user_id;
}
}},
{field: 'realname', title: __('Realname'), operate: 'LIKE',visible:false},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE',visible:false},
{field: 'identity_number', title: __('Identity_number'), operate: 'LIKE',visible:true},
{field: 'parent_user_id', title: __('Parent_user_id'), operate: false,visible:false},
}
},
{ field: 'realname', title: __('Realname'), operate: 'LIKE', visible: false },
{ field: 'mobile', title: __('Mobile'), operate: 'LIKE', visible: false },
{ field: 'identity_number', title: __('Identity_number'), operate: 'LIKE', visible: true },
{ field: 'parent_user_id', title: __('Parent_user_id'), operate: false, visible: false },
// {field: 'area.MergerName', title: __('所属区域')},
/* {field: 'city_id', title: __('City_id')},
{field: 'area_id', title: __('Area_id')},*/
/* {field: 'city_id', title: __('City_id')},
{field: 'area_id', title: __('Area_id')},*/
// {field: 'detail_address', title: __('Detail_address'), operate: 'LIKE'},
// {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.status},
{field: 'deviceCount', title: __('deviceCount'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
{ field: 'deviceCount', title: __('deviceCount'), operate: 'LIKE' },
{ field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'status', title: __('Status'), searchList: { "1": __('Status 1'), "2": __('Status 2') }, formatter: Table.api.formatter.status },
{
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'detail',
......@@ -76,14 +79,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
edit: function () {
Controller.api.bindevent();
},
detail: function(){
detail: function () {
var user_id = $('#user_id').val();
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'device/chargedevice/index?user_id=' + user_id,
add_url: 'device/chargedevice/add?user_id=' +user_id,
add_url: 'device/chargedevice/add?user_id=' + user_id,
edit_url: 'device/chargedevice/edit',
del_url: 'device/chargedevice/del',
multi_url: 'device/chargedevice/multi',
......@@ -103,19 +106,31 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'user_id', title: __('User_id')},
{field: 'charge_device_name', title: __('Charge_device_name'), operate: 'LIKE'},
{field: 'charge_device_sn', title: __('Charge_device_sn'), operate: 'LIKE'},
{field: 'area_name', title: __('Area_name'), operate: 'LIKE'},
{field: 'detail_address', title: __('Detail_address'), operate: 'LIKE'},
{field: 'charge_device_type', title: __('Charge_device_type'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'authorizestatus', title: __('Authorizestatus'), searchList: {"1":__('Authorizestatus 1'),"2":__('Authorizestatus 2')}, formatter: Table.api.formatter.status},
{field: 'authorizetime', title: __('Authorizetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
{ checkbox: true },
{ field: 'id', title: __('Id') },
{
field: 'user_id', title: __('User_id'), formatter: function (value, row, index) {
if (row.users) {
var html = "id:" + row.user_id + "<br/> 昵称:" + row.users.nickname;
html = row.realname ? html + "<br/> 姓名:" + row.realname : html;
html = row.users.mobile ? html + "<br/> 电话:" + row.users.mobile : html;
return html;
} else {
return "id:" + row.user_id;
}
}
},
{ field: 'charge_device_name', title: __('Charge_device_name'), operate: 'LIKE' },
{ field: 'charge_device_sn', title: __('Charge_device_sn'), operate: 'LIKE' },
{ field: 'area_name', title: __('Area_name'), operate: 'LIKE' },
{ field: 'detail_address', title: __('Detail_address'), operate: 'LIKE' },
{ field: 'charge_device_type', title: __('Charge_device_type'), operate: 'LIKE' },
{ field: 'status', title: __('Status'), searchList: { "1": __('Status 1'), "2": __('Status 2') }, formatter: Table.api.formatter.status },
{ field: 'authorizestatus', title: __('Authorizestatus'), searchList: { "1": __('Authorizestatus 1'), "2": __('Authorizestatus 2') }, formatter: Table.api.formatter.status },
{ field: 'authorizetime', title: __('Authorizetime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime },
{ field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
]
]
});
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment