## 销售单据
>[info]功能:
1,显示数据:通过 `shop_users` 员工表 显示员工
>[info] 2,通过 `wp_order` 订单表 `wp_order_return` 退货表中当天的销售情况
/*
*@desc 销售单据- 根据登录账号信息获取收银员账号数据
*
*/
public function scopeDocumentsWhere($query)
{
$in = \cs\login::login_user(1);
if($in){
$query->whereIn('yf_shop_base_id',$in);
}
$wq = request_data('wq');
if($wq){
$query->where(function($query)use($wq){
$query->orwhere('user', 'like', "%".$wq."%");
});
}
$query->orderby('created','desc');
$shop_id = request_data('shop_id');
if($shop_id){
$query->where('yf_shop_base_id',$shop_id);
}
//根据唯一标识查询收银员id
$role = roles::where('slug','shouyin')->first();
$role_users = role_users::where('role_id',$role->id)->get()->toArray();
if($role_users){
foreach ($role_users as $k => $v) {
$in[] = $v['user_id'];
}
if($in){
$query->whereIn('id',$in);
}
}
}