Browse Source

自送弹窗

master
lanzu_qsy 6 years ago
parent
commit
2d1c1abaab
  1. 35
      app/Admin/Controllers/ImsCjdcOrderMainController.php
  2. 51
      app/Admin/Extensions/CheckRow.php
  3. 1
      app/Admin/Extensions/OrderPrint.php
  4. 16
      app/Admin/Extensions/OrderStateHandle.php
  5. 2
      app/Libs/feier_print/api_php_demo.php
  6. 89
      composer.lock

35
app/Admin/Controllers/ImsCjdcOrderMainController.php

@ -2,9 +2,12 @@
namespace App\Admin\Controllers;
use App\Admin\Extensions\CheckRow;
use App\Admin\Extensions\CouponTieEdit;
use App\Admin\Extensions\OrderDetail;
use App\Admin\Extensions\OrderPrint;
use App\Admin\Extensions\OrderStateHandle;
use App\Admin\Forms\CouponTieForm;
use App\Admin\Repositories\ImsCjdcOrderMain;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
@ -41,8 +44,34 @@ class ImsCjdcOrderMainController extends AdminController
$grid->column('market.name','所属市场');
$grid->time;
$grid->pay_time;
$grid->actions(function (Grid\Displayers\Actions $actions) {
$grid->actions(new CheckRow('自送'));
$grid->column('配送方式')
->if(function ($column){
if ($this->state==3){
return true;
}
return false;
})
->display('站内自送')
->modal('站内自送',function ($modal){
return CouponTieForm::make();
})
->else()
->display('站内自送');
$grid->actions(function (Grid\Displayers\Actions $actions) use ($grid){
$state = $actions->row->state;
if ($state==2){
$actions->append(new OrderStateHandle('接单',3));
$actions->append(new OrderPrint('打印'));
@ -83,7 +112,9 @@ class ImsCjdcOrderMainController extends AdminController
$grid->disableViewButton();
$grid->disableEditButton();
$grid->disableDeleteButton();

51
app/Admin/Extensions/CheckRow.php

@ -1,59 +1,32 @@
<?php
namespace App\Admin\Extensions;
use App\Admin\Forms\CouponTieForm;
use App\Models\ImsCjdcOrderMain;
use App\Models\StoreAccount;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Http\Request;
class CheckRow extends RowAction
{
protected $model;
protected $state;
protected $title;
public function __construct($title=null,$state=null)
public function __construct($title=null)
{
parent::__construct($title);
$this->state = $state;
}
/**
* 处理请求
*
* @param Request $request
*
* @return \Dcat\Admin\Actions\Response
*/
public function handle(Request $request)
{
// 获取当前行ID
$id = $this->getKey();
$orderMain = new ImsCjdcOrderMain();
$state = $request->get('state');
$res = $orderMain->modifyState($id,$state);
if ($res==true){
return $this->response()->success('操作成功')->refresh();
}else{
return $this->response()->error('操作失败');
}
}
/**
* 设置要POST到接口的数据
*
* @return array
*/
public function parameters()
public function render()
{
return [
'state' => $this->state,
];
// 实例化表单类并传递自定义参数
$form = CouponTieForm::make();
return Modal::make()
->lg()
->title($this->title)
->body($form)
->button($this->title);
}
}

1
app/Admin/Extensions/OrderPrint.php

@ -65,7 +65,6 @@ class OrderPrint extends RowAction
public function feiErPrint($order_num)
{
include_once app_path('Libs\feier_print\api_php_demo.php');
$result = json_decode(FeiePrint($order_num));
dd($result);

16
app/Admin/Extensions/OrderStateHandle.php

@ -2,7 +2,9 @@
namespace App\Admin\Extensions;
use App\Models\ImsCjdcOrderMain;
use Dcat\Admin\Grid\Displayers\Modal;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Layout\Content;
use Illuminate\Http\Request;
class OrderStateHandle extends RowAction
@ -11,6 +13,7 @@ class OrderStateHandle extends RowAction
protected $model;
protected $state;
protected $title;
protected $content;
public function __construct($title=null,$state=null)
{
@ -20,6 +23,7 @@ class OrderStateHandle extends RowAction
}
/**
* 处理请求
*
@ -34,7 +38,12 @@ class OrderStateHandle extends RowAction
$orderMain = new ImsCjdcOrderMain();
$state = $request->get('state');
if ($state==30){
$res = $orderMain->updateShippingType($id,1);
$content = new Content();
$content = $this->showForm($content);
return $content;
dd('弹出表单');
//$res = $orderMain->updateShippingType($id,1);
}elseif ($state==100){
}else{
@ -59,4 +68,9 @@ class OrderStateHandle extends RowAction
'state' => $this->state,
];
}
public function showForm(Content $content)
{
return $content->title('站内自送')->body("<h1>hello world!</h1>");
}
}

2
app/Libs/feier_print/api_php_demo.php

@ -150,7 +150,7 @@ function signature($time)
function FeiePrint($order_num)
{
$data = Db::table('ims_cjdc_order_main')
$data = DB::table('ims_cjdc_order_main')
->alias('m')
->join(['ims_cjdc_order'=>'o'],'o.order_main_id = m.id','inner')
->join(['ims_cjdc_order_goods'=>'g'],'o.id = g.order_id','inner')

89
composer.lock

@ -165,16 +165,16 @@
},
{
"name": "dcat/laravel-admin",
"version": "1.6.5",
"version": "1.7.1",
"source": {
"type": "git",
"url": "https://github.com/jqhph/dcat-admin.git",
"reference": "684ea3da59a6caa8f00771781b7ff50d18759b81"
"reference": "b2694de229a9fd52f9ab048870d4e93b8ee7a505"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jqhph/dcat-admin/zipball/684ea3da59a6caa8f00771781b7ff50d18759b81",
"reference": "684ea3da59a6caa8f00771781b7ff50d18759b81",
"url": "https://api.github.com/repos/jqhph/dcat-admin/zipball/b2694de229a9fd52f9ab048870d4e93b8ee7a505",
"reference": "b2694de229a9fd52f9ab048870d4e93b8ee7a505",
"shasum": "",
"mirrors": [
{
@ -233,7 +233,7 @@
"laravel",
"laravel admin"
],
"time": "2020-07-28T03:26:18+00:00"
"time": "2020-09-02T13:19:24+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
@ -2131,12 +2131,6 @@
"wechat",
"weibo"
],
"funding": [
{
"url": "https://www.patreon.com/overtrue",
"type": "patreon"
}
],
"time": "2020-03-04T15:22:25+00:00"
},
{
@ -2210,20 +2204,6 @@
"weixin",
"weixin-sdk"
],
"funding": [
{
"url": "https://www.easywechat.com/img/pay/wechat.jpg",
"type": "custom"
},
{
"url": "https://github.com/overtrue",
"type": "github"
},
{
"url": "https://www.patreon.com/overtrue",
"type": "patreon"
}
],
"time": "2020-07-29T07:36:50+00:00"
},
{
@ -3203,20 +3183,6 @@
"caching",
"psr6"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-23T17:22:30+00:00"
},
{
@ -3285,20 +3251,6 @@
"interoperability",
"standards"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-06T13:23:11+00:00"
},
{
@ -4898,20 +4850,6 @@
"psr-17",
"psr-7"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-06-25T08:21:47+00:00"
},
{
@ -5441,20 +5379,6 @@
"instantiate",
"serialize"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-06-07T15:42:22+00:00"
},
{
@ -7865,6 +7789,5 @@
"platform": {
"php": "^7.2.5"
},
"platform-dev": [],
"plugin-api-version": "1.1.0"
"platform-dev": []
}
Loading…
Cancel
Save