| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- namespace app\controller\admin\order;
- use app\common\repositories\store\order\VerifyRecordRepository;
- use crmeb\basic\BaseController;
- use app\common\repositories\store\order\StoreOrderRepository as repository;
- use crmeb\services\ExcelService;
- use think\App;
- /**
- * 订单
- */
- class Order extends BaseController
- {
- protected $repository;
- public function __construct(App $app, repository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- /**
- * 每个商户的订单列表
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- * @day 2024/5/10
- */
- public function lst($id)
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['date', 'order_sn', 'order_type', 'keywords', 'username', 'activity_type', 'group_order_sn', 'store_name', 'filter_delivery', 'filter_product', 'delivery_id','nickname','uid','phone','real_name']);
- $where['mer_id'] = $id;
- $where['is_spread'] = $this->request->param('is_spread', '');
- return app('json')->success($this->repository->adminMerGetList($where, $page, $limit));
- }
- /**
- * 平台对订单备注
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- */
- public function markForm($id)
- {
- if (!$this->repository->getWhereCount([$this->repository->getPk() => $id]))
- return app('json')->fail('数据不存在');
- return app('json')->success(formToData($this->repository->adminMarkForm($id)));
- }
- /**
- * 平台对订单备注
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- */
- public function mark($id)
- {
- if (!$this->repository->getWhereCount([$this->repository->getPk() => $id]))
- return app('json')->fail('数据不存在');
- $data = $this->request->params(['admin_mark']);
- $this->repository->update($id, $data);
- return app('json')->success('备注成功');
- }
- /**
- * 订单统计
- * @return \think\response\Json
- * @author Qinii
- */
- public function title()
- {
- $where = $this->request->params(['type', 'date', 'mer_id', 'keywords', 'status', 'username', 'order_sn', 'is_trader', 'activity_type', 'filter_delivery', 'filter_product','nickname','uid','phone','real_name']);
- $where['is_spread'] = $this->request->param('is_spread', 0);
- return app('json')->success($this->repository->getStat($where, $where['status']));
- }
- /**
- * 订单列表
- * @return mixed
- * @author Qinii
- * @day 2020-06-25
- */
- public function getAllList()
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['type', 'date', 'mer_id', 'keywords', 'status', 'username', 'order_sn', 'is_trader', 'activity_type', 'group_order_sn', 'store_name', 'spread_name', 'top_spread_name', 'filter_delivery', 'filter_product','nickname','uid','phone','real_name','delivery_name','delivery_phone']);
- $pay_type = $this->request->param('pay_type', '');
- if ($pay_type != '') $where['pay_type'] = $this->repository::PAY_TYPE_FILTEER[$pay_type];
- $where['is_spread'] = $this->request->param('is_spread', 0);
- $data = $this->repository->adminGetList($where, $page, $limit);
- return app('json')->success($data);
- }
- /**
- * 自提订单统计
- * @return \think\response\Json
- * @author Qinii
- */
- public function takeTitle()
- {
- $where = $this->request->params(['date', 'order_sn', 'keywords', 'username', 'is_trader']);
- $where['take_order'] = 1;
- $where['status'] = '';
- $where['verify_date'] = $where['date'];
- unset($where['date']);
- $pay_type = $this->request->param('pay_type','');
- if ($pay_type != '') $where['pay_type'] = $this->repository::PAY_TYPE_FILTEER[$pay_type];
- return app('json')->success($this->repository->getStat($where, ''));
- }
- /**
- * 自提订单列表
- * @return mixed
- * @author Qinii
- * @day 2020-08-17
- */
- public function getTakeList()
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['date', 'order_sn', 'keywords', 'username', 'is_trader']);
- $where['take_order'] = 1;
- $where['status'] = '';
- $where['verify_date'] = $where['date'];
- unset($where['date']);
- $pay_type = $this->request->param('pay_type','');
- if ($pay_type != '') $where['pay_type'] = $this->repository::PAY_TYPE_FILTEER[$pay_type];
- return app('json')->success($this->repository->adminGetList($where, $page, $limit));
- }
- /**
- * 服务中心核销记录列表
- * @return mixed
- * @author Qinii
- * @day 2020-08-17
- */
- public function getVerifyList()
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['date', 'order_sn', 'keywords', 'username','status']);
- $where['take_order'] = 1;
- $where['status'] = '';
- $where['verify_time'] = $where['date'];
- // unset($where['date']);
- // $pay_type = $this->request->param('pay_type','');
- // if ($pay_type != '') $where['pay_type'] = $this->repository::PAY_TYPE_FILTEER[$pay_type];
- return app('json')->success($this->repository->adminGetList($where, $page, $limit));
- }
- /**
- *
- * @return mixed
- * @author Qinii
- * @day 2020-08-17
- */
- public function chart()
- {
- return app('json')->success($this->repository->OrderTitleNumber(null, null));
- }
- /**
- * 分销订单头部统计
- * @return \think\response\Json
- * @author Qinii
- * @day 2023/7/7
- */
- public function spreadChart()
- {
- return app('json')->success($this->repository->OrderTitleNumber(null, 2));
- }
- /**
- * 自提订单头部统计
- * @return mixed
- * @author Qinii
- * @day 2020-08-17
- */
- public function takeChart()
- {
- return app('json')->success($this->repository->OrderTitleNumber(null, 1));
- }
- /**
- * 订单类型
- * @return mixed
- * @author Qinii
- * @day 2020-08-15
- */
- public function orderType()
- {
- return app('json')->success($this->repository->orderType([]));
- }
- /**
- * 订单详情
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- */
- public function detail($id)
- {
- $data = $this->repository->getOne($id, null);
- if (!$data)
- return app('json')->fail('数据不存在');
- return app('json')->success($data);
- }
- /**
- * 订单操作记录
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- */
- public function status($id)
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['date', 'user_type']);
- $where['id'] = $id;
- return app('json')->success($this->repository->getOrderStatus($where, $page, $limit));
- }
- /**
- * 快递查询
- * @param $id
- * @return mixed
- * @author Qinii
- * @day 2020-06-25
- */
- public function express($id)
- {
- if (!$this->repository->getWhereCount(['order_id' => $id]))
- return app('json')->fail('订单信息或状态错误');
- return app('json')->success($this->repository->express($id, null));
- }
- public function reList($id)
- {
- [$page, $limit] = $this->getPage();
- $where = ['reconciliation_id' => $id, 'type' => 0];
- return app('json')->success($this->repository->reconList($where, $page, $limit));
- }
- /**
- * 导出文件
- * @author Qinii
- * @day 2020-07-30
- */
- public function excel()
- {
- $where = $this->request->params(['type', 'date', 'mer_id', 'keywords', 'status', 'username', 'order_sn', 'take_order', 'is_trader', 'activity_type', 'group_order_sn', 'store_name', 'filter_delivery', 'filter_product', 'pay_type','uid','phone','real_name','delivery_name','delivery_phone']);
- if ($where['pay_type'] != '') $where['pay_type'] = $this->repository::PAY_TYPE_FILTEER[$where['pay_type']];
- if ($where['take_order']) {
- $where['verify_date'] = $where['date'];
- unset($where['date']);
- }
- [$page, $limit] = $this->getPage();
- $data = app()->make(ExcelService::class)->order($where, $page, $limit);
- return app('json')->success($data);
- }
- /**
- * 拆分后自订单
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- * @day 2023/2/22
- */
- public function childrenList($id)
- {
- $data = $this->repository->childrenList($id, 0);
- return app('json')->success($data);
- }
- /**
- * 核销记录列表
- * @return \think\response\Json
- * @author Qinii
- * @day 2023/9/24
- */
- public function verify_lst(VerifyRecordRepository $repository)
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['uid', 'order_sn','status']);
- return app('json')->success($repository->getList($where, $page, $limit));
- }
- /**
- * 效验核销记录
- * @return \think\response\Json
- * @author Qinii
- * @day 2023/9/24
- */
- public function verify_validation($id,VerifyRecordRepository $repository)
- {
- $repository->verifyValidation($id);
- return app('json')->success('验证成功');
- }
- }
|