添加账单详情

This commit is contained in:
luofei 2024-06-07 11:13:25 +08:00
parent e8a515eef1
commit 4aac0ff460
2 changed files with 26 additions and 6 deletions

View File

@ -66,6 +66,24 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
$query->where('user_id', 'in', $userIds)->whereOr('financial_record_sn', 'like', "%{$this->params['keyword']}%"); $query->where('user_id', 'in', $userIds)->whereOr('financial_record_sn', 'like', "%{$this->params['keyword']}%");
}); });
}) })
->when(!empty($this->params['date_type']) && !empty($this->params['date']), function (Query $query) {
switch ($this->params['date_type']) {
case 2:
$start = new \DateTime($this->params['date']);
$start = $start->getTimestamp();
$end = $start + (86400 * 7);
break;
case 3:
$start = strtotime($this->params['date']);
$end = strtotime('+1 month', strtotime($this->params['date']));
break;
default:
$start = strtotime($this->params['date']);
$end = strtotime($this->params['date']) + 86400;
break;
}
$query->whereBetweenTime('create_time', $start, $end);
})
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($item) { ->select()->each(function ($item) {

View File

@ -2,6 +2,7 @@
namespace app\store\controller\finance; namespace app\store\controller\finance;
use app\admin\lists\store_finance_flow\StoreFinanceFlowLists;
use app\common\controller\Definitions; use app\common\controller\Definitions;
use app\common\lists\StoreBillLists; use app\common\lists\StoreBillLists;
use app\common\logic\StoreFinanceFlowLogic; use app\common\logic\StoreFinanceFlowLogic;
@ -37,16 +38,17 @@ class StoreBillController extends BaseAdminController
ApiDoc\NotHeaders(), ApiDoc\NotHeaders(),
ApiDoc\Author('中国队长'), ApiDoc\Author('中国队长'),
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
ApiDoc\Param(name: 'remark', type: 'string', require: true, desc: '备注'), ApiDoc\Query(name: 'date_type', type: 'int', require: false, desc: '日期类型1日账单2周账单3月账单'),
ApiDoc\Query(name: 'date', type: 'string', require: false, desc: '日期日账单2021-01-01周账单2024-W23月账单2021-01'),
ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '流水号/用户昵称'),
ApiDoc\Header(ref: [Definitions::class, "token"]), ApiDoc\Header(ref: [Definitions::class, "token"]),
ApiDoc\Query(ref: [Definitions::class, "page"]),
ApiDoc\ResponseSuccess("data", type: "array"), ApiDoc\ResponseSuccess("data", type: "array"),
] ]
public function detail(StoreFinanceFlowLogic $logic) public function detail()
{ {
$id = $this->request->post('id'); return $this->dataLists(new StoreFinanceFlowLists());
$remark = $this->request->post('remark');
$logic->remark($id, $remark);
return $this->success('操作成功', [], 1, 1);
} }
#[ #[