121 lines
4.5 KiB
PHP
121 lines
4.5 KiB
PHP
<?php
|
|
|
|
namespace app\api\logic;
|
|
|
|
use app\common\server\UrlServer;
|
|
use think\Db;
|
|
|
|
class StaffgoodsLogic
|
|
{
|
|
//获取物料的列表
|
|
public static function godds_list($get){
|
|
$lists=Db::name('epr')->where('type',$get['type_id'])->select();
|
|
foreach ( $lists as &$item){
|
|
$item['abs_avatar']=UrlServer::getFileUrl($item['abs_avatar']);
|
|
}
|
|
return $lists;
|
|
}
|
|
|
|
public static function goods_info($id){
|
|
$list=Db::name('epr')->where('id',$id)->select();
|
|
foreach ( $list as &$item){
|
|
$item['abs_avatar']=UrlServer::getFileUrl($item['abs_avatar']);
|
|
}
|
|
return $list;
|
|
}
|
|
|
|
public static function addgoods($get){
|
|
$data=[
|
|
'goods_id'=>$get['ids'],
|
|
'staff_id'=>$get['staff_id'],
|
|
'buynums' =>$get['count'],
|
|
'name'=>$get['shopName'],
|
|
'number'=>$get['count']*$get['price'],
|
|
'create_time'=>time(),
|
|
'price' =>$get['price']
|
|
];
|
|
return Db::name('erp_staff')->data($data)->insert();
|
|
|
|
}
|
|
|
|
public static function order_wages($get){
|
|
|
|
$where=[];
|
|
$where[] = ['staff_status', '=',3]; //判断完成订单
|
|
$where[]=['staff_id', '=',$get['staff_id']];
|
|
if($get['status']==1 && $get['status']!=''){
|
|
$where[]=['account', '>',0];
|
|
}
|
|
if($get['status']==2 && $get['status']!=''){
|
|
$where[]=['add', '>',0];
|
|
$where[]=['addtime', '=',1];
|
|
}
|
|
if($get['status']==3 && $get['status']!=''){
|
|
$where[]=['add', '>',0];
|
|
$where[]=['addtime', '=',2];
|
|
}
|
|
if($get['status']==7 && $get['status']!=''){
|
|
$where[]=['abnormal', '=',1];
|
|
}
|
|
$lists=Db::name('order_exe')
|
|
->where($where)
|
|
->whereTime('autotime', 'last month')
|
|
// ->page($get['page'],$get['pageSize'])
|
|
->select();
|
|
|
|
foreach ($lists as &$item){
|
|
$order_info=Db::name('order')->where('order_sn',$item['order_sn'])->find();
|
|
if($order_info){
|
|
$item['order_sn']=$order_info['order_sn'];
|
|
$item['name']=$order_info['consignee'];
|
|
$item['phone']=$order_info['mobile'];
|
|
$item['address']= $order_info['address'];
|
|
$item['lat']= $order_info['lat'];
|
|
$item['lng']= $order_info['lng'];
|
|
$item['autotime']=date('Y-m-d',$item['autotime']);
|
|
$goods=Db::name('goods')->where('id',$order_info['goods_id'])->find();
|
|
$item['goods_name']= $goods['name'];
|
|
if($item['addtime']==1){
|
|
$item['sw']='上午';
|
|
$item['sw_time']='8:00-12:00';
|
|
}else{
|
|
$item['sw']='下午';
|
|
$item['sw_time']='14:00-18:00';
|
|
}
|
|
|
|
}
|
|
}
|
|
return $lists;
|
|
}
|
|
public static function orderinfo_wages($get){
|
|
$lists=Db::name('order_exe a')
|
|
->join('order b','a.order_sn=b.order_sn')
|
|
->where(['a.staff_status'=>3,'a.staff_id'=>$get['staff_id']])
|
|
->where('b.number','>',3)
|
|
->whereTime('autotime', 'last month')
|
|
->select();
|
|
foreach ($lists as &$item){
|
|
$order_info=Db::name('order')->where('order_sn',$item['order_sn'])->find();
|
|
if($order_info){
|
|
$item['order_sn']=$order_info['order_sn'];
|
|
$item['name']=$order_info['consignee'];
|
|
$item['phone']=$order_info['mobile'];
|
|
$item['address']= $order_info['address'];
|
|
$item['lat']= $order_info['lat'];
|
|
$item['lng']= $order_info['lng'];
|
|
$item['autotime']=date('Y-m-d',$item['autotime']);
|
|
$goods=Db::name('goods')->where('id',$order_info['goods_id'])->find();
|
|
$item['goods_name']= $goods['name'];
|
|
if($item['addtime']==1){
|
|
$item['sw']='上午';
|
|
$item['sw_time']='8:00-12:00';
|
|
}else{
|
|
$item['sw']='下午';
|
|
$item['sw_time']='14:00-18:00';
|
|
}
|
|
|
|
}
|
|
}
|
|
return $lists;
|
|
}
|
|
} |