SystemVerifyOrder.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/11/11
  6. */
  7. namespace app\admin\controller\system;
  8. use app\admin\controller\AuthController;
  9. use crmeb\services\{
  10. UtilService as Util,
  11. JsonService as Json
  12. };
  13. use app\admin\model\system\SystemVerifyOrder as VerifyOrderModel;
  14. use app\admin\model\system\SystemStore as StoreModel;
  15. /**
  16. * 核销订单管理控制器
  17. * Class SystemVerifyOrder
  18. * @package app\admin\controller\system
  19. */
  20. class SystemVerifyOrder extends AuthController
  21. {
  22. /**
  23. * @return mixed
  24. */
  25. public function index()
  26. {
  27. $this->assign([
  28. 'year' => get_month(),
  29. 'real_name' => $this->request->get('real_name', ''),
  30. 'store_list' => StoreModel::dropList()
  31. ]);
  32. return $this->fetch();
  33. }
  34. /**
  35. * 获取头部订单金额等信息
  36. * return json
  37. */
  38. public function getBadge()
  39. {
  40. $where = Util::postMore([
  41. ['status', ''],
  42. ['real_name', ''],
  43. ['is_del', 0],
  44. ['data', ''],
  45. ['store_id', ''],
  46. ['order', '']
  47. ]);
  48. return Json::successful(VerifyOrderModel::getBadge($where));
  49. }
  50. /**
  51. * 获取订单列表
  52. * return json
  53. */
  54. public function order_list()
  55. {
  56. $where = Util::getMore([
  57. ['real_name', $this->request->param('real_name', '')],
  58. ['is_del', 0],
  59. ['data', ''],
  60. ['store_id', ''],
  61. ['page', 1],
  62. ['limit', 20],
  63. ]);
  64. return Json::successlayui(VerifyOrderModel::OrderList($where));
  65. }
  66. /**
  67. * 删除订单
  68. * */
  69. public function del_order()
  70. {
  71. $ids = Util::postMore(['ids'])['ids'];
  72. if (!count($ids)) return Json::fail('请选择需要删除的订单');
  73. if (VerifyOrderModel::where('is_del', 0)->where('id', 'in', $ids)->count())
  74. return Json::fail('您选择的的订单存在用户未删除的订单,无法删除用户未删除的订单');
  75. $res = VerifyOrderModel::where('id', 'in', $ids)->update(['is_system_del' => 1]);
  76. if ($res)
  77. return Json::successful('删除成功');
  78. else
  79. return Json::fail('删除失败');
  80. }
  81. }