|
|
@@ -15,9 +15,11 @@ use App\OwnerPriceLogistic;
|
|
|
use App\OwnerPriceLogisticDetail;
|
|
|
use App\OwnerPriceOperation;
|
|
|
use App\OwnerPriceOperationItem;
|
|
|
+use App\OwnerPriceSystem;
|
|
|
use App\OwnerStoragePriceModel;
|
|
|
use App\Services\common\BatchUpdateService;
|
|
|
use App\Services\common\ExportService;
|
|
|
+use App\Services\common\QueryService;
|
|
|
use App\Services\LogService;
|
|
|
use App\Services\OwnerPriceOperationItemService;
|
|
|
use App\Services\OwnerPriceOperationService;
|
|
|
@@ -1133,6 +1135,7 @@ class PriceModelController extends Controller
|
|
|
"unit_id" => request("unit_id"),
|
|
|
"time_unit_id" => request("time_unit_id"),
|
|
|
"amount_interval" => request("amount_interval") ?? null,
|
|
|
+ "tax_rate_id" => request("tax_rate_id") ?? null,
|
|
|
];
|
|
|
if (request("id")){
|
|
|
$model = app('OwnerStoragePriceModelService')->find(request("id"));
|
|
|
@@ -1150,7 +1153,7 @@ class PriceModelController extends Controller
|
|
|
|
|
|
public function apiStoreOperation()
|
|
|
{
|
|
|
- $this->gate("项目管理-项目-录入");
|
|
|
+ $this->gate("计费模型-仓储-录入");
|
|
|
$params = request()->input();
|
|
|
$params["owner_id"] = [$params["owner_id"]];
|
|
|
$errors = $this->operationValidator($params,request("id"))->errors();
|
|
|
@@ -1170,6 +1173,7 @@ class PriceModelController extends Controller
|
|
|
"discount_count" => implode(",",request("discount_count")),
|
|
|
"total_price" => request("total_price"),
|
|
|
"total_discount_price"=> implode(",",request("total_discount_price")),
|
|
|
+ "tax_rate_id" => request("tax_rate_id") ?? null,
|
|
|
];
|
|
|
if (request("id")){
|
|
|
$model = app('OwnerPriceOperationService')->find(request("id"),["items"]);
|
|
|
@@ -1232,7 +1236,7 @@ class PriceModelController extends Controller
|
|
|
|
|
|
public function apiStoreExpress()
|
|
|
{
|
|
|
- $this->gate("项目管理-项目-录入");
|
|
|
+ $this->gate("计费模型-快递-录入");
|
|
|
$params = request()->input();
|
|
|
$params["logistic_id"] = $params["logistics"];
|
|
|
$errors = $this->expressValidator($params,request("id"))->errors()->toArray();
|
|
|
@@ -1249,6 +1253,7 @@ class PriceModelController extends Controller
|
|
|
"additional_weight" => request("additional_weight"),
|
|
|
"amount_interval" => request("amount_interval"),
|
|
|
"weight_interval" => request("weight_interval"),
|
|
|
+ "tax_rate_id" => request("tax_rate_id") ?? null,
|
|
|
];
|
|
|
if (request("id")){
|
|
|
/** @var \stdClass $model */
|
|
|
@@ -1307,7 +1312,7 @@ class PriceModelController extends Controller
|
|
|
|
|
|
public function apiStoreLogistic()
|
|
|
{
|
|
|
- $this->gate("项目管理-项目-录入");
|
|
|
+ $this->gate("计费模型-物流-录入");
|
|
|
$params = request()->input();
|
|
|
$params["owner_id"] = [$params["owner_id"]];
|
|
|
$params["logistic_id"] = $params["logistics"];
|
|
|
@@ -1329,6 +1334,7 @@ class PriceModelController extends Controller
|
|
|
"pick_up_price" => request('pick_up_price'),
|
|
|
"fuel_price" => request('fuel_price'),
|
|
|
"service_price" => request('service_price'),
|
|
|
+ "tax_rate_id" => request("tax_rate_id") ?? null,
|
|
|
];
|
|
|
if (request("id")){
|
|
|
$model = app("OwnerPriceLogisticService")->find(request("id"),["details"]);
|
|
|
@@ -1388,7 +1394,7 @@ class PriceModelController extends Controller
|
|
|
|
|
|
public function apiStoreDirectLogistic()
|
|
|
{
|
|
|
- $this->gate("项目管理-项目-录入");
|
|
|
+ $this->gate("计费模型-直发-录入");
|
|
|
$errors = $this->directLogisticValidator(request()->input(),request("id"))->errors()->toArray();
|
|
|
$exist = [];
|
|
|
foreach (request("items") as $index=>$item){
|
|
|
@@ -1401,6 +1407,7 @@ class PriceModelController extends Controller
|
|
|
$obj = [
|
|
|
"name" => request("name"),
|
|
|
"base_km" => request("base_km"),
|
|
|
+ "tax_rate_id"=> request("tax_rate_id") ?? null,
|
|
|
];
|
|
|
if (request("id")){
|
|
|
$model = app("OwnerPriceDirectLogisticService")->find(request("id"),["details"]);
|
|
|
@@ -1449,6 +1456,27 @@ class PriceModelController extends Controller
|
|
|
$this->success($model);
|
|
|
}
|
|
|
|
|
|
+ public function apiStoreSystem()
|
|
|
+ {
|
|
|
+ $this->gate("计费模型-系统-录入");
|
|
|
+ if (!request("owner_id") || !request("usage_fee") || \request("usage_fee")<0)$this->success(["errors"=>["usage_fee"=>["不得小于0"]]]);
|
|
|
+ if (request("id")){
|
|
|
+ /** @var OwnerPriceSystem|\stdClass $model */
|
|
|
+ $model = OwnerPriceSystem::query()->find(request("id"));
|
|
|
+ if ($model->operation)$model->update(["usage_fee"=>\request("usage_fee"),"operation"=>"U","tax_rate_id"=>\request("tax_rate_id")]);
|
|
|
+ else $model = OwnerPriceSystem::query()->create([
|
|
|
+ "usage_fee" => \request("usage_fee"),
|
|
|
+ "operation"=>"U",
|
|
|
+ "target_id"=>$model->id,
|
|
|
+ "owner_id"=>$model->owner_id,
|
|
|
+ "tax_rate_id"=>\request("tax_rate_id")
|
|
|
+ ]);
|
|
|
+ }else{
|
|
|
+ $model = OwnerPriceSystem::query()->create(["usage_fee" => \request("usage_fee"),"owner_id"=>request("owner_id"),"operation"=>"C","tax_rate_id"=>\request("tax_rate_id")]);
|
|
|
+ }
|
|
|
+ $this->success($model);
|
|
|
+ }
|
|
|
+
|
|
|
public function getPriceModel()
|
|
|
{
|
|
|
/** @var Owner|\stdClass $owner */
|
|
|
@@ -1466,8 +1494,8 @@ class PriceModelController extends Controller
|
|
|
},"ownerPriceLogistics"=>function($query){
|
|
|
/** @var Builder $query */
|
|
|
$query->with(["details","logistics"]);
|
|
|
- },"ownerPriceDirectLogistics.details"]);
|
|
|
- $owner->loadCount(["storageAudit","operationAudit","expressAudit","logisticAudit","directLogisticAudit"]);
|
|
|
+ },"ownerPriceDirectLogistics.details","ownerPriceSystem"]);
|
|
|
+ $owner->loadCount(["storageAudit","operationAudit","expressAudit","logisticAudit","directLogisticAudit","systemAudit"]);
|
|
|
$features = app("FeatureService")->getMapArray();
|
|
|
OwnerPriceOperation::$features = $features;
|
|
|
OwnerPriceOperationItem::$features = $features;
|
|
|
@@ -1737,6 +1765,18 @@ class PriceModelController extends Controller
|
|
|
}
|
|
|
$this->success();
|
|
|
}
|
|
|
+ public function apiDelSystem()
|
|
|
+ {
|
|
|
+ $this->gate("项目管理-系统-录入");
|
|
|
+ if (!request("id"))$this->error("非法参数");
|
|
|
+ /** @var OwnerPriceSystem|\stdClass $model */
|
|
|
+ $model = OwnerPriceSystem::query()->find(\request("id"));
|
|
|
+ if ($model->operation && $model->target_id){
|
|
|
+ OwnerPriceSystem::query()->where($model->target_id,\request("id"))->update(["operation"=>"D"]);
|
|
|
+ $model->delete();
|
|
|
+ }
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
|
|
|
private function publicDeleteNode(string $serviceName)
|
|
|
{
|
|
|
@@ -1811,7 +1851,25 @@ class PriceModelController extends Controller
|
|
|
$owner->load("ownerPriceDirectLogistics.details");
|
|
|
$this->success($owner->ownerPriceDirectLogistics);
|
|
|
break;
|
|
|
+ case "system":
|
|
|
+ $result = app(QueryService::class)->priceModelAuditOrRecoverQuery(request("isAudit"),OwnerPriceSystem::query(),$ownerId,null,true);
|
|
|
+ if ($result["delete"]){
|
|
|
+ OwnerPriceSystem::destroy($result["delete"]);
|
|
|
+ app("OwnerService")->refreshRelevance($ownerId,5,true);
|
|
|
+ }
|
|
|
+ if ($result["update"]){
|
|
|
+ OwnerPriceSystem::query()->whereIn("id",$result["update"])->update(["operation"=>null,"target_id"=>null]);
|
|
|
+ app("OwnerService")->refreshRelevance($ownerId,5);
|
|
|
+ }
|
|
|
+ $owner->load("ownerPriceSystem");
|
|
|
+ $this->success($owner->ownerPriceSystem);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取审核对比信息
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
}
|