RefundOrder.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\order;
  12. use app\common\repositories\store\ExcelRepository;
  13. use crmeb\basic\BaseController;
  14. use app\common\repositories\store\order\MerchantReconciliationorderRepository;
  15. use app\common\repositories\store\order\MerchantReconciliationRepository;
  16. use app\common\repositories\system\merchant\MerchantRepository;
  17. use app\common\repositories\store\order\StoreRefundOrderRepository as repository;
  18. use crmeb\services\ExcelService;
  19. use think\App;
  20. class RefundOrder extends BaseController
  21. {
  22. protected $repository;
  23. public function __construct(App $app,repository $repository)
  24. {
  25. parent::__construct($app);
  26. $this->repository = $repository;
  27. }
  28. public function lst($id)
  29. {
  30. [$page,$limit] = $this->getPage();
  31. $where['reconciliation_type'] = $this->request->param('status',1);
  32. $where['date'] = $this->request->param('date');
  33. $where['mer_id'] = $id;
  34. $where['status'] = 3;
  35. return app('json')->success($this->repository->getAdminList($where,$page,$limit));
  36. }
  37. public function markForm($id)
  38. {
  39. if(!$this->repository->getWhereCount([$this->repository->getPk() => $id]))
  40. return app('json')->fail('数据不存在');
  41. return app('json')->success(formToData($this->repository->adminMarkForm($id)));
  42. }
  43. public function mark($id)
  44. {
  45. if(!$this->repository->getWhereCount([$this->repository->getPk() => $id]))
  46. return app('json')->fail('数据不存在');
  47. $data = $this->request->params(['admin_mark']);
  48. $this->repository->update($id,$data);
  49. return app('json')->success('备注成功');
  50. }
  51. public function getAllList()
  52. {
  53. [$page,$limit] = $this->getPage();
  54. $where = $this->request->params(['refund_order_sn','status','refund_type','date','mer_id','order_sn','is_trader']);
  55. return app('json')->success($this->repository->getAllList($where, $page, $limit));
  56. }
  57. public function reList($id)
  58. {
  59. [$page,$limit] = $this->getPage();
  60. $where = ['reconciliation_id' => $id,'type' => 1];
  61. return app('json')->success($this->repository->reconList($where,$page,$limit));
  62. }
  63. public function excel()
  64. {
  65. $where = $this->request->params(['refund_order_sn','status','refund_type','date','order_sn','id','mer_id']);
  66. [$page, $limit] = $this->getPage();
  67. $data = app()->make(ExcelService::class)->refundOrder($where, $page, $limit);
  68. return app('json')->success($data);
  69. }
  70. }