150 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			150 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			PHP
		
	
	
| <?php
 | ||
| // +----------------------------------------------------------------------
 | ||
| // | likeshop开源商城系统
 | ||
| // +----------------------------------------------------------------------
 | ||
| // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
 | ||
| // | gitee下载:https://gitee.com/likeshop_gitee
 | ||
| // | github下载:https://github.com/likeshop-github
 | ||
| // | 访问官网:https://www.likeshop.cn
 | ||
| // | 访问社区:https://home.likeshop.cn
 | ||
| // | 访问手册:http://doc.likeshop.cn
 | ||
| // | 微信公众号:likeshop技术社区
 | ||
| // | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
 | ||
| // |  likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
 | ||
| // | 禁止对系统程序代码以任何目的,任何形式的再发布
 | ||
| // | likeshop团队版权所有并拥有最终解释权
 | ||
| // +----------------------------------------------------------------------
 | ||
| // | author: likeshop.cn.team
 | ||
| // +----------------------------------------------------------------------
 | ||
| 
 | ||
| 
 | ||
| namespace app\admin\controller\order;
 | ||
| 
 | ||
| use app\admin\logic\user\BusinessTeamLogic;
 | ||
| use app\common\basics\AdminBase;
 | ||
| use app\common\model\order\order as OrderModel;
 | ||
| use app\common\server\JsonServer;
 | ||
| use app\admin\logic\order\OrderLogic;
 | ||
| use app\common\model\Client_;
 | ||
| use app\common\enum\PayEnum;
 | ||
| use app\common\model\order\OrderLog;
 | ||
| 
 | ||
| 
 | ||
| /**
 | ||
|  * Class order
 | ||
|  * @package app\admin\controller\order
 | ||
|  */
 | ||
| class Order extends AdminBase
 | ||
| {
 | ||
| 
 | ||
|     /**
 | ||
|      * @notes 订单列表
 | ||
|      * @return \think\response\Json|\think\response\View
 | ||
|      * @author suny
 | ||
|      * @date 2021/7/13 7:07 下午
 | ||
|      */
 | ||
|     public function lists()
 | ||
|     {
 | ||
|         if ($this->request->isAjax()) {
 | ||
|             $get = $this->request->get();
 | ||
|             return JsonServer::success('', OrderLogic::statistics($get));
 | ||
|         }
 | ||
|         $data = OrderLogic::statistics();
 | ||
|         // 订单状态
 | ||
|         $order_status = OrderModel::getOrderStatus(true);
 | ||
|         $order_status = OrderLogic::getStat($order_status); //拼装数量统计
 | ||
|         // 订单类型
 | ||
|         $order_type = OrderModel::getOrderType(true);
 | ||
|         // 订单来源
 | ||
|         $order_source = Client_::getClient(true);
 | ||
|         // 支付方式
 | ||
|         $pay_way = PayEnum::getPayWay(true);
 | ||
|         // 配送方式
 | ||
|         $delivery_type = OrderModel::getDeliveryType(true);
 | ||
|         $all = OrderLogic::getAll();
 | ||
|         return view('', [
 | ||
|             'all' => $all,
 | ||
|             'statistics' => $data,
 | ||
|             'order_status' => $order_status,
 | ||
|             'order_type' => $order_type,
 | ||
|             'order_source' => $order_source,
 | ||
|             'pay_way' => $pay_way,
 | ||
|             'team_list' => BusinessTeamLogic::getBusinessTeamList(),
 | ||
|             'delivery_type' => $delivery_type
 | ||
|         ]);
 | ||
|     }
 | ||
| 
 | ||
|     /**
 | ||
|      * @notes 订单详情
 | ||
|      * @return \think\response\View
 | ||
|      * @throws \think\db\exception\DataNotFoundException
 | ||
|      * @throws \think\db\exception\ModelNotFoundException
 | ||
|      * @throws \think\exception\DbException
 | ||
|      * @author suny
 | ||
|      * @date 2021/7/13 7:07 下午
 | ||
|      */
 | ||
|     public function detail()
 | ||
|     {
 | ||
| 
 | ||
|         $id = $this->request->get('id');
 | ||
|         $detail = OrderLogic::getDetail($id);
 | ||
|         $order_log = OrderLog::getOrderLog($id);
 | ||
|         return view('', [
 | ||
|             'detail' => $detail,
 | ||
|             'logs' => $order_log
 | ||
|         ]);
 | ||
|     }
 | ||
| 
 | ||
|     /**
 | ||
|      * @notes 物流信息
 | ||
|      * @return \think\response\View
 | ||
|      * @author suny
 | ||
|      * @date 2021/7/13 7:07 下午
 | ||
|      */
 | ||
|     public function express()
 | ||
|     {
 | ||
|         $id = $this->request->get('id');
 | ||
|         $detail = OrderLogic::getDetail($id);
 | ||
|         $detail['shipping'] = OrderLogic::shippingInfo($detail['id']);
 | ||
|         return view('', [
 | ||
|             'detail' => $detail
 | ||
|         ]);
 | ||
|     }
 | ||
| 
 | ||
| 
 | ||
|     /**
 | ||
|      * @notes 导出Excel
 | ||
|      * @return \think\response\Json
 | ||
|      * @throws \think\db\exception\DataNotFoundException
 | ||
|      * @throws \think\db\exception\DbException
 | ||
|      * @throws \think\db\exception\ModelNotFoundException
 | ||
|      * @author 段誉
 | ||
|      * @date 2022/4/24 10:20
 | ||
|      */
 | ||
|     public function export()
 | ||
|     {
 | ||
|         $params = $this->request->get();
 | ||
|         $result = OrderLogic::statistics($params, true);
 | ||
|         if(false === $result) {
 | ||
|             return JsonServer::error(OrderLogic::getError() ?: '导出失败');
 | ||
|         }
 | ||
|         return JsonServer::success('', $result);
 | ||
|     }
 | ||
| 
 | ||
|     public function setTeam(){
 | ||
|         if($this->request->isAjax()){
 | ||
|             $post = $this->request->post();
 | ||
|             if (empty($post['order_ids']) || empty($post['team_id'])) {
 | ||
|                 return JsonServer::error('参数错误');
 | ||
|             }
 | ||
|             $result = OrderLogic::setTeam($post);
 | ||
|             if($result === true) {
 | ||
|                 return JsonServer::success('设置成功');
 | ||
|             }
 | ||
|             return JsonServer::error(OrderLogic::getError());
 | ||
|         }
 | ||
|         return view('', [
 | ||
|             'team_list' => json_encode(BusinessTeamLogic::getBusinessTeamList())
 | ||
|         ]);
 | ||
|     }
 | ||
| } |