cxfoot/modules/admin/controllers/mall/OrderController.php
2023-10-24 14:54:18 +08:00

137 lines
3.6 KiB
PHP

<?php
/**
* @author Any
* @description KISS
* @date 2021-4-19
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\modules\admin\controllers\mall;
use app\models\Store;
use app\modules\admin\models\mall\order\OrderActionForm;
use app\modules\admin\models\mall\order\OrderListForm;
use app\modules\admin\models\mall\order\OrderMultiForm;
use yii\helpers\VarDumper;
use app\modules\admin\behaviors\LoginBehavior;
use app\modules\admin\controllers\Controller;
use app\models\PageForm;
class OrderController extends Controller
{
public function behaviors()
{
return array_merge(parent::behaviors(), [
'login' => [
'class' => LoginBehavior::className(),
],
]);
}
//订单列表
public function actionIndex()
{
if(\Yii::$app->request->isAjax){
$form = new OrderListForm();
$form->attributes = \Yii::$app->request->get();
$data = $form->search();
return $this->responseHandler($data);
}
$store = Store::find()->select('id,name')->where(['is_delete' => 0])->asArray()->all();
return $this->render('index',[
'store' => $store
]);
}
//订单取消
public function actionCancel()
{
if(!\Yii::$app->request->isPost){
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderActionForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->cancel();
return $this->responseHandler($data);
}
//订单删除
public function actionDelete()
{
if(!\Yii::$app->request->isPost){
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderActionForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->delete();
return $this->responseHandler($data);
}
//订单完成
public function actionFinish()
{
if(!\Yii::$app->request->isPost){
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderActionForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->finish();
return $this->responseHandler($data);
}
//分账
public function actionMulti()
{
if(!\Yii::$app->request->isPost){
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderActionForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->multi();
return $this->responseHandler($data);
}
//查询分账进度
public function actionSearchMulti()
{
if(\Yii::$app->request->isPost){
$form = new OrderMultiForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->search();
return $this->responseHandler($data);
}
return $this->render('search_multi',[
'type' => 0
]);
}
public function actionSearchMulti2()
{
if(!\Yii::$app->request->isPost){
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderMultiForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->search2();
return $this->responseHandler($data);
}
}