mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
99 lines
2.4 KiB
PHP
99 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filters;
|
|
|
|
use App\Models\BusinessOrderItem;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
class BusinessOrderFilter extends Filters
|
|
{
|
|
protected function ids($value)
|
|
{
|
|
return $this->builder->whereIn('id', $value);
|
|
}
|
|
|
|
protected function participateNo($value)
|
|
{
|
|
return $this->builder->where('participate_no', trim($value));
|
|
}
|
|
|
|
protected function supplyParticipateNo($value)
|
|
{
|
|
return $this->builder->where('supply_participate_no', trim($value));
|
|
}
|
|
|
|
protected function pno($value)
|
|
{
|
|
return $this->builder->where(function (Builder $builder) use ($value) {
|
|
$builder->where('participate_no', $value)
|
|
->orWhere('supply_participate_no', $value);
|
|
});
|
|
}
|
|
|
|
protected function shopId($value)
|
|
{
|
|
return $this->builder->where('shop_id', $value);
|
|
}
|
|
|
|
protected function activityNo($value)
|
|
{
|
|
return $this->builder->where('activity_no', $value);
|
|
}
|
|
|
|
protected function shippingStatus($value)
|
|
{
|
|
return $this->builder->where('shipping_status', $value);
|
|
}
|
|
|
|
protected function isSupplier($value)
|
|
{
|
|
return $this->builder->where('is_supplier', $value);
|
|
}
|
|
|
|
protected function cancelStatus($value)
|
|
{
|
|
return $this->builder->where('cancel_status', $value);
|
|
}
|
|
|
|
protected function afterSalesStatus($value)
|
|
{
|
|
return $this->builder->where('after_sales_status', $value);
|
|
}
|
|
|
|
protected function confirmAtStart($value)
|
|
{
|
|
$start = Carbon::parse($value)->timestamp;
|
|
$start *= 1000;
|
|
|
|
return $this->builder->where('confirm_at', '>=', $start);
|
|
}
|
|
|
|
protected function confirmAtEnd($value)
|
|
{
|
|
$end = Carbon::parse($value)->timestamp;
|
|
$end *= 1000;
|
|
|
|
return $this->builder->where('confirm_at', '<=', $end);
|
|
}
|
|
|
|
protected function goodsSkuNum($value)
|
|
{
|
|
if (1 === $value) {
|
|
return $this->builder->where('goods_sku_num', '=', 1);
|
|
}
|
|
if (2 === $value) {
|
|
return $this->builder->where('goods_sku_num', '<=', 5)
|
|
->where('goods_sku_num', '>=', 2);
|
|
}
|
|
if (6 === $value) {
|
|
return $this->builder->where('goods_sku_num', '>=', 6);
|
|
}
|
|
}
|
|
|
|
protected function printStatus($value)
|
|
{
|
|
return $this->builder->where('print_status', $value);
|
|
}
|
|
}
|