调整身份相关

This commit is contained in:
2023-03-10 17:53:02 +08:00
parent 3cd75b1d6e
commit 2bf6a397b1
10 changed files with 86 additions and 13 deletions

View File

@@ -9,6 +9,9 @@ use Encore\Admin\Grid;
use Illuminate\Support\Arr;
use Illuminate\Support\MessageBag;
use Illuminate\Support\Str;
use Modules\Mall\Http\Controllers\Admin\Action\Goods\Down;
use Modules\Mall\Http\Controllers\Admin\Action\Goods\SkuAction;
use Modules\Mall\Http\Controllers\Admin\Action\Goods\Up;
use Modules\Mall\Models\Brand;
use Modules\Mall\Models\Category;
use Modules\Mall\Models\Delivery;
@@ -49,6 +52,20 @@ class GoodsController extends AdminController
});
});
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->disableView();
$actions->disableDelete();
if ($actions->row->status == Goods::STATUS_UP) {
$actions->add(new Down());
}
if ($actions->row->status == Goods::STATUS_DOWN) {
$actions->add(new Up());
}
if ($actions->row->type == Goods::TYPE_MULTIPLE) {
$actions->add(new SkuAction());
}
});
$grid->model()
->with(['category', 'shop', 'delivery'])
->withCount(['specs', 'skus'])

View File

@@ -31,8 +31,8 @@ class Goods extends Model
const TYPE_SINGLE = 1;
const TYPE_MULTIPLE = 2;
const TYPE_MAP = [
self::TYPE_SINGLE => '单规格',
// self::TYPE_MULTIPLE => '多规格',
self::TYPE_SINGLE => '单规格',
self::TYPE_MULTIPLE => '多规格',
];
/**
* 状态

View File

@@ -59,4 +59,25 @@ class GoodsSku extends Model
return false;
}
/**
* @Notes : 检测商品价格,给出最低售价
*
* @Date : 2022/6/30 11:41
* @param float $cost
* @param float $price
* @return float
* @author : Mr.wang
*/
public static function verifyPrice(float $cost, float $price): float
{
return 0;
$costPercent = app('Conf_mall')['cost_percent'] ?? 70;
$up = ceil(bcdiv($cost, bcdiv($costPercent, 100, 4), 2));
if ($price < $up) {
return $up;
} else {
return 0;
}
}
}

View File

@@ -41,6 +41,8 @@ Route::group([
/**
* 商品管理
*/
$router->get('goods/{goods}/multiple', 'SkuMultipleController@index');
$router->post('goods/{goods}/multiple', 'SkuMultipleController@store');
$router->resource('goods', 'GoodsController');
$router->resource('goods.skus', 'SkuController');
$router->resource('goods.specs', 'SpecController');