old-hotel-new/app/Admin/Controllers/LiveExitController.php

187 lines
11 KiB
PHP

<?php
namespace App\Admin\Controllers;
use App\Models\{Keyword,Oldmen};
use Slowlyo\OwlAdmin\Renderers\Page;
use Slowlyo\OwlAdmin\Renderers\Form;
use Slowlyo\OwlAdmin\Renderers\TableColumn;
use Slowlyo\OwlAdmin\Controllers\AdminController;
use App\Services\Admin\LiveContinueService;
use Illuminate\Http\Request;
use App\Admin\Components;
class LiveExitController extends AdminController
{
protected string $serviceName = LiveContinueService::class;
public function form(): Form
{
return $this->baseForm()->body([
]);
}
public function doForm(){
$feeKeys =[];
$feeKeys['oldman_id'] = '${oldman_id}';
$feeKeys['add_extends'] = '${add_extends}';
$feeKeys['del_extends'] = '${del_extends}';
$page = $this->basePage()->body([
amisMake()->Card()->className('border-0')->body(
amisMake()->Wrapper()->className('p-0')->body(
amisMake()->Grid()->className('relative')->columns([
amisMake()->Wrapper()->sm(8)->body([
amisMake()->Panel()->title('结算表单')->body(
amisMake()->form()->title('')->panelClassName('border-0')->mode('horizontal')->name('base_form')
->api(admin_url('live-continue-do'))
->body([
amisMake()->FieldSetControl()->title('客人信息')->collapsable(true)->body([
amisMake()->Service()->api([
"method"=>'get',
"url" => admin_url('oldmen/${oldman_id}/edit'),
"data"=>[
'_action' => 'getData',
],
"sendOn" => "this.oldman_id > 0 "
]),
amisMake()->GroupControl()->body([
amisMake()->PickerControl('oldman_id', '姓名')
->valueField('id')
->labelField('name')
->joinValues(false)->extractValue(true)
->size('lg')
->source([
'method' => 'get',
'url' => admin_url('oldmen?_action=getData&live_in='.Oldmen::STATUS_LIVE),
'data' => [
'name'=>'${term}',
]
])
->pickerSchema(
[
'mode' => 'table',
'name' => 'monitor_list',
'headerToolbar' => amisMake()->form()
->wrapWithPanel(false)
->className('text-right')
->target('monitor_list')
->mode('inline')
->body([
amisMake()->TextControl('term', '姓名/身份证号')->addOn(
amis('submit')->label(__('admin.search'))->level('primary')
)
]),
'columns' => [
TableColumn::make()->name('name')->label('姓名'),
TableColumn::make()->name('card_no')->label('身份证号码'),
]
]
)->value(0)
->required(true),
amisMake()->RadiosControl('sex', '性别')->options([
1=>'男',2=>'女'
])->disabled(true),
]),
amisMake()->GroupControl()->body([
amisMake()->TextControl('card_no', '身份证号码')->disabled(true),
amisMake()->DateControl('birthday', '出生日期')->format('YYYY-MM-DD')->disabled(true),
]),
amisMake()->GroupControl()->body([
amisMake()->TextControl('floor_name', '楼栋')->disabled(true),
amisMake()->TextControl('agreement_no', '协议号码')->disabled(true),
]),
amisMake()->GroupControl()->body([
amisMake()->RadiosControl('nurse_lv', '护理等级')->options(Keyword::getByParentKey('nurse_lv')->pluck('name', 'value'))->disabled(true),
]),
]),
amisMake()->FieldSetControl()->className('mt-10')->title('已缴费明细')->collapsable(true)->body(
amisMake()->FieldSetControl()->title('基础费用')->className('mt-5')->collapsable(true)->size('base')->body(
amisMake()->Service()->schemaApi([
"method"=>'get',
"url" => admin_url('live-const-flow').'?oldman_id=${oldman_id}',
])
),
),
amisMake()->FieldSetControl()->className('mt-10')->title('附加项')->collapsable(true)->body([
amisMake()->ComboControl('del_extends','收费项')->multiple(true)->items([
amisMake()->TextControl('name', '名称'),
Components::make()->decimalControl('fee', '金额')
]),
amisMake()->ComboControl('add_extends','抵扣项')->multiple(true)->items([
amisMake()->TextControl('name', '名称'),
Components::make()->decimalControl('fee', '金额')
]),
]),
])
->actions([
amis('button')->label("生成清单")->level('primary')
->onEvent([
'click'=>[
'actions'=>[
[
'actionType'=>'reload',
'componentId'=>'fee_table'
],
[
'actionType'=>'setValue',
'componentId'=>'fee_table',
'args'=>[
'value'=> $feeKeys
]
]
]
]
]),
amis('submit')->label('确认结算')->confirmText('是否确认结算,并且已查看结算费用清单?')
->redirect('live-in')
->level('danger'),
]),
),
]),
amisMake()->Wrapper()->sm(4)->className('absolute bottom-20 w-2/6')->body([
amisMake()->Panel()->title('结算清单')->body([
amisMake()->Service()->name('fee_table_name')->id('fee_table')
->data($feeKeys)
->body(
amisMake()->table()->affixHeader(false)
->title('')
->source('${rows}')
->combineNum(2)
->columns([
amisMake()->TableColumn()->name('name')->label('名称'),
amisMake()->TableColumn()->name('fee_name')->label('费用项'),
amisMake()->TableColumn()->name('fee_value')->label('费用'),
])->affixRow([
amis('text')->text('合计')->colSpan(2),
amis('tpl')->tpl('${SUM(ARRAYMAP(rows, item => item.fee_value))}')
]),
)->api([
'method'=>'get',
'data'=> $feeKeys,
'url' =>admin_url('exit-feelist')
]),
]),
]),
]),
)
),
]);
return $this->response()->success($page);
}
public function do(Request $request){
}
}