['bidding_decision_id', 'project_id', 'pay_type'], '%like%' => ['applier'] ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/16 10:46 */ public function lists(): array { return BidSecurityApply::where($this->searchWhere) ->field('id,security_apply_code,project_id,bidding_decision_id,applier,refund_date,create_time') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $bidding_decision = BidBiddingDecision::field('code,margin_amount,bidding_time')->where('id',$data['bidding_decision_id'])->findOrEmpty(); $project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); $data['bidding_decision_code'] = $bidding_decision['code']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['custom_name'] = $custom['name']; $data['bidding_time'] = $bidding_decision['bidding_time']; //保证金金额 $data['margin_amount'] = $bidding_decision['margin_amount']; //已退金额 $data['has_refund_amount'] = BidSecurityRefund::where('bid_security_apply_id',$data['id'])->sum('refund_amount'); //未退金额 $data['not_refund_amount'] = $data['margin_amount'] - $data['has_refund_amount']; return $data; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/12/16 10:46 */ public function count(): int { return BidSecurityApply::where($this->searchWhere)->count(); } public function setFileName(): string { return '投标保证金列表'; } /** * @notes 导出字段 * @return string[] * @author 段誉 * @date 2022/11/24 16:17 */ public function setExcelFields(): array { return [ "id" => "id", "security_apply_code" => "投标编号", "custom_name" => "客户名称", "project_name" => "项目名称", "bidding_time" => "投标时间", "refund_date" => "预计退还时间", "margin_amount" => "保证金金额", "applier" => "申请人", "has_refund_amount" => "已退金额", "not_refund_amount" => "未退金额", "create_time" => "创建日期", ]; } }