|
|
@ -2,7 +2,9 @@ |
|
|
|
|
|
|
|
|
namespace App\AdminSupplier\Controllers; |
|
|
namespace App\AdminSupplier\Controllers; |
|
|
|
|
|
|
|
|
|
|
|
use App\Admin\Repositories\Order; |
|
|
use App\AdminSupplier\Repositories\Product; |
|
|
use App\AdminSupplier\Repositories\Product; |
|
|
|
|
|
use App\Common\OrderStatus; |
|
|
use App\Common\ProductStatus; |
|
|
use App\Common\ProductStatus; |
|
|
use App\Models\AgentProduct; |
|
|
use App\Models\AgentProduct; |
|
|
use App\Models\AgentProductItem; |
|
|
use App\Models\AgentProductItem; |
|
|
@ -254,8 +256,16 @@ class ProductController extends AdminController |
|
|
if (!Admin::user()->publish_type || !in_array($form->type, Admin::user()->publish_type)) { |
|
|
if (!Admin::user()->publish_type || !in_array($form->type, Admin::user()->publish_type)) { |
|
|
return $form->response()->error('对不起,你没有此类产品的发布、编辑权限'); |
|
|
return $form->response()->error('对不起,你没有此类产品的发布、编辑权限'); |
|
|
} |
|
|
} |
|
|
} else if ($form->isEditing()) { //type不允许编辑
|
|
|
|
|
|
$form->type = $form->model()->type; |
|
|
|
|
|
|
|
|
} else if ($form->isEditing()) { |
|
|
|
|
|
$form->type = $form->model()->type; //type不允许编辑
|
|
|
|
|
|
|
|
|
|
|
|
//如果存在未核销的订单不允许编辑
|
|
|
|
|
|
$exists = \App\Models\Order::where('product_id', $form->model()->id) |
|
|
|
|
|
->whereIn('status', [OrderStatus::PAID, OrderStatus::PAID_RETAINAGE, OrderStatus::OFFLINE_PAID, OrderStatus::REFUSED_REFUND]) |
|
|
|
|
|
->exists(); |
|
|
|
|
|
if ($exists) { |
|
|
|
|
|
return $form->response()->error('该产品还有未核销的订单,不允许编辑'); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//不允许编辑的字段,忽略字段不起作用?
|
|
|
//不允许编辑的字段,忽略字段不起作用?
|
|
|
|