<?php
namespace app\admin\controller\rose;
use app\admin\controller\AuthController;
use app\admin\model\order\StoreOrder as StoreOrderModel;
use app\models\user\UserCode;
use crmeb\services\{
    UtilService as Util,
    JsonService as Json
};
class Order extends AuthController
{
    public function index()
    {
        $this->assign([
            'year' => get_month(),
            'real_name' => $this->request->get('real_name', ''),
            'status' => $this->request->param('status', ''),
            'orderCount' => StoreOrderModel::orderCount(),
            'payTypeCount' => StoreOrderModel::payTypeCount(),
            'code_list' => UserCode::alias('c')->join("user u",'c.uid=u.uid',"left")->field('c.code,u.uid,u.real_name,u.nickname')->select(),
        ]);
        return $this->fetch();
    }
    /**
     * 获取订单列表
     * return json
     */
    public function order_list()
    {
        $where = Util::getMore([
            ['status', ''],
            ['real_name', $this->request->param('real_name', '')],
            ['is_del', 0],
            ['data', ''],
            ['type', ''],
            ['pay_type', ''],
            ['order', ''],
            ['page', 1],
            ['limit', 20],
            ['excel', 0],
            ['code',''],
        ]);
        return Json::successlayui(StoreOrderModel::OrderList($where));
    }

}