select(); return $this->_success('获取数据成功', $goods_type); } //获取物料的商品信息\ public function godds_list(){ $get = $this->request->get();//获取到员工的ID $lists=StaffgoodsLogic::godds_list($get); return $this->_success('获取数据成功', $lists); } public function goods_info(){ $id = $this->request->get('id');//获取到员工的ID $lists=StaffgoodsLogic::goods_info($id); return $this->_success('获取数据成功', $lists); } //员工申请物料 public function addgoods(){ $get = $this->request->get();//接受传递过来的参数 $lists=StaffgoodsLogic::addgoods($get); return $this->_success('申请成功等待审核'); } //我的物料申请记录 public function usergoods(){ $get = $this->request->get();//接受传递过来的参数 $data=Db::name('erp_staff') ->where('status',$get['status']) ->where('staff_id',$get['staff_id']) ->page($get['page'],$get['pageSize']) ->select(); foreach ($data as $key => $level){ $goods=Db::name('epr')->where('id',$level['goods_id'])->find(); $data[$key]['name']=$goods['name']; $data[$key]['images']=UrlServer::getFileUrl($goods['abs_avatar']);; $data[$key]['time']=date('Y-m-d H:i:s',$data[$key]['create_time']); } return $this->_success('获取数据成功过',$data); } //删除物料申请 public function staff_del(){ $get = $this->request->get();//接受传递过来的参数\ $del=Db::name('erp_staff')->where('id',$get['id'])->delete(); return $this->_success('删除成功'); } //我的请假的数据 public function user_leave(){ $get = $this->request->get();//接受传递过来的参数 $data=Db::name('leave') ->where('status',0) ->where('user_id',$get['staff_id']) ->page($get['page'],$get['pageSize']) ->select(); foreach ($data as $key => $level){ $data[$key]['time']=date('Y-m-d',$data[$key]['time']); if($data[$key]['addtime']==1){ $data[$key]['sw']='上午'; }else{ $data[$key]['sw']='下午'; } } return $this->_success('获取数据成功过',$data); } //我的加时订单显示列表 public function user_addorder(){ $get = $this->request->get();//接受传递过来的参数 $lists=Db::name('order_timeadd') ->where('status',$get['status']) ->where('staff_id',$get['staff_id']) ->page($get['page'],$get['pageSize']) ->select(); foreach ($lists as $k => $v){ $order=Db::name('order_exe')->where('id',$lists[$k]['orderid'])->field('order_sn,addtime')->find(); //获取子订单信息 if($order){ $order_info=Db::name('order')->where('order_sn',$order['order_sn'])->find(); if($order_info){ $lists[$k]['order_sn']=$order_info['order_sn']; $lists[$k]['name']=$order_info['consignee']; $lists[$k]['phone']=$order_info['mobile']; $lists[$k]['address']= $order_info['address']; $lists[$k]['lat']= $order_info['lat']; $lists[$k]['lng']= $order_info['lng']; } $goods=Db::name('goods')->where('id',$order_info['goods_id'])->find(); $lists[$k]['goods_name']= $goods['name']; if($order['addtime']==1){ $lists[$k]['sw']='上午'; $lists[$k]['sw_time']='8:00-12:00'; }else{ $lists[$k]['sw']='下午'; $lists[$k]['sw_time']='14:00-18:00'; } } } return $this->_success('获取数据成功',$lists); } public function user_finance(){ $get = $this->request->get();//接受传递过来的参数 $lists=Db::name('finance') ->where('status',$get['status']) ->where('staff_id',$get['staff_id']) ->page($get['page'],$get['pageSize']) ->select(); foreach ($lists as $k => $v){ $order=Db::name('order_exe')->where('id',$lists[$k]['order_id'])->find(); //获取子订单信息 $order_info=Db::name('order')->where('order_sn',$order['order_sn'])->find(); $lists[$k]['order_sn']=$order_info['order_sn']; $lists[$k]['name']=$order_info['consignee']; $lists[$k]['phone']=$order_info['mobile']; $goods=Db::name('goods')->where('id',$order_info['goods_id'])->find(); $lists[$k]['goods_name']= $goods['name']; $lists[$k]['address']= $order_info['address']; $lists[$k]['lat']= $order_info['lat']; $lists[$k]['lng']= $order_info['lng']; if($order['addtime']==1){ $lists[$k]['sw']='上午'; $lists[$k]['sw_time']='8:00-12:00'; }else{ $lists[$k]['sw']='下午'; $lists[$k]['sw_time']='14:00-18:00'; } } return $this->_success('获取数据成功过',$lists); } public function get_imgs(){ $input = input(); if(empty($input['order_id'])){ $this->_error('order_id 不能为空'); } $data = Db::name('user_order_imges')->where('order_id',$input['order_id'])->find(); if(!$data){ return $this->_success(''); } $data['image1'] = json_decode($data['image1'],true); $data['image2'] = json_decode($data['image2'],true); $data['image3'] = json_decode($data['image3'],true); foreach ($data['image1'] as $k=>$v){ $data['image1'][$k]['url'] = 'https://web.dulmao.com'.$v['url']; } foreach ($data['image2'] as $k=>$v){ $data['image2'][$k]['url'] = 'https://web.dulmao.com'.$v['url']; } foreach ($data['image3'] as $k=>$v){ $data['image3'][$k]['url'] = 'https://web.dulmao.com'.$v['url']; } return $this->_success('保存成功',$data); } public function up_imgs(){ $input = input(); if(empty($input['data'])){ $this->_error('请上传图片'); } $imgs = json_decode($input['data'],true); $img1 = $imgs['img1']; $img2 = $imgs['img2']; $img3 = $imgs['img3']; foreach ($img1 as $k=>$v){ $img1[$k]['url'] = str_replace('https://web.dulmao.com','',$v['url']); } foreach ($img2 as $k=>$v){ $img2[$k]['url'] = str_replace('https://web.dulmao.com','',$v['url']); } foreach ($img3 as $k=>$v){ $img3[$k]['url'] = str_replace('https://web.dulmao.com','',$v['url']); } $data = [ 'image1'=>json_encode($img1), 'image2'=>json_encode($img2), 'image3'=>json_encode($img3), 'textarea'=>$input['textarea'], 'order_id'=>$input['order_id'] ]; $info = Db::name('user_order_imges')->where('order_id',$input['order_id'])->find(); if($info){ Db::name('user_order_imges')->where('order_id',$input['id'])->update($data); Db::name('order_exe')->where('id',$input['id'])->update(['is_images'=>1]); }else{ Db::name('user_order_imges')->insert($data); Db::name('order_exe')->where('id',$input['id'])->update(['is_images'=>1]); } return $this->_success('保存成功'); } //上传服务的图片内容 public function order_images(){ $file = request()->file('file'); // 移动到框架应用根目录/public/uploads/ 目录下 if($file){ $info = $file->move(ROOT_PATH . '/uploads/webimges'); if($info){ // 成功上传后 获取上传信息 // 输出 jpg // echo $info->getExtension(); // // 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg // echo $info->getSaveName(); // // 输出 42a79759f284b767dfcb2a0197904287.jpg // echo $info->getFilename(); return json(['code'=>200,'data'=>'https://web.dulmao.com/uploads/webimges/'.$info->getSaveName()]); }else{ return json(['code'=>0,'msg'=>$file->getError()]); } } $this->_error("请上传文件"); } //根据主订单编号获取到子订单 public function sub_orderlist(){ $get = $this->request->get();//接受传递过来的参数 $order = new Orderexe(); $lists =$order->where('order_sn',$get['order_sn']) ->where('staff_status',$get['status']) ->order('autotime desc') ->select(); foreach ($lists as $list){ $custom=Db::name('order')->where('order_sn',$list['order_sn'])->find(); $list['address']= $custom['address']; $list['lat']= $custom['lat']; $list['lng']= $custom['lng']; $goods=Db::name('goods')->where('id',$custom['goods_id'])->find(); $list['goods_name']= $goods['name']; if(intval(($list['autotime']-time())/86400)>1){ $list['jldate']=intval(($list['autotime']-time())/86400); }else{ $list['jldate']='-'; } $adder=Db::name('user_address')->where('telephone',$custom['mobile'])->find(); if($adder){ $admin=Db::name('admin')->where('id',$adder['admin_id'])->find(); if($admin){ $list['admin_name']=$admin['name']; $list['admin_phone']=$admin['phone']; }else{ $list['admin_name']='-'; $list['admin_phone']='-'; } } if($list['addtime']==1){ $list['sw']='上午'; $list['sw_time']='8:00-12:00'; }else{ $list['sw']='下午'; $list['sw_time']='14:00-18:00'; } //查询其他用户 $list['autotime']=date("Y-m-d",$list['autotime']); } $this->_success('获取数据成功', $lists); } //主订单下面的子订单 public function counts(){ $order = new Orderexe(); $get = $this->request->get();//接受传递过来的参数 $data['toder'] = $order->where('order_sn',$get['order_sn']) ->where('staff_status',0) ->order('autotime desc') ->count(); $data['ardfs'] = $order->where('order_sn',$get['order_sn']) ->where('staff_status',1) ->order('autotime desc') ->count(); $data['fwz'] = $order->where('order_sn',$get['order_sn']) ->where('staff_status',2) ->count(); $data['fwywc'] = $order->where('order_sn',$get['order_sn']) ->where('staff_status',3) ->count(); $data['ycorder'] = $order->where('order_sn',$get['order_sn']) ->where('abnormal',1) ->count(); $this->_success('获取数据成功',$data); } //根据订单ID显示订单详情 public function orderinfos(){ $get = $this->request->get();//接受传递过来的参数 $orderinfo=Db::name('order')->where('id',$get['order_id'])->find(); $goods=Db::name('goods')->where('id',$orderinfo['goods_id'])->find(); $orderinfo['goods_name']= $goods['name']; $orderinfo['create_time']=date('Y-m-d H:i:s', $orderinfo['create_time']); $orderinfo['goods_images']=UrlServer::getFileUrl($goods['image']); $this->_success('获取数据成功',$orderinfo); } //客户管家的主订单 public function order_list(){ $get = $this->request->get();//接受传递过来的参数 $staff=Db::name('staff')->where('id',$get['staff_id'])->field('mobile')->find(); $admin=Db::name('admin')->where('phone',$staff['mobile'])->find(); $lists =Db::name('order')->where('admin_id',$admin['id']) ->where('pay_status',1) ->limit(10) ->order('id desc') ->select(); foreach ($lists as $k => $v){ $goods=Db::name('goods')->where('id',$lists[$k]['goods_id'])->find(); $lists[$k]['goods_name']= $goods['name']; $lists[$k]['slect_order']=Db::name('order_exe')->where('order_sn',$lists[$k]['order_sn'])->where('staff_status',3)->count(); $lists[$k]['time_payorder']= date('Y-m',$lists[$k]['create_time']); $lists[$k]['dai_order']= $lists[$k]['number']-$lists[$k]['code']; } $this->_success('获取数据成功',$lists); } //订单的评价 public function order_sever(){ $get = $this->request->get();//接受传递过来的参数 $order=Db::name('order_exe')->where('id',$get['order_id'])->find(); //获取子订单的信息 $user=Db::name('order')->where('order_sn',$order['order_sn'])->find(); //获取主订单信息 $data=[ 'name'=> $user['consignee'], 'phone'=> $user['mobile'], 'adders'=> $user['address'], 'order_id'=>$get['order_id'], 'staff_id'=>$order['staff_id'], 'score'=>$get['score'], 'eceives'=>$get['infoReceives'], 'eceivesd'=>$get['infoReceivesd'], 'content'=>$get['textareaValue'], 'create_time'=>time() ]; $where=Db::name('orderexe_evaluate')->where('order_id',$get['order_id'])->find(); if($where){ $this->_success('已经提交评价'); }else{ $inser=Db::name('orderexe_evaluate')->data($data)->insert(); $this->_success('评价内容提交成功'); } } //员工的工资单 public function order_wages(){ $get = $this->request->get();//接受传递过来的参数 $lists=StaffgoodsLogic::order_wages($get); return $this->_success('获取数据成功', $lists); } //员工年卡订单 public function orderinfo_wages(){ $get = $this->request->get();//接受传递过来的参数 $lists=StaffgoodsLogic::orderinfo_wages($get); return $this->_success('获取数据成功', $lists); } }