14 changed files with 73 additions and 849 deletions
-
36app/Admin/Actions/Grid/GoodsNewCopy.php
-
36app/Admin/Actions/Grid/GoodsNewImage.php
-
294app/Admin/Controllers/v3/GoodsNewController.php
-
38app/Admin/Controllers/v3/OrderReportController.php
-
110app/Admin/Extensions/OrderReportPage.php
-
16app/Admin/Repositories/v3/GoodsNew.php
-
59app/Admin/Repositories/v3/OrderReport.php
-
15app/Models/v3/FinancialRecord.php
-
70app/Models/v3/GoodsNew.php
-
18app/Models/v3/GoodsNewBanners.php
-
115app/Models/v3/StoreNew.php
-
42resources/lang/zh-CN/goods-new.php
-
13resources/lang/zh-CN/order-report.php
-
60resources/views/order_report.php
@ -1,36 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Actions\Grid; |
|||
|
|||
use Dcat\Admin\Grid\RowAction; |
|||
use Dcat\Admin\Widgets\Modal; |
|||
use App\Admin\Forms\GoodsNewCopyForm; |
|||
|
|||
class GoodsNewCopy extends RowAction |
|||
{ |
|||
/** |
|||
* @return string |
|||
*/ |
|||
protected $title = '复制'; |
|||
|
|||
public function render() |
|||
{ |
|||
$id = $this->getKey(); |
|||
|
|||
$modal = Modal::make() |
|||
->xl() |
|||
->title($this->title) |
|||
->body(GoodsNewCopyForm::make()->setKey($id)) |
|||
->button($this->title); |
|||
|
|||
return $modal; |
|||
} |
|||
|
|||
public function parameters() |
|||
{ |
|||
|
|||
return [ |
|||
|
|||
]; |
|||
} |
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Actions\Grid; |
|||
|
|||
use Dcat\Admin\Grid\RowAction; |
|||
use Dcat\Admin\Widgets\Modal; |
|||
use App\Admin\Forms\GoodsNewImageForm; |
|||
|
|||
class GoodsNewImage extends RowAction |
|||
{ |
|||
/** |
|||
* @return string |
|||
*/ |
|||
protected $title = '上传图片'; |
|||
|
|||
public function render() |
|||
{ |
|||
$id = $this->getKey(); |
|||
|
|||
$modal = Modal::make() |
|||
->xl() |
|||
->title($this->title) |
|||
->body(GoodsNewImageForm::make()->setKey($id)) |
|||
->button($this->title); |
|||
|
|||
return $modal; |
|||
} |
|||
|
|||
public function parameters() |
|||
{ |
|||
|
|||
return [ |
|||
|
|||
]; |
|||
} |
|||
} |
|||
@ -1,294 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Controllers\v3; |
|||
|
|||
use App\Admin\Actions\Grid\GoodsNewCopy; |
|||
use App\Admin\Actions\Grid\GoodsNewImage; |
|||
use App\Admin\Repositories\v3\GoodsNew; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Controllers\AdminController; |
|||
use App\Models\v3\Category as CategoryModel; |
|||
use App\Models\v3\StoreNew as StoreModel; |
|||
use Dcat\Admin\Form\NestedForm; |
|||
use App\Models\v3\GoodsNew as GoodsModel; |
|||
use App\Models\v3\Market as MarketModel; |
|||
use App\Models\v3\GoodsCategory as GoodsCategoryModel; |
|||
|
|||
class GoodsNewController extends AdminController |
|||
{ |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new GoodsNew(), function (Grid $grid) { |
|||
|
|||
// 二级分类
|
|||
$categoryList = CategoryModel::getArray([['parent_id','>',0]],['选择分类'=>0]); |
|||
// 店铺
|
|||
$storeList = StoreModel::getStoreArray(); |
|||
// 商品类目
|
|||
$goodsCategoryList = GoodsCategoryModel::getArray([],['选择类目'=>0]); |
|||
//市场
|
|||
$marketList = MarketModel::getMarketArray(); |
|||
|
|||
$grid->id->sortable(); |
|||
$grid->cover_img_url->image('',50); |
|||
$grid->name->editable(); |
|||
$grid->price->editable(); |
|||
$grid->column('goods_unit','单位')->editable(); |
|||
$grid->column('spec','规格')->display(function($spec){ |
|||
$item = ''; |
|||
if(!empty($spec)){ |
|||
foreach($spec as $key => $value){ |
|||
$specKey = isset($value['spec_key'])?$value['spec_key']:''; |
|||
$specValue = isset($value['spec_value'])?$value['spec_value']:''; |
|||
$item .= $specKey.':'.$specValue.'</br>'; |
|||
} |
|||
} |
|||
|
|||
return $item; |
|||
}); |
|||
$grid->column('market_id')->display(function($marketId){ |
|||
$item = MarketModel::getMarketInfo($marketId,'name'); |
|||
return empty($item) ? '' : $item->name; |
|||
}); |
|||
$grid->store_id->display(function ($storeId){ |
|||
$store = StoreModel::getStoreInfo($storeId,'name'); |
|||
return empty($store) ? '' : $store->name; |
|||
}); |
|||
$grid->category_id->select($categoryList); |
|||
// ->load('goods_category_id', '/api/goods_category_list')
|
|||
// ->display(function ($categoryId){
|
|||
// $item = CategoryModel::getInfo($categoryId,'title');
|
|||
// return empty($item) ? '选择分类' : $item->title;
|
|||
// });
|
|||
$grid->goods_category_id->select($goodsCategoryList); |
|||
// ->display(function ($goodsCategoryId){
|
|||
// $item = GoodsCategoryModel::getInfo($goodsCategoryId,'title');
|
|||
// return empty($item) ? '' : $item->title;
|
|||
// });
|
|||
|
|||
$grid->sort->sortable(); |
|||
$grid->on_sale->switch(); |
|||
|
|||
$grid->actions([new GoodsNewCopy(),new GoodsNewImage()]); |
|||
$grid->filter(function (Grid\Filter $filter) use($storeList, $categoryList, $goodsCategoryList, $marketList){ |
|||
$filter->equal('id'); |
|||
$filter->like('name'); |
|||
$filter->equal('store_id')->select($storeList); |
|||
$filter->equal('category_id')->select($categoryList); |
|||
$filter->equal('goods_category_id')->select($goodsCategoryList); |
|||
$filter->equal('market_id')->select($marketList); |
|||
$filter->equal('on_sale')->select(GoodsModel::$_ONSALE); |
|||
$filter->equal('price'); |
|||
$filter->equal('goods_unit'); |
|||
}); |
|||
|
|||
$grid->model()->orderBy('goods_category_id', 'asc'); |
|||
// 每页10条
|
|||
$grid->paginate(10); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a show builder. |
|||
* |
|||
* @param mixed $id |
|||
* |
|||
* @return Show |
|||
*/ |
|||
protected function detail($id) |
|||
{ |
|||
// $g = GoodsModel::find(1572);
|
|||
// dd($g->toArray());
|
|||
return Show::make($id, new GoodsNew(), function (Show $show) { |
|||
$show->row(function (Show\Row $show) { |
|||
$show->width(6)->field('id'); |
|||
$show->width(6)->field('name'); |
|||
$show->width(6)->category_id->as(function ($categoryId){ |
|||
$item = CategoryModel::getInfo($categoryId,'title'); |
|||
return empty($item) ? '' : $item->title; |
|||
}); |
|||
$show->width(6)->store_id->as(function ($storeId){ |
|||
$item = StoreModel::getStoreInfo($storeId,'name'); |
|||
return empty($item) ? '' : $item->name; |
|||
}); |
|||
$show->width(6)->goods_category_id->as(function ($goodsCategoryId){ |
|||
$item = GoodsCategoryModel::getInfo($goodsCategoryId,'title'); |
|||
return empty($item) ? '' : $item->title; |
|||
}); |
|||
$show->width(6)->cover_img->image(); |
|||
$show->width(6)->price; |
|||
$show->width(6)->original_price; |
|||
$show->width(6)->vip_price; |
|||
$show->width(6)->inventory; |
|||
$show->width(6)->goods_unit; |
|||
|
|||
}); |
|||
$show->row(function (Show\Row $show) { |
|||
$show->width(6)->on_sale_text; |
|||
$show->width(6)->content; |
|||
$show->width(6)->sort; |
|||
$show->width(6)->restrict_num; |
|||
$show->width(6)->start_num; |
|||
$show->width(6)->is_infinite_text; |
|||
|
|||
$show->width(6)->tags->as(function ($value){ |
|||
return $value; |
|||
}); |
|||
$show->width(6)->spec->as(function ($value){ |
|||
$text = ''; |
|||
if($value){ |
|||
foreach ($value as $v){ |
|||
$specKey = isset($v['spec_key'])?$v['spec_key']:''; |
|||
$specValue = isset($v['spec_value'])?$v['spec_value']:''; |
|||
$text .= '【'.$specKey .':'.$specValue.'】 '; |
|||
} |
|||
} |
|||
return $text; |
|||
}); |
|||
$goodsModel = new GoodsModel(); |
|||
$show->html(function () use($goodsModel){ |
|||
if(empty($this->details_imgs)){ |
|||
return ''; |
|||
}else{ |
|||
// 还需要优化
|
|||
$value = $this->details_imgs; |
|||
$text = ''; |
|||
foreach ($value as $v){ |
|||
$img = $goodsModel->imageUrl($v); |
|||
$text .= "<img src='$img' />"; |
|||
} |
|||
return $text; |
|||
} |
|||
}); |
|||
|
|||
// $show->created_at;
|
|||
// $show->updated_at;
|
|||
}); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a form builder. |
|||
* |
|||
* @return Form |
|||
*/ |
|||
protected function form() |
|||
{ |
|||
$builder = GoodsModel::with(['ImageNewBanners','VideoNewBanners']); |
|||
|
|||
return Form::make($builder, function (Form $form) { |
|||
$form->hidden('id'); |
|||
|
|||
// 二级分类
|
|||
$categoryList = CategoryModel::getArray([['parent_id','>',0]]); |
|||
// 商品类目
|
|||
$goodsCategoryList = GoodsCategoryModel::getArray(); |
|||
// 店铺
|
|||
$storeList = StoreModel::getStoreArray(); |
|||
//市场
|
|||
// $marketList = MarketModel::getMarketArray();
|
|||
|
|||
$form->column(6, function (Form $form) use($storeList,$categoryList,$goodsCategoryList ){ |
|||
$form->hidden('market_id')->default(0); |
|||
$form->select('category_id')->required()->options($categoryList)->load('goods_category_id', '/api/goods_category_list'); |
|||
$form->select('goods_category_id'); |
|||
$form->select('store_id')->required()->options($storeList); |
|||
$form->text('name')->required()->maxLength(20); |
|||
$form->image('cover_img')->autoUpload()->url('ops/files')->required(); |
|||
$form->number('sort'); |
|||
}); |
|||
$form->column(6, function (Form $form) { |
|||
$form->currency('price')->required()->floatTwo()->symbol('¥'); |
|||
$form->currency('original_price')->required()->floatTwo()->symbol('¥'); |
|||
$form->currency('vip_price')->required()->floatTwo()->symbol('¥'); |
|||
$form->text('goods_unit')->help('如:斤,个,盒,500克,1000克,1500克等'); |
|||
$form->radio('is_infinite')->options(['关闭','开启'])->default(1); |
|||
$form->number('inventory')->required()->attribute('min', 1)->default(1); |
|||
$form->number('restrict_num')->attribute('min', 0)->default(0)->help('0表示不限购'); |
|||
$form->number('start_num')->attribute('min', 1)->default(1); |
|||
}); |
|||
$form->column(12, function (Form $form) { |
|||
$form->hasMany('image_new_banners', function (Form\NestedForm $form) { |
|||
$form->image('path')->autoUpload()->url('ops/files')->width(2); |
|||
$form->number('sort')->width(2)->default(0); |
|||
$form->hidden('type')->value(1)->default(1); |
|||
})->required(); |
|||
$form->divider(); |
|||
$form->hasMany('video_new_banners', function (Form\NestedForm $form) { |
|||
$form->file('path')->autoUpload()->url('ops/files')->width(2); |
|||
$form->number('sort')->width(2)->default(0); |
|||
$form->hidden('type')->value(2)->default(2); |
|||
}); |
|||
$form->divider(); |
|||
|
|||
$form->multipleImage('details_imgs')->url('ops/files')->help('按图片顺序上传'); |
|||
$form->text('content')->maxLength(50); |
|||
$form->text('remark')->maxLength(50); |
|||
|
|||
$form->tags('tags','标签')->options(['新品','热销','新鲜']); |
|||
$form->table('spec', function (NestedForm $table) { |
|||
$table->text('spec_key')->required()->help('如:净含量:500克,保质期:120天,包装:12个/盒等'); |
|||
$table->text('spec_value')->required(); |
|||
}); |
|||
$form->switch('on_sale') |
|||
->customFormat(function ($v) { |
|||
return $v == 1 ? 1 : 0; |
|||
}) |
|||
->saving(function ($v) { |
|||
return $v == 1 ? 1 : 0; |
|||
}); |
|||
|
|||
$form->disableResetButton(); |
|||
$form->disableViewCheck(); |
|||
$form->disableEditingCheck(); |
|||
$form->disableCreatingCheck(); |
|||
}); |
|||
$form->saving(function (Form $form){ |
|||
$storeId = $form->input('store_id'); |
|||
|
|||
$tags = $form->input('tags'); |
|||
$spec = $form->input('spec'); |
|||
$detailsImgs = $form->input('details_imgs'); |
|||
$goodsCategoryId = $form->input('goods_category_id'); |
|||
|
|||
if($form->isCreating() && !empty($storeId)){ |
|||
// 商品所属市场,根据店铺查询市场
|
|||
$info = StoreModel::getStoreInfo($storeId,'market_id'); |
|||
$form->market_id = $info->market_id; |
|||
} |
|||
|
|||
$tags = $form->input('tags'); |
|||
if(!empty($tags)){ |
|||
$tagsArr = []; |
|||
foreach($tags as $kt => $tag){ |
|||
if(empty($tag)){ |
|||
unset($tags[$kt]); |
|||
continue; |
|||
} |
|||
$tagsArr[] = $tag; |
|||
} |
|||
|
|||
$form->tags = json_encode($tagsArr); |
|||
} |
|||
|
|||
if($storeId && empty($spec)){ |
|||
$form->spec = []; |
|||
} |
|||
if($storeId && empty($detailsImgs)){ |
|||
$form->details_imgs = []; |
|||
} |
|||
if($storeId && empty($goodsCategoryId)){ |
|||
$form->goods_category_id = 0; |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
} |
|||
@ -1,110 +0,0 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Admin\Extensions; |
|||
|
|||
use App\Admin\Common\LinkUrl; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Support\LazyRenderable; |
|||
use Illuminate\Support\Facades\DB; |
|||
use App\Models\ImsCjdcOrder as orderModel; |
|||
use App\Models\ImsCjdcOrderMain as orderMainModel; |
|||
use App\Models\v3\Market as MarketModel; |
|||
use App\Models\StoreAccount as StoreAccountModel; |
|||
use App\Models\v3\Store as StoreModel; |
|||
use App\Models\v3\User as UserModel; |
|||
|
|||
class OrderReportPage extends LazyRenderable |
|||
{ |
|||
|
|||
protected static $js = [LinkUrl::VUE_JS, LinkUrl::ELEMENT_UI_JS]; |
|||
protected static $css = [LinkUrl::DETAIL_CSS, LinkUrl::ELEMENT_UI_CSS]; |
|||
|
|||
public function render() |
|||
{ |
|||
$marketId = request()->input('market_id'); |
|||
$startTime = request()->input('start_time'); |
|||
$endTime = request()->input('end_time'); |
|||
$orderMain = orderMainModel::select(DB::raw('COUNT(id) AS total_num, SUM(money) AS total_money'))->whereIn('state',[4,5,10]); |
|||
|
|||
$storeNewUser = StoreAccountModel::select(DB::raw("SUM( CASE WHEN note = '新用户下单成功,平台奖励' THEN 1 ELSE 0 END ) AS new_add_total, SUM( CASE WHEN note = '新用户下单成功,平台奖励' THEN money ELSE 0 END ) AS new_user_total,SUM( CASE WHEN note = '用户下单成功,平台奖励' THEN money ELSE 0 END ) AS store_total")); |
|||
|
|||
$newUser = UserModel::select(DB::raw('count(id) AS total')); |
|||
|
|||
if($marketId){ |
|||
$orderMain->where('market_id',$marketId); |
|||
|
|||
// 查询这个市场下的店铺id
|
|||
$storeIds = StoreModel::where('market_id',$marketId)->pluck('id'); |
|||
$storeNewUser->whereIn('store_id',$storeIds); |
|||
} |
|||
if($startTime){ |
|||
$orderMain->where([['created_at','>=',strtotime($startTime)]]); |
|||
$storeNewUser->where([['time','>=',$startTime]]); |
|||
$newUser->where([['created_at','>=',strtotime($startTime)]]); |
|||
} |
|||
if($endTime){ |
|||
$orderMain->where([['created_at','<=',strtotime($endTime)]]); |
|||
$storeNewUser->where([['time','<=',$endTime]]); |
|||
$newUser->where([['created_at','<=',strtotime($endTime)]]); |
|||
} |
|||
if(empty($startTime) && empty($endTime)){ |
|||
$time = date('Y-m-d',time()); |
|||
$todayStart = $time.'00:00:00'; |
|||
$todayEnd = $time.'23:59:59'; |
|||
$orderMain->where([['created_at','>=',strtotime($todayStart)]]); |
|||
$storeNewUser->where([['time','>=',$todayStart]]); |
|||
$newUser->where([['created_at','>=',strtotime($todayStart)]]); |
|||
|
|||
$orderMain->where([['created_at','<=',strtotime($todayEnd)]]); |
|||
$storeNewUser->where([['time','<=',$todayEnd]]); |
|||
$newUser->where([['created_at','<=',strtotime($todayEnd)]]); |
|||
} |
|||
// 订单总额
|
|||
$orderReport = $orderMain->get()->toArray(); |
|||
// 总补贴金额
|
|||
$storeNewUsers = $storeNewUser->get()->toArray(); |
|||
// 总用户
|
|||
$userTotal = $newUser->get()->toArray(); |
|||
|
|||
$query = [ |
|||
'order_total_num' => !empty($orderReport[0]['total_num'])?$orderReport[0]['total_num']:0, |
|||
'order_total_money' => !empty($orderReport[0]['total_money'])?$orderReport[0]['total_money']:0, |
|||
|
|||
'new_user_total_money' => !empty($storeNewUsers[0]['new_user_total'])?$storeNewUsers[0]['new_user_total']:0, |
|||
'store_user_total_money' => !empty($storeNewUsers[0]['store_total'])?$storeNewUsers[0]['store_total']:0, |
|||
'new_add_user' => !empty($storeNewUsers[0]['new_add_total'])?$storeNewUsers[0]['new_add_total']:0, |
|||
|
|||
'user_total' => !empty($userTotal[0]['total'])?$userTotal[0]['total']:0, |
|||
]; |
|||
|
|||
if ($query) { |
|||
// $marketList = MarketModel::getMarket();
|
|||
|
|||
Admin::script( |
|||
<<<JS |
|||
|
|||
var app = new Vue({ |
|||
el:"#order_report", |
|||
data:{ |
|||
|
|||
order_total_num:"{$query['order_total_num']}", |
|||
order_total_money:"{$query['order_total_money']}", |
|||
new_user_total_money:"{$query['new_user_total_money']}", |
|||
store_user_total_money:"{$query['store_user_total_money']}", |
|||
new_add_user:"{$query['new_add_user']}", |
|||
user_total:"{$query['user_total']}", |
|||
}, |
|||
methods: { |
|||
|
|||
} |
|||
}); |
|||
JS |
|||
); |
|||
|
|||
} |
|||
return view('order_report'); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -1,16 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Repositories\v3; |
|||
|
|||
use App\Models\v3\GoodsNew as Model; |
|||
use Dcat\Admin\Repositories\EloquentRepository; |
|||
|
|||
class GoodsNew extends EloquentRepository |
|||
{ |
|||
/** |
|||
* Model. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $eloquentClass = Model::class; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
<?php |
|||
/** |
|||
* 总账的模型 |
|||
*/ |
|||
namespace App\Models\v3; |
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class FinancialRecord extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
protected $table = 'lanzu_financial_record'; |
|||
protected $dateFormat = 'U'; |
|||
|
|||
} |
|||
@ -1,70 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Models\v3; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class GoodsNew extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
use SoftDeletes; |
|||
|
|||
protected $table = 'lanzu_goods_new'; |
|||
protected $dateFormat = 'U'; |
|||
/* 查询记录数 limit */ |
|||
protected $perPage = 10; |
|||
protected $appends = [ |
|||
'cover_img_url', |
|||
'on_sale_text', |
|||
'is_infinite_text' |
|||
]; |
|||
|
|||
protected $casts = [ |
|||
'details_imgs'=>'array', |
|||
// 'tags'=>'array',
|
|||
'spec'=>'array', |
|||
]; |
|||
|
|||
public static $_ONSALE = ['否','是']; |
|||
public static $_ISINFINITE = ['关闭','开启']; |
|||
|
|||
public function getCoverImgUrlAttribute($value) |
|||
{ |
|||
$value = $value ? $value : $this->cover_img; |
|||
return $this->imageUrl($value); |
|||
} |
|||
public function getOnSaleTextAttribute($value) |
|||
{ |
|||
$value = $value ? $value : $this->on_sale; |
|||
return isset(self::$_ONSALE[$value]) ? self::$_ONSALE[$value] : ''; |
|||
} |
|||
public function getIsInfiniteTextAttribute($value) |
|||
{ |
|||
$value = $value ? $value : $this->is_infinite; |
|||
return isset(self::$_ISINFINITE[$value]) ? self::$_ISINFINITE[$value] : ''; |
|||
} |
|||
public function ImageNewBanners(){ |
|||
return $this->hasMany('\App\Models\v3\GoodsNewBanners','goods_id','id')->where('type',1); |
|||
} |
|||
|
|||
public function VideoNewBanners(){ |
|||
return $this->hasMany('\App\Models\v3\GoodsNewBanners','goods_id','id')->where('type',2); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 处理旧图片 |
|||
* @param $value |
|||
* @return string |
|||
*/ |
|||
public function imageUrl($value) |
|||
{ |
|||
if(strripos($value,"http") === false){ |
|||
return config('filesystems.disks.oss.img_host').'/'.$value; |
|||
}else{ |
|||
return $value; |
|||
} |
|||
} |
|||
} |
|||
@ -1,18 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Models\v3; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class GoodsNewBanners extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
use SoftDeletes; |
|||
|
|||
protected $table = 'lanzu_goods_banners_new'; |
|||
protected $dateFormat = 'U'; |
|||
protected $fillable = ['path', 'id', 'goods_id','type','url']; |
|||
|
|||
} |
|||
@ -1,115 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace App\Models\v3; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class StoreNew extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
use SoftDeletes; |
|||
|
|||
protected $table = 'lanzu_store_new'; |
|||
protected $dateFormat = 'U'; |
|||
|
|||
/* 查询记录数 limit */ |
|||
protected $perPage = 10; |
|||
|
|||
public static $_ISREST= ['否','是']; |
|||
public static $_ISOPEN = ['关闭','开启']; |
|||
|
|||
protected $appends = [ |
|||
'logo_url', |
|||
'is_rest_text', |
|||
'is_open_text' |
|||
]; |
|||
|
|||
public function getLogoUrlAttribute($value) |
|||
{ |
|||
$value = $value ? $value : $this->logo; |
|||
return $this->imageUrl($value); |
|||
} |
|||
|
|||
public function getIsRestTextAttribute($value) |
|||
{ |
|||
$value = $value ? $value : $this->is_rest; |
|||
return isset(self::$_ISREST[$value]) ? self::$_ISREST[$value] : ''; |
|||
} |
|||
public function getIsOpenTextAttribute($value) |
|||
{ |
|||
$value = $value ? $value : $this->is_iopen; |
|||
return isset(self::$_ISOPEN[$value]) ? self::$_ISOPEN[$value] : ''; |
|||
} |
|||
|
|||
/** |
|||
* 获取商家环境图片 |
|||
* @param $value $this->environment |
|||
* @return array |
|||
*/ |
|||
public function getEnvironmentAttribute($value) |
|||
{ |
|||
$value = $value ? $value : $this->environmant; |
|||
return $value ? explode(',',$value) : []; |
|||
} |
|||
public function setEnvironmentAttribute($value) |
|||
{ |
|||
$this->attributes['environment'] = implode(',',$value); |
|||
} |
|||
|
|||
/** |
|||
* 是否开启店铺 |
|||
*/ |
|||
public function getIsOpenAttribute($value) |
|||
{ |
|||
$value = $value ? $value : ''; |
|||
return $value ? explode(',',$value) : []; |
|||
} |
|||
public function setIsOpenAttribute($value) |
|||
{ |
|||
$this->attributes['is_open'] = 1; |
|||
} |
|||
|
|||
/** |
|||
* 获取单个店铺信息 |
|||
* @param int $id |
|||
* @param string $field |
|||
* @return string |
|||
*/ |
|||
public static function getStoreInfo($id,$field = '*') |
|||
{ |
|||
return self::select($field)->find($id); |
|||
} |
|||
|
|||
/** |
|||
* 获取店铺数组 |
|||
* id为键,name为值 |
|||
* @return array |
|||
*/ |
|||
public static function getStoreArray() |
|||
{ |
|||
$list = self::select('id','name') |
|||
->where('status',2) |
|||
->whereNull('deleted_at') |
|||
->get(); |
|||
$array = []; |
|||
if(count($list) > 0){ |
|||
foreach ($list as $value) { |
|||
$array[$value->id] = $value->name; |
|||
} |
|||
} |
|||
|
|||
return $array; |
|||
} |
|||
|
|||
// 处理图片
|
|||
public function imageUrl($value) |
|||
{ |
|||
if(strripos($value,"http") === false){ |
|||
return config('filesystems.disks.oss.img_host').'/'.$value; |
|||
}else{ |
|||
return $value; |
|||
} |
|||
} |
|||
} |
|||
@ -1,42 +0,0 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'GoodsNew' => '线上商品清洗', |
|||
'goods_new' => '线上商品清洗', |
|||
], |
|||
'fields' => [ |
|||
'name' => '商品名称', |
|||
'category_id' => '所属分类', |
|||
'goods_category_id' => '商品类目', |
|||
'store_id' => '所属商家', |
|||
'cover_img' => '封面图', |
|||
'cover_img_url' => '封面图', |
|||
'banners' => '轮播图', |
|||
|
|||
'price' => '售价', |
|||
'original_price' => '原价', |
|||
'vip_price' => '会员价', |
|||
'on_sale' => '是否上架', |
|||
'on_sale_text' => '是否上架', |
|||
'inventory' => '库存', |
|||
'content' => '简介', |
|||
'sort' => '排序', |
|||
'restrict_num' => '限购份数', |
|||
'start_num' => '起售份数', |
|||
'is_infinite' => '开启无限库存', |
|||
'is_infinite_text' => '开启无限库存', |
|||
'goods_unit' => '商品单位', |
|||
'tags' => '标签', |
|||
'details_imgs' => '详情图片', |
|||
'spec' => '规格', |
|||
'unit_number' => '单位前的数', |
|||
'remark' => '备注', |
|||
'spec_key' =>'规格名称', |
|||
'spec_value' => '规格参数', |
|||
'market_id' => '市场', |
|||
'image_new_banners' => '轮播图片', |
|||
'video_new_banners' => '轮播视频' |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
@ -0,0 +1,13 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'OrderReport' => '订单统计报表', |
|||
'order_report' => '订单统计报表', |
|||
], |
|||
'fields' => [ |
|||
'name' => '统计名称', |
|||
'value' => '统计数量', |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
@ -1,60 +0,0 @@ |
|||
<div id="order_report"> |
|||
<!-- 搜索 --> |
|||
<div> |
|||
<form action="" pjax-container="" method="get"> |
|||
<div> |
|||
<select class="form-control" name="market_id" > |
|||
<option value="0">选择市场</option> |
|||
<option value="1">海尔青啤市场</option> |
|||
<option value="2">东沟岭市场</option> |
|||
<option value="3">铜鼓岭市场</option> |
|||
<option value="4">华园菜市</option> |
|||
<option value="5">平西市场</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<div style="margin-top: 20px;"> |
|||
<div class="form-group"> |
|||
<div class="input-group input-group-sm"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text bg-white text-capitalize"><b>时间</b> <i class="feather icon-calendar"></i></span> |
|||
</div> |
|||
<input autocomplete="off" type="text" class="form-control" id="filter_column__time_start" placeholder="时间" name="start_time" value="" > |
|||
<span class="input-group-addon" style="border-left: 0; border-right: 0;">To</span> |
|||
<input autocomplete="off" type="text" class="form-control" id="filter_column__time_end" placeholder="时间" name="end_time" value="" > |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<input type="submit" value="查询"/> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<!-- 搜索 end --> |
|||
<!-- 订单数据 --> |
|||
<div style="margin-top: 20px;"> |
|||
<div> |
|||
<p>订单总额(元): {{order_total_money}}</p> |
|||
</div> |
|||
<div> |
|||
<p>平台新用户补贴总额(元): {{new_user_total_money}}</p> |
|||
</div> |
|||
<div> |
|||
<p>店铺用户每日首单补贴(元): {{store_user_total_money}}</p> |
|||
</div> |
|||
</div> |
|||
<!-- 订单数据 end --> |
|||
<!-- 用户数据 --> |
|||
<div> |
|||
<div> |
|||
<div> |
|||
<p>现存用户总数(位): {{user_total}}</p> |
|||
</div> |
|||
<div> |
|||
<p>新增用户数(位): {{new_add_user}}</p> |
|||
</div> |
|||
</div> |
|||
<!-- 用户数据 end --> |
|||
|
|||
</div> |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue