可自行调整时间和费用
parent
b9d34750f9
commit
51bc60cde9
|
|
@ -38,10 +38,16 @@ class ConstFlowController extends AdminController
|
|||
amisMake()->TableColumn('oldman.name', '客人'),
|
||||
amisMake()->TableColumn('const_type', '缴费类型')->type('mapping')->map(ConstFlow::typeMapLabel())->className('text-primary'),
|
||||
amisMake()->TableColumn('money', '金额'),
|
||||
amisMake()->TableColumn('created_at', '办理时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('start_at', '开始时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('end_at', '结束时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('created_at', '办理时间')->type('datetime')->sortable(true),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->showFlow(),
|
||||
]),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(true, 'lg')->hiddenOn('this.const_type == 3'),
|
||||
$this->rowDeleteButton()->hiddenOn('this.const_type == 3')
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
|
|
@ -50,7 +56,10 @@ class ConstFlowController extends AdminController
|
|||
public function form($isEdit = false): Form
|
||||
{
|
||||
return $this->baseForm()->body([
|
||||
|
||||
amisMake()->GroupControl()->body([
|
||||
amisMake()->DateControl('start_at', '开始时间')->format('YYYY-MM-DD 00:00:00')->required(true),
|
||||
amisMake()->DateControl('end_at', '结束时间')->format('YYYY-MM-DD 23:59:59')->required(true),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,9 @@ class LiveInController extends AdminController
|
|||
TableColumn::make()->name('live_in_at')->label('入住时间')->type('datetime')->sortable(true),
|
||||
TableColumn::make()->name('avliable_at')->label('截至时间')->type('datetime')->sortable(true),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(true, 'lg'),
|
||||
amisMake()->LinkAction()->label('续住')->icon('fa fa-plus')->link('live-continue-do?oldman_id=${id}')->level('link'),
|
||||
amisMake()->LinkAction()->label('结算')->icon('fa fa-external-link-alt')->link('live-exit-do?oldman_id=${id}')->level('link')
|
||||
amisMake()->LinkAction()->label('结算')->icon('fa fa-external-link-alt')->link('live-exit-do?oldman_id=${id}')->level('link'),
|
||||
]),
|
||||
]);
|
||||
|
||||
|
|
@ -54,7 +55,10 @@ class LiveInController extends AdminController
|
|||
public function form(): Form
|
||||
{
|
||||
return $this->baseForm()->body([
|
||||
|
||||
amisMake()->GroupControl()->body([
|
||||
amisMake()->DateControl('live_in_at', '入住时间')->format('YYYY-MM-DD 00:00:00')->required(true),
|
||||
amisMake()->DateControl('avliable_at', '截至时间')->format('YYYY-MM-DD 23:59:59')->required(true),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Route::group([
|
|||
$router->get('live-fee-form-data', '\App\Admin\Controllers\OldmenController@liveSchemaFormData');
|
||||
$router->get('live-const-flow', '\App\Admin\Controllers\OldmenController@liveConstFlow');
|
||||
//客人-入住
|
||||
$router->get('live-in', '\App\Admin\Controllers\LiveInController@index');
|
||||
$router->resource('live-in', \App\Admin\Controllers\LiveInController::class)->only(['index', 'edit', 'update']);
|
||||
$router->get('live-in-do', '\App\Admin\Controllers\LiveInController@doForm');
|
||||
$router->post('live-in-do', '\App\Admin\Controllers\LiveInController@do');
|
||||
//客人-续住
|
||||
|
|
@ -45,7 +45,7 @@ Route::group([
|
|||
$router->post('live-exit-do', '\App\Admin\Controllers\LiveExitController@do');
|
||||
|
||||
//费用设置
|
||||
$router->resource('consts', \App\Admin\Controllers\ConstFlowController::class)->only(['index', 'show', 'destroy']);
|
||||
$router->resource('consts', \App\Admin\Controllers\ConstFlowController::class)->only(['index', 'edit', 'update','show', 'destroy']);
|
||||
$router->post('flow-list-tabs', '\App\Admin\Controllers\ConstFlowController@flowExtendList');
|
||||
$router->get('const-setting', '\App\Admin\Controllers\SettingController@settingFeeConfig');
|
||||
$router->post('const-setting', '\App\Admin\Controllers\SettingController@settingFeeConfigStore');
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ namespace App\Services\Admin;
|
|||
use App\Models\ConstFlow;
|
||||
use Slowlyo\OwlAdmin\Services\AdminService;
|
||||
use App\Filters\Admin\ConstFlowFilter;
|
||||
use App\Models\Oldmen;
|
||||
use PhpParser\Node\Stmt\Const_;
|
||||
|
||||
/**
|
||||
* 费用明细
|
||||
|
|
@ -28,4 +30,32 @@ class ConstFlowService extends BaseService
|
|||
'avliable_at' => $flow->end_at
|
||||
]));
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
{
|
||||
$id = collect(explode(',', $ids));
|
||||
// 所有ID
|
||||
foreach ($id as $value) {
|
||||
$_flow = ConstFlow::find($value);
|
||||
if($_flow->const_type == ConstFlow::TYPE_IN){
|
||||
$_oldman = Oldmen::find($_flow->oldman_id);
|
||||
//如果还有续费记录未删除,则提示先删除续费记录;
|
||||
if(ConstFlow::where('oldman_id', $_oldman->id)->where('const_type', '>', ConstFlow::TYPE_IN)->where('end_at', '<=', $_oldman->avliable_at)->exists()){
|
||||
return $this->setError('请先删除该用户续费记录');
|
||||
}
|
||||
//如果删除入住;则判断当前用户状态是否是入住,是,则变更为未入住;
|
||||
if($_oldman->live_in_at == $_flow->start_at && $_oldman->live_in == Oldmen::STATUS_LIVE){
|
||||
$_oldman->update([
|
||||
'live_in' => Oldmen::STATUS_NORMAL,
|
||||
'need_pay' => Oldmen::PAY_NORMAL,
|
||||
'live_in_at' => null,
|
||||
'avliable_at' => null,
|
||||
'bonds' => [],//保证金归零
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$id = $id->unique();
|
||||
return $this->query()->whereIn($this->primaryKey(), $id)->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue