2023-02-14 19:17:00 +08:00

76 lines
2.5 KiB
PHP

<?php
namespace app\admin\controller\nk;
use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;
/**
* 区域订单手续费(佣金)管理
*
* @icon fa fa-circle-o
*/
class Merchant extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->url=[
'/admin/nk.merchant/index',
'/admin/nk.merchant/read',
];
}
/**
* 查看
*/
public function index()
{
$total=0;
$list=[];
$brokerage_price=0;
$find=Db::table('fa_szxc_information_useraddress')->where('user_id',$this->adminInfo['id'])->value('street_id');
if (request()->isAjax()) {
$params= get_params();
if ($find!=0){
$total=Db::connect('shop')->name('merchant_address')->where('street_id',$find)
->where('status',1)->count();
$merchant_id=Db::connect('shop')->name('merchant_address')->where('street_id',$find)
->where('status',1)
->page($params['page'])
->limit($params['limit'])
->field('mer_id')->select();
$arr=[];
foreach ($merchant_id as $k=>$v){
$arr[]=$v['mer_id'];
}
$list=Db::connect('shop')->name('merchant')->where('mer_id','in',$arr)->field('mer_id,mer_name,real_name,mark,create_time,sales,mer_money,margin')->select();
}
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}
return view('',['url'=>$this->url]);
}
/**
* 查看信息
*/
public function read()
{
$params = get_params();
$find=Db::connect('shop')->name('merchant')->where('mer_id',$params['id'])
->withAttr('is_trader',function ($value,$data){
return $value==1?'自营':'非自营';
})
->withAttr('category_id',function ($value,$data){
return Db::connect('shop')->name('merchant_category')->where('merchant_category_id ',$value)->value('category_name');
})
->withAttr('type_id',function ($value,$data){
return Db::connect('shop')->name('merchant_type')->where('mer_type_id ',$value)->value('type_name');
})
->find();
return view('',['url'=>$this->url,'read'=>$find]);
}
}