|
|
@ -190,13 +190,6 @@ class AgentProductController extends AdminController |
|
|
} else { |
|
|
} else { |
|
|
$form->hidden('type')->value(0); |
|
|
$form->hidden('type')->value(0); |
|
|
if ($form->isCreating()) { |
|
|
if ($form->isCreating()) { |
|
|
$js = file_get_contents(resource_path('js/select-supplier-product-change.js')); |
|
|
|
|
|
$class = str_replace('\\', '\\\\', LoadSupplierSpec::class); |
|
|
|
|
|
$js = str_replace( |
|
|
|
|
|
['`{{url}}`', '`{{class}}`'], |
|
|
|
|
|
[route(admin_api_route_name('form')), $class], |
|
|
|
|
|
$js |
|
|
|
|
|
); |
|
|
|
|
|
$form->selectTable('product_id', '供应商产品') |
|
|
$form->selectTable('product_id', '供应商产品') |
|
|
->required() |
|
|
->required() |
|
|
->help('产品列表显示的是该产品的标题和图片') |
|
|
->help('产品列表显示的是该产品的标题和图片') |
|
|
@ -204,7 +197,13 @@ class AgentProductController extends AdminController |
|
|
->dialogWidth('80%;min-width:825px;') |
|
|
->dialogWidth('80%;min-width:825px;') |
|
|
->from(SelectProduct::make(['ids' => $form->model()->product_ids])) |
|
|
->from(SelectProduct::make(['ids' => $form->model()->product_ids])) |
|
|
->model(Product::class) |
|
|
->model(Product::class) |
|
|
->script($js); |
|
|
|
|
|
|
|
|
->script("
|
|
|
|
|
|
$(function () { |
|
|
|
|
|
$('input[name=\"product_id\"]').change(function () { |
|
|
|
|
|
$('.spec-sync').click(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
");
|
|
|
} else { |
|
|
} else { |
|
|
$form->hidden('product_id'); |
|
|
$form->hidden('product_id'); |
|
|
$form->display('product.title'); |
|
|
$form->display('product.title'); |
|
|
@ -216,19 +215,24 @@ class AgentProductController extends AdminController |
|
|
$form->text('supplier_name', '规格')->disable()->customFormat(fn() => $this->product_spec['name'] ?? '供应商已删除规格'); |
|
|
$form->text('supplier_name', '规格')->disable()->customFormat(fn() => $this->product_spec['name'] ?? '供应商已删除规格'); |
|
|
$form->date('supplier_date', '日期')->disable()->customFormat(fn() => $this->product_spec['date'] ?? '供应商已删除规格'); |
|
|
$form->date('supplier_date', '日期')->disable()->customFormat(fn() => $this->product_spec['date'] ?? '供应商已删除规格'); |
|
|
$form->text('supplier_stock', '供应商库存')->disable()->customFormat(fn() => $this->product_spec['stock'] ?? 0); |
|
|
$form->text('supplier_stock', '供应商库存')->disable()->customFormat(fn() => $this->product_spec['stock'] ?? 0); |
|
|
$form->text('supplier_price', '供应商价')->disable()->customFormat(fn() => $this->product_spec['price'] ?? 0); |
|
|
|
|
|
|
|
|
$form->text('supplier_cost_price', '供应商成本价')->disable()->customFormat(fn() => $this->product_spec['cost_price'] ?? 0); |
|
|
|
|
|
$form->text('supplier_price', '建议销售价')->disable()->customFormat(fn() => $this->product_spec['price'] ?? 0); |
|
|
$form->text('stock', '您的库存')->required() |
|
|
$form->text('stock', '您的库存')->required() |
|
|
//如果库存大于供应商库存,则取供应商库存
|
|
|
//如果库存大于供应商库存,则取供应商库存
|
|
|
->customFormat(fn() => isset($this->product_spec['stock'], $this->stock) && $this->stock > $this->product_spec['stock'] ? $this->product_spec['stock'] : $this->stock); |
|
|
->customFormat(fn() => isset($this->product_spec['stock'], $this->stock) && $this->stock > $this->product_spec['stock'] ? $this->product_spec['stock'] : $this->stock); |
|
|
$form->text('original_price', '您的市场价')->required(); |
|
|
$form->text('original_price', '您的市场价')->required(); |
|
|
$form->text('price', '您的销售价')->required(); |
|
|
|
|
|
|
|
|
$form->text('price', '您的销售价')->required() |
|
|
|
|
|
//如果代理商价格小于供应商建议售价,则取供应商售价
|
|
|
|
|
|
->customFormat(fn() => isset($this->product_spec['price'], $this->price) && $this->price < $this->product_spec['price'] ? $this->product_spec['price'] : $this->price); |
|
|
|
|
|
|
|
|
Admin::style('.has-many-spec .add.btn{display:none;} |
|
|
Admin::style('.has-many-spec .add.btn{display:none;} |
|
|
.has-many-spec .field_date{width:100px!important;} |
|
|
|
|
|
|
|
|
.has-many-spec .field_supplier_date{width:100px!important;} |
|
|
.has-many-spec .col-md-12{padding:0;} |
|
|
.has-many-spec .col-md-12{padding:0;} |
|
|
.has-many-spec .form-group{margin-bottom:0;} |
|
|
.has-many-spec .form-group{margin-bottom:0;} |
|
|
.has-many-spec .form-group .remove{margin-top:10px;} |
|
|
.has-many-spec .form-group .remove{margin-top:10px;} |
|
|
.has-many-spec .input-group-prepend{display:none;} |
|
|
.has-many-spec .input-group-prepend{display:none;} |
|
|
.has-many-spec .input-group>.form-control:not(:first-child){border-radius:.25rem;}'); |
|
|
.has-many-spec .input-group>.form-control:not(:first-child){border-radius:.25rem;}'); |
|
|
|
|
|
|
|
|
$js = file_get_contents(resource_path('js/agent-spec-edit.js')); |
|
|
$js = file_get_contents(resource_path('js/agent-spec-edit.js')); |
|
|
$class = str_replace('\\', '\\\\', LoadSupplierSpec::class); |
|
|
$class = str_replace('\\', '\\\\', LoadSupplierSpec::class); |
|
|
$js = str_replace( |
|
|
$js = str_replace( |
|
|
|