model = new Consume(); } /** * 查看 */ public function index() { //设置过滤方法 $this->request->filter(['strip_tags', 'trim']); if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { return $this->selectpage(); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $list = $this->model->where($where)->where(['check_status' => 2])->with(['staff','customer']) ->order('id desc')->paginate($limit); $result = array("total" => $list->total(), "rows" => $list->items()); return json($result); } return $this->view->fetch(); } //费用详情 public function detail($ids = null) { // 基本信息 $row = $this->model->where('id',$ids)->with(['staff','customer'])->find(); if(empty($row)){ $this->error('信息不存在'); } $row['detail']= ConsumeDetail::where(['consume_id'=>$ids])->select(); // 操作记录 $operations = ExamineRecord::where('relation_id',$ids)->with(['checkStaff'])->select(); $this->assign('ids',$ids); $this->assign('row',$row); $this->assign('operations',$operations); return $this->view->fetch(); } // 回款: 新增合同的回款/列表/详情 // 费用:列表/新增/修改/删除 // 出纳:列表/详情/批量打款 单独打款操作 is_cashier=1 //出纳 public function cashier(){ $ids=input('ids'); if(empty($ids)){ $this->error('参数错误'); } $ids = rtrim($ids,']'); $ids = ltrim($ids,'['); $ids=explode(',',$ids); ConsumeModel::where(['id'=>['in',$ids]])->update(['is_cashier'=>1]); $data=[]; foreach ($ids as $id){ $data[] = [ 'relation_type' => ExamineRecord::CONSUME_TYPE, 'relation_id' => $id, 'check_staff_id' => $this->_staff->id, 'status' => 1, 'content' => '出纳审核', 'createtime' => time(), 'updatetime' => time() ]; } $examineModel=new ExamineRecord(); $examineModel->insertAll($data); $this->success('操作成功'); } }