StoreFinanceFlow.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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\store\finance;
  12. use app\services\store\finance\StoreFinanceFlowServices;
  13. use app\services\store\SystemStoreStaffServices;
  14. use think\facade\App;
  15. use app\controller\store\AuthController;
  16. /**
  17. * 门店流水
  18. * Class StoreFinanceFlow
  19. * @package app\controller\store\finance
  20. */
  21. class StoreFinanceFlow extends AuthController
  22. {
  23. /**
  24. * StoreFinanceFlow constructor.
  25. * @param App $app
  26. * @param StoreFinanceFlowServices $services
  27. */
  28. public function __construct(App $app, StoreFinanceFlowServices $services)
  29. {
  30. parent::__construct($app);
  31. $this->services = $services;
  32. }
  33. /**
  34. * 显示资源列表
  35. * @return mixed
  36. * @throws \think\db\exception\DataNotFoundException
  37. * @throws \think\db\exception\DbException
  38. * @throws \think\db\exception\ModelNotFoundException
  39. */
  40. public function index()
  41. {
  42. $where = $this->request->getMore([
  43. ['staff_id', 0],
  44. ['data', '', '', 'time'],
  45. ]);
  46. $where['keyword'] = $this->request->param('keywork', '');
  47. $where['store_id'] = $this->storeId;
  48. $where['is_del'] = 0;
  49. $where['trade_type'] = 1;
  50. $where['no_type'] = 1;
  51. return app('json')->success($this->services->getList($where));
  52. }
  53. /**
  54. * 增加备注
  55. * @param $id
  56. * @return mixed
  57. */
  58. public function mark($id)
  59. {
  60. [$mark] = $this->request->getMore([
  61. ['mark', '']
  62. ], true);
  63. if (!$id || !$mark) {
  64. return app('json')->fail('缺少参数');
  65. }
  66. $info = $this->services->get((int)$id);
  67. if (!$info) {
  68. return app('json')->fail('账单流水不存在');
  69. }
  70. if (!$this->services->update($id, ['mark' => $mark])) {
  71. return app('json')->fail('备注失败');
  72. }
  73. return app('json')->success('备注成功');
  74. }
  75. /**
  76. * 获取店员select
  77. * @param SystemStoreStaffServices $services
  78. * @return mixed
  79. */
  80. public function getStaffSelect(SystemStoreStaffServices $services)
  81. {
  82. $where['store_id'] = $this->storeId;
  83. $where['is_del'] = 0;
  84. $where['status'] = 1;
  85. return app('json')->success($services->getSelectList($where));
  86. }
  87. /**
  88. * 账单记录
  89. * @return mixed
  90. */
  91. public function fundRecord()
  92. {
  93. $where = $this->request->getMore([
  94. ['timeType', 'day'],
  95. ['data', '', '', 'time'],
  96. ]);
  97. $where['store_id'] = $this->storeId;
  98. $where['trade_type'] = 1;
  99. $where['no_type'] = 1;
  100. return app('json')->success($this->services->getFundRecord($where));
  101. }
  102. /**
  103. * 账单详情
  104. * @param $ids
  105. * @return mixed
  106. * @throws \think\db\exception\DataNotFoundException
  107. * @throws \think\db\exception\DbException
  108. * @throws \think\db\exception\ModelNotFoundException
  109. */
  110. public function fundRecordInfo()
  111. {
  112. $where = $this->request->getMore([
  113. ['ids', ''],
  114. ['staff_id', 0]
  115. ]);
  116. $where['keyword'] = $this->request->param('keyword', '');
  117. $where['id'] = $where['ids'] ? explode(',', $where['ids']) : [];
  118. unset($where['ids']);
  119. $where['is_del'] = 0;
  120. $where['store_id'] = $this->storeId;
  121. $where['trade_type'] = 1;
  122. return app('json')->success($this->services->getList($where));
  123. }
  124. }