master
cody 5 months ago
parent 9aef20f75b
commit 9cd8c85df7

@ -0,0 +1,60 @@
<?php
namespace App\Forms;
use Kris\LaravelFormBuilder\Form;
use Kris\LaravelFormBuilder\Field;
class OrderAgreementForm extends Form
{
public function buildForm()
{
$this->add("id", Field::HIDDEN);
$this->add("order_id", Field::NUMBER, [
"label" => "订单ID",
"rules" => "required",
"attr" => ["placeholder" => "请输入订单ID"]
]);
$this->add("paramedic_id", Field::NUMBER, [
"label" => "护工ID",
"attr" => ["placeholder" => "请输入护工ID选填"]
]);
$this->add("customer_id", Field::NUMBER, [
"label" => "客户ID",
"attr" => ["placeholder" => "请输入客户ID选填"]
]);
$this->add("paramedic_sign_id", Field::TEXT, [
"label" => "护工签名图片ID",
"attr" => ["placeholder" => "请输入护工签名图片ID选填"]
]);
$this->add("customer_sign_id", Field::TEXT, [
"label" => "客户签名图片ID",
"attr" => ["placeholder" => "请输入客户签名图片ID选填"]
]);
$this->add("company_sign_id", Field::TEXT, [
"label" => "公司签名图片ID",
"attr" => ["placeholder" => "请输入公司签名图片ID选填"]
]);
$this->add("file_id", Field::NUMBER, [
"label" => "文件ID",
"attr" => ["placeholder" => "请输入文件ID选填"]
]);
$this->add('buttons', 'buttongroup', [
"splitted" => true,
"buttons" => [
["label" => "保存", "attr" => ["class" => "btn btn-primary mr-1", "type" => "submit"]],
["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]]
]
]);
}
}

@ -0,0 +1,45 @@
<?php
/**
* Created by PhpStorm.
* User: weizongsong
* Date: 2025-10-23
* Time: 21:00
*/
namespace App\Http\Controllers\Admin;
use App\Forms\OrderAgreementForm;
use App\Models\OrderAgreement;
use Illuminate\Http\Request;
class OrderAgreementController extends CommonController
{
public $bladePath = "admin.order-agreement";
public $urlPrefix = "admin/order-agreement";
public $modelName = "订单协议";
public $modelClass = OrderAgreement::class;
public $formClass = OrderAgreementForm::class;
public function index(Request $request)
{
$query = $this->model->with(['order', 'paramedicSign', 'customerSign', 'companySign', 'file']);
// 搜索功能
if ($request->order_id) {
$query->where('order_id', $request->order_id);
}
if ($request->customer_id) {
$query->where('customer_id', $request->customer_id);
}
if ($request->paramedic_id) {
$query->where('paramedic_id', $request->paramedic_id);
}
$data = $query->orderBy('id', 'desc')->paginate(10);
return view($this->bladePath . ".index", compact("data"));
}
}

@ -26,4 +26,9 @@ class OrderAgreement extends SoftDeletesModel
return $this->hasOne(Uploads::class, 'id', 'file_id');
}
public function order()
{
return $this->hasOne(Orders::class, 'id', 'order_id');
}
}

@ -0,0 +1,17 @@
@extends("admin.layouts.layout")
@php
$pageTitle = __("actions." . last(explode("/", request()->url()))) . $modelName;
@endphp
@section("content")
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
@include("public._form")
</div>
</div>
</div>
</div>
@endsection

@ -0,0 +1,120 @@
@extends("admin.layouts.layout")
@section("content")
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="mb-3">
<a class="btn btn-primary" href="{{url($urlPrefix . '/create')}}">
@lang("icons.action_create") @lang('actions.create'){{$modelName}}
</a>
</div>
<!-- 搜索表单 -->
<div class="mb-3">
<form method="GET" action="{{url($urlPrefix)}}" class="form-inline">
<div class="form-group mr-2">
<input type="number" name="order_id" class="form-control" placeholder="订单ID"
value="{{request('order_id')}}">
</div>
<div class="form-group mr-2">
<input type="number" name="customer_id" class="form-control" placeholder="客户ID"
value="{{request('customer_id')}}">
</div>
<div class="form-group mr-2">
<input type="number" name="paramedic_id" class="form-control" placeholder="护工ID"
value="{{request('paramedic_id')}}">
</div>
<button type="submit" class="btn btn-info mr-2">搜索</button>
<a href="{{url($urlPrefix)}}" class="btn btn-secondary">重置</a>
</form>
</div>
<table class="table table-bordered" id="data-table">
<thead>
<tr>
<th>ID</th>
<th>订单ID</th>
<th>护工ID</th>
<th>客户ID</th>
<th>护工签名</th>
<th>客户签名</th>
<th>公司签名</th>
<th>文件</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach ($data as $row)
<tr data-id="{{$row->id}}">
<td>{{ $row->id }}</td>
<td>
@if($row->order)
{{ $row->order_id }}
@else
{{ $row->order_id ?: '-' }}
@endif
</td>
<td>{{ $row->paramedic_id ?: '-' }}</td>
<td>{{ $row->customer_id ?: '-' }}</td>
<td>
@if($row->paramedicSign)
<a href="{{Storage::url($row->paramedicSign->folder . '/' . $row->paramedicSign->name)}}"
target="_blank">查看</a>
@else
-
@endif
</td>
<td>
@if($row->customerSign)
<a href="{{Storage::url($row->customerSign->folder . '/' . $row->customerSign->name)}}"
target="_blank">查看</a>
@else
-
@endif
</td>
<td>
@if($row->companySign)
<a href="{{Storage::url($row->companySign->folder . '/' . $row->companySign->name)}}"
target="_blank">查看</a>
@else
-
@endif
</td>
<td>
@if($row->file)
<a href="{{Storage::url($row->file->folder . '/' . $row->file->name)}}"
target="_blank">下载</a>
@else
-
@endif
</td>
<td>{{ $row->created_at->format('Y-m-d H:i:s') }}</td>
<td>
<a class="btn btn-sm btn-primary"
href="{{url("{$urlPrefix}/edit?id={$row['id']}")}}">@lang("icons.action_edit")
@lang("actions.edit")</a>
<a class="btn btn-sm btn-danger btn-delete" data-id="{{$row['id']}}"
href="javascript:;">@lang("icons.action_delete") @lang("actions.delete")</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@include("public._pages")
</div>
</div>
</div>
</div>
@include("public._delete")
@endsection
@push("footer")
<script>
</script>
@endpush

@ -8,27 +8,25 @@
<div class="card-body">
<div class="mb-3">
<form class="form-inline" id="search-form" autocomplete="off">
<select class="form-control mr-1" name="project_id"
onchange="$(this).closest('form').submit()">
<select class="form-control mr-1" name="project_id" onchange="$(this).closest('form').submit()">
@foreach($projects as $pp)
<option
value="{{$pp->id}}" @if($pp->id == $project_id) {{ "selected" }}@endif>{{$pp->name}}</option>
<option value="{{$pp->id}}" @if($pp->id == $project_id) {{ "selected" }}@endif>{{$pp->name}}
</option>
@endforeach
</select>
<select class="form-control mr-1" name="building_id"
onchange="$(this).closest('form').submit()">
onchange="$(this).closest('form').submit()">
<option value="">全部楼栋</option>
@foreach($buildings as $pp)
<option
value="{{$pp->id}}" @if($pp->id == $building_id) {{ "selected" }}@endif>{{$pp->name}}</option>
<option value="{{$pp->id}}" @if($pp->id == $building_id) {{ "selected" }}@endif>{{$pp->name}}
</option>
@endforeach
</select>
<select class="form-control mr-1" name="area_id"
onchange="$(this).closest('form').submit()">
<select class="form-control mr-1" name="area_id" onchange="$(this).closest('form').submit()">
<option value="">全部病区</option>
@foreach($areas as $pp)
<option
value="{{$pp->id}}" @if($pp->id == $area_id) {{ "selected" }}@endif>{{$pp->name}}</option>
<option value="{{$pp->id}}" @if($pp->id == $area_id) {{ "selected" }}@endif>{{$pp->name}}
</option>
@endforeach
</select>
<select class="form-control mr-1" name="month" onchange="$(this).closest('form').submit()">
@ -38,21 +36,19 @@
</select>
<select class="form-control mr-1" name="date" onchange="$(this).closest('form').submit()">
<option value="">包含本月所有日期</option>
@for($i=1;$i<=31;$i++)
<option
value="{{ sprintf("%02d",$i)}}" @if(sprintf("%02d",$i) == request()->date) {{ "selected" }}@endif>{{sprintf("%02d",$i)}}</option>
@for($i = 1; $i <= 31; $i++)
<option value="{{ sprintf("%02d", $i)}}" @if(sprintf("%02d", $i) == request()->date) {{ "selected" }}@endif>{{sprintf("%02d", $i)}}</option>
@endfor
</select>
<select class="form-control mr-1" name="status" onchange="$(this).closest('form').submit()">
@foreach($order_status_list as $key=>$mm)
<option
value="{{$key}}" @if($key == $status) {{ "selected" }}@endif>{{$mm}}</option>
@foreach($order_status_list as $key => $mm)
<option value="{{$key}}" @if($key == $status) {{ "selected" }}@endif>{{$mm}}</option>
@endforeach
</select>
<input class="form-control" type="text" name="keyword" value="{{ request()->keyword }}"
placeholder="订单编号/联系人/联系电话">
placeholder="订单编号/联系人/联系电话">
@if(\App\Models\CommonModel::checkExport())
<button class="btn btn-primary ml-1" type="button" onclick="doExport(this)">导出</button>
@endif
@ -60,92 +56,99 @@
</div>
<table class="table table-bordered" id="data-table">
<thead>
<tr>
<th>订单编号</th>
<th>协议</th>
<tr>
<th>订单编号</th>
<th>协议</th>
<th>所属项目/医院</th>
<th>所在楼栋</th>
<th>所在病区</th>
{{-- <th>客户科室</th>--}}
<th>客户姓名</th>
<th>客户余额</th>
<th>联系电话</th>
<th>被护理人</th>
<th>开始服务日期</th>
<th>结束日期</th>
<th>状态</th>
<th>总计</th>
<th>所属项目/医院</th>
<th>所在楼栋</th>
<th>所在病区</th>
{{-- <th>客户科室</th>--}}
<th>客户姓名</th>
<th>客户余额</th>
<th>联系电话</th>
<th>被护理人</th>
<th>开始服务日期</th>
<th>结束日期</th>
<th>状态</th>
<th>总计</th>
@if (empty($hushizhang) && empty($yuanfang))
<th>操作</th>
@endif
</tr>
@if (empty($hushizhang) && empty($yuanfang))
<th>操作</th>
@endif
</tr>
</thead>
<tbody>
@foreach ($data as $row)
<tr data-id="{{$row->id}}">
<td>
{{ $row->serial }}
</td>
<td>{!! isset($row->orderAgreementByLast)?"<a href='/storage/" .$row->orderAgreementByLast->file->name."' target='_blank'><img src='/storage/" .$row->orderAgreementByLast->file->name."' width='50' height='50'></a>":"" !!}</td>
<td>{{ $row->project->name }}</td>
<td>{{ $row->bed->building->name }}</td>
<td>{{ $row->bed->area->name }}</td>
{{-- <td>{{ $row->department }}</td>--}}
<td>{{ $row->customer->name ?: $row->patient->name }}</td>
<td>{{ $row->customer->balance }}</td>
<td>{{ $row->customer->mobile }}</td>
<td>{{ $row->patient->name }}</td>
<td>{{ $row->from_date }}</td>
<td>{!! $row->status == \App\Models\Orders::STATUS_FINISHED ? $row->to_date : "<label class='badge badge-danger'>未结</label> {$row->to_date}" !!}</td>
<td>{!! $row->getStatusLabelAttribute() !!} </td>
<td>{!! $row->status == \App\Models\Orders::STATUS_FINISHED ? "" : "<label class='badge badge-danger'>预计</label>" !!} {{ $row->total }} </td>
@if (empty($hushizhang) && empty($yuanfang))
@foreach ($data as $row)
<tr data-id="{{$row->id}}">
<td>
<a class="btn btn-sm btn-primary"
href="javascript:;" onclick="toggleItems(this)"><i
class="mdi mdi-arrow-down"></i> 查看</a>
{{ $row->serial }}
</td>
<td>{!! isset($row->orderAgreementByLast) ? "<a href='/storage/" . $row->orderAgreementByLast->file->name . "' target='_blank'><img src='/storage/" . $row->orderAgreementByLast->file->name . "' width='50' height='50'></a>" : "" !!}
</td>
@endif
</tr>
<tr style="display: none">
<td colspan="14" class="p-0">
<table class="table table-striped mb-0 border-0">
<thead>
<tr>
<th>所在床位</th>
<th>护理日期</th>
<th>护工</th>
<th>单价</th>
<th>扣款时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach($row->orderItems as $item)
<tr data-id="{{ $item->id }}" data-item-id="{{ $item->id }}">
<td>{{ $item->building->name }}-{{ $item->room->name }}
-{{ $item->bed->name }}床
</td>
<td>{{ $item->service_date }}</td>
<td>{{ $item->paramedic ? $item->paramedic->name : "" }}</td>
<td data-field="total">{{ $item->total }}</td>
<td>{{ $item->paid_at }}</td>
<td>
<button type="button" class="btn btn-primary btn-sm"
onclick="changeItem(this)">修改
</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
@endforeach
<td>{{ $row->project->name }}</td>
<td>{{ $row->bed->building->name }}</td>
<td>{{ $row->bed->area->name }}</td>
{{-- <td>{{ $row->department }}</td>--}}
<td>{{ $row->customer->name ?: $row->patient->name }}</td>
<td>{{ $row->customer->balance }}</td>
<td>{{ $row->customer->mobile }}</td>
<td>{{ $row->patient->name }}</td>
<td>{{ $row->from_date }}</td>
<td>{!! $row->status == \App\Models\Orders::STATUS_FINISHED ? $row->to_date : "<label class='badge badge-danger'>未结</label> {$row->to_date}" !!}
</td>
<td>{!! $row->getStatusLabelAttribute() !!} </td>
<td>{!! $row->status == \App\Models\Orders::STATUS_FINISHED ? "" : "<label class='badge badge-danger'>预计</label>" !!}
{{ $row->total }} </td>
@if (empty($hushizhang) && empty($yuanfang))
<td>
<a class="btn btn-sm btn-primary" href="javascript:;" onclick="toggleItems(this)"><i
class="mdi mdi-arrow-down"></i> 查看</a>
<a class="btn btn-sm btn-info"
href="{{url("admin/order-agreement?order_id={$row->id}")}}" target="_blank"
title="查看该订单的所有协议">
<i class="mdi mdi-file-document"></i> 查看协议
</a>
</td>
@endif
</tr>
<tr style="display: none">
<td colspan="14" class="p-0">
<table class="table table-striped mb-0 border-0">
<thead>
<tr>
<th>所在床位</th>
<th>护理日期</th>
<th>护工</th>
<th>单价</th>
<th>扣款时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach($row->orderItems as $item)
<tr data-id="{{ $item->id }}" data-item-id="{{ $item->id }}">
<td>{{ $item->building->name }}-{{ $item->room->name }}
-{{ $item->bed->name }}床
</td>
<td>{{ $item->service_date }}</td>
<td>{{ $item->paramedic ? $item->paramedic->name : "" }}</td>
<td data-field="total">{{ $item->total }}</td>
<td>{{ $item->paid_at }}</td>
<td>
<button type="button" class="btn btn-primary btn-sm"
onclick="changeItem(this)">修改
</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
@endforeach
</tbody>
</table>
@include("public._pages")
@ -173,8 +176,7 @@
</div>
<div class="form-group">
<label for="total">价格</label>
<input class="form-control" type="number" name="total" required=""
onblur="calculateSalary();">
<input class="form-control" type="number" name="total" required="" onblur="calculateSalary();">
</div>
<div id="factor-box">
@ -303,4 +305,4 @@
window.open(url);
}
</script>
@endpush
@endpush

@ -69,6 +69,7 @@ Route::group(["namespace" => "Admin", "prefix" => "admin"], function () {
\App\Models\CommonModel::generateCurdRouter("AlipayAccountController", "alipay-account");
\App\Models\CommonModel::generateCurdRouter("AdverseController", "adverse");
Route::post("adverse/order-search", 'AdverseController@orderSearch');
\App\Models\CommonModel::generateCurdRouter("OrderAgreementController", "order-agreement");
Route::get("product", 'ProductController@index');
Route::get("product/create", 'ProductController@create');

Loading…
Cancel
Save