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

223 lines
6.4 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 app\modules\admin\models\mall\order\OrderSaleActionForm;
use app\modules\admin\models\mall\order\OrderSaleListForm;
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);
}
//售后列表
public function actionSale()
{
if (\Yii::$app->request->isAjax) {
$form = new OrderSaleListForm();
$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('sale', [
'store' => $store
]);
}
//售后订单同意
public function actionStatusYes()
{
if (!\Yii::$app->request->isPost) {
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderSaleActionForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->finish();
return $this->responseHandler($data);
}
//售后订单拒绝
public function actionStatusNo()
{
if (!\Yii::$app->request->isPost) {
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderSaleActionForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->cancel();
return $this->responseHandler($data);
}
public function actionRefund()
{
if (!\Yii::$app->request->isPost) {
$data = $this->invaildRequest();
return $this->responseHandler($data);
}
$form = new OrderSaleActionForm();
$form->attributes = \Yii::$app->request->post();
$data = $form->refund();
return $this->responseHandler($data);
}
//订单导出
public function actionGoodsOrderExport()
{
$form = new OrderListForm();
$form->attributes = \Yii::$app->request->get();
$data = $form->goods_order_export();
return $this->responseHandler($data);
}
//包厢订单
public function actionBooxSearch()
{
if (\Yii::$app->request->isAjax) {
$form = new OrderListForm();
$form->attributes = \Yii::$app->request->get();
$data = $form->boox_search();
return $this->responseHandler($data);
}
$store = Store::find()->select('id,name')->where(['is_delete' => 0])->asArray()->all();
return $this->render('boox_search', [
'store' => $store
]);
}
//订单导出
public function actionBooxOrderExport()
{
$form = new OrderListForm();
$form->attributes = \Yii::$app->request->get();
$data = $form->boox_order_export();
return $this->responseHandler($data);
}
}