feat: #10000 团购基础功能开发完成
This commit is contained in:
parent
b18bcc50d7
commit
65c6aebf46
@ -73,15 +73,15 @@ class GoodsSkusController extends Controller
|
||||
}])
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate(5);
|
||||
foreach ($goodsSkus as &$sku) {
|
||||
$externalSkuId = $sku['goods']['goods_code'] . '_' . $sku['sku_code'];
|
||||
$lastInventoryTime = $sku['daily']['inventory_time'];
|
||||
$fields = implode(',', [
|
||||
'shop_id',
|
||||
'external_sku_id',
|
||||
'sum(goods_number) as number',
|
||||
'sum(already_cancel_number) as cancel_number',
|
||||
]);
|
||||
foreach ($goodsSkus as &$sku) {
|
||||
$externalSkuId = $sku['goods']['goods_code'] . '_' . $sku['sku_code'];
|
||||
$lastInventoryTime = $sku['daily']['inventory_time'];
|
||||
$orderDetail = BusinessOrderItem::query()
|
||||
->select(DB::raw($fields))
|
||||
->where('external_sku_id', $externalSkuId)
|
||||
|
||||
@ -8,6 +8,8 @@ use App\Http\Resources\GoodsSkuResource;
|
||||
use App\Models\Goods;
|
||||
use App\Models\GoodsSku;
|
||||
use App\Models\Log as LogModel;
|
||||
use App\Models\Shop;
|
||||
use App\Utils\ArrayUtils;
|
||||
use App\Utils\DateTimeUtils;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@ -32,6 +34,7 @@ class GroupsController extends Controller
|
||||
{
|
||||
$groups = Groups::query()
|
||||
->filter()
|
||||
->with(['shop:id,name'])
|
||||
->paginate($request->get('per_page'));
|
||||
|
||||
return GroupsResource::collection($groups);
|
||||
@ -46,7 +49,52 @@ class GroupsController extends Controller
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
var_dump($request->get('data'));
|
||||
$skus = GoodsSku::query()
|
||||
->whereIn('id', $request->new_ids)
|
||||
->with(['goods' => function ($query) {
|
||||
$query->with(['type:id,name', 'brand:id,name']);
|
||||
}])
|
||||
->get()
|
||||
->toArray();
|
||||
$changeData = $request->change_data;
|
||||
$changeData = ArrayUtils::index($changeData, 'id');
|
||||
$shop = Shop::query()->find($request->shop_id);
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$group = new Groups();
|
||||
$group->shop_id = $request->shop_id;
|
||||
$group->title = $request->title;
|
||||
$group->is_save_preview = $request->is_save_preview;
|
||||
$group->start_time = $request->datetimerange[0];
|
||||
$group->end_time = $request->datetimerange[1];
|
||||
$group->save();
|
||||
$groupGoods = [];
|
||||
foreach ($skus as $sku) {
|
||||
$price = $shop['ratio'] * $sku['cost'] * 100;
|
||||
$groupGoods[] = [
|
||||
'group_id' => $group->id,
|
||||
'category_name' => $sku['goods']['type']['name'],
|
||||
'type_id' => $sku['goods']['type']['id'],
|
||||
'goods_name' => $sku['goods']['title'] . ' ' . $sku['title'],
|
||||
'goods_id' => $sku['goods_id'],
|
||||
'limit_buy' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['limit_buy'] : 0,
|
||||
'sku_id' => $sku['id'],
|
||||
'price_in_fen' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['price_in_fen'] * 100 : $price,
|
||||
'sort' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['sort'] : 500,
|
||||
'external_sku_id' => $sku['goods']['goods_code'] . '_' . $sku['sku_code'],
|
||||
];
|
||||
}
|
||||
(new GroupGoods())->batchInsert($groupGoods);
|
||||
DB::commit();
|
||||
} catch (\Exception $exception) {
|
||||
DB::rollBack();
|
||||
$this->res = [
|
||||
'httpCode' => 400,
|
||||
'errorCode' => 400500,
|
||||
'errorMessage' => $exception->getMessage(),
|
||||
];
|
||||
}
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
@ -64,7 +112,57 @@ class GroupsController extends Controller
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
var_dump($request->get('data'));
|
||||
$shop = Shop::query()->find($request->shop_id);
|
||||
$shop['ratio'] = 1;
|
||||
$deleteIds = $request->delete_ids;
|
||||
$ids = GroupGoods::query()
|
||||
->where('group_id', $id)
|
||||
->whereNotIn('sku_id', $deleteIds)
|
||||
->pluck('sku_id')->toArray();
|
||||
$skus = GoodsSku::query()
|
||||
->whereIn('id', array_merge($ids, $request->new_ids))
|
||||
->with(['goods' => function ($query) {
|
||||
$query->with(['type:id,name', 'brand:id,name']);
|
||||
}])
|
||||
->get()
|
||||
->toArray();
|
||||
$changeData = $request->change_data;
|
||||
$changeData = ArrayUtils::index($changeData, 'id');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$group = Groups::query()->find($id);
|
||||
$group->start_time = $request->datetimerange[0];
|
||||
$group->end_time = $request->datetimerange[1];
|
||||
$group->save();
|
||||
GroupGoods::where('group_id', $id)->whereIn('sku_id', $deleteIds)->delete();
|
||||
foreach ($skus as $sku) {
|
||||
$price = $shop['ratio'] * $sku['cost'] * 100;
|
||||
$groupGoods = [
|
||||
'category_name' => $sku['goods']['type']['name'],
|
||||
'type_id' => $sku['goods']['type']['id'],
|
||||
'goods_name' => $sku['goods']['title'] . ' ' . $sku['title'],
|
||||
'goods_id' => $sku['goods_id'],
|
||||
'limit_buy' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['limit_buy'] : 0,
|
||||
'price_in_fen' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['price_in_fen'] * 100 : $price,
|
||||
'sort' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['sort'] : 500,
|
||||
'external_sku_id' => $sku['goods']['goods_code'] . '_' . $sku['sku_code'],
|
||||
];
|
||||
GroupGoods::updateOrCreate(
|
||||
['group_id' => $group->id, 'sku_id' => $sku['id']],
|
||||
$groupGoods
|
||||
);
|
||||
}
|
||||
DB::commit();
|
||||
} catch (\Exception $exception) {
|
||||
DB::rollBack();
|
||||
$this->res = [
|
||||
'httpCode' => 400,
|
||||
'errorCode' => 400500,
|
||||
'errorMessage' => $exception->getMessage(),
|
||||
];
|
||||
}
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
|
||||
public function destroy()
|
||||
@ -73,38 +171,112 @@ class GroupsController extends Controller
|
||||
|
||||
public function getGoods(Request $request)
|
||||
{
|
||||
if ($request->get('group_id')) {
|
||||
$goodsNameLike = '';
|
||||
$shop = Shop::query()->find($request->get('shop_id'));
|
||||
$shop['ratio'] = 1;
|
||||
$deleteIds = $request->get('delete_ids') ?: [];
|
||||
$groupId = $request->get('group_id');
|
||||
$groupGoods = GroupGoods::query()
|
||||
->select(['id', 'sku_id', 'sort', 'limit_buy', 'price_in_fen'])
|
||||
->where('group_id', $groupId)
|
||||
->whereNotIn('sku_id', $deleteIds)
|
||||
->get()
|
||||
->toArray();
|
||||
$groupGoods = ArrayUtils::index($groupGoods, 'sku_id');
|
||||
$skuIds = array_keys($groupGoods);
|
||||
if ($newIds = $request->get('new_ids')) {
|
||||
$skuIds = array_merge($skuIds, $newIds);
|
||||
}
|
||||
$goodsCode = $skuCode = '';
|
||||
$externalSkuId = $request->get('external_sku_id');
|
||||
if (false === strpos($externalSkuId, '_')) {
|
||||
$goodsNameLike = $externalSkuId;
|
||||
if (false !== strpos($externalSkuId, '_')) {
|
||||
[$goodsCode, $skuCode] = explode('_', $externalSkuId);
|
||||
$externalSkuId = '';
|
||||
}
|
||||
$goods = GroupGoods::query()
|
||||
->when($goodsNameLike, function ($query, $goodsNameLike) {
|
||||
return $query->where('goods_name', 'like', "%$goodsNameLike%");
|
||||
$goodsIds = Goods::query()
|
||||
->when($externalSkuId, function ($query, $externalSkuId) {
|
||||
return $query->where('title', 'like', "%$externalSkuId%");
|
||||
})
|
||||
->with(['goodsSku:id,stock'])
|
||||
->filter()
|
||||
->paginate($request->get('per_page'));
|
||||
|
||||
return GroupGoodsResource::collection($goods);
|
||||
}
|
||||
->when($goodsCode, function ($query, $goodsCode) {
|
||||
return $query->where('goods_code', $goodsCode);
|
||||
})
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
$stockSelect = (int)$request->get('has_stock');
|
||||
$fields = implode(',', [
|
||||
'id',
|
||||
'goods_id',
|
||||
'title',
|
||||
'sku_code',
|
||||
'stock',
|
||||
'cost',
|
||||
]);
|
||||
$goodsSkus = GoodsSku::query()
|
||||
->whereIn('id', $request->get('ids'))
|
||||
->select(DB::raw($fields))
|
||||
->whereIn('id', $skuIds)
|
||||
->whereIn('goods_id', $goodsIds)
|
||||
->when($skuCode, function ($query, $skuCode) {
|
||||
return $query->where('sku_code', $skuCode);
|
||||
})
|
||||
->when($stockSelect, function ($query, $stockSelect) {
|
||||
if ($stockSelect > 0) {
|
||||
return $query->where('stock', '>', 0);
|
||||
}
|
||||
|
||||
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'));
|
||||
foreach ($goodsSkus as &$goodsSku) {
|
||||
if (isset($groupGoods[$goodsSku['id']])) {
|
||||
$goodsSku['price_in_fen'] = $groupGoods[$goodsSku['id']]['price_in_fen'];
|
||||
$goodsSku['sort'] = $groupGoods[$goodsSku['id']]['sort'];
|
||||
$goodsSku['limit_buy'] = $groupGoods[$goodsSku['id']]['limit_buy'];
|
||||
} else {
|
||||
$goodsSku['price_in_fen'] = $shop['ratio'] * $goodsSku['cost'];
|
||||
$goodsSku['sort'] = 500;
|
||||
$goodsSku['limit_buy'] = 0;
|
||||
}
|
||||
$goodsSku['goods_name'] = $goodsSku['goods']['title'] . ' ' . $goodsSku['title'];
|
||||
$goodsSku['external_sku_id'] = $goodsSku['goods']['goods_code'] . '_' . $goodsSku['sku_code'];
|
||||
$goodsSku['category_name'] = $goodsSku['goods']['type']['name'];
|
||||
}
|
||||
|
||||
return GoodsSkuResource::collection($goodsSkus);
|
||||
}
|
||||
|
||||
public function addGoods(Request $request)
|
||||
public function addGroupGoods(Request $request)
|
||||
{
|
||||
var_dump($request->get('ids'));
|
||||
var_dump($request->get('shop_id'));
|
||||
var_dump($request->get('group_id'));
|
||||
$shop = Shop::query()->find($request->get('shop_id'));
|
||||
$shop['ratio'] = 1;
|
||||
$ids = [];
|
||||
if ($newIds = $request->get('new_ids')) {
|
||||
$ids = array_merge($ids, $newIds);
|
||||
}
|
||||
if ($hasIds = $request->get('has_ids')) {
|
||||
$ids = array_merge($ids, $hasIds);
|
||||
}
|
||||
$goodsSkus = GoodsSku::query()
|
||||
->whereIn('id', $ids)
|
||||
->with(['goods' => function ($query) {
|
||||
$query->with(['type:id,name', 'brand:id,name']);
|
||||
}])
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate($request->get('per_page'));
|
||||
foreach ($goodsSkus as &$goodsSku) {
|
||||
$goodsSku['price_in_fen'] = $shop['ratio'] * $goodsSku['cost'];
|
||||
$goodsSku['sort'] = 500;
|
||||
$goodsSku['limit_buy'] = 0;
|
||||
$goodsSku['goods_name'] = $goodsSku['goods']['title'] . ' ' . $goodsSku['title'];
|
||||
$goodsSku['external_sku_id'] = $goodsSku['goods']['goods_code'] . '_' . $goodsSku['sku_code'];
|
||||
$goodsSku['category_name'] = $goodsSku['goods']['type']['name'];
|
||||
}
|
||||
|
||||
return GoodsSkuResource::collection($goodsSkus);
|
||||
}
|
||||
|
||||
public function goodsList(Request $request)
|
||||
@ -124,10 +296,19 @@ class GroupsController extends Controller
|
||||
return $query->where('goods_code', $goodsCode);
|
||||
})
|
||||
->pluck('id');
|
||||
$ids = [];
|
||||
$excludeIds = $request->get('has_ids') ?: [];
|
||||
$deleteIds = $request->get('delete_ids') ?: [];
|
||||
if ($groupId = $request->get('group_id')) {
|
||||
$skuIds = GroupGoods::query()
|
||||
->where('group_id', $groupId)
|
||||
->whereNotIn('sku_id', $deleteIds)
|
||||
->pluck('sku_id')
|
||||
->toArray();
|
||||
$excludeIds = array_merge($excludeIds, $skuIds);
|
||||
}
|
||||
$goodsSkus = GoodsSku::query()
|
||||
->whereIn('goods_id', $goodsIds)
|
||||
->whereNotIn('id', $ids)
|
||||
->whereNotIn('id', $excludeIds)
|
||||
->when($skuCode, function ($query, $skuCode) {
|
||||
return $query->where('sku_code', $skuCode);
|
||||
})
|
||||
|
||||
@ -27,19 +27,13 @@ class GroupsRequest extends FormRequest
|
||||
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']
|
||||
'datetimerange' => ['required', 'array'],
|
||||
'is_save_preview' => ['required', 'integer'],
|
||||
'group_id' => ['integer'],
|
||||
'delete_ids' => ['array'],
|
||||
'new_ids' => ['required_if:group_id,0','array'],
|
||||
'change_data' => ['array'],
|
||||
// 'sort' => ['array'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,24 @@ class GroupGoods extends Model
|
||||
'external_sku_id',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'category_name',
|
||||
'type_id',
|
||||
'goods_name',
|
||||
'goods_id',
|
||||
'limit_buy',
|
||||
'price_in_fen',
|
||||
'sort',
|
||||
'external_sku_id',
|
||||
'sku_id',
|
||||
'group_id',
|
||||
];
|
||||
|
||||
public function getPriceInFenAttribute($value)
|
||||
{
|
||||
return round($value / 100, 2);
|
||||
}
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->hasOne(Goods::class, 'id', 'goods_id');
|
||||
|
||||
@ -14,4 +14,44 @@ class Groups extends Model
|
||||
'shop_id',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function setStartTimeAttribute($value)
|
||||
{
|
||||
$time = strtotime($value);
|
||||
$this->attributes['start_time'] = $time * 1000;
|
||||
}
|
||||
|
||||
public function getStartTimeAttribute($value)
|
||||
{
|
||||
return date('Y-m-d H:i:s', $value / 1000);
|
||||
}
|
||||
|
||||
public function setEndTimeAttribute($value)
|
||||
{
|
||||
$time = strtotime($value);
|
||||
$this->attributes['end_time'] = $time * 1000;
|
||||
}
|
||||
|
||||
public function getEndTimeAttribute($value)
|
||||
{
|
||||
return date('Y-m-d H:i:s', $value / 1000);
|
||||
}
|
||||
|
||||
public function getStatusAttribute($value)
|
||||
{
|
||||
$map = [
|
||||
-10 => '待发布/预览中',
|
||||
-5 => '未开始',
|
||||
1 => '跟团中',
|
||||
20 => '已结束',
|
||||
30 => '已删除',
|
||||
];
|
||||
|
||||
return $map[$value];
|
||||
}
|
||||
|
||||
public function shop()
|
||||
{
|
||||
return $this->hasOne(Shop::class, 'id', 'shop_id');
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ class CreateGroupsTable extends Migration
|
||||
$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->tinyInteger('status')->default(-10)->comment('团状态(-10:待发布/预览中,-5:未开始,1:跟团中,20:已结束,30:已删除');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
@ -36,6 +36,8 @@ class CreateGroupGoodsTable extends Migration
|
||||
$table->unsignedInteger('total_quantity')->default(0)->comment('总库存,最多100w');
|
||||
$table->integer('sort')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['group_id', 'sku_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
1
public/dist/css/chunk-288420ae.363cf34f.css
vendored
1
public/dist/css/chunk-288420ae.363cf34f.css
vendored
@ -1 +0,0 @@
|
||||
#nprogress{pointer-events:none}#nprogress .bar{background:#29d;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.width[data-v-60a78277]{transition:all .3s;opacity:0;width:0!important}.width1[data-v-60a78277]{transition:all .3s;opacity:1;width:200px!important}.el-container[data-v-60a78277]{height:100vh}.el-aside[data-v-60a78277]{background-color:#d3dce6;color:#333;overflow-x:hidden}.el-aside[data-v-60a78277]::-webkit-scrollbar{width:8px}.el-aside[data-v-60a78277]::-webkit-scrollbar-thumb{background-color:rgba(144,147,153,.3);border-radius:20px}.el-main[data-v-60a78277]{background-color:#f0f2f5;color:#333;padding:0 0!important}.el-main[data-v-60a78277]::-webkit-scrollbar{width:10px}.el-main[data-v-60a78277]::-webkit-scrollbar-thumb{background-color:rgba(144,147,153,.3)}.box-card[data-v-60a78277]{min-height:calc(100vh - 120px);margin:10px}.conent[data-v-60a78277]{width:100%;min-height:calc(100vh - 200px);position:relative}.add[data-v-60a78277]{cursor:pointer;font-size:25px;color:#606266}.head[data-v-60a78277]{padding:10px;background-color:#fff;border-bottom:1px solid #f6f6f6;box-shadow:0 1px 4px rgba(0,21,41,.08)}.head ul[data-v-60a78277]{display:flex;justify-content:space-between}.head ul li[data-v-60a78277]{display:flex;align-items:center}.head ul li .right[data-v-60a78277]{margin-left:20px}.head ul li .token[data-v-60a78277]{cursor:pointer}.el-aside[data-v-60a78277]{background:#282c34;box-shadow:2px 0 6px rgba(0,21,41,.35)}[data-v-60a78277] .el-menu{border:none}.el-menu-item[data-v-60a78277]:hover{outline:0!important;background:#5470c6!important;border-radius:5px!important}.el-menu-item.is-active[data-v-60a78277]{color:#fff!important;background:#5470c6!important;border-radius:5px!important}.el-menu-item-group__title[data-v-60a78277]{padding:0 0!important}
|
||||
1
public/dist/css/chunk-3ebcaff1.902ebb66.css
vendored
Normal file
1
public/dist/css/chunk-3ebcaff1.902ebb66.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
#nprogress{pointer-events:none}#nprogress .bar{background:#29d;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
||||
1
public/dist/css/chunk-4caed774.ad94328f.css
vendored
Normal file
1
public/dist/css/chunk-4caed774.ad94328f.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
#nprogress{pointer-events:none}#nprogress .bar{background:#29d;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.width[data-v-2333c1ea]{transition:all .3s;opacity:0;width:0!important}.width1[data-v-2333c1ea]{transition:all .3s;opacity:1;width:200px!important}.el-container[data-v-2333c1ea]{height:100vh}.el-aside[data-v-2333c1ea]{background-color:#d3dce6;color:#333;overflow-x:hidden}.el-aside[data-v-2333c1ea]::-webkit-scrollbar{width:8px}.el-aside[data-v-2333c1ea]::-webkit-scrollbar-thumb{background-color:rgba(144,147,153,.3);border-radius:20px}.el-main[data-v-2333c1ea]{background-color:#f0f2f5;color:#333;padding:0 0!important}.el-main[data-v-2333c1ea]::-webkit-scrollbar{width:10px}.el-main[data-v-2333c1ea]::-webkit-scrollbar-thumb{background-color:rgba(144,147,153,.3)}.box-card[data-v-2333c1ea]{min-height:calc(100vh - 120px);margin:10px}.conent[data-v-2333c1ea]{width:100%;min-height:calc(100vh - 200px);position:relative}.add[data-v-2333c1ea]{cursor:pointer;font-size:25px;color:#606266}.head[data-v-2333c1ea]{padding:10px;background-color:#fff;border-bottom:1px solid #f6f6f6;box-shadow:0 1px 4px rgba(0,21,41,.08)}.head ul[data-v-2333c1ea]{display:flex;justify-content:space-between}.head ul li[data-v-2333c1ea]{display:flex;align-items:center}.head ul li .right[data-v-2333c1ea]{margin-left:20px}.head ul li .token[data-v-2333c1ea]{cursor:pointer}.el-aside[data-v-2333c1ea]{background:#282c34;box-shadow:2px 0 6px rgba(0,21,41,.35)}[data-v-2333c1ea] .el-menu{border:none}.el-menu-item[data-v-2333c1ea]:hover{outline:0!important;background:#5470c6!important;border-radius:5px!important}.el-menu-item.is-active[data-v-2333c1ea]{color:#fff!important;background:#5470c6!important;border-radius:5px!important}.el-menu-item-group__title[data-v-2333c1ea]{padding:0 0!important}
|
||||
1
public/dist/css/chunk-5782cef6.902ebb66.css
vendored
Normal file
1
public/dist/css/chunk-5782cef6.902ebb66.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
#nprogress{pointer-events:none}#nprogress .bar{background:#29d;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
||||
1
public/dist/css/chunk-6995cb27.902ebb66.css
vendored
Normal file
1
public/dist/css/chunk-6995cb27.902ebb66.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
#nprogress{pointer-events:none}#nprogress .bar{background:#29d;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
||||
2
public/dist/index.html
vendored
2
public/dist/index.html
vendored
@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>erp</title><link href="css/chunk-0cbcaa56.e05858e7.css" rel="prefetch"><link href="css/chunk-10d9ee19.84a6683c.css" rel="prefetch"><link href="css/chunk-26daa808.62429343.css" rel="prefetch"><link href="css/chunk-288420ae.363cf34f.css" rel="prefetch"><link href="css/chunk-35db73ce.1f9c10ff.css" rel="prefetch"><link href="css/chunk-38b35ffa.1005fa16.css" rel="prefetch"><link href="css/chunk-4f15b41a.2cf53495.css" rel="prefetch"><link href="css/chunk-52fcdd7c.51e3ffbd.css" rel="prefetch"><link href="css/chunk-6ae0a0d3.84a02b23.css" rel="prefetch"><link href="css/chunk-75426f71.902ebb66.css" rel="prefetch"><link href="css/chunk-a3ddd952.902ebb66.css" rel="prefetch"><link href="css/chunk-e5a82016.e6531cef.css" rel="prefetch"><link href="css/chunk-f35dfe36.ea52b615.css" rel="prefetch"><link href="js/chunk-0cbcaa56.114d39a7.js" rel="prefetch"><link href="js/chunk-10d9ee19.a46bd74b.js" rel="prefetch"><link href="js/chunk-26daa808.81ee116f.js" rel="prefetch"><link href="js/chunk-288420ae.9af9438b.js" rel="prefetch"><link href="js/chunk-35db73ce.4d1abceb.js" rel="prefetch"><link href="js/chunk-38b35ffa.03231ad3.js" rel="prefetch"><link href="js/chunk-4f15b41a.059677d1.js" rel="prefetch"><link href="js/chunk-52fcdd7c.a84c5d80.js" rel="prefetch"><link href="js/chunk-63c1eac8.59f3df74.js" rel="prefetch"><link href="js/chunk-6ae0a0d3.d3308c16.js" rel="prefetch"><link href="js/chunk-75426f71.1a12b5c7.js" rel="prefetch"><link href="js/chunk-a3ddd952.7cfd6c27.js" rel="prefetch"><link href="js/chunk-e5a82016.5108e633.js" rel="prefetch"><link href="js/chunk-f35dfe36.683d24b3.js" rel="prefetch"><link href="css/app.6c30acd7.css" rel="preload" as="style"><link href="css/chunk-vendors.9181e156.css" rel="preload" as="style"><link href="js/app.a17cb104.js" rel="preload" as="script"><link href="js/chunk-vendors.13743003.js" rel="preload" as="script"><link href="css/chunk-vendors.9181e156.css" rel="stylesheet"><link href="css/app.6c30acd7.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but erp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.13743003.js"></script><script src="js/app.a17cb104.js"></script></body></html>
|
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>erp</title><link href="css/chunk-0cbcaa56.e05858e7.css" rel="prefetch"><link href="css/chunk-10d9ee19.84a6683c.css" rel="prefetch"><link href="css/chunk-20ee929b.902ebb66.css" rel="prefetch"><link href="css/chunk-26daa808.62429343.css" rel="prefetch"><link href="css/chunk-35db73ce.1f9c10ff.css" rel="prefetch"><link href="css/chunk-38b35ffa.1005fa16.css" rel="prefetch"><link href="css/chunk-3ebcaff1.902ebb66.css" rel="prefetch"><link href="css/chunk-4caed774.ad94328f.css" rel="prefetch"><link href="css/chunk-4f15b41a.2cf53495.css" rel="prefetch"><link href="css/chunk-52fcdd7c.51e3ffbd.css" rel="prefetch"><link href="css/chunk-5782cef6.902ebb66.css" rel="prefetch"><link href="css/chunk-6995cb27.902ebb66.css" rel="prefetch"><link href="css/chunk-6ae0a0d3.84a02b23.css" rel="prefetch"><link href="css/chunk-75426f71.902ebb66.css" rel="prefetch"><link href="css/chunk-e5a82016.e6531cef.css" rel="prefetch"><link href="css/chunk-f35dfe36.ea52b615.css" rel="prefetch"><link href="js/chunk-0cbcaa56.46e3dd42.js" rel="prefetch"><link href="js/chunk-10d9ee19.672076a8.js" rel="prefetch"><link href="js/chunk-20ee929b.66c18bf5.js" rel="prefetch"><link href="js/chunk-26daa808.a340b60b.js" rel="prefetch"><link href="js/chunk-35db73ce.e1ffc5fa.js" rel="prefetch"><link href="js/chunk-38b35ffa.6daa44bc.js" rel="prefetch"><link href="js/chunk-3ebcaff1.c0a7b78c.js" rel="prefetch"><link href="js/chunk-4caed774.92751344.js" rel="prefetch"><link href="js/chunk-4f15b41a.8943bdec.js" rel="prefetch"><link href="js/chunk-52fcdd7c.0f505f93.js" rel="prefetch"><link href="js/chunk-5782cef6.9a64eaec.js" rel="prefetch"><link href="js/chunk-63c1eac8.59f3df74.js" rel="prefetch"><link href="js/chunk-6995cb27.94c8f05b.js" rel="prefetch"><link href="js/chunk-6ae0a0d3.b08743d0.js" rel="prefetch"><link href="js/chunk-75426f71.1a12b5c7.js" rel="prefetch"><link href="js/chunk-e5a82016.5fa7963e.js" rel="prefetch"><link href="js/chunk-f35dfe36.e7038b09.js" rel="prefetch"><link href="css/app.6c30acd7.css" rel="preload" as="style"><link href="css/chunk-vendors.9181e156.css" rel="preload" as="style"><link href="js/app.135707da.js" rel="preload" as="script"><link href="js/chunk-vendors.13743003.js" rel="preload" as="script"><link href="css/chunk-vendors.9181e156.css" rel="stylesheet"><link href="css/app.6c30acd7.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but erp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.13743003.js"></script><script src="js/app.135707da.js"></script></body></html>
|
||||
2
public/dist/js/app.135707da.js
vendored
Normal file
2
public/dist/js/app.135707da.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/dist/js/app.135707da.js.map
vendored
Normal file
1
public/dist/js/app.135707da.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
public/dist/js/app.a17cb104.js
vendored
2
public/dist/js/app.a17cb104.js
vendored
File diff suppressed because one or more lines are too long
1
public/dist/js/app.a17cb104.js.map
vendored
1
public/dist/js/app.a17cb104.js.map
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-10d9ee19.672076a8.js.map
vendored
Normal file
1
public/dist/js/chunk-10d9ee19.672076a8.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
public/dist/js/chunk-20ee929b.66c18bf5.js
vendored
Normal file
4
public/dist/js/chunk-20ee929b.66c18bf5.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-20ee929b.66c18bf5.js.map
vendored
Normal file
1
public/dist/js/chunk-20ee929b.66c18bf5.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
public/dist/js/chunk-288420ae.9af9438b.js
vendored
4
public/dist/js/chunk-288420ae.9af9438b.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/dist/js/chunk-38b35ffa.03231ad3.js
vendored
2
public/dist/js/chunk-38b35ffa.03231ad3.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/dist/js/chunk-38b35ffa.6daa44bc.js
vendored
Normal file
2
public/dist/js/chunk-38b35ffa.6daa44bc.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-38b35ffa.6daa44bc.js.map
vendored
Normal file
1
public/dist/js/chunk-38b35ffa.6daa44bc.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
4
public/dist/js/chunk-3ebcaff1.c0a7b78c.js
vendored
Normal file
4
public/dist/js/chunk-3ebcaff1.c0a7b78c.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-3ebcaff1.c0a7b78c.js.map
vendored
Normal file
1
public/dist/js/chunk-3ebcaff1.c0a7b78c.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
4
public/dist/js/chunk-4caed774.92751344.js
vendored
Normal file
4
public/dist/js/chunk-4caed774.92751344.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-4caed774.92751344.js.map
vendored
Normal file
1
public/dist/js/chunk-4caed774.92751344.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-4f15b41a.8943bdec.js.map
vendored
Normal file
1
public/dist/js/chunk-4f15b41a.8943bdec.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
public/dist/js/chunk-5782cef6.9a64eaec.js
vendored
Normal file
4
public/dist/js/chunk-5782cef6.9a64eaec.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-5782cef6.9a64eaec.js.map
vendored
Normal file
1
public/dist/js/chunk-5782cef6.9a64eaec.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
9
resources/frontend/src/router/list.js
vendored
9
resources/frontend/src/router/list.js
vendored
@ -71,10 +71,15 @@ const list = [
|
||||
component: () => import("../views/group/group.vue"),
|
||||
},
|
||||
{
|
||||
path: "GROUP_ADD",
|
||||
name: "新增团购",
|
||||
path: "GROUP_GOODS_ADD",
|
||||
name: "团购商品新增",
|
||||
component: () => import("../views/group/addGroup.vue"),
|
||||
},
|
||||
{
|
||||
path: "GROUP_GOODS_EDIT",
|
||||
name: "团购商品修改",
|
||||
component: () => import("../views/group/editGroup.vue"),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<el-card style="margin-top: 10px" class="box-card">
|
||||
<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-select v-model="group.shop_id">
|
||||
<el-option v-for="store in stores" :key="store.id" :label="store.name" :value="store.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
@ -12,70 +12,82 @@
|
||||
<el-input type="textarea" v-model="group.title" style="width: 500px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="团购商品">
|
||||
<el-button @click="centerDialog()">从商品列表导入</el-button>
|
||||
<el-button @click="importGoods()">从商品列表导入</el-button>
|
||||
<el-input placeholder="搜索商品名称、编码" v-model="groupGoodsSearch.external_sku_id"
|
||||
style="margin-left: 20px; width: 400px;">
|
||||
<template slot="append" @click="groupGoodsList();">查询</template>
|
||||
<el-button slot="append" @click="getGroupGoodsList();">查询</el-button>
|
||||
</el-input>
|
||||
<div>
|
||||
<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 style="display: flex; align-items: center;">
|
||||
<span style="margin-right: 20px;">商品状态</span>
|
||||
<el-radio-group v-model="groupGoodsSearch.has_stock" @change="getGroupGoodsList()">
|
||||
<el-radio :label="2">全部</el-radio>
|
||||
<el-radio :label="1">在售中</el-radio>
|
||||
<el-radio :label="0">已售罄</el-radio>
|
||||
</el-radio-group>
|
||||
</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">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="margin-right: 20px;">商品分类</span>
|
||||
<el-radio-group v-model="groupGoodsSearch.type_id" size="small" @change="getGroupGoodsList()">
|
||||
<el-radio-button label="0">全部</el-radio-button>
|
||||
<el-radio-button v-for="goodsType in types" :key="goodsType.id" :label="goodsType.id">
|
||||
{{goodsType.name}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-table ref="multipleTableGroup" v-loading="groupLoading" :data="groupGoods.data" border
|
||||
style="width: 100%" height="800" :row-key="getRowKeys">
|
||||
<el-table-column type="selection" :reserve-selection="true" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序">
|
||||
<el-table-column label="排序">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.sort" placeholder="排序"
|
||||
@change="handleCellChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="商品名称">
|
||||
<el-table-column prop="goods_name" label=" 商品名称">
|
||||
</el-table-column>
|
||||
<el-table-column prop="code" label="编码">
|
||||
<el-table-column prop="external_sku_id" label="编码">
|
||||
</el-table-column>
|
||||
<el-table-column prop="category" label="分类">
|
||||
<el-table-column prop="category_name" label="分类">
|
||||
</el-table-column>
|
||||
<el-table-column prop="num" label="库存">
|
||||
<el-table-column prop="stock" label="库存">
|
||||
</el-table-column>
|
||||
<el-table-column prop="limit_buy" label="限购数量">
|
||||
<el-table-column label="限购数量">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.limit_buy" placeholder="限购数量"
|
||||
@change="handleCellChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="price" label="价格">
|
||||
<el-table-column label="价格">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.price_in_fen" placeholder="价格"
|
||||
@change="handleCellChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="options" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small">编辑</el-button>
|
||||
<el-button @click="setTop(scope.row)" type="text" size="small">置顶</el-button>
|
||||
<el-button type="text" size="small">设置限购</el-button>
|
||||
<el-button type="text" size="small">设置秒杀</el-button>
|
||||
<el-button type="text" size="small">删除</el-button>
|
||||
<!-- <el-button @click="setTop(scope.row)" type="text" size="small">置顶</el-button> -->
|
||||
<el-button @click="remove(scope.row)" type="text" size="small">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<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="groupGoodsList"
|
||||
:current-page.sync="groupGoods.meta.per_page" :page-sizes="[20, 30, 50, 100]"
|
||||
:page-size="groupGoods.meta.size" layout="sizes, prev, pager, next"
|
||||
<el-pagination @size-change="handleSizeChangeGroup" @current-change="getGroupGoodsList"
|
||||
:current-page.sync="groupGoods.meta.current_page" :page-sizes="[20, 30, 50, 100]"
|
||||
:page-size="groupGoods.meta.per_page" layout="sizes, prev, pager, next"
|
||||
:total="groupGoods.meta.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="团购时间" prop="datetimerange">
|
||||
<el-date-picker v-model="group.datetimerange" type="datetimerange" range-separator="至"
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
@change="setTime">
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</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 v-show="shopDisable" type="success" @click="onEdit();">修改团购</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
@ -100,15 +112,15 @@
|
||||
<el-input placeholder="搜索商品名称、编码" v-model="goodsList.goods_keyword" style="width: 400px;">
|
||||
</el-input>
|
||||
<el-radio-group v-model="goodsList.has_stock" style="margin: 0 30px">
|
||||
<el-radio label="1">有库存</el-radio>
|
||||
<el-radio label="0">全部</el-radio>
|
||||
<el-radio :label="1">有库存</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()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table ref="multipleTable" @select="handleSelect" v-loading="goodsLoading" :data="goods.data" border
|
||||
style="width: 100%" height="520" :row-key="getRowKeys">
|
||||
style="width: 100%" height="520" :row-key="getRowKeys" @select-all="selectCurrentGoods">
|
||||
<el-table-column type="selection" :reserve-selection="true" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
@ -126,10 +138,7 @@
|
||||
{{scope.row.goods.brand ? scope.row.goods.brand.name : ''}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.goods.type.name}}
|
||||
</template>
|
||||
<el-table-column prop="goods.type.name" label="分类">
|
||||
</el-table-column>
|
||||
<el-table-column prop="num" label="库存">
|
||||
</el-table-column>
|
||||
@ -160,20 +169,17 @@
|
||||
|
||||
<script>
|
||||
import { storeList } from "../../api/shop";
|
||||
import { addGroup, showGroup, editGroup, getGroupGoods, addGroupGoods } from "../../api/group";
|
||||
import { addGroup, addGroupGoods } from "../../api/group";
|
||||
import { goods_types, Brand_goods_types } from "../../api/rankingData";
|
||||
import { addGoods, getGoodsList } from "../../api/goods";
|
||||
import { getGoodsList } from "../../api/goods";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
group: {
|
||||
shop_id: '',
|
||||
status: "",
|
||||
title: "",
|
||||
start_time: "",
|
||||
end_time: "",
|
||||
is_save_preview: 1,
|
||||
datetimerange: []
|
||||
datetimerange: [],
|
||||
},
|
||||
rules: {
|
||||
shop_id: [
|
||||
@ -192,18 +198,14 @@ export default {
|
||||
total: 0,
|
||||
current_page: 1,
|
||||
per_page: 20,
|
||||
num: 0,
|
||||
on_num: 0,
|
||||
off_num: 0,
|
||||
},
|
||||
},
|
||||
groupGoodsSearch: {
|
||||
external_sku_id: "",
|
||||
status: 0,
|
||||
has_stock: 1,
|
||||
type_id: 0,
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
ids: [],
|
||||
group_id: 0
|
||||
},
|
||||
groupLoading: false,
|
||||
goodsLoading: true,
|
||||
@ -221,31 +223,24 @@ export default {
|
||||
brands: [],
|
||||
goodsList: {
|
||||
goods_keyword: "",
|
||||
has_stock: "1",
|
||||
has_stock: 1,
|
||||
type_id: 0,
|
||||
brand_id: 0,
|
||||
has_ids: [],
|
||||
},
|
||||
goodsListPage: {
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
},
|
||||
shopDisable: false,
|
||||
dialogTitle: "您的商品库中已有 0 件商品",
|
||||
selectNum: 0,
|
||||
selectGoods: [],
|
||||
allGoods: [],
|
||||
changeData: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getStoreList();
|
||||
let groupId = parseInt(this.$route.query.id);
|
||||
if (groupId) {
|
||||
this.groupGoodsSearch.group_id = groupId;
|
||||
this.shopDisable = true;
|
||||
this.getGoupInfo(this.$route.query.id);
|
||||
this.groupGoodsList();
|
||||
this.dialogTitle = "您的商品库中已有 " + this.groupGoods.meta.total + " 件商品";
|
||||
}
|
||||
this.getbrandType();
|
||||
this.getgoodsType();
|
||||
this.goodsSearch();
|
||||
@ -263,39 +258,50 @@ export default {
|
||||
},
|
||||
onAdd(is_save_preview) {
|
||||
this.group.is_save_preview = is_save_preview;
|
||||
this.group.new_ids = this.goodsList.has_ids;
|
||||
let changeData = [];
|
||||
this.changeData.forEach((v, k) => {
|
||||
if (v) {
|
||||
changeData.push(v);
|
||||
}
|
||||
})
|
||||
this.group.change_data = changeData;
|
||||
this.$refs.group.validate((valid) => {
|
||||
if (valid) {
|
||||
alert('submit!');
|
||||
addGroup(this.group).then((res) => {
|
||||
this.$message(res.data.message);
|
||||
this.$router.push({ path: "GROUP_MANAGEMENT"});
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
onEdit() {
|
||||
this.$refs.group.validate((valid) => {
|
||||
if (valid) {
|
||||
alert('edit!');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
setTop() {
|
||||
|
||||
},
|
||||
handleSizeChangeGroup(val) {
|
||||
this.groupGoodsSearch.per_page = val;
|
||||
this.groupGoodsList();
|
||||
this.getGroupGoodsList();
|
||||
},
|
||||
groupGoodsList(page = 1) {
|
||||
this.groupGoodsSearch.page = page;
|
||||
getGroupGoods(params).then((res) => {
|
||||
getGroupGoodsList(page = 1) {
|
||||
let params = {
|
||||
page: page,
|
||||
per_page: this.groupGoodsSearch.per_page,
|
||||
goods_keyword: this.groupGoodsSearch.external_sku_id,
|
||||
has_stock: this.groupGoodsSearch.has_stock,
|
||||
type_id: this.groupGoodsSearch.type_id,
|
||||
shop_id: this.group.shop_id,
|
||||
has_ids: this.goodsList.has_ids,
|
||||
};
|
||||
addGroupGoods(params).then((res) => {
|
||||
this.groupGoods = res.data;
|
||||
this.groupGoods.data.forEach((sku, index) => {
|
||||
if (undefined !== this.changeData[sku.id]) {
|
||||
this.groupGoods.data[index].sort = this.changeData[sku.id].sort;
|
||||
this.groupGoods.data[index].limit_buy = this.changeData[sku.id].limit_buy;
|
||||
this.groupGoods.data[index].price_in_fen = this.changeData[sku.id].price_in_fen;
|
||||
}
|
||||
})
|
||||
this.groupGoods.meta.per_page = parseInt(this.groupGoods.meta.per_page);
|
||||
})
|
||||
},
|
||||
getGoupInfo(id) {
|
||||
// showGroup(id).then((res) => {
|
||||
// })
|
||||
},
|
||||
getgoodsType() {
|
||||
let params = {
|
||||
@ -313,16 +319,37 @@ export default {
|
||||
this.brands = res.data.data;
|
||||
});
|
||||
},
|
||||
handleSelectionChangeGroup() {
|
||||
|
||||
batchRemove() {
|
||||
this.$refs.multipleTableGroup.selection.forEach((row) => {
|
||||
let index = this.goodsList.has_ids.indexOf(row.id);
|
||||
if (index > 0) {
|
||||
delete this.goodsList.has_ids[index];
|
||||
}
|
||||
})
|
||||
this.$refs.multipleTableGroup.clearSelection();
|
||||
this.getGroupGoodsList();
|
||||
},
|
||||
setTime(val) {
|
||||
this.group.start_time = val[0];
|
||||
this.group.end_time = val[1];
|
||||
remove(row) {
|
||||
this.goodsList.has_ids.forEach((v, k) => {
|
||||
if (v == row.id) {
|
||||
delete this.goodsList.has_ids[k];
|
||||
}
|
||||
})
|
||||
this.getGroupGoodsList();
|
||||
},
|
||||
handleCellChange(row) {
|
||||
this.changeData[row.id] = {
|
||||
id: row.id,
|
||||
sort: row.sort,
|
||||
limit_buy: row.limit_buy,
|
||||
price_in_fen: row.price_in_fen,
|
||||
};
|
||||
},
|
||||
// 从商品列表导入
|
||||
centerDialog() {
|
||||
importGoods() {
|
||||
if (this.group.shop_id) {
|
||||
this.dialogTitle = "您的商品库中已有 " + this.groupGoods.meta.total + " 件商品";
|
||||
this.goodsSearch();
|
||||
this.centerDialogVisible = true;
|
||||
} else {
|
||||
this.$message.error('请先选择店铺');
|
||||
@ -395,20 +422,45 @@ export default {
|
||||
this.goodsSearch();
|
||||
},
|
||||
addGoods() {
|
||||
let ids = [];
|
||||
let new_ids = [];
|
||||
this.selectGoods.forEach((v, k) => {
|
||||
if (k !== undefined) {
|
||||
ids.push(k)
|
||||
new_ids.push(k)
|
||||
}
|
||||
})
|
||||
let params = {
|
||||
group_id: this.groupGoodsSearch.group_id,
|
||||
shop_id: this.group.shop_id,
|
||||
ids: ids
|
||||
has_ids: this.goodsList.has_ids,
|
||||
new_ids: new_ids,
|
||||
per_page: this.groupGoods.meta.per_page
|
||||
}
|
||||
this.goodsList.has_ids.push(...new_ids);
|
||||
addGroupGoods(params).then((res) => {
|
||||
|
||||
this.groupGoods = res.data;
|
||||
this.groupGoods.meta.per_page = parseInt(this.groupGoods.meta.per_page);
|
||||
})
|
||||
this.$refs.goodsList.resetFields();
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
this.selectGoods = [];
|
||||
this.selectNum = 0;
|
||||
this.centerDialogVisible = false;
|
||||
},
|
||||
selectCurrentGoods(selection) {
|
||||
if (selection.length) {
|
||||
selection.forEach((row) => {
|
||||
if (undefined === this.selectGoods[row.id]) {
|
||||
this.selectGoods[row.id] = 1;
|
||||
}
|
||||
})
|
||||
this.selectNum += selection.length;
|
||||
} else {
|
||||
this.goods.data.forEach((row) => {
|
||||
if (undefined !== this.selectGoods[row.id]) {
|
||||
delete this.selectGoods[row.id];
|
||||
}
|
||||
})
|
||||
this.selectNum -= this.goods.data.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
469
resources/frontend/src/views/group/editGroup.vue
Normal file
469
resources/frontend/src/views/group/editGroup.vue
Normal file
@ -0,0 +1,469 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card style="margin-top: 10px" class="box-card">
|
||||
<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="true">
|
||||
<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="活动标题" 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="importGoods()">从商品列表导入</el-button>
|
||||
<el-input placeholder="搜索商品名称、编码" v-model="groupGoodsSearch.external_sku_id"
|
||||
style="margin-left: 20px; width: 400px;">
|
||||
<el-button slot="append" @click="getGroupGoodsList();">查询</el-button>
|
||||
</el-input>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="margin-right: 20px;">商品状态</span>
|
||||
<el-radio-group v-model="groupGoodsSearch.has_stock" @change="getGroupGoodsList()">
|
||||
<el-radio :label="0">全部</el-radio>
|
||||
<el-radio :label="1">在售中</el-radio>
|
||||
<el-radio :label="-1">已售罄</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="margin-right: 20px;">商品分类</span>
|
||||
<el-radio-group v-model="groupGoodsSearch.type_id" size="small" @change="getGroupGoodsList()">
|
||||
<el-radio-button label="0">全部</el-radio-button>
|
||||
<el-radio-button v-for="goodsType in types" :key="goodsType.id" :label="goodsType.id">
|
||||
{{goodsType.name}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-table ref="multipleTableGroup" v-loading="groupLoading" :data="groupGoods.data" border
|
||||
style="width: 100%" height="800" :row-key="getRowKeys">
|
||||
<el-table-column type="selection" :reserve-selection="true" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column label="排序">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.sort" placeholder="排序"
|
||||
@change="handleCellChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="goods_name" label=" 商品名称">
|
||||
</el-table-column>
|
||||
<el-table-column prop="external_sku_id" label="编码">
|
||||
</el-table-column>
|
||||
<el-table-column prop="category_name" label="分类">
|
||||
</el-table-column>
|
||||
<el-table-column prop="stock" label="库存">
|
||||
</el-table-column>
|
||||
<el-table-column label="限购数量">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.limit_buy" placeholder="限购数量"
|
||||
@change="handleCellChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.price_in_fen" placeholder="价格"
|
||||
@change="handleCellChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="options" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button @click="setTop(scope.row)" type="text" size="small">置顶</el-button> -->
|
||||
<el-button @click="remove(scope.row)" type="text" size="small">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<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="getGroupGoodsList"
|
||||
:current-page.sync="groupGoods.meta.current_page" :page-sizes="[20, 30, 50, 100]"
|
||||
:page-size="groupGoods.meta.per_page" layout="sizes, prev, pager, next"
|
||||
:total="groupGoods.meta.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="团购时间" prop="datetimerange">
|
||||
<el-date-picker v-model="group.datetimerange" type="datetimerange" range-separator="至"
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item style="display: flex; justify-content: flex-end;">
|
||||
<el-button type="success" @click="onEdit();">修改团购</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<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()">
|
||||
<el-radio-button label="0">全部</el-radio-button>
|
||||
<el-radio-button v-for="goodsType in types" :key="goodsType.id" :label="goodsType.id">
|
||||
{{goodsType.name}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品品牌" prop="brand_id">
|
||||
<el-radio-group v-model="goodsList.brand_id" size="small" @change="goodsSearch()">
|
||||
<el-radio-button label="0">全部</el-radio-button>
|
||||
<el-radio-button v-for="goodsBrand in brands" :key="goodsBrand.id" :label="goodsBrand.id">
|
||||
{{goodsBrand.name}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<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.has_stock" style="margin: 0 30px">
|
||||
<el-radio :label="1">有库存</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()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table ref="multipleTable" @select="handleSelect" v-loading="goodsLoading" :data="goods.data" border
|
||||
style="width: 100%" height="520" :row-key="getRowKeys" @select-all="selectCurrentGoods">
|
||||
<el-table-column type="selection" :reserve-selection="true" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.goods.title + ' ' + scope.row.title}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="编码">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.goods.goods_code + '_' + scope.row.sku_code}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.goods.brand ? scope.row.goods.brand.name : ''}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="goods.type.name" label="分类">
|
||||
</el-table-column>
|
||||
<el-table-column prop="num" label="库存">
|
||||
</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="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>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<div>
|
||||
<el-button @click="toggleSelection(1)">全选</el-button>
|
||||
<el-button @click="toggleSelection(0)">取消全选</el-button>
|
||||
</div>
|
||||
<div>已选 {{selectNum}} 件</div>
|
||||
<div>
|
||||
<el-button type="primary" @click="addGoods();">确 定</el-button>
|
||||
<el-button @click="centerDialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import { storeList } from "../../api/shop";
|
||||
import { showGroup, editGroup, getGroupGoods } from "../../api/group";
|
||||
import { goods_types, Brand_goods_types } from "../../api/rankingData";
|
||||
import { getGoodsList } from "../../api/goods";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
group: {
|
||||
shop_id: '',
|
||||
title: "",
|
||||
is_save_preview: 1,
|
||||
datetimerange: [],
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
},
|
||||
rules: {
|
||||
shop_id: [
|
||||
{ required: true, message: '请选择店铺' },
|
||||
],
|
||||
title: [
|
||||
{ required: true, message: '请输入活动标题', trigger: 'blur' },
|
||||
],
|
||||
datetimerange: [
|
||||
{ required: true, message: '请选择团购时间', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
groupGoods: {
|
||||
data: [],
|
||||
meta: {
|
||||
total: 0,
|
||||
current_page: 1,
|
||||
per_page: 20,
|
||||
},
|
||||
},
|
||||
groupGoodsSearch: {
|
||||
external_sku_id: "",
|
||||
has_stock: 1,
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
group_id: 0,
|
||||
delete_ids: [],
|
||||
new_ids: [],
|
||||
type_id: 0,
|
||||
},
|
||||
groupLoading: false,
|
||||
goodsLoading: true,
|
||||
goods: {
|
||||
data: [],
|
||||
meta: {
|
||||
total: 0,
|
||||
current_page: 1,
|
||||
per_page: 20,
|
||||
}
|
||||
},
|
||||
centerDialogVisible: false,
|
||||
stores: [],
|
||||
types: [],
|
||||
brands: [],
|
||||
goodsList: {
|
||||
goods_keyword: "",
|
||||
has_stock: 1,
|
||||
type_id: 0,
|
||||
brand_id: 0,
|
||||
delete_ids: [],
|
||||
new_ids: [],
|
||||
has_ids: [],
|
||||
},
|
||||
goodsListPage: {
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
},
|
||||
dialogTitle: "您的商品库中已有 0 件商品",
|
||||
selectNum: 0,
|
||||
selectGoods: [],
|
||||
deleteGoods: [],
|
||||
allGoods: [],
|
||||
changeData: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getStoreList();
|
||||
this.groupGoodsSearch.group_id = parseInt(this.$route.query.id);
|
||||
this.getGoupInfo(this.$route.query.id);
|
||||
this.getGroupGoodsList();
|
||||
this.getbrandType();
|
||||
this.getgoodsType();
|
||||
},
|
||||
methods: {
|
||||
getStoreList() {
|
||||
let params = {
|
||||
page: 0,
|
||||
per_page: 999,
|
||||
plat_id: 1
|
||||
};
|
||||
storeList(params).then((res) => {
|
||||
this.stores = res.data.data;
|
||||
});
|
||||
},
|
||||
onEdit() {
|
||||
this.group.new_ids = this.goodsList.has_ids;
|
||||
let changeData = [];
|
||||
this.changeData.forEach((v, k) => {
|
||||
if (v) {
|
||||
changeData.push(v);
|
||||
}
|
||||
})
|
||||
this.group.change_data = changeData;
|
||||
this.group.delete_ids = this.groupGoodsSearch.delete_ids;
|
||||
this.$refs.group.validate((valid) => {
|
||||
if (valid) {
|
||||
editGroup(this.groupGoodsSearch.group_id, this.group).then((res) => {
|
||||
this.$message(res.data.message);
|
||||
// this.$router.push({ path: "GROUP_MANAGEMENT" });
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleSizeChangeGroup(val) {
|
||||
this.groupGoodsSearch.per_page = val;
|
||||
this.getGroupGoodsList();
|
||||
},
|
||||
getGroupGoodsList(page = 1) {
|
||||
this.groupGoodsSearch.page = page;
|
||||
this.groupGoodsSearch.new_ids = this.goodsList.new_ids;
|
||||
getGroupGoods(this.groupGoodsSearch).then((res) => {
|
||||
this.groupGoods = res.data;
|
||||
this.groupGoods.data.forEach((sku, index) => {
|
||||
if (undefined !== this.changeData[sku.id]) {
|
||||
this.groupGoods.data[index].sort = this.changeData[sku.id].sort;
|
||||
this.groupGoods.data[index].limit_buy = this.changeData[sku.id].limit_buy;
|
||||
this.groupGoods.data[index].price_in_fen = this.changeData[sku.id].price_in_fen;
|
||||
}
|
||||
})
|
||||
this.groupGoods.meta.per_page = parseInt(this.groupGoods.meta.per_page);
|
||||
})
|
||||
},
|
||||
getGoupInfo(id) {
|
||||
showGroup(id).then((res) => {
|
||||
this.group = res.data.data;
|
||||
this.group.datetimerange = [this.group.start_time, this.group.end_time];
|
||||
})
|
||||
},
|
||||
getgoodsType() {
|
||||
let params = {
|
||||
per_page: 9999,
|
||||
};
|
||||
goods_types(params).then((res) => {
|
||||
this.types = res.data.data;
|
||||
});
|
||||
},
|
||||
getbrandType() {
|
||||
let params = {
|
||||
per_page: 9999,
|
||||
};
|
||||
Brand_goods_types(params).then((res) => {
|
||||
this.brands = res.data.data;
|
||||
});
|
||||
},
|
||||
batchRemove() {
|
||||
this.$refs.multipleTableGroup.selection.forEach((row) => {
|
||||
this.groupGoodsSearch.delete_ids.push(row.id);
|
||||
let index = this.goodsList.has_ids.indexOf(row.id);
|
||||
if (index > 0) {
|
||||
delete this.goodsList.has_ids[index];
|
||||
}
|
||||
})
|
||||
this.$refs.multipleTableGroup.clearSelection();
|
||||
this.getGroupGoodsList();
|
||||
},
|
||||
remove(row) {
|
||||
this.groupGoodsSearch.delete_ids.push(row.id);
|
||||
this.goodsList.has_ids.forEach((v, k) => {
|
||||
if (v == row.id) {
|
||||
delete this.goodsList.has_ids[k];
|
||||
}
|
||||
})
|
||||
this.getGroupGoodsList();
|
||||
},
|
||||
handleCellChange(row) {
|
||||
this.changeData[row.id] = {
|
||||
id: row.id,
|
||||
sort: row.sort,
|
||||
limit_buy: row.limit_buy,
|
||||
price_in_fen: row.price_in_fen,
|
||||
};
|
||||
},
|
||||
// 从商品列表导入
|
||||
importGoods() {
|
||||
if (this.group.shop_id) {
|
||||
this.dialogTitle = "您的商品库中已有 " + this.groupGoods.meta.total + " 件商品";
|
||||
this.goodsSearch();
|
||||
this.centerDialogVisible = true;
|
||||
} else {
|
||||
this.$message.error('请先选择店铺');
|
||||
}
|
||||
},
|
||||
goodsSearch(page = 1) {
|
||||
this.goodsList.page = page;
|
||||
this.goodsList.per_page = this.goodsListPage.per_page;
|
||||
this.goodsList.group_id = this.groupGoodsSearch.group_id;
|
||||
this.goodsList.delete_ids = this.groupGoodsSearch.delete_ids;
|
||||
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() {
|
||||
this.selectGoods.forEach((v, k) => {
|
||||
if (k !== undefined) {
|
||||
this.goodsList.new_ids.push(k)
|
||||
this.goodsList.has_ids.push(k)
|
||||
}
|
||||
})
|
||||
this.getGroupGoodsList();
|
||||
this.$refs.goodsList.resetFields();
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
this.selectGoods = [];
|
||||
this.selectNum = 0;
|
||||
this.centerDialogVisible = false;
|
||||
},
|
||||
selectCurrentGoods(selection) {
|
||||
if (selection.length) {
|
||||
selection.forEach((row) => {
|
||||
if (undefined === this.selectGoods[row.id]) {
|
||||
this.selectGoods[row.id] = 1;
|
||||
}
|
||||
})
|
||||
this.selectNum += selection.length;
|
||||
} else {
|
||||
this.goods.data.forEach((row) => {
|
||||
if (undefined !== this.selectGoods[row.id]) {
|
||||
delete this.selectGoods[row.id];
|
||||
}
|
||||
})
|
||||
this.selectNum -= this.goods.data.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -21,14 +21,14 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getGroupList();">查询</el-button>
|
||||
<el-button type="success" @click="groupSet(0);">新增团购</el-button>
|
||||
<el-button type="success" @click="groupAdd();">新增团购</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 10px" class="box-card">
|
||||
<el-table v-loading="loading" :data="tableData" border style="width: 100%">
|
||||
<el-table-column prop="shop_name" label="店铺">
|
||||
<el-table-column prop="shop.name" label="店铺">
|
||||
</el-table-column>
|
||||
<el-table-column prop="title" label="活动标题">
|
||||
</el-table-column>
|
||||
@ -48,8 +48,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="options" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="groupSet(scope.row.id)" type="text" size="small">查看</el-button>
|
||||
<el-button @click="groupSet(scope.row.id)" type="text" size="small">编辑</el-button>
|
||||
<el-button @click="groupEdit(scope.row.id)" type="text" size="small">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -96,9 +95,12 @@ export default {
|
||||
this.tableData = res.data.data;
|
||||
})
|
||||
},
|
||||
groupSet(id) {
|
||||
this.$router.push({ path: "GROUP_ADD", query: { id: id } });
|
||||
}
|
||||
groupAdd() {
|
||||
this.$router.push({ path: "GROUP_GOODS_ADD", query: { id: 0 } });
|
||||
},
|
||||
groupEdit(id) {
|
||||
this.$router.push({ path: "GROUP_GOODS_EDIT", query: { id: id } });
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
4
resources/frontend/vue.config.js
vendored
4
resources/frontend/vue.config.js
vendored
@ -11,8 +11,8 @@ module.exports = {
|
||||
proxy: {
|
||||
// 配置代理
|
||||
"/api": {
|
||||
target: "http://172.21.77.221:81",
|
||||
// target: "http://erp.chutang66.com",
|
||||
// target: "http://172.23.134.136:81",
|
||||
target: "http://erp.chutang66.com",
|
||||
changeOrigin: true, // 开启代理
|
||||
pathRewrite: {
|
||||
// 重命名
|
||||
|
||||
@ -49,7 +49,7 @@ 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::resource('group', 'Group\GroupsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
|
||||
});
|
||||
// 登录
|
||||
Route::post('/auth/login', [LoginController::class, 'login'])->name('auth.login');
|
||||
@ -62,11 +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::post('groupGoods', [GroupsController::class, 'addGroupGoods'])->name('group.add_goods')->middleware('auth:api');
|
||||
Route::get('addGoods', [GroupsController::class, 'addGoods'])->name('group.add_goods')->middleware('auth:api');
|
||||
Route::resource('group', 'Group\GroupsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
|
||||
|
||||
// 妙选商城数据推送
|
||||
Route::post('business', [ShopsController::class, 'business'])->name('shop.put.business');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user