cxgj/modules/store/controllers/mall/OrderController.php
2023-11-27 09:45:13 +08:00

136 lines
3.7 KiB
PHP

<?php
/**
* @author Any
* @description KISS
* @date 2021-4-19
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\modules\store\controllers\mall;
use app\models\Store;
use app\modules\store\models\mall\order\OrderActionForm;
use app\modules\store\models\mall\order\OrderListForm;
use app\modules\store\models\mall\order\OrderMultiForm;
use yii\helpers\VarDumper;
use app\modules\store\behaviors\LoginBehavior;
use app\modules\store\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();
$form->store_id = \Yii::$app->store->identity->store_id;
$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);
}
}