Browse Source

拒绝退款

master
lanzu_qsy 5 years ago
parent
commit
3e116ce8d4
  1. 4
      app/Admin/Controllers/ImsCjdcOrderMainController.php
  2. 36
      app/Admin/Extensions/OrderRefund.php
  3. 4
      app/Admin/Extensions/OrderStateHandle.php
  4. 54
      app/Admin/Forms/RefundNote.php

4
app/Admin/Controllers/ImsCjdcOrderMainController.php

@ -6,6 +6,7 @@ use App\Admin\Extensions\CheckRow;
use App\Admin\Extensions\CouponTieEdit; use App\Admin\Extensions\CouponTieEdit;
use App\Admin\Extensions\OrderDetail; use App\Admin\Extensions\OrderDetail;
use App\Admin\Extensions\OrderPrint; use App\Admin\Extensions\OrderPrint;
use App\Admin\Extensions\OrderRefund;
use App\Admin\Extensions\OrderStateHandle; use App\Admin\Extensions\OrderStateHandle;
use App\Admin\Forms\CouponTieForm; use App\Admin\Forms\CouponTieForm;
use App\Admin\Repositories\ImsCjdcOrderMain; use App\Admin\Repositories\ImsCjdcOrderMain;
@ -60,6 +61,9 @@ class ImsCjdcOrderMainController extends AdminController
}elseif ($state==3){ }elseif ($state==3){
$actions->append(new OrderPrint('打印')); $actions->append(new OrderPrint('打印'));
$actions->append(new CheckRow($actions->row->id,$grid->model()->getCurrentPage(),'自送')); $actions->append(new CheckRow($actions->row->id,$grid->model()->getCurrentPage(),'自送'));
}elseif ($state==8){
$actions->append(new OrderStateHandle('同意退款',9));
$actions->append(new OrderRefund($actions->row->id,$grid->model()->getCurrentPage(),'拒绝退款'));
} }
$actions->append(new OrderDetail('详情')); $actions->append(new OrderDetail('详情'));
}); });

36
app/Admin/Extensions/OrderRefund.php

@ -0,0 +1,36 @@
<?php
namespace App\Admin\Extensions;
use App\Admin\Forms\RefundNote;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;
class OrderRefund extends RowAction
{
protected $title;
protected $order_id;
protected $currentPage;
public function __construct($orderId,$currentPage,$title=null)
{
$this->order_id = $orderId;
$this->currentPage = $currentPage;
parent::__construct($title);
}
public function render()
{
// 实例化表单类并传递自定义参数
$form = RefundNote::make(['order_id'=>$this->order_id,'current_page'=>$this->currentPage]);
return Modal::make()
->lg()
->title('拒绝理由')
->body($form)
->button($this->title);
}
}

4
app/Admin/Extensions/OrderStateHandle.php

@ -2,6 +2,7 @@
namespace App\Admin\Extensions; namespace App\Admin\Extensions;
use App\Admin\Common\Rpc; use App\Admin\Common\Rpc;
use App\Admin\Forms\RefundNote;
use App\Models\ImsCjdcOrderMain; use App\Models\ImsCjdcOrderMain;
use Dcat\Admin\Grid\Displayers\Modal; use Dcat\Admin\Grid\Displayers\Modal;
use Dcat\Admin\Grid\RowAction; use Dcat\Admin\Grid\RowAction;
@ -46,7 +47,10 @@ class OrderStateHandle extends RowAction
Log::error('订单完成时分账接口调用失败',$result); Log::error('订单完成时分账接口调用失败',$result);
return $this->response()->error('操作失败')->refresh(); return $this->response()->error('操作失败')->refresh();
} }
}elseif ($res&&$state==9){//同意退款
} }
if ($res==true){ if ($res==true){
return $this->response()->success('操作成功')->refresh(); return $this->response()->success('操作成功')->refresh();
}else{ }else{

54
app/Admin/Forms/RefundNote.php

@ -0,0 +1,54 @@
<?php
namespace App\Admin\Forms;
use App\Models\ImsCjdcOrderMain;
use Dcat\Admin\Widgets\Form;
use Symfony\Component\HttpFoundation\Response;
class RefundNote extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return Response
*/
public function handle(array $input)
{
$note = request()->get('refuse_refund_note');
$oid = request()->get('order_id');
$current_page = request()->get('current_page');
$result = ImsCjdcOrderMain::where('id', $oid)->update([
'refuse_refund_note' => $note,
'state'=>10,
'updated_at' => time()
]);
if ($result) {
return $this->success('操作成功', "order?page={$current_page}");
} else {
return $this->error('操作失败');
}
}
/**
* Build a form here.
*/
public function form()
{
$this->textarea('refuse_refund_note', '原因')->placeholder('请填写拒绝退款的理由,字数不得超过50个字')->required();
$this->hidden('order_id')->value($this->data['order_id']);
$this->hidden('current_page')->value($this->data['current_page']);
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
}
}
Loading…
Cancel
Save