feat: #10000 暂存
This commit is contained in:
parent
cbec345d84
commit
b18bcc50d7
@ -20,6 +20,9 @@
|
||||
6. `php artisan key:generate`
|
||||
7. `php artisan update:super_admin_permissions` 更新超级管理员角色权限
|
||||
|
||||
#### 更新权限
|
||||
`php artisan db:seed --class=PermissionsTableSeeder`
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. 阅读并遵守<<[Laravel项目开发规范](https://learnku.com/docs/laravel-specification/9.x/whats-the-use-of-standards/12720)>>
|
||||
|
||||
@ -38,12 +38,12 @@ class BusinessGoodsSkuToLocal extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$num = 0;
|
||||
BusinessGoodsSku::chunk(100, function ($businessGoodsSkus) use ($num) {
|
||||
BusinessGoodsSku::chunk(100, function ($businessGoodsSkus) use (&$num) {
|
||||
foreach ($businessGoodsSkus as $businessGoodsSku) {
|
||||
if (empty($businessGoodsSku['goods_name']) || empty($businessGoodsSku['external_sku_id'])) {
|
||||
continue;
|
||||
|
||||
@ -27,8 +27,8 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// 服务器添加cron入口
|
||||
// * * * * * cd /home/wwwroot/erp.staging.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
|
||||
// 服务器/etc/crontab添加cron入口
|
||||
// * * * * * cd /mnt/wwwroot/erp.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
|
||||
$schedule->command(Inventory::class)->dailyAt('07:00');
|
||||
$schedule->command(KttOrderQuery::class)->everyMinute();
|
||||
$schedule->command(DeleteKttQuery::class)->daily();
|
||||
|
||||
@ -11,11 +11,15 @@ class GoodsFilter extends Filters
|
||||
|
||||
protected function typeId($value)
|
||||
{
|
||||
return $this->builder->where('type_id', '=', $value);
|
||||
if($value){
|
||||
return $this->builder->where('type_id', '=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
protected function brandId($value)
|
||||
{
|
||||
return $this->builder->where('brand_id', '=', $value);
|
||||
if($value){
|
||||
return $this->builder->where('brand_id', '=', $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,4 +13,9 @@ class GoodsSkuFilter extends Filters
|
||||
{
|
||||
return $this->builder->where('status', '=', $value);
|
||||
}
|
||||
|
||||
protected function excludeIds($value)
|
||||
{
|
||||
return $this->builder->whereNotIn('id', $value);
|
||||
}
|
||||
}
|
||||
|
||||
21
app/Filters/GroupGoodsFilter.php
Normal file
21
app/Filters/GroupGoodsFilter.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
class GroupGoodsFilter extends Filters
|
||||
{
|
||||
protected function goodsName($value)
|
||||
{
|
||||
return $this->builder->where('goods_name', 'like', "%$value%");
|
||||
}
|
||||
|
||||
protected function groupId($value)
|
||||
{
|
||||
return $this->builder->where('group_id', '=', $value);
|
||||
}
|
||||
|
||||
protected function externalSkuId($value)
|
||||
{
|
||||
return $this->builder->where('external_sku_id', '=', $value);
|
||||
}
|
||||
}
|
||||
23
app/Filters/GroupsFilter.php
Normal file
23
app/Filters/GroupsFilter.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
class GroupsFilter extends Filters
|
||||
{
|
||||
protected function title($value)
|
||||
{
|
||||
return $this->builder->where('title', 'like', "%$value%");
|
||||
}
|
||||
|
||||
protected function shopId($value)
|
||||
{
|
||||
if ($value) {
|
||||
return $this->builder->where('shop_id', '=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
protected function status($value)
|
||||
{
|
||||
return $this->builder->where('status', '=', $value);
|
||||
}
|
||||
}
|
||||
11
app/Filters/ShopFilter.php
Normal file
11
app/Filters/ShopFilter.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
class ShopFilter extends Filters
|
||||
{
|
||||
protected function platId($value)
|
||||
{
|
||||
return $this->builder->where('plat_id', '=', $value)->where('expires_at', '>', time());
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ class GoodsSkusController extends Controller
|
||||
$query->where('day', $day);
|
||||
}])
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate($request->get('per_page'));
|
||||
->paginate(5);
|
||||
foreach ($goodsSkus as &$sku) {
|
||||
$externalSkuId = $sku['goods']['goods_code'] . '_' . $sku['sku_code'];
|
||||
$lastInventoryTime = $sku['daily']['inventory_time'];
|
||||
@ -480,7 +480,6 @@ class GoodsSkusController extends Controller
|
||||
'errorMessage' => 'not found inventory file',
|
||||
];
|
||||
}
|
||||
|
||||
try {
|
||||
$import = new InventoryImport();
|
||||
$path = $request->file('inventoryFile');
|
||||
|
||||
146
app/Http/Controllers/Group/GroupsController.php
Normal file
146
app/Http/Controllers/Group/GroupsController.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Group;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\GroupsRequest;
|
||||
use App\Http\Resources\GoodsSkuResource;
|
||||
use App\Models\Goods;
|
||||
use App\Models\GoodsSku;
|
||||
use App\Models\Log as LogModel;
|
||||
use App\Utils\DateTimeUtils;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\Groups;
|
||||
use App\Http\Requests\GoodsRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use App\Http\Resources\GroupsResource;
|
||||
use App\Models\GroupGoods;
|
||||
use App\Http\Resources\GroupGoodsResource;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class GroupsController extends Controller
|
||||
{
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$groups = Groups::query()
|
||||
->filter()
|
||||
->paginate($request->get('per_page'));
|
||||
|
||||
return GroupsResource::collection($groups);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$rules = (new GroupsRequest())->rules();
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
var_dump($request->get('data'));
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return new GroupsResource(Groups::query()
|
||||
->find($id));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$rules = (new GroupsRequest())->rules();
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
var_dump($request->get('data'));
|
||||
}
|
||||
|
||||
public function destroy()
|
||||
{
|
||||
}
|
||||
|
||||
public function getGoods(Request $request)
|
||||
{
|
||||
if ($request->get('group_id')) {
|
||||
$goodsNameLike = '';
|
||||
$externalSkuId = $request->get('external_sku_id');
|
||||
if (false === strpos($externalSkuId, '_')) {
|
||||
$goodsNameLike = $externalSkuId;
|
||||
}
|
||||
$goods = GroupGoods::query()
|
||||
->when($goodsNameLike, function ($query, $goodsNameLike) {
|
||||
return $query->where('goods_name', 'like', "%$goodsNameLike%");
|
||||
})
|
||||
->with(['goodsSku:id,stock'])
|
||||
->filter()
|
||||
->paginate($request->get('per_page'));
|
||||
|
||||
return GroupGoodsResource::collection($goods);
|
||||
}
|
||||
$goodsSkus = GoodsSku::query()
|
||||
->whereIn('id', $request->get('ids'))
|
||||
->with(['goods' => function ($query) {
|
||||
$query->with(['type:id,name', 'brand:id,name']);
|
||||
}])
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate($request->get('per_page'));
|
||||
|
||||
return GoodsSkuResource::collection($goodsSkus);
|
||||
}
|
||||
|
||||
public function addGoods(Request $request)
|
||||
{
|
||||
var_dump($request->get('ids'));
|
||||
var_dump($request->get('shop_id'));
|
||||
var_dump($request->get('group_id'));
|
||||
}
|
||||
|
||||
public function goodsList(Request $request)
|
||||
{
|
||||
$goodsCode = $skuCode = '';
|
||||
$goodsKeyword = $request->get('goods_keyword');
|
||||
if (false !== strpos($goodsKeyword, '_')) {
|
||||
[$goodsCode, $skuCode] = explode('_', $goodsKeyword);
|
||||
$goodsKeyword = '';
|
||||
}
|
||||
$goodsIds = Goods::query()
|
||||
->when($goodsKeyword, function ($query, $goodsKeyword) {
|
||||
return $query->where('title', 'like', "%$goodsKeyword%");
|
||||
})
|
||||
->filter()
|
||||
->when($goodsCode, function ($query, $goodsCode) {
|
||||
return $query->where('goods_code', $goodsCode);
|
||||
})
|
||||
->pluck('id');
|
||||
$ids = [];
|
||||
$goodsSkus = GoodsSku::query()
|
||||
->whereIn('goods_id', $goodsIds)
|
||||
->whereNotIn('id', $ids)
|
||||
->when($skuCode, function ($query, $skuCode) {
|
||||
return $query->where('sku_code', $skuCode);
|
||||
})
|
||||
->when($request->get('has_stock'), function ($query) {
|
||||
return $query->where('stock', '>', 0);
|
||||
})
|
||||
->filter()
|
||||
->with(['goods' => function ($query) {
|
||||
$query->with(['type:id,name', 'brand:id,name']);
|
||||
}])
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate($request->get('per_page'));
|
||||
|
||||
return GoodsSkuResource::collection($goodsSkus);
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@ class MenusController extends Controller
|
||||
{
|
||||
$permissions = $request->user()->getPermissionsViaRoles()->toArray();
|
||||
$permissions = array_column($permissions, 'name');
|
||||
$menus = Menu::query()->get()->toArray();
|
||||
$menus = Menu::query()->orderBy('parent_id')->orderBy('seq')->get()->toArray();
|
||||
$hasPermissionMenus = [];
|
||||
foreach ($menus as $menu) {
|
||||
if (in_array($menu['code'], $permissions, true)) {
|
||||
|
||||
@ -17,7 +17,7 @@ class ShopsController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$shops = Shop::query()->paginate($request->get('per_page'));
|
||||
$shops = Shop::query()->filter()->paginate($request->get('per_page'));
|
||||
foreach ($shops as $shop) {
|
||||
$shop->authUrl = '';
|
||||
if ('妙选' !== $shop->plat_id && ('未授权' === $shop->status || '重新授权' === $shop->status)) {
|
||||
|
||||
45
app/Http/Requests/GroupsRequest.php
Normal file
45
app/Http/Requests/GroupsRequest.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class GroupsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'shop_id' => ['required', 'integer', 'exists:shops,id'],
|
||||
'title' => ['required', 'string'],
|
||||
'start_time' => ['required', 'string'],
|
||||
'end_time' => ['required', 'string'],
|
||||
'data' => ['required', 'array'],
|
||||
'data.*.category_name' => ['required', 'string'],
|
||||
'data.*.type_id' => ['required', 'integer'],
|
||||
'data.*.goods_name' => ['required', 'string'],
|
||||
'data.*.goods_id' => ['required', 'integer'],
|
||||
'data.*.limit_buy' => ['integer'],
|
||||
'data.*.sku_id' => ['required', 'integer'],
|
||||
'data.*.external_sku_id' => ['required', 'string'],
|
||||
'data.*.price_in_fen' => ['required', 'number'],
|
||||
'data.*.sort' => ['required', 'integer'],
|
||||
'is_save_preview' => ['required', 'integer']
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Http/Resources/GroupGoodsResource.php
Normal file
19
app/Http/Resources/GroupGoodsResource.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class GroupGoodsResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
19
app/Http/Resources/GroupsResource.php
Normal file
19
app/Http/Resources/GroupsResource.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class GroupsResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ class GoodsSku extends Model
|
||||
public $fieldSearchable = [
|
||||
'sku_title',
|
||||
'status',
|
||||
'exclude_ids'
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
27
app/Models/GroupGoods.php
Normal file
27
app/Models/GroupGoods.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\traits\Filter;
|
||||
|
||||
class GroupGoods extends Model
|
||||
{
|
||||
use Filter;
|
||||
|
||||
//查询字段
|
||||
public $fieldSearchable = [
|
||||
'group_id',
|
||||
'goods_name',
|
||||
'external_sku_id',
|
||||
];
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->hasOne(Goods::class, 'id', 'goods_id');
|
||||
}
|
||||
|
||||
public function goodsSku()
|
||||
{
|
||||
return $this->hasOne(GoodsSku::class, 'id', 'sku_id');
|
||||
}
|
||||
}
|
||||
17
app/Models/Groups.php
Normal file
17
app/Models/Groups.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\traits\Filter;
|
||||
|
||||
class Groups extends Model
|
||||
{
|
||||
use Filter;
|
||||
|
||||
//查询字段
|
||||
public $fieldSearchable = [
|
||||
'title',
|
||||
'shop_id',
|
||||
'status',
|
||||
];
|
||||
}
|
||||
@ -2,10 +2,18 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\traits\Filter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Shop extends Model
|
||||
{
|
||||
use Filter;
|
||||
|
||||
//查询字段
|
||||
public $fieldSearchable = [
|
||||
'plat_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'access_token',
|
||||
'expires_in',
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGroupsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('groups', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedInteger('shop_id');
|
||||
$table->unsignedBigInteger('end_time');
|
||||
$table->unsignedTinyInteger('is_save_preview')->comment('是否保存为预览团0-不为预览团,1-预览团');
|
||||
$table->unsignedBigInteger('start_time');
|
||||
$table->text('title');
|
||||
$table->string('activity_no')->nullable()->comment('团号');
|
||||
$table->unsignedTinyInteger('create_status')->default(3)->comment('1-创建成功,2-创建失败,3-创建中');
|
||||
$table->string('error_msg')->nullable()->comment('create_status为2时有,创建团失败原因');
|
||||
$table->text('qr_code_url')->nullable()->comment('create_status为1时有,团小程序二维码图片地址');
|
||||
$table->unsignedBigInteger('create_time')->nullable();
|
||||
$table->unsignedTinyInteger('is_help_sell')->nullable()->comment('是否帮卖0-我发布的,1-我帮卖的');
|
||||
$table->tinyInteger('status')->comment('团状态(-10:待发布/预览中,-5:未开始,1:跟团中,20:已结束,30:已删除');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('groups');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGroupGoodsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('group_goods', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('group_id');
|
||||
$table->string('category_name');
|
||||
$table->unsignedBigInteger('type_id');
|
||||
$table->string('goods_desc')->nullable();
|
||||
$table->string('goods_name');
|
||||
$table->unsignedBigInteger('goods_id');
|
||||
$table->unsignedInteger('ktt_goods_id');
|
||||
$table->unsignedInteger('limit_buy')->default(0);
|
||||
$table->unsignedBigInteger('market_price')->default(0);
|
||||
$table->text('pic_url_list')->nullable();
|
||||
$table->unsignedBigInteger('sku_id');
|
||||
$table->unsignedInteger('ktt_sku_id');
|
||||
$table->string('external_sku_id');
|
||||
$table->unsignedBigInteger('price_in_fen');
|
||||
$table->unsignedTinyInteger('quantity_type')->default(0)->comment('库存类型,0-普通 1-无限,无限库存时会无视total_quantity字段');
|
||||
$table->text('spec_id_list')->nullable()->comment('规格id列表,无规格为空list,如果想规格为红色,M,调用生成规格的id,红色为1,M为3,则应传入[1,3]');
|
||||
$table->text('thumb_url')->nullable()->comment('sku图url,注意sku图格式必须是jpg、jpeg、png中的一个,且尺寸不得大于1200*1200,大小不大于1MB,可以不填');
|
||||
$table->unsignedInteger('total_quantity')->default(0)->comment('总库存,最多100w');
|
||||
$table->integer('sort')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('group_goods');
|
||||
}
|
||||
}
|
||||
@ -20,20 +20,22 @@ class MenusTableSeeder extends Seeder
|
||||
['parent_id' => $id, 'code' => 'GOODS_BRAND', 'name' => '商品品牌', 'seq' => 2],
|
||||
]);
|
||||
// 店铺管理
|
||||
DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'SHOP_MANAGE', 'name' => '店铺管理', 'seq' => 1]);
|
||||
DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'SHOP_MANAGE', 'name' => '店铺管理', 'seq' => 10]);
|
||||
// 用户管理
|
||||
DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'USER_MANAGE', 'name' => '用户管理', 'seq' => 2]);
|
||||
DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'USER_MANAGE', 'name' => '用户管理', 'seq' => 20]);
|
||||
// 系统管理-(角色管理,权限管理,系统日志)
|
||||
$id = DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'SYSTEM_MANAGE', 'name' => '系统管理', 'seq' => 3]);
|
||||
$id = DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'SYSTEM_MANAGE', 'name' => '系统管理', 'seq' => 30]);
|
||||
DB::table('menus')->insert([
|
||||
['parent_id' => $id, 'code' => 'ROLE_MANAGE', 'name' => '角色管理', 'seq' => 0],
|
||||
// ['parent_id' => $id,'code' => 'PERMISSION_MANAGE', 'name' => '权限管理', 'seq' => 1],
|
||||
['parent_id' => $id, 'code' => 'SYSTEM_LOG', 'name' => '系统日志', 'seq' => 2],
|
||||
]);
|
||||
// 平台
|
||||
$id = DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'PLAT', 'name' => '平台', 'seq' => 4]);
|
||||
$id = DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'PLAT', 'name' => '平台', 'seq' => 40]);
|
||||
DB::table('menus')->insert([
|
||||
['parent_id' => $id, 'code' => 'PLAT_GOODS_LIST', 'name' => '货品列表', 'seq' => 0],
|
||||
]);
|
||||
// 团购
|
||||
DB::table('menus')->insertGetId(['parent_id' => 0, 'code' => 'GROUP_MANAGEMENT', 'name' => '团购管理', 'seq' => 1]);
|
||||
}
|
||||
}
|
||||
|
||||
109
resources/frontend/src/api/goods.js
vendored
109
resources/frontend/src/api/goods.js
vendored
@ -2,86 +2,95 @@ import http from "@/util/http.js";
|
||||
|
||||
//店铺订单
|
||||
export function shops(params) {
|
||||
return http({
|
||||
url: "/api/count/orders/num",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
return http({
|
||||
url: "/api/count/orders/num",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 商品管理列表
|
||||
export function goods(params) {
|
||||
return http({
|
||||
url: "/api/goods_skus",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
return http({
|
||||
url: "/api/goods_skus",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
// 新建商品
|
||||
export function addGoods(data) {
|
||||
return http({
|
||||
url: "/api/goods",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
return http({
|
||||
url: "/api/goods",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 查看商品
|
||||
export function checkGoods(id) {
|
||||
return http({
|
||||
url: `/api/goods_skus/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
return http({
|
||||
url: `/api/goods_skus/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
// 商品列表
|
||||
export function goodsList(params) {
|
||||
return http({
|
||||
url: "/api/goods",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
return http({
|
||||
url: "/api/goods",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
// 更新商品
|
||||
export function updateGoods(id, data) {
|
||||
return http({
|
||||
url: `/api/goods_skus/${id}`,
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
return http({
|
||||
url: `/api/goods_skus/${id}`,
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 上新/库存盘点/库存
|
||||
export function update(data) {
|
||||
return http({
|
||||
url: "/api/batch/goods_skus",
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
return http({
|
||||
url: "/api/batch/goods_skus",
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 单个字段更新
|
||||
export function singleUpdate(id, data) {
|
||||
return http({
|
||||
url: `/api/single/goods_skus/${id}`,
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
return http({
|
||||
url: `/api/single/goods_skus/${id}`,
|
||||
method: "patch",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 图片上传
|
||||
export function imgUpload(data, item) {
|
||||
return http({
|
||||
url: "/api/upload",
|
||||
Headers: item,
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
return http({
|
||||
url: "/api/upload",
|
||||
Headers: item,
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 表格导出
|
||||
export function tableExport(params) {
|
||||
return http({
|
||||
url: "/goods_skus/export",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
return http({
|
||||
url: "/goods_skus/export",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 商品列表(添加)
|
||||
export function getGoodsList(params) {
|
||||
return http({
|
||||
url: "/api/goodsList",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
9
resources/frontend/src/api/group.js
vendored
9
resources/frontend/src/api/group.js
vendored
@ -43,3 +43,12 @@ export function getGroupGoods(params) {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 增加团购商品
|
||||
export function addGroupGoods(params) {
|
||||
return http({
|
||||
url: `/api/groupGoods`,
|
||||
method: "post",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,33 +1,38 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card style="margin-top: 10px" class="box-card">
|
||||
<el-form :model="group" label-width="80px">
|
||||
<el-form-item label="店铺">
|
||||
<el-select v-model="group.store_id" :disabled="disabled">
|
||||
<el-form ref="group" :rules="rules" :model="group" label-width="80px">
|
||||
<el-form-item label="店铺" prop="shop_id">
|
||||
<el-select v-model="group.shop_id" :disabled="shopDisable">
|
||||
<el-option v-for="store in stores" :key="store.id" :label="store.name" :value="store.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动标题">
|
||||
<el-form-item label="活动标题" prop="title">
|
||||
<el-input type="textarea" v-model="group.title" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="团购商品">
|
||||
<el-button @click="centerDialogVisible = true">从商品列表导入</el-button>
|
||||
<el-input placeholder="搜索商品名称、编码" v-model="group.searchInput"
|
||||
<el-button @click="centerDialog()">从商品列表导入</el-button>
|
||||
<el-input placeholder="搜索商品名称、编码" v-model="groupGoodsSearch.external_sku_id"
|
||||
style="margin-left: 20px; width: 400px;">
|
||||
<template slot="append" @click="groupGoodsSearch();">查询</template>
|
||||
<template slot="append" @click="groupGoodsList();">查询</template>
|
||||
</el-input>
|
||||
<div>
|
||||
<el-button type="text" @click="groupGoodsSearch({statue: 2});">全部({{group.num}})</el-button>
|
||||
<el-button type="text" @click="groupGoodsSearch({statue: 1});">在售中({{group.on_num}})</el-button>
|
||||
<el-button type="text" @click="groupGoodsSearch({statue: 0});">已售罄({{group.off_num}})
|
||||
<el-button type="text" @click="groupGoodsSearch.status=2;groupGoodsList();">
|
||||
全部({{groupGoods.meta.num}})
|
||||
</el-button>
|
||||
<el-button type="text" @click="groupGoodsSearch.status=1;groupGoodsList();">
|
||||
在售中({{groupGoods.meta.on_num}})
|
||||
</el-button>
|
||||
<el-button type="text" @click="groupGoodsSearch.status=0;groupGoodsList();">
|
||||
已售罄({{groupGoods.meta.off_num}})
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTableGroup" @selection-change="handleSelectionChangeGroup"
|
||||
v-loading="groupLoading" :data="groupGoods.data" border style="width: 100%" height="800">
|
||||
<el-table-column type="selection" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="序号">
|
||||
<el-table-column prop="sort" label="排序">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="商品名称">
|
||||
</el-table-column>
|
||||
@ -54,27 +59,28 @@
|
||||
<div
|
||||
style="display: flex; justify-content: space-between; align-items: center; line-height: 32px; margin-top: 20px;">
|
||||
<el-button type="danger" size="small" @click="batchRemove();">批量删除</el-button>
|
||||
<el-pagination @size-change="handleSizeChangeGroup" @current-change="handleCurrentChangeGroup"
|
||||
<el-pagination @size-change="handleSizeChangeGroup" @current-change="groupGoodsList"
|
||||
:current-page.sync="groupGoods.meta.per_page" :page-sizes="[20, 30, 50, 100]"
|
||||
:page-size="groupGoods.meta.size" layout="sizes, prev, pager, next"
|
||||
:total="groupGoods.meta.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="团购时间">
|
||||
<el-form-item label="团购时间" prop="datetimerange">
|
||||
<el-date-picker v-model="group.datetimerange" type="datetimerange" range-separator="至"
|
||||
start-placeholder="开始时间" end-placeholder="结束时间">
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
@change="setTime">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item style="display: flex; justify-content: flex-end;">
|
||||
<el-button @click="onAdd(1);">保存预览</el-button>
|
||||
<el-button type="primary" @click="onAdd(0);">发布</el-button>
|
||||
<el-button type="success" @click="onEdit();">修改团购</el-button>
|
||||
<el-button v-show="shopDisable" type="success" @click="onEdit();">修改团购</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-dialog :title="dialogTitle" :visible.sync="centerDialogVisible" width="80%">
|
||||
<el-dialog :title="dialogTitle" :visible.sync="centerDialogVisible" width="80%" :close-on-click-modal="false">
|
||||
<el-form ref="goodsList" :model="goodsList" label-width="80px">
|
||||
<el-form-item label="商品分类" prop="type_id">
|
||||
<el-radio-group v-model="goodsList.type_id" size="small" @change="goodsSearch()">
|
||||
@ -90,20 +96,20 @@
|
||||
{{goodsBrand.name}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="搜索" prop="goodsKeyword">
|
||||
<el-input placeholder="搜索商品名称、编码" v-model="goodsList.goodsKeyword" style="width: 400px;">
|
||||
<el-form-item label="搜索" prop="goods_keyword">
|
||||
<el-input placeholder="搜索商品名称、编码" v-model="goodsList.goods_keyword" style="width: 400px;">
|
||||
</el-input>
|
||||
<el-radio-group v-model="goodsList.status" style="margin: 0 30px">
|
||||
<el-radio-group v-model="goodsList.has_stock" style="margin: 0 30px">
|
||||
<el-radio label="1">有库存</el-radio>
|
||||
<el-radio label="2">全部</el-radio>
|
||||
<el-radio label="0">全部</el-radio>
|
||||
</el-radio-group>
|
||||
<el-button type="primary" size="small" @click="goodsSearch();">查询</el-button>
|
||||
<el-button size="small" @click="resetForm('goodsList')">重置</el-button>
|
||||
<el-button size="small" @click="resetForm()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table ref="multipleTable" @selection-change="handleSelectionChange" v-loading="goodsLoading"
|
||||
:data="goods.data" border style="width: 100%" height="520">
|
||||
<el-table-column type="selection" width="55">
|
||||
<el-table ref="multipleTable" @select="handleSelect" v-loading="goodsLoading" :data="goods.data" border
|
||||
style="width: 100%" height="520" :row-key="getRowKeys">
|
||||
<el-table-column type="selection" :reserve-selection="true" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template slot-scope="scope">
|
||||
@ -117,7 +123,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.goods.brand.name}}
|
||||
{{scope.row.goods.brand ? scope.row.goods.brand.name : ''}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类">
|
||||
@ -129,7 +135,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="display: flex; flex-direction: row-reverse; align-items: center; margin-top: 10px;">
|
||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
<el-pagination @size-change="handleSizeChange" @current-change="goodsSearch"
|
||||
:current-page.sync="goods.meta.current_page" :page-sizes="[20, 30, 50, 100]"
|
||||
:page-size="goods.meta.per_page" layout="sizes, prev, pager, next" :total="goods.meta.total">
|
||||
</el-pagination>
|
||||
@ -142,7 +148,7 @@
|
||||
</div>
|
||||
<div>已选 {{selectNum}} 件</div>
|
||||
<div>
|
||||
<el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
|
||||
<el-button type="primary" @click="addGoods();">确 定</el-button>
|
||||
<el-button @click="centerDialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@ -154,22 +160,31 @@
|
||||
|
||||
<script>
|
||||
import { storeList } from "../../api/shop";
|
||||
import { addGroup, showGroup, editGroup, getGroupGoods } from "../../api/group";
|
||||
import { addGroup, showGroup, editGroup, getGroupGoods, addGroupGoods } from "../../api/group";
|
||||
import { goods_types, Brand_goods_types } from "../../api/rankingData";
|
||||
import { goods } from "../../api/goods";
|
||||
import { addGoods, getGoodsList } from "../../api/goods";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
group: {
|
||||
store_id: "",
|
||||
shop_id: '',
|
||||
status: "",
|
||||
title: "",
|
||||
resource: "",
|
||||
num: 0,
|
||||
on_num: 0,
|
||||
off_num: 0,
|
||||
datetimerange: "",
|
||||
searchInput: "",
|
||||
start_time: "",
|
||||
end_time: "",
|
||||
is_save_preview: 1,
|
||||
datetimerange: []
|
||||
},
|
||||
rules: {
|
||||
shop_id: [
|
||||
{ required: true, message: '请选择店铺' },
|
||||
],
|
||||
title: [
|
||||
{ required: true, message: '请输入活动标题', trigger: 'blur' },
|
||||
],
|
||||
datetimerange: [
|
||||
{ required: true, message: '请选择团购时间', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
groupGoods: {
|
||||
data: [],
|
||||
@ -177,10 +192,21 @@ export default {
|
||||
total: 0,
|
||||
current_page: 1,
|
||||
per_page: 20,
|
||||
}
|
||||
num: 0,
|
||||
on_num: 0,
|
||||
off_num: 0,
|
||||
},
|
||||
},
|
||||
groupGoodsSearch: {
|
||||
external_sku_id: "",
|
||||
status: 0,
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
ids: [],
|
||||
group_id: 0
|
||||
},
|
||||
groupLoading: false,
|
||||
goodsLoading: false,
|
||||
goodsLoading: true,
|
||||
goods: {
|
||||
data: [],
|
||||
meta: {
|
||||
@ -194,27 +220,31 @@ export default {
|
||||
types: [],
|
||||
brands: [],
|
||||
goodsList: {
|
||||
goodsKeyword: "",
|
||||
status: "1",
|
||||
goods_keyword: "",
|
||||
has_stock: "1",
|
||||
type_id: 0,
|
||||
brand_id: 0,
|
||||
excludeIds: [],
|
||||
page: 1,
|
||||
per_page: 1,
|
||||
},
|
||||
disabled: false,
|
||||
goodsListPage: {
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
},
|
||||
shopDisable: false,
|
||||
dialogTitle: "您的商品库中已有 0 件商品",
|
||||
selectNum: 0,
|
||||
selectGoods: []
|
||||
selectGoods: [],
|
||||
allGoods: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getStoreList();
|
||||
let id = parseInt(this.$route.query.id);
|
||||
if (id) {
|
||||
this.disabled = true;
|
||||
let groupId = parseInt(this.$route.query.id);
|
||||
if (groupId) {
|
||||
this.groupGoodsSearch.group_id = groupId;
|
||||
this.shopDisable = true;
|
||||
this.getGoupInfo(this.$route.query.id);
|
||||
this.dialogTitle = "您的商品库中已有 " + this.group.num + " 件商品";
|
||||
this.groupGoodsList();
|
||||
this.dialogTitle = "您的商品库中已有 " + this.groupGoods.meta.total + " 件商品";
|
||||
}
|
||||
this.getbrandType();
|
||||
this.getgoodsType();
|
||||
@ -222,52 +252,46 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getStoreList() {
|
||||
let page = {
|
||||
let params = {
|
||||
page: 0,
|
||||
per_page: 999,
|
||||
plat_id: 1
|
||||
};
|
||||
storeList(page).then((res) => {
|
||||
storeList(params).then((res) => {
|
||||
this.stores = res.data.data;
|
||||
});
|
||||
},
|
||||
onAdd(is_save_preview) {
|
||||
console.log(is_save_preview)
|
||||
console.log(group)
|
||||
this.$message('add');
|
||||
this.group.is_save_preview = is_save_preview;
|
||||
this.$refs.group.validate((valid) => {
|
||||
if (valid) {
|
||||
alert('submit!');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
onEdit() {
|
||||
console.log(group)
|
||||
this.$message('edit');
|
||||
this.$refs.group.validate((valid) => {
|
||||
if (valid) {
|
||||
alert('edit!');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
setTop() {
|
||||
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.$message({
|
||||
message: val,
|
||||
type: "success"
|
||||
});
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.$message({
|
||||
message: val,
|
||||
type: "success"
|
||||
});
|
||||
},
|
||||
handleSizeChangeGroup(val) {
|
||||
this.$message({
|
||||
message: val,
|
||||
type: "success"
|
||||
});
|
||||
this.groupGoodsSearch.per_page = val;
|
||||
this.groupGoodsList();
|
||||
},
|
||||
handleCurrentChangeGroup(val) {
|
||||
this.$message({
|
||||
message: val,
|
||||
type: "success"
|
||||
});
|
||||
},
|
||||
groupGoodsSearch(params = {}) {
|
||||
// getGroupGoods(params).then((res) => { })
|
||||
groupGoodsList(page = 1) {
|
||||
this.groupGoodsSearch.page = page;
|
||||
getGroupGoods(params).then((res) => {
|
||||
this.groupGoods = res.data;
|
||||
})
|
||||
},
|
||||
getGoupInfo(id) {
|
||||
// showGroup(id).then((res) => {
|
||||
@ -275,7 +299,7 @@ export default {
|
||||
},
|
||||
getgoodsType() {
|
||||
let params = {
|
||||
per_page: 99999,
|
||||
per_page: 9999,
|
||||
};
|
||||
goods_types(params).then((res) => {
|
||||
this.types = res.data.data;
|
||||
@ -283,33 +307,108 @@ export default {
|
||||
},
|
||||
getbrandType() {
|
||||
let params = {
|
||||
per_page: 99999,
|
||||
per_page: 9999,
|
||||
};
|
||||
Brand_goods_types(params).then((res) => {
|
||||
this.brands = res.data.data;
|
||||
});
|
||||
},
|
||||
goodsSearch() {
|
||||
goods(this.goodsList).then((res) => {
|
||||
this.goods = res.data;
|
||||
})
|
||||
},
|
||||
toggleSelection(isAll) {
|
||||
if (isAll) {
|
||||
|
||||
} else {
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
}
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.selectGoods = val;
|
||||
console.log(this.selectGoods)
|
||||
},
|
||||
handleSelectionChangeGroup() {
|
||||
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
setTime(val) {
|
||||
this.group.start_time = val[0];
|
||||
this.group.end_time = val[1];
|
||||
},
|
||||
// 从商品列表导入
|
||||
centerDialog() {
|
||||
if (this.group.shop_id) {
|
||||
this.centerDialogVisible = true;
|
||||
} else {
|
||||
this.$message.error('请先选择店铺');
|
||||
}
|
||||
},
|
||||
goodsSearch(page = 1) {
|
||||
this.goodsList.page = page;
|
||||
this.goodsList.per_page = this.goodsListPage.per_page;
|
||||
this.goodsLoading = true;
|
||||
getGoodsList(this.goodsList).then((res) => {
|
||||
this.goods = res.data;
|
||||
this.goods.meta.per_page = parseInt(this.goods.meta.per_page);
|
||||
this.goods.data.forEach((row, i) => {
|
||||
if (undefined !== this.selectGoods[row.id]) {
|
||||
this.$refs.multipleTable.toggleRowSelection(row, true);
|
||||
}
|
||||
})
|
||||
this.goodsLoading = false;
|
||||
})
|
||||
if (1 === page) {
|
||||
this.getAllGoods(this.goodsList);
|
||||
}
|
||||
},
|
||||
getAllGoods(params) {
|
||||
params.page = 1;
|
||||
params.per_page = 9999;
|
||||
getGoodsList(params).then((res) => {
|
||||
this.allGoods = res.data.data;
|
||||
})
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.goodsListPage.per_page = val;
|
||||
this.goodsSearch();
|
||||
},
|
||||
getRowKeys(row) {
|
||||
return row.id;
|
||||
},
|
||||
toggleSelection(isAll) {
|
||||
if (isAll) {
|
||||
this.allGoods.forEach((sku, i) => {
|
||||
if (undefined === this.selectGoods[sku.id]) {
|
||||
this.selectNum++;
|
||||
}
|
||||
this.selectGoods[sku.id] = 1;
|
||||
})
|
||||
this.goods.data.forEach((row, i) => {
|
||||
this.$refs.multipleTable.toggleRowSelection(row, true);
|
||||
})
|
||||
} else {
|
||||
this.allGoods.forEach((sku, i) => {
|
||||
if (undefined !== this.selectGoods[sku.id]) {
|
||||
delete this.selectGoods[sku.id];
|
||||
this.selectNum--;
|
||||
}
|
||||
})
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
}
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
if (undefined === this.selectGoods[row.id]) {
|
||||
this.selectGoods[row.id] = 1;
|
||||
this.selectNum++;
|
||||
} else {
|
||||
delete this.selectGoods[row.id];
|
||||
this.selectNum--;
|
||||
}
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs.goodsList.resetFields();
|
||||
this.goodsSearch();
|
||||
},
|
||||
addGoods() {
|
||||
let ids = [];
|
||||
this.selectGoods.forEach((v, k) => {
|
||||
if (k !== undefined) {
|
||||
ids.push(k)
|
||||
}
|
||||
})
|
||||
let params = {
|
||||
group_id: this.groupGoodsSearch.group_id,
|
||||
shop_id: this.group.shop_id,
|
||||
ids: ids
|
||||
}
|
||||
addGroupGoods(params).then((res) => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,10 +10,10 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="团购状态">
|
||||
<el-select v-model="formSearch.status" placeholder="团购状态">
|
||||
<el-option label="未开始" value="0"></el-option>
|
||||
<el-option label="未开始" value="-5"></el-option>
|
||||
<el-option label="跟团中" value="1"></el-option>
|
||||
<el-option label="预览中" value="2"></el-option>
|
||||
<el-option label="已结束" value="3"></el-option>
|
||||
<el-option label="预览中" value="-10"></el-option>
|
||||
<el-option label="已结束" value="20"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动标题">
|
||||
@ -68,12 +68,12 @@ export default {
|
||||
store_id: "",
|
||||
status: "",
|
||||
title: "",
|
||||
page: 1,
|
||||
per_page: 20
|
||||
},
|
||||
stores: [],
|
||||
loading: false,
|
||||
tableData: [
|
||||
{ id: 1, shop_name: "花富贵儿", title: "团购", status: "未开始", start_time: "2022-10-01 00:00:00", end_time: "2022-10-10 00:00:00", ercode: "https://ts1.cn.mm.bing.net/th/id/R-C.8c975bf1ced8f8aac41a73e8691b385c?rik=%2fOWwdmGCNTjfQA&riu=http%3a%2f%2ftupian.qqw21.com%2farticle%2fUploadPic%2f2012-9%2f201291621552596740.jpg&ehk=yDVF7XeRX8kqDF4CTnZ8JRMjF7yk%2f7G4GTzEVSmWlv0%3d&risl=&pid=ImgRaw&r=0" }
|
||||
]
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -82,19 +82,19 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getStoreList() {
|
||||
let page = {
|
||||
let params = {
|
||||
page: 0,
|
||||
per_page: 999,
|
||||
plat_id: 1
|
||||
};
|
||||
storeList(page).then((res) => {
|
||||
storeList(params).then((res) => {
|
||||
this.stores = res.data.data;
|
||||
});
|
||||
},
|
||||
getGroupList() {
|
||||
console.log(this.formSearch)
|
||||
// groupList(this.formSearch).then((res) => {
|
||||
// this.tableData = res.data.data;
|
||||
// })
|
||||
groupList(this.formSearch).then((res) => {
|
||||
this.tableData = res.data.data;
|
||||
})
|
||||
},
|
||||
groupSet(id) {
|
||||
this.$router.push({ path: "GROUP_ADD", query: { id: id } });
|
||||
|
||||
2
resources/frontend/vue.config.js
vendored
2
resources/frontend/vue.config.js
vendored
@ -11,7 +11,7 @@ module.exports = {
|
||||
proxy: {
|
||||
// 配置代理
|
||||
"/api": {
|
||||
target: "http://172.17.161.186:81",
|
||||
target: "http://172.21.77.221:81",
|
||||
// target: "http://erp.chutang66.com",
|
||||
changeOrigin: true, // 开启代理
|
||||
pathRewrite: {
|
||||
|
||||
@ -282,4 +282,35 @@ return [
|
||||
'name' => '同步库存',
|
||||
'parent_id' => 120,
|
||||
],
|
||||
// 团购管理
|
||||
'GROUP_MANAGEMENT' => [
|
||||
'id' => 13,
|
||||
'name' => '团购管理',
|
||||
'parent_id' => 0,
|
||||
],
|
||||
'group.index' => [
|
||||
'id' => 130,
|
||||
'name' => '列表',
|
||||
'parent_id' => 13,
|
||||
],
|
||||
'group.store' => [
|
||||
'id' => 131,
|
||||
'name' => '新增',
|
||||
'parent_id' => 13,
|
||||
],
|
||||
'group.show' => [
|
||||
'id' => 132,
|
||||
'name' => '查看',
|
||||
'parent_id' => 13,
|
||||
],
|
||||
'group.update' => [
|
||||
'id' => 133,
|
||||
'name' => '更新',
|
||||
'parent_id' => 13,
|
||||
],
|
||||
'group.destroy' => [
|
||||
'id' => 134,
|
||||
'name' => '删除',
|
||||
'parent_id' => 13,
|
||||
],
|
||||
];
|
||||
|
||||
@ -6,6 +6,7 @@ use App\Http\Controllers\UploadController;
|
||||
use App\Http\Controllers\Shop\ShopsController;
|
||||
use App\Http\Controllers\Goods\GoodsSkusController;
|
||||
use App\Http\Controllers\Business\BusinessGoodsSkusController;
|
||||
use App\Http\Controllers\Group\GroupsController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -47,6 +48,8 @@ Route::middleware(['auth:api', 'check.permissions'])->group(function () {
|
||||
// 平台
|
||||
Route::resource('plat_goods', 'Business\BusinessGoodsSkusController', ['only' => ['index', 'update', 'destroy']]);
|
||||
Route::post('plat/sync/{id}/stock', [BusinessGoodsSkusController::class, 'syncStock'])->name('plat.sync.stock');
|
||||
// 团购
|
||||
Route::resource('group', 'Group\GroupsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
|
||||
});
|
||||
// 登录
|
||||
Route::post('/auth/login', [LoginController::class, 'login'])->name('auth.login');
|
||||
@ -59,6 +62,12 @@ Route::resource('menus', 'Menu\MenusController', ['only' => ['index',
|
||||
// 获取平台列表
|
||||
Route::get('shop_platforms', [ShopsController::class, 'getPlatList'])->name('plat.list')->middleware('auth:api');
|
||||
|
||||
// 商品列表
|
||||
Route::get('goodsList', [GroupsController::class, 'goodsList'])->name('goods.list')->middleware('auth:api');
|
||||
Route::get('groupGoods', [GroupsController::class, 'getGoods'])->name('group.get_goods')->middleware('auth:api');
|
||||
Route::post('groupGoods', [GroupsController::class, 'addGoods'])->name('group.add_goods')->middleware('auth:api');
|
||||
Route::get('addGoods', [GroupsController::class, 'addGoods'])->name('group.add_goods')->middleware('auth:api');
|
||||
|
||||
// 妙选商城数据推送
|
||||
Route::post('business', [ShopsController::class, 'business'])->name('shop.put.business');
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user