adminInfo = get_login_admin(); $this->category_id=354; $this->url=[ '/admin/supplychain.index/index?category_id='.$this->category_id, '/admin/supplychain.index/add', '/admin/supplychain.index/edit', '/admin/supplychain.index/delete', '/admin/supplychain.merchant/index', '/admin/supplychain.merchant/bill', ]; } /** * * 供应链团队列表 * */ public function index() { if (request()->isAjax()) { $params= get_params(); $where = []; if (isset($params['keywords']) && !empty($params['keywords'])){ $where[]= ['name','like','%'.$params['keywords'].'%']; } if($this->adminInfo['position_id'] != 1){ //不是超级管理员 $www['admin_id'] = $this->adminInfo['id']; $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); if ($user_address){ if($user_address['auth_range'] == 1){ $where[] = ['village_id','=',$user_address['village_id']]; }elseif ($user_address['auth_range'] == 2){ $where[] = ['street_id','=',$user_address['street_id']]; }elseif ($user_address['auth_range'] == 3){ $where[] = ['area_id','=',$user_address['area_id']]; }else{ $where[] = ['village_id','=',$user_address['village_id']]; } }else{ $where[] = ['village_id','=','']; } } $total = SupplyChainLinkMerchant::where($where)->count(); $list = SupplyChainLinkMerchant::with(['supplyChain', 'merchant'])->order('id desc')->select(); View::assign('url', $this->url); View::assign('list', $list); $result = ['total' => $total, 'data' => $list]; return table_assign(0, '', $result); }else{ $total = SupplyChainLinkMerchant::count(); $list = SupplyChainLinkMerchant::with(['merchant', 'supplyChain'])->select(); View::assign('url', $this->url); View::assign('list', $list); $result = ['total' => $total, 'data' => $list]; return view(); } } /** * * 交易订单 * */ public function bill() { if (request()->isAjax()) { $params= get_params(); $where = []; if (isset($params['keywords']) && !empty($params['keywords'])){ $where[]= ['name','like','%'.$params['keywords'].'%']; } if($this->adminInfo['position_id'] != 1){ //不是超级管理员 $www['admin_id'] = $this->adminInfo['id']; $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); if ($user_address){ if($user_address['auth_range'] == 1){ $where[] = ['village_id','=',$user_address['village_id']]; }elseif ($user_address['auth_range'] == 2){ $where[] = ['street_id','=',$user_address['street_id']]; }elseif ($user_address['auth_range'] == 3){ $where[] = ['area_id','=',$user_address['area_id']]; }else{ $where[] = ['village_id','=',$user_address['village_id']]; } }else{ $where[] = ['village_id','=','']; } } $total = StoreOrderModel::where($where)->count(); $list = StoreOrderModel::with(['merchant'])->order('order_id desc')->select(); View::assign('url', $this->url); View::assign('list', $list); $result = ['total' => $total, 'data' => $list]; return table_assign(0, '', $result); }else{ $total = StoreOrderModel::count(); $list = StoreOrderModel::with(['merchant'])->select(); View::assign('url', $this->url); View::assign('list', $list); $result = ['total' => $total, 'data' => $list]; return view(); } } /** * * 新增 * */ public function add() { return view(); } /** * * 编辑 * */ public function edit() { return view(); } /** * * 删除 * */ public function delete() { return view(); } }