客户列表添加卡匹配属性
This commit is contained in:
parent
5f7cc584b4
commit
b2ffd86d05
@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Collection;
|
||||
use App\Domains\Virtual\Services\CardService;
|
||||
use Dipper\Excel\Concerns\WithColumnFormatting;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use App\Domains\Virtual\Repositories\PropertyRepository;
|
||||
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
||||
|
||||
class CardExport extends AbstractExport implements FromQuery, WithHeadings, WithRows, WithColumnFormatting
|
||||
@ -27,6 +28,23 @@ class CardExport extends AbstractExport implements FromQuery, WithHeadings, With
|
||||
public function query()
|
||||
{
|
||||
$this->conditions['type'] = 0;
|
||||
|
||||
// 添加卡属性匹配查找
|
||||
$properties = app(PropertyRepository::class)->select(['company_id', 'package_id', 'product', 'package'])->get();
|
||||
if (isset($this->conditions['prop_product']) && isset($this->conditions['prop_package'])) {
|
||||
$props = $properties->where('product', $this->conditions['prop_product'])->where($this->conditions['prop_package'])->get();
|
||||
$this->conditions['company_id'] = $props->pluck('company_id')->toArray();
|
||||
$this->conditions['package_id'] = $props->pluck('package_id')->toArray();
|
||||
} elseif (isset($this->conditions['prop_product'])) {
|
||||
$props = $properties->where('product', $this->conditions['prop_product'])->get();
|
||||
$this->conditions['company_id'] = $props->pluck('company_id')->toArray();
|
||||
$this->conditions['package_id'] = $props->pluck('package_id')->toArray();
|
||||
} elseif (isset($this->conditions['prop_package'])) {
|
||||
$props = $properties->where('package', $this->conditions['prop_package'])->get();
|
||||
$this->conditions['company_id'] = $props->pluck('company_id')->toArray();
|
||||
$this->conditions['package_id'] = $props->pluck('package_id')->toArray();
|
||||
}
|
||||
|
||||
$builder = app(OrderCardPartitionRepository::class)->forceNoReset()->withConditions($this->conditions)->orderBy('sim')->applyConditions();
|
||||
|
||||
return $builder;
|
||||
@ -52,6 +70,8 @@ class CardExport extends AbstractExport implements FromQuery, WithHeadings, With
|
||||
$item['carrier_operator'],
|
||||
$item['company_name'],
|
||||
$item['package_name'],
|
||||
$item['prop_product'],
|
||||
$item['prop_package'],
|
||||
$item['virtual_activated_at'],
|
||||
$item['status_name'],
|
||||
$item['created_at'],
|
||||
@ -73,6 +93,8 @@ class CardExport extends AbstractExport implements FromQuery, WithHeadings, With
|
||||
'运营商',
|
||||
'企业名称',
|
||||
'套餐名称',
|
||||
'产品类型',
|
||||
'套餐类型',
|
||||
'激活时间',
|
||||
'状态',
|
||||
'创建时间',
|
||||
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use App\Domains\Card\Repositories\CardRepository;
|
||||
use App\Domains\Virtual\Repositories\PropertyRepository;
|
||||
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
||||
|
||||
class CardService extends Service
|
||||
@ -41,6 +42,21 @@ class CardService extends Service
|
||||
$page = Request::get('page', 1);
|
||||
$conditions['type'] = isset($conditions['card_status']) ? [0, 1, 2] : 0;
|
||||
|
||||
// 添加卡属性匹配查找
|
||||
$properties = app(PropertyRepository::class)->select(['company_id', 'package_id', 'product', 'package'])->get();
|
||||
if (isset($conditions['prop_product']) && isset($conditions['prop_package'])) {
|
||||
$props = $properties->where('product', $conditions['prop_product'])->where($conditions['prop_package'])->get();
|
||||
$conditions['company_id'] = $props->pluck('company_id')->toArray();
|
||||
$conditions['package_id'] = $props->pluck('package_id')->toArray();
|
||||
} elseif (isset($conditions['prop_product'])) {
|
||||
$props = $properties->where('product', $conditions['prop_product'])->get();
|
||||
$conditions['company_id'] = $props->pluck('company_id')->toArray();
|
||||
$conditions['package_id'] = $props->pluck('package_id')->toArray();
|
||||
} elseif (isset($conditions['prop_package'])) {
|
||||
$props = $properties->where('package', $conditions['prop_package'])->get();
|
||||
$conditions['company_id'] = $props->pluck('company_id')->toArray();
|
||||
$conditions['package_id'] = $props->pluck('package_id')->toArray();
|
||||
}
|
||||
|
||||
|
||||
$select = [
|
||||
@ -140,6 +156,11 @@ class CardService extends Service
|
||||
$data['status'] = $status;
|
||||
$data['status_name'] = $cardStatus[$status];
|
||||
|
||||
// 添加卡属性匹配字段
|
||||
$property = PropertyService::load($item->company_id, $item->package_id);
|
||||
$data['prop_product'] = $property['product'] ?? '';
|
||||
$data['prop_package'] = $property['package'] ?? '';
|
||||
|
||||
return collect($data);
|
||||
});
|
||||
|
||||
|
@ -44,6 +44,8 @@ class PropertyService extends Service
|
||||
'updated_at' => null,
|
||||
];
|
||||
|
||||
protected static $properties;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
@ -294,4 +296,18 @@ class PropertyService extends Service
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function load($company_id, $package_id)
|
||||
{
|
||||
if (!self::$properties) {
|
||||
$properties = app(PropertyRepository::class)
|
||||
->select(['company_id', 'package_id', 'product', 'package'])->get();
|
||||
|
||||
self::$properties = $properties->keyBy(function ($item) {
|
||||
return $item['company_id'] . '_' . $item['package_id'];
|
||||
})->toArray();
|
||||
}
|
||||
|
||||
return self::$packages[$company_id] . '_' . $package_id;
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,16 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<Input clearable placeholder="产品类型" v-model.trim="params.prop_product"></Input>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<Input clearable placeholder="套餐类型" v-model.trim="params.prop_package"></Input>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<Select clearable placeholder="运营商" v-model="params.carrier_operator">
|
||||
|
@ -12,6 +12,8 @@ export default {
|
||||
sim: "",
|
||||
company_name: "",
|
||||
package_name: "",
|
||||
prop_product: "",
|
||||
prop_package: "",
|
||||
carrier_operator: "",
|
||||
card_status: "",
|
||||
time: [],
|
||||
@ -51,6 +53,16 @@ export default {
|
||||
key: "package_name",
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
title: "产品类型",
|
||||
key: "prop_product",
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
title: "套餐类型",
|
||||
key: "prop_package",
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
key: "status_name",
|
||||
|
1
public/js/app.9c45d043.js
Normal file
1
public/js/app.9c45d043.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.d9d4ec7b.js
Normal file
1
public/js/app.d9d4ec7b.js
Normal file
File diff suppressed because one or more lines are too long
8
public/js/chunk-2190ce90.812ad47d.js
Normal file
8
public/js/chunk-2190ce90.812ad47d.js
Normal file
File diff suppressed because one or more lines are too long
8
public/js/chunk-2190ce90.9ee88810.js
Normal file
8
public/js/chunk-2190ce90.9ee88810.js
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-2190ce90.53edb7ab.css rel=prefetch><link href=/css/chunk-9c85aab4.6166dab5.css rel=prefetch><link href=/js/chunk-2190ce90.ad10d08a.js rel=prefetch><link href=/js/chunk-29ecfeab.11f34170.js rel=prefetch><link href=/js/chunk-5b684432.3ffe9c78.js rel=prefetch><link href=/js/chunk-9c85aab4.9b7da8a1.js rel=prefetch><link href=/css/app.42353d5a.css rel=preload as=style><link href=/css/chunk-vendors.1ec583d1.css rel=preload as=style><link href=/js/app.f5597fdb.js rel=preload as=script><link href=/js/chunk-vendors.3b4ff77b.js rel=preload as=script><link href=/css/chunk-vendors.1ec583d1.css rel=stylesheet><link href=/css/app.42353d5a.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.3b4ff77b.js></script><script src=/js/app.f5597fdb.js></script></body></html>
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-2190ce90.53edb7ab.css rel=prefetch><link href=/css/chunk-9c85aab4.6166dab5.css rel=prefetch><link href=/js/chunk-2190ce90.9ee88810.js rel=prefetch><link href=/js/chunk-29ecfeab.11f34170.js rel=prefetch><link href=/js/chunk-5b684432.3ffe9c78.js rel=prefetch><link href=/js/chunk-9c85aab4.9b7da8a1.js rel=prefetch><link href=/css/app.42353d5a.css rel=preload as=style><link href=/css/chunk-vendors.1ec583d1.css rel=preload as=style><link href=/js/app.d9d4ec7b.js rel=preload as=script><link href=/js/chunk-vendors.3b4ff77b.js rel=preload as=script><link href=/css/chunk-vendors.1ec583d1.css rel=stylesheet><link href=/css/app.42353d5a.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.3b4ff77b.js></script><script src=/js/app.d9d4ec7b.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user