60 lines
1.7 KiB
PHP
60 lines
1.7 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace app\admin\lists;
|
||
|
|
||
|
use app\common\lists\ListsSearchInterface;
|
||
|
use app\common\model\beforehand_order\BeforehandOrder;
|
||
|
use app\common\model\finance\AccountsReceivable;
|
||
|
|
||
|
/**
|
||
|
* AccountsReceivableLists
|
||
|
* Class AccountsReceivableLists
|
||
|
* @package app\admin\lists
|
||
|
*/
|
||
|
class AccountsReceivableLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
|
{
|
||
|
|
||
|
public function setSearch(): array
|
||
|
{
|
||
|
return [
|
||
|
'=' => ['store_id', 'user_id'],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @notes 获取列表
|
||
|
* @return array
|
||
|
* @throws \think\db\exception\DataNotFoundException
|
||
|
* @throws \think\db\exception\DbException
|
||
|
* @throws \think\db\exception\ModelNotFoundException
|
||
|
*/
|
||
|
public function lists(): array
|
||
|
{
|
||
|
$query = AccountsReceivable::where($this->searchWhere);
|
||
|
if (!empty($this->params['order_sn'])) {
|
||
|
$orderIds = BeforehandOrder::where('order_id', 'like', '%' . $this->params['order_sn'] . '%')->column('id');
|
||
|
$query->whereIn('order_id', $orderIds);
|
||
|
}
|
||
|
return $query
|
||
|
->with('info')
|
||
|
->limit($this->limitOffset, $this->limitLength)
|
||
|
->order(['id' => 'desc'])
|
||
|
->select()
|
||
|
->toArray();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @notes 获取数量
|
||
|
* @return int
|
||
|
*/
|
||
|
public function count(): int
|
||
|
{
|
||
|
$query = AccountsReceivable::where($this->searchWhere);
|
||
|
if (!empty($this->params['order_sn'])) {
|
||
|
$orderIds = BeforehandOrder::where('order_id', 'like', '%' . $this->params['order_sn'] . '%')->column('id');
|
||
|
$query->whereIn('order_id', $orderIds);
|
||
|
}
|
||
|
return $query->count();
|
||
|
}
|
||
|
|
||
|
}
|