Browse Source

产品信息同步到代理商修改

master
李可松 4 years ago
parent
commit
25a17fee7e
  1. 8
      app/AdminSupplier/Controllers/ProductController.php

8
app/AdminSupplier/Controllers/ProductController.php

@ -135,12 +135,14 @@ class ProductController extends AdminController
$form->text('original_price')->required();
$form->text('price')->required();
$form->text('cost_price')->required();
Admin::style('.field_date{width:100px!important;}
.has-many-spec .col-md-12{padding:0;}
.has-many-spec .add.btn{display:none;}
.has-many-spec .input-group-prepend{display:none;}
.has-many-spec .form-group{margin-bottom:0;}
.has-many-spec .input-group>.form-control:not(:first-child){border-radius:.25rem;}');
Admin::script(file_get_contents(resource_path('js/supplier-batch-add-spec.js')));
})->useTable()->required();
if ($form->isEditing() && in_array($form->model()->status, [ProductStatus::SOLD_OUT, ProductStatus::ON_SALE])) {
@ -304,7 +306,7 @@ class ProductController extends AdminController
if ($form->isEditing() && $result) {
$ap_ids = AgentProductItem::where('product_id', $form->getKey())->pluck('agent_product_id')->toArray();
try {
if ($ap_ids) {
//修改信息同步信息到代理商产品,注:组合产品不同步
AgentProduct::whereIn('id', $ap_ids)->where('type', 0)->update([
'title' => $form->title,
@ -312,10 +314,6 @@ class ProductController extends AdminController
'know' => $form->know,
'content' => $form->content,
]);
return $form->response()->success('更新成功!')->script('history.go(-1)');
} catch (\Exception $exception) {
return $form->response()->error($exception->getMessage());
}
//TODO 还需要规格同步到代理商

Loading…
Cancel
Save