SupplierTransactions.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 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\v1\supplier;
  12. use think\facade\App;
  13. use app\controller\admin\AuthController;
  14. use app\services\supplier\finance\SupplierTransactionsServices;
  15. /**
  16. * 门店流水
  17. * Class StoreFinanceFlow
  18. * @package app\controller\admin\v1\store
  19. */
  20. class SupplierTransactions extends AuthController
  21. {
  22. /**
  23. * StoreFinanceFlow constructor.
  24. * @param App $app
  25. * @param SupplierTransactionsServices $services
  26. */
  27. public function __construct(App $app, SupplierTransactionsServices $services)
  28. {
  29. parent::__construct($app);
  30. $this->services = $services;
  31. }
  32. /**
  33. * 显示资源列表
  34. * @return mixed
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public function index()
  40. {
  41. $where = $this->request->getMore([
  42. ['data', '', '', 'time'],
  43. ['store_id', '']
  44. ]);
  45. $where['keyword'] = $this->request->param('keyword', '');
  46. $where['is_del'] = 0;
  47. $where['trade_type'] = 1;
  48. $where['no_type'] = 2;
  49. return app('json')->success($this->services->getList($where));
  50. }
  51. /**
  52. * 增加备注
  53. * @param $id
  54. * @return mixed
  55. */
  56. public function mark($id)
  57. {
  58. [$mark] = $this->request->getMore([
  59. ['mark', '']
  60. ], true);
  61. if (!$id || !$mark) {
  62. return app('json')->fail('缺少参数');
  63. }
  64. $info = $this->services->get((int)$id);
  65. if (!$info) {
  66. return app('json')->fail('账单流水不存在');
  67. }
  68. if (!$this->services->update($id, ['remark' => $mark])) {
  69. return app('json')->fail('备注失败');
  70. }
  71. return app('json')->success('备注成功');
  72. }
  73. /**
  74. * 账单记录
  75. * @return mixed
  76. */
  77. public function fundRecord()
  78. {
  79. $where = $this->request->getMore([
  80. ['timeType', 'day'],
  81. ['data', '', '', 'time'],
  82. ['store_id', '']
  83. ]);
  84. $where['trade_type'] = 1;
  85. $where['no_type'] = 1;
  86. return app('json')->success($this->services->getFundRecord($where));
  87. }
  88. /**
  89. * 账单详情
  90. * @param $ids
  91. * @return mixed
  92. * @throws \think\db\exception\DataNotFoundException
  93. * @throws \think\db\exception\DbException
  94. * @throws \think\db\exception\ModelNotFoundException
  95. */
  96. public function fundRecordInfo()
  97. {
  98. $where = $this->request->getMore([
  99. ['ids', ''],
  100. ['store_id', '']
  101. ]);
  102. $where['keyword'] = $this->request->param('keyword', '');
  103. $where['id'] = $where['ids'] ? explode(',', $where['ids']) : [];
  104. unset($where['ids']);
  105. $where['is_del'] = 0;
  106. $where['trade_type'] = 1;
  107. return app('json')->success($this->services->getList($where));
  108. }
  109. }