酒店预订平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

134 lines
3.7 KiB

  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\command\Util;
  4. use app\admin\dao\GroupDao;
  5. use app\admin\model\AuthGroup;
  6. use app\admin\service\PaymentOrderService;
  7. use app\common\controller\Backend;
  8. /**
  9. * 付款账单管理
  10. *
  11. * @icon fa fa-circle-o
  12. */
  13. class PaymentOrder extends Backend
  14. {
  15. protected $noNeedRight = ['save',"getList","setStatus","addOrderMain","removeOrderMain","getSubOrderList","delAll"];
  16. /**
  17. * PaymentOrder模型对象
  18. * @var \app\admin\model\PaymentOrder
  19. */
  20. protected $model = null;
  21. public function _initialize()
  22. {
  23. parent::_initialize();
  24. $this->model = new \app\admin\model\PaymentOrder;
  25. }
  26. public function import()
  27. {
  28. parent::import();
  29. }
  30. /**
  31. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  32. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  33. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  34. */
  35. /**
  36. * 保存记录
  37. * @return \think\response\Json
  38. */
  39. public function save(){
  40. $params=$this->request->post();
  41. $params['create_id']=$this->auth->id;
  42. $groupDao = new GroupDao();
  43. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  44. $service = new PaymentOrderService();
  45. $result = $service->save($params);
  46. return json($result);
  47. }
  48. /**
  49. * 获取列表
  50. * @return \think\response\Json
  51. */
  52. public function getList(){
  53. $params=$this->request->post();
  54. $groupDao = new GroupDao();
  55. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  56. $service = new PaymentOrderService();
  57. $result = $service->getList($params);
  58. return json($result);
  59. }
  60. /**
  61. * 状态设置
  62. * @return \think\response\Json
  63. */
  64. public function setStatus(){
  65. $groupIds = $this->auth->getGroupIds();
  66. $authGroup = new AuthGroup();
  67. $cnt = $authGroup->where(["id" => ["in",$groupIds], "finance_flag" => 1])->count("*");
  68. if ($cnt==0) {
  69. return json(Util::returnArrEr("未获取财务部门权限"));
  70. }
  71. $params=$this->request->post();
  72. $service = new PaymentOrderService();
  73. $result = $service->setStatus($params['id'],$params['status']);
  74. return json($result);
  75. }
  76. /**
  77. * 添加到收款单
  78. * @return \think\response\Json
  79. */
  80. public function addOrderMain(){
  81. $params=$this->request->post();
  82. $service = new PaymentOrderService();
  83. $result = $service->addSubOrder($params);
  84. return json($result);
  85. }
  86. /**
  87. * 移除收购单
  88. * @return \think\response\Json
  89. */
  90. public function removeOrderMain(){
  91. $params=$this->request->post();
  92. $service = new PaymentOrderService();
  93. $result = $service->removeSubOrder($params);
  94. return json($result);
  95. }
  96. /**
  97. * 获取订单列表
  98. * @return \think\response\Json
  99. */
  100. public function getSubOrderList(){
  101. $params=$this->request->post();
  102. $groupDao = new GroupDao();
  103. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  104. $service = new PaymentOrderService();
  105. $result = $service->getSubOrderList($params);
  106. return json($result);
  107. }
  108. /**
  109. * 删除收款单
  110. */
  111. public function delAll(){
  112. $params=$this->request->post();
  113. $service = new PaymentOrderService();
  114. $result = $service->delAll($params['id']);
  115. return json($result);
  116. }
  117. }