!114 团购修改

Merge pull request !114 from 赵世界/develop
This commit is contained in:
赵世界 2022-10-25 05:59:55 +00:00 committed by Gitee
commit a66255ec5b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
46 changed files with 302 additions and 227 deletions

View File

@ -40,7 +40,7 @@ class KttOrderQuery extends Command
*/
public function handle()
{
$shops = Shop::query()->where('plat_id', 1)->where('status', 1)->get();
$shops = Shop::query()->where('plat_id', Shop::$PLAT_KTT)->where('status', Shop::$STATUS_AUTHORIZED)->get();
$endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 60000;
foreach ($shops as $shop) {

View File

@ -44,7 +44,7 @@ class Swoole extends Command
public function handle()
{
Timer::tick(3000, function () {
$shops = Shop::query()->where('plat_id', 1)->where('status', 1)->get();
$shops = Shop::query()->where('plat_id', Shop::$PLAT_KTT)->where('status', Shop::$STATUS_AUTHORIZED)->get();
$endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 3000;
foreach ($shops as $shop) {

View File

@ -8,21 +8,14 @@ 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\Models\Shop;
use App\Utils\ArrayUtils;
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
{
@ -34,9 +27,13 @@ class GroupsController extends Controller
public function index(Request $request)
{
$groups = Groups::query()
->filter()
->with(['shop:id,name'])
->where('parent_id', 0)
->filter()
->paginate($request->get('per_page'));
foreach ($groups as &$group) {
$group['children'] = Groups::query()->with(['shop:id,name'])->where('parent_id', $group->id)->get();
}
return GroupsResource::collection($groups);
}
@ -59,19 +56,34 @@ class GroupsController extends Controller
->toArray();
$changeData = $request->change_data;
$changeData = ArrayUtils::index($changeData, 'id');
$shop = Shop::query()->find($request->shop_id);
DB::beginTransaction();
$shopIds = Shop::query()
->where('plat_id', Shop::$PLAT_KTT)
->where('expires_at', '>', time())
->pluck('id')
->toArray();
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();
$shopGroups = [];
foreach ($shopIds as $shopId) {
$shopGroups[] = [
'parent_id' => $group->id,
'shop_id' => $shopId,
'title' => $group->title,
'is_save_preview' => $group->is_save_preview,
'start_time' => strtotime($request->datetimerange[0]) * 1000,
'end_time' => strtotime($request->datetimerange[1]) * 1000,
];
}
(new Groups())->batchInsert($shopGroups);
$groupGoods = [];
foreach ($skus as $sku) {
$price = $shop['ratio'] * $sku['cost'] * 100;
$price = $sku['cost'] * 100;
$groupGoods[] = [
'group_id' => $group->id,
'category_name' => $sku['goods']['type']['name'],
@ -81,7 +93,6 @@ class GroupsController extends Controller
'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'],
];
}
@ -102,6 +113,7 @@ class GroupsController extends Controller
public function show($id)
{
return new GroupsResource(Groups::query()
->where('parent_id', 0)
->find($id));
}
@ -114,15 +126,15 @@ class GroupsController extends Controller
return response($this->res, $this->res['httpCode']);
}
$shop = Shop::query()->find($request->shop_id);
$shop['ratio'] = 1;
$deleteIds = $request->delete_ids;
$ids = GroupGoods::query()
$groupHasGoods = GroupGoods::query()
->where('group_id', $id)
->whereNotIn('sku_id', $deleteIds)
->pluck('sku_id')->toArray();
->get(['id', 'sku_id', 'limit_buy', 'price_in_fen'])
->toArray();
$groupHasGoods = ArrayUtils::index($groupHasGoods, 'sku_id');
$skus = GoodsSku::query()
->whereIn('id', array_merge($ids, $request->new_ids))
->whereIn('id', array_merge(array_keys($groupHasGoods), $request->new_ids))
->with(['goods' => function ($query) {
$query->with(['type:id,name', 'brand:id,name']);
}])
@ -133,20 +145,28 @@ class GroupsController extends Controller
DB::beginTransaction();
try {
$group = Groups::query()->find($id);
$group->title = $request->title;
$group->start_time = $request->datetimerange[0];
$group->end_time = $request->datetimerange[1];
$group->save();
DB::table('groups')
->where('parent_id', $group->id)
->update([
'title' => $group->title,
'start_time' => strtotime($request->datetimerange[0]) * 1000,
'end_time' => strtotime($request->datetimerange[1]) * 1000,
]);
GroupGoods::where('group_id', $id)->whereIn('sku_id', $deleteIds)->delete();
foreach ($skus as $sku) {
$price = $shop['ratio'] * $sku['cost'] * 100;
$limitBuy = isset($groupHasGoods[$sku['id']]) ? $groupHasGoods[$sku['id']]['limit_buy'] : 0;
$price = isset($groupHasGoods[$sku['id']]) ? $groupHasGoods[$sku['id']]['price_in_fen'] : $sku['cost'];
$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,
'limit_buy' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['limit_buy'] : $limitBuy,
'price_in_fen' => isset($changeData[$sku['id']]) ? $changeData[$sku['id']]['price_in_fen'] * 100 : $price * 100,
'external_sku_id' => $sku['goods']['goods_code'] . '_' . $sku['sku_code'],
];
GroupGoods::updateOrCreate(
@ -174,12 +194,10 @@ class GroupsController extends Controller
public function getGoods(Request $request)
{
$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'])
->select(['id', 'sku_id', 'limit_buy', 'price_in_fen'])
->where('group_id', $groupId)
->whereNotIn('sku_id', $deleteIds)
->get()
@ -237,11 +255,9 @@ class GroupsController extends Controller
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['price_in_fen'] = $goodsSku['cost'];
$goodsSku['limit_buy'] = 0;
}
$goodsSku['goods_name'] = $goodsSku['goods']['title'] . ' ' . $goodsSku['title'];
@ -254,8 +270,6 @@ class GroupsController extends Controller
public function addGroupGoods(Request $request)
{
$shop = Shop::query()->find($request->get('shop_id'));
$shop['ratio'] = 1;
$ids = [];
if ($newIds = $request->get('new_ids')) {
$ids = array_merge($ids, $newIds);
@ -271,8 +285,7 @@ class GroupsController extends Controller
->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['price_in_fen'] = $goodsSku['cost'];
$goodsSku['limit_buy'] = 0;
$goodsSku['goods_name'] = $goodsSku['goods']['title'] . ' ' . $goodsSku['title'];
$goodsSku['external_sku_id'] = $goodsSku['goods']['goods_code'] . '_' . $goodsSku['sku_code'];

View File

@ -40,13 +40,18 @@ class ShopsController extends Controller
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:191|unique:shops,name',
'plat_id' => 'required|integer',
'ratio' => 'required|numeric',
'ratio' => 'required',
]);
if ($validator->fails()) {
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
return response($this->res, $this->res['httpCode']);
}
$operator = substr($request->ratio, 0, 1);
if (!in_array($operator, ['+', '-', '*', '/'])) {
$this->res->errorMessage = '运算符号仅允许+,-,*,/';
return response($this->res, $this->res['httpCode']);
}
$shop = new Shop();
$shop->name = $request->name;
$shop->plat_id = $request->plat_id;
@ -61,6 +66,11 @@ class ShopsController extends Controller
public function update(Request $request, $id)
{
$operator = substr($request->ratio, 0, 1);
if (!in_array($operator, ['+', '-', '*', '/'])) {
$this->res->errorMessage = '运算符号仅允许+,-,*,/';
return response($this->res, $this->res['httpCode']);
}
$shop = Shop::query()->find($id);
$shop->ratio = $request->ratio;
$shop->save();

View File

@ -25,7 +25,6 @@ class GroupsRequest extends FormRequest
public function rules()
{
return [
'shop_id' => ['required', 'integer', 'exists:shops,id'],
'title' => ['required', 'string'],
'datetimerange' => ['required', 'array'],
'is_save_preview' => ['required', 'integer'],

View File

@ -0,0 +1,42 @@
<?php
namespace App\Jobs;
use App\Models\Shop;
use App\Services\Business\BusinessFactory;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class KttQueryGroupStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $groupId;
public $shopId;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($groupId, $shopId)
{
$this->groupId = $groupId;
$this->shopId = $shopId;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$shop = Shop::query()->find($this->shopId);
$client = BusinessFactory::init()->make($shop['plat_id'])->setShop($shop);
$client->queryGroupStatus($this->groupId);
}
}

View File

@ -3,12 +3,16 @@
namespace App\Listeners;
use App\Events\GroupSetEvent;
use App\Models\Groups;
use App\Models\Shop;
use App\Services\Business\BusinessFactory;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Jobs\KttQueryGroupStatus;
class GroupQueryListener
class GroupQueryListener implements ShouldQueue
{
use InteractsWithQueue;
/**
* Create the event listener.
*
@ -27,11 +31,15 @@ class GroupQueryListener
*/
public function handle(GroupSetEvent $event)
{
$shopId = Groups::query()->where('id', $event->groupId)->value('shop_id');
$shop = Shop::query()->find($shopId);
$client = BusinessFactory::init()->make($shop['plat_id'])->setShop($shop);
$shops = Shop::query()
->where('plat_id', Shop::$PLAT_KTT)
->where('expires_at', '>', time())
->get(['id', 'plat_id'])
->toArray();
foreach ($shops as $shop) {
$client = BusinessFactory::init()->make($shop['plat_id'])->setShopWithId($shop['id']);
$client->createGroup($event->groupId);
sleep(1);
$client->queryGroupStatus($event->groupId);
KttQueryGroupStatus::dispatch($event->groupId, $shop['id'])->delay(5);
}
}
}

View File

@ -29,7 +29,7 @@ class StockUpdateListener
*/
public function handle(StockUpdateEvent $event)
{
$shops = Shop::query()->whereNotIn('status', [0, 3])->get(['id', 'plat_id']);
$shops = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP])->get(['id', 'plat_id']);
if (empty($shops)) {
return;
}

View File

@ -49,7 +49,7 @@ class UpdateBusinessGoodsStock implements ShouldQueue
if ('下架' === $event->goodsSku->status) {
return;
}
$builder = Shop::query()->whereNotIn('status', [0, 3]);
$builder = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP]);
// 非订单影响库存变更,只更新本店铺下商品
if (!isset($event->businessGoods['business_order_id'])) {
$builder->where('id', $event->businessGoods['shop_id']);

View File

@ -30,7 +30,7 @@ class GroupGoods extends Model
public function getPriceInFenAttribute($value)
{
return round($value / 100, 2);
return $value / 100;
}
public function goods()

View File

@ -50,6 +50,17 @@ class Groups extends Model
return $map[$value];
}
public function getCreateStatusAttribute($value)
{
$map = [
1 => '创建成功',
2 => '创建失败',
3 => '创建中',
];
return $map[$value];
}
public function shop()
{
return $this->hasOne(Shop::class, 'id', 'shop_id');

View File

@ -9,6 +9,14 @@ class Shop extends Model
{
use Filter;
public static $PLAT_KTT = 1;
public static $PLAT_MX = 0;
public static $STATUS_UNAUTHORIZED = 0;
public static $STATUS_AUTHORIZED = 1;
public static $STATUS_NO_AUTHORIZED = 2;
public static $STATUS_STOP = 3;
//查询字段
public $fieldSearchable = [
'plat_id',

View File

@ -8,25 +8,44 @@ use App\Utils\DateTimeUtils;
class Groups
{
public static function createGroup($localGroupId)
public static function createGroup($localGroupId, $shop)
{
$type = 'pdd.ktt.group.create';
$group = GroupsModel::query()->find($localGroupId);
$group = GroupsModel::query()->where('parent_id', $localGroupId)->where('shop_id', $shop->id)->first();
$groupGoods = GroupGoods::query()
->where('group_id', $group->id)
->where('group_id', $group->parent_id)
->with(['goodsSku:id,stock'])
->orderBy('sort')
->get();
$goodsSkus = [];
$operator = substr($shop->ratio, 0, 1);
$ratio = (float)trim(substr($shop->ratio, 1));
foreach ($groupGoods as $item) {
$priceInFen = $item['price_in_fen']; // 常规数值
switch ($operator) {
case '+':
$priceInFen += $ratio;
break;
case '-':
$priceInFen -= $ratio;
break;
case '*':
$priceInFen *= $ratio;
break;
case '/':
$priceInFen /= $ratio;
break;
}
$priceInFen *= 100;
$goodsSkus[] = [
'category_name' => $item['category_name'],
'goods_desc' => $item['goods_desc'] ?: $group['title'],
'goods_desc' => $item['goods_name'],
'goods_name' => $item['goods_name'],
'limit_buy' => $item['limit_buy'],
'market_price' => $item['market_price'],
'market_price' => $priceInFen ?: 10000,
'sku_list' => [[
'external_sku_id' => $item['external_sku_id'],
'price_in_fen' => $item['price_in_fen'],
'price_in_fen' => $priceInFen ?: 10000,
'quantity_type' => 0,
'spec_id_list' => [],
'total_quantity' => $item['goodsSku']['stock'],
@ -44,10 +63,10 @@ class Groups
return [$type, $appendParams];
}
public static function queryGroupStatus($localGroupId)
public static function queryGroupStatus($localGroupId, $shopId)
{
$type = 'pdd.ktt.group.query.status';
$group = GroupsModel::query()->find($localGroupId);
$group = GroupsModel::query()->where('parent_id', $localGroupId)->where('shop_id', $shopId)->first();
$appendParams = [
'activity_no' => $group->activity_no
];

View File

@ -164,10 +164,10 @@ class KuaiTuanTuan extends BusinessClient
public function createGroup($localGroupId)
{
[$type, $appendParams] = Groups::createGroup($localGroupId);
[$type, $appendParams] = Groups::createGroup($localGroupId, $this->shop);
$res = $this->doRequest($type, $appendParams);
if (isset($res['response']['success'])) {
$group = GroupsModel::query()->find($localGroupId);
$group = GroupsModel::query()->where('parent_id', $localGroupId)->where('shop_id', $this->shop->id)->first();
$group->activity_no = $res['response']['activity_no'];
$group->save();
}
@ -177,23 +177,27 @@ class KuaiTuanTuan extends BusinessClient
public function queryGroupStatus($localGroupId)
{
[$type, $appendParams] = Groups::queryGroupStatus($localGroupId);
[$type, $appendParams] = Groups::queryGroupStatus($localGroupId, $this->shop->id);
$res = $this->doRequest($type, $appendParams);
if (isset($res['response'])) {
$group = GroupsModel::query()->find($localGroupId);
$group->error_msg = $res['response']['error_msg'];
$group = GroupsModel::query()->where('parent_id', $localGroupId)->where('shop_id', $this->shop->id)->first();
$group->create_status = $res['response']['status'];
if (1 === $res['response']['status']) {
$group->qr_code_url = $res['response']['qr_code_url'];
$group->status = $res['response']['status'];
$group->save();
foreach ($res['response']['goods_list'] as $goods) {
$groupGoods = GroupGoods::query()
->where('group_id', $localGroupId)
->where('external_sku_id', $goods['external_sku_id'])
->find();
$groupGoods->erp_goods_id = $goods['goods_id'];
$groupGoods->erp_sku_id = $goods['sku_list'][0]['sku_id'];
$groupGoods->save();
// foreach ($res['response']['goods_list'] as $goods) {
// $groupGoods = GroupGoods::query()
// ->where('group_id', $localGroupId)
// ->where('external_sku_id', $goods['sku_list'][0]['external_sku_id'])
// ->first();
// $groupGoods->ktt_goods_id = $goods['goods_id'];
// $groupGoods->ktt_sku_id = $goods['sku_list'][0]['sku_id'];
// $groupGoods->save();
// }
}
if (2 === $res['response']['status']) {
$group->error_msg = $res['response']['error_msg'];
}
$group->save();
}
return $res;
@ -202,7 +206,18 @@ class KuaiTuanTuan extends BusinessClient
public function queryGroup()
{
[$type, $appendParams] = Groups::queryGroup();
$res = $this->doRequest($type, $appendParams);
if (isset($res['ktt_group_query_list_response'])) {
foreach ($res['ktt_group_query_list_response']['activity_list'] as $activity) {
$group = GroupsModel::query()->where('activity_no', $activity['activity_no'])->first();
if ($group) {
$group->is_help_sell = $activity[''];
$group->status = $activity[''];
$group->save();
}
}
}
return $this->doRequest($type, $appendParams);
return $res;
}
}

View File

@ -27,6 +27,7 @@ class CreateGoodsSkusTable extends Migration
$table->unsignedInteger('yesterday_num')->default(0)->comment('1天前库存');
$table->unsignedDecimal('reference_price')->default(0)->comment('参考售价');
$table->unsignedInteger('reserve')->default(0)->comment('预留量');
$table->text('thumb_url')->nullable()->comment('sku图url');
$table->timestamps();
// 索引
$table->unique(['goods_id', 'sku_code']);

View File

@ -29,7 +29,7 @@ class CreateShopsTable extends Migration
$table->text('scope')->nullable()->comment('接口列表');
$table->text('pop_auth_token_create_response')->nullable()->comment('授权认证信息');
$table->unsignedTinyInteger('status')->index()->default(0)->comment('状态');
$table->decimal('ratio')->default(1)->comment('成本倍率');
$table->string('ratio')->default('*1')->comment('成本变动');
$table->softDeletes();
$table->timestamps();
//索引

View File

@ -16,7 +16,8 @@ class CreateGroupsTable extends Migration
Schema::defaultStringLength(191);
Schema::create('groups', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('shop_id');
$table->unsignedInteger('shop_id')->default(0);
$table->unsignedInteger('parent_id')->default(0);
$table->unsignedBigInteger('end_time');
$table->unsignedTinyInteger('is_save_preview')->comment('是否保存为预览团0-不为预览团,1-预览团');
$table->unsignedBigInteger('start_time');

View File

@ -22,12 +22,12 @@ class CreateGroupGoodsTable extends Migration
$table->string('goods_desc')->nullable();
$table->string('goods_name');
$table->unsignedBigInteger('goods_id');
$table->unsignedInteger('ktt_goods_id');
$table->unsignedBigInteger('ktt_goods_id')->nullable();
$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->unsignedBigInteger('ktt_sku_id')->nullable();
$table->string('external_sku_id');
$table->unsignedBigInteger('price_in_fen');
$table->unsignedTinyInteger('quantity_type')->default(0)->comment('库存类型0-普通 1-无限无限库存时会无视total_quantity字段');

View File

@ -1 +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)}}a[data-v-538fe600]{text-decoration:none;color:#fff}.block[data-v-538fe600]{margin-top:20px}
#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)}}a[data-v-1cc99200]{text-decoration:none;color:#fff}.block[data-v-1cc99200]{margin-top:20px}

View File

@ -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-20c83087.d0b599f3.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-f35dfe36.ea52b615.css" rel="prefetch"><link href="js/chunk-0cbcaa56.46e3dd42.js" rel="prefetch"><link href="js/chunk-10d9ee19.6bc719ae.js" rel="prefetch"><link href="js/chunk-20c83087.a3787c22.js" rel="prefetch"><link href="js/chunk-20ee929b.97f64c98.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.b3f1815c.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.379f5198.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-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.7287a242.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.7287a242.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-088acbde.902ebb66.css" rel="prefetch"><link href="css/chunk-0cbcaa56.e05858e7.css" rel="prefetch"><link href="css/chunk-0f6f9608.b3153d73.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-35db73ce.1f9c10ff.css" rel="prefetch"><link href="css/chunk-38b35ffa.1005fa16.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-6ae0a0d3.84a02b23.css" rel="prefetch"><link href="css/chunk-75426f71.902ebb66.css" rel="prefetch"><link href="css/chunk-904e5abc.902ebb66.css" rel="prefetch"><link href="css/chunk-a3ddd952.902ebb66.css" rel="prefetch"><link href="css/chunk-e35186f0.902ebb66.css" rel="prefetch"><link href="css/chunk-f35dfe36.ea52b615.css" rel="prefetch"><link href="js/chunk-088acbde.46503dcc.js" rel="prefetch"><link href="js/chunk-0cbcaa56.46e3dd42.js" rel="prefetch"><link href="js/chunk-0f6f9608.540fa080.js" rel="prefetch"><link href="js/chunk-10d9ee19.6bc719ae.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-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-63c1eac8.59f3df74.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-904e5abc.3cea2bdf.js" rel="prefetch"><link href="js/chunk-a3ddd952.dc1ed0be.js" rel="prefetch"><link href="js/chunk-e35186f0.efed2a2b.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.d5be9b64.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.d5be9b64.js"></script></body></html>

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

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

View File

@ -2,12 +2,6 @@
<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">
<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>
@ -30,19 +24,19 @@
<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>
{{ 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="排序">
<!-- <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> -->
<el-table-column prop="goods_name" label=" 商品名称">
</el-table-column>
<el-table-column prop="external_sku_id" label="编码">
@ -57,9 +51,9 @@
@change="handleCellChange(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column label="价格">
<el-table-column label="成本">
<template slot-scope="scope">
<el-input v-model="scope.row.price_in_fen" placeholder="价格"
<el-input v-model="scope.row.price_in_fen" placeholder="成本"
@change="handleCellChange(scope.row)"></el-input>
</template>
</el-table-column>
@ -98,14 +92,14 @@
<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>
{{ 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>
{{ goodsBrand.name }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="搜索" prop="goods_keyword">
@ -125,17 +119,17 @@
</el-table-column>
<el-table-column label="商品信息">
<template slot-scope="scope">
{{scope.row.goods.title + ' ' + scope.row.title}}
{{ 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}}
{{ 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 : ''}}
{{ scope.row.goods.brand ? scope.row.goods.brand.name : '' }}
</template>
</el-table-column>
<el-table-column prop="goods.type.name" label="分类">
@ -155,7 +149,7 @@
<el-button @click="toggleSelection(1)">全选</el-button>
<el-button @click="toggleSelection(0)">取消全选</el-button>
</div>
<div>已选 {{selectNum}} </div>
<div>已选 {{ selectNum }} </div>
<div>
<el-button type="primary" @click="addGoods();"> </el-button>
<el-button @click="centerDialogVisible = false"> </el-button>
@ -168,7 +162,6 @@
<script>
import { storeList } from "../../api/shop";
import { addGroup, addGroupGoods } from "../../api/group";
import { goods_types, Brand_goods_types } from "../../api/rankingData";
import { getGoodsList } from "../../api/goods";
@ -176,15 +169,11 @@ export default {
data() {
return {
group: {
shop_id: '',
title: "",
is_save_preview: 1,
datetimerange: [],
},
rules: {
shop_id: [
{ required: true, message: '请选择店铺' },
],
title: [
{ required: true, message: '请输入活动标题', trigger: 'blur' },
],
@ -202,7 +191,7 @@ export default {
},
groupGoodsSearch: {
external_sku_id: "",
has_stock: 1,
has_stock: 2,
type_id: 0,
page: 1,
per_page: 20,
@ -218,7 +207,6 @@ export default {
}
},
centerDialogVisible: false,
stores: [],
types: [],
brands: [],
goodsList: {
@ -240,22 +228,11 @@ export default {
}
},
mounted() {
this.getStoreList();
this.getbrandType();
this.getgoodsType();
this.goodsSearch();
},
methods: {
getStoreList() {
let params = {
page: 0,
per_page: 999,
plat_id: 1
};
storeList(params).then((res) => {
this.stores = res.data.data;
});
},
onAdd(is_save_preview) {
this.group.is_save_preview = is_save_preview;
this.group.new_ids = this.goodsList.has_ids;
@ -268,9 +245,16 @@ export default {
this.group.change_data = changeData;
this.$refs.group.validate((valid) => {
if (valid) {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
addGroup(this.group).then((res) => {
loading.close();
this.$message(res.data.message);
this.$router.push({ path: "GROUP_MANAGEMENT"});
this.$router.push({ path: "GROUP_MANAGEMENT" });
})
} else {
return false;
@ -288,14 +272,13 @@ export default {
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].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;
}
@ -340,20 +323,16 @@ export default {
handleCellChange(row) {
this.changeData[row.id] = {
id: row.id,
sort: row.sort,
// 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;
@ -429,7 +408,6 @@ export default {
}
})
let params = {
shop_id: this.group.shop_id,
has_ids: this.goodsList.has_ids,
new_ids: new_ids,
per_page: this.groupGoods.meta.per_page

View File

@ -2,12 +2,6 @@
<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>
@ -30,19 +24,19 @@
<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>
{{ 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="排序">
<!-- <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> -->
<el-table-column prop="goods_name" label=" 商品名称">
</el-table-column>
<el-table-column prop="external_sku_id" label="编码">
@ -97,14 +91,14 @@
<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>
{{ 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>
{{ goodsBrand.name }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="搜索" prop="goods_keyword">
@ -124,17 +118,17 @@
</el-table-column>
<el-table-column label="商品信息">
<template slot-scope="scope">
{{scope.row.goods.title + ' ' + scope.row.title}}
{{ 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}}
{{ 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 : ''}}
{{ scope.row.goods.brand ? scope.row.goods.brand.name : '' }}
</template>
</el-table-column>
<el-table-column prop="goods.type.name" label="分类">
@ -154,7 +148,7 @@
<el-button @click="toggleSelection(1)">全选</el-button>
<el-button @click="toggleSelection(0)">取消全选</el-button>
</div>
<div>已选 {{selectNum}} </div>
<div>已选 {{ selectNum }} </div>
<div>
<el-button type="primary" @click="addGoods();"> </el-button>
<el-button @click="centerDialogVisible = false"> </el-button>
@ -167,7 +161,6 @@
<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";
@ -175,7 +168,6 @@ export default {
data() {
return {
group: {
shop_id: '',
title: "",
is_save_preview: 1,
datetimerange: [],
@ -183,9 +175,6 @@ export default {
end_time: ''
},
rules: {
shop_id: [
{ required: true, message: '请选择店铺' },
],
title: [
{ required: true, message: '请输入活动标题', trigger: 'blur' },
],
@ -203,7 +192,7 @@ export default {
},
groupGoodsSearch: {
external_sku_id: "",
has_stock: 1,
has_stock: 0,
page: 1,
per_page: 20,
group_id: 0,
@ -222,7 +211,6 @@ export default {
}
},
centerDialogVisible: false,
stores: [],
types: [],
brands: [],
goodsList: {
@ -247,7 +235,6 @@ export default {
}
},
mounted() {
this.getStoreList();
this.groupGoodsSearch.group_id = parseInt(this.$route.query.id);
this.getGoupInfo(this.$route.query.id);
this.getGroupGoodsList();
@ -255,16 +242,6 @@ export default {
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 = [];
@ -277,9 +254,16 @@ export default {
this.group.delete_ids = this.groupGoodsSearch.delete_ids;
this.$refs.group.validate((valid) => {
if (valid) {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
editGroup(this.groupGoodsSearch.group_id, this.group).then((res) => {
loading.close();
this.$message(res.data.message);
// this.$router.push({ path: "GROUP_MANAGEMENT" });
this.$router.push({ path: "GROUP_MANAGEMENT" });
})
} else {
return false;
@ -297,7 +281,7 @@ export default {
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].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;
}
@ -307,8 +291,13 @@ export default {
},
getGoupInfo(id) {
showGroup(id).then((res) => {
if (undefined === res.data.data.id) {
this.$message.error('不可编辑!!!');
this.$router.push({ path: "GROUP_MANAGEMENT" });
} else {
this.group = res.data.data;
this.group.datetimerange = [this.group.start_time, this.group.end_time];
}
})
},
getgoodsType() {
@ -350,20 +339,16 @@ export default {
handleCellChange(row) {
this.changeData[row.id] = {
id: row.id,
sort: row.sort,
// 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;

View File

@ -2,12 +2,6 @@
<div>
<el-card class="box-card" :body-style="{ padding: '20px 20px 0 20px' }">
<el-form :inline="true" :model="formSearch" class="demo-form-inline">
<el-form-item label="店铺">
<el-select v-model="formSearch.store_id" placeholder="全部">
<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-select v-model="formSearch.status" placeholder="团购状态">
<el-option label="未开始" value="-5"></el-option>
@ -27,7 +21,8 @@
</el-card>
<el-card style="margin-top: 10px" class="box-card">
<el-table v-loading="loading" :data="tableData" border style="width: 100%">
<el-table v-loading="loading" :data="tableData" border style="width: 100%" row-key="id"
:tree-props="{ children: 'children' }">
<el-table-column prop="shop.name" label="店铺">
</el-table-column>
<el-table-column prop="title" label="活动标题">
@ -36,19 +31,22 @@
</el-table-column>
<el-table-column label="开团时间">
<template slot-scope="scope">
<div>{{scope.row.start_time}}</div>
<div>{{ scope.row.start_time }}</div>
<div></div>
<div>{{scope.row.end_time}}</div>
<div>{{ scope.row.end_time }}</div>
</template>
</el-table-column>
<el-table-column label="手机查看">
<template slot-scope="scope">
<el-image style="width: 100px; height: 100px" :src="scope.row.ercode"></el-image>
<el-image style="width: 100px; height: 100px" :src="scope.row.qr_code_url"></el-image>
</template>
</el-table-column>
<el-table-column prop="create_status" label="创建结果">
</el-table-column>
<el-table-column prop="options" label="操作">
<template slot-scope="scope">
<el-button @click="groupEdit(scope.row.id)" type="text" size="small">编辑</el-button>
<el-button v-if="scope.row.parent_id == 0" @click="groupEdit(scope.row.id)" type="text"
size="small">编辑</el-button>
</template>
</el-table-column>
</el-table>
@ -58,41 +56,28 @@
<script>
import { storeList } from "../../api/shop";
import { groupList } from "../../api/group";
export default {
data() {
return {
formSearch: {
store_id: "",
status: "",
title: "",
page: 1,
per_page: 20
},
stores: [],
loading: false,
loading: true,
tableData: []
}
},
mounted() {
this.getStoreList();
this.getGroupList();
},
methods: {
getStoreList() {
let params = {
page: 0,
per_page: 999,
plat_id: 1
};
storeList(params).then((res) => {
this.stores = res.data.data;
});
},
getGroupList() {
groupList(this.formSearch).then((res) => {
this.tableData = res.data.data;
this.loading = false;
})
},
groupAdd() {

View File

@ -9,9 +9,9 @@
<el-table-column prop="name" label="店铺名称">
</el-table-column>
<el-table-column prop="plat_id" label="所属平台"></el-table-column>
<el-table-column label="成本倍率">
<el-table-column label="成本变动">
<template slot-scope="scope">
<el-input v-model="scope.row.ratio" placeholder="成本倍率" @change="handleCellChange(scope.row)">
<el-input v-model="scope.row.ratio" placeholder="成本变动" @change="handleCellChange(scope.row)">
</el-input>
</template>
</el-table-column>
@ -64,8 +64,8 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="成本倍率">
<el-input v-model="form.ratio" placeholder="成本倍率" style="width: 400px;"></el-input>
<el-form-item label="成本变动">
<el-input v-model="form.ratio" placeholder="成本变动" style="width: 400px;"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -85,7 +85,7 @@ export default {
form: {
name: "",
plat_id: "",
ratio: 1,
ratio: "*1",
},
rules: {
name: [
@ -95,7 +95,7 @@ export default {
{ required: true, message: '请选择店铺平台', trigger: 'blur' },
],
ratio: [
{ required: true, message: '请输入成本倍率', trigger: 'blur', },
{ required: true, message: '请输入成本变动', trigger: 'blur', },
],
},
storeId: [], // id
@ -183,7 +183,7 @@ export default {
});
},
handleCellChange(row) {
this.$confirm('确认修改成本倍率吗?', '提示', {
this.$confirm('确认修改成本变动吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'