diff --git a/app/Admin/Controllers/v3/OrderDeliveryReportController.php b/app/Admin/Controllers/v3/OrderDeliveryReportController.php index e41821d..3c7f138 100644 --- a/app/Admin/Controllers/v3/OrderDeliveryReportController.php +++ b/app/Admin/Controllers/v3/OrderDeliveryReportController.php @@ -5,6 +5,7 @@ namespace App\Admin\Controllers\v3; use App\Admin\Actions\Grid\v3\DataReportOption; use App\Admin\Actions\Tools\GoodsReportExport; use App\Admin\Common\Auth; +use App\Admin\Renderable\OrderDeliveryById; use App\Admin\Repositories\v3\OrderDeliveryReport; use Dcat\Admin\Grid; use Dcat\Admin\Controllers\AdminController; @@ -54,16 +55,15 @@ class OrderDeliveryReportController extends AdminController })->image('',50); $grid->column('name','姓名'); - $grid->column('market_id','市场')->display(function($marketId){ - $item = MarketModel::getMarketInfo($marketId,'name'); - return $item->name ?? ''; + $grid->column('market_id','市场')->display(function($marketId) use($marketList){ + return $marketList[$marketId] ?? ''; }); $grid->column('total_number','配送单数') ->modal(function($modal){ $name = $this->name; - $modal->title($name.'的余额明细'); - $table = StoreBalance::make(['user_id'=>$this->user_id]); + $modal->title($name.'的配送明细'); + $table = OrderDeliveryById::make(['horseman_id'=>$this->horseman_id]); return $table; }); $grid->column('total_delivery','总配送费'); @@ -73,6 +73,7 @@ class OrderDeliveryReportController extends AdminController $filter->panel(); $filter->equal('start_time','开始时间')->date()->width(2); $filter->equal('end_time','结束时间')->date()->width(2); + $filter->equal('horseman_id','配送员ID'); $filter->equal('user_id','懒ID')->width(2); $filter->equal('name','姓名')->width(2); if(!$this->marketId){ diff --git a/app/Admin/Renderable/OrderDeliveryById.php b/app/Admin/Renderable/OrderDeliveryById.php index 218fa8c..d170b2d 100644 --- a/app/Admin/Renderable/OrderDeliveryById.php +++ b/app/Admin/Renderable/OrderDeliveryById.php @@ -5,6 +5,7 @@ use Dcat\Admin\Grid; use App\Admin\Common\Type; use Dcat\Admin\Grid\LazyRenderable; use App\Models\ImsCjdcOrderMain as OrderMainModel; +use App\Models\v3\Market as MarketModel; class OrderDeliveryById extends LazyRenderable { @@ -16,46 +17,34 @@ class OrderDeliveryById extends LazyRenderable $horsemanId = $this->horseman_id ?? 0; $model = new OrderMainModel(); if($horsemanId > 0){ - $model->where('horseman_id',$horsemanId); + $model->where('horseman_id',$horsemanId)->where('type',1)->where('shipping_type',1); } - + // dd($model->where('horseman_id',$horsemanId)); return Grid::make($model, function (Grid $grid) { - $grid->column('id','ID'); - $grid->column('user_id','配送员姓名'); - $grid->column('global_order_id','订单编号'); - $grid->column('market_id','下单市场'); + $marketList = MarketModel::getMarketArray(); - $grid->column('created_at','下单时间')->display(function($createdAt){ - return date('Y-m-d H:i:s',$createdAt);; + $grid->column('horseman_id','配送员ID'); + // $grid->column('user_id','配送员姓名'); + $grid->column('global_order_id','订单编号'); + $grid->column('market_id','下单市场')->display(function($marketId) use($marketList){ + return $marketList[$marketId] ?? ''; }); - $grid->column('status','状态') + $grid->column('state','状态') ->using( - [] - ) - ->label( - config('label.status_label') + OrderMainModel::STATE_LIST ); - $grid->column('created_at')->display(function($createdAt){ + $grid->column('created_at','下单时间')->display(function($createdAt){ return date('Y-m-d H:i:s',$createdAt); }); // 搜索 - $grid->filter(function (Grid\Filter $filter){ - $userTypeList = Type::USER_TYPE_LIST; - $moneyTypeList = Type::MONEY_TYPE_LIST; - $sourceTYpeList = Type::SOURCE_TYPE_LIST; - unset($userTypeList[0],$moneyTypeList[0]); + $grid->filter(function (Grid\Filter $filter) use($marketList){ - $filter->equal('id','流水表ID')->width(3); - $filter->equal('user_id','账户ID')->width(3); - $filter->equal('current_balance','账户余额')->width(3); + $filter->equal('user_id','下单用户懒ID')->width(3); - $filter->equal('money','流水金额')->width(3); - $filter->equal('source_id','关联流水ID')->width(3); + $filter->equal('global_order_id','订单编号')->width(3); - $filter->equal('money_type','流水类型')->select($userTypeList)->width(4); - $filter->equal('user_type','账户类型')->select($moneyTypeList)->width(4); - $filter->equal('source_type','关联类型')->select($sourceTYpeList)->width(4); + $filter->equal('market_id','下单市场')->select($marketList)->width(4); $filter->whereBetween('created_at',function($q){ $start = $this->input['start'] ?? null; diff --git a/app/Models/ImsCjdcOrderMain.php b/app/Models/ImsCjdcOrderMain.php index 658395b..119acc4 100644 --- a/app/Models/ImsCjdcOrderMain.php +++ b/app/Models/ImsCjdcOrderMain.php @@ -37,9 +37,25 @@ class ImsCjdcOrderMain extends Model const ORDER_STATE_REFUNDED = 9; // 拒绝退款 const ORDER_STATE_UNREFUND = 10; + // 部分退款 + const ORDER_STATE_REBATES = 11; // 完成状态组合 const ORDER_STATE_FINISH = [self::ORDER_STATE_COMPLETE, self::ORDER_STATE_EVALUATED, self::ORDER_STATE_UNREFUND]; + const STATE_LIST = [ + self::ORDER_STATE_UNPAY => '待支付', + self::ORDER_STATE_UNTAKE => '待接单', + self::ORDER_STATE_DELIVERY => '待送达', + self::ORDER_STATE_COMPLETE => '已完成', + self::ORDER_STATE_EVALUATED => '已评价', + self::ORDER_STATE_CANCEL => '已取消', + self::ORDER_STATE_REFUSE => '已拒单', + self::ORDER_STATE_REFUNDING => '退款中', + self::ORDER_STATE_REFUNDED => '已退款', + self::ORDER_STATE_UNREFUND => '拒绝退款', + self::ORDER_STATE_REBATES => '部分退款', + ]; + const TABLE_NAME = 'lanzu_order_main'; // 订单支付方式 // 微信支付 const ORDER_PAY_WX = 1; @@ -47,7 +63,7 @@ class ImsCjdcOrderMain extends Model const ORDER_PAY_BALANCE = 2; use HasDateTimeFormatter; - //protected $table = 'ims_cjdc_order_main'; + protected $table = 'lanzu_order_main'; public $timestamps = false;