Commit 7da49779 by 孙龙

订单详情

parent df357e26
<?php
namespace App\Admin\Actions;
use App\Models\Order as OrderModel;
use Dcat\Admin\Grid\BatchAction;
use Dcat\Admin\Grid\Tools\AbstractTool;
use Illuminate\Http\Request;
use Dcat\Admin\Widgets\Modal;
class OrderEditSatusAction extends BatchAction
{
/**
* 按钮样式定义,默认 btn btn-white waves-effect
*
* @var string
*/
protected $title = "";
protected $style = 'btn btn-primary feather icon-check-square';
public function render()
{
$this->title = admin_trans("order.labels.edit_status_handle");
$form = \App\Admin\Forms\HandOrderListEStatus::make();
$buttonName = trans('order.labels.edit_status_handle');
return Modal::make()->lg()->title($this->title)->body($form->payload([
]))->onLoad($this->getModalScript())
->button('<button class="btn btn-primary">
<i class="feather icon-check-circle"></i><span class="d-none d-sm-inline" style="margin-left: 5px">' . $buttonName . '</span>
</button>');
}
protected function getModalScript()
{
// 弹窗显示后往隐藏的id表单中写入批量选中的行ID
$warning = trans('global.labels.operate_must_single');
$warning2 = trans('global.labels.operate_must_select_data');
return <<<JS
// 获取选中的ID数组
var key = {$this->getSelectedKeysScript()}
if (key.length > 1){
Dcat.swal.error('$warning');
Dcat.reload();
return false;
}
if (!key.length){
Dcat.swal.error('$warning2');
Dcat.reload();
}
$('#order_id').val(key);
JS;
}
}
\ No newline at end of file
<?php
namespace App\Admin\Forms;
use App\Models\Inquiry;
use App\Models\Order;
use Dcat\Admin\Models\Administrator;
use Dcat\Admin\Widgets\Alert;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Contracts\LazyRenderable;
class HandOrderListEStatus extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$order_id = arrayGet($input,"order_id",0,"intval");
$status = arrayGet($input,"status",0,"intval");
$orderInfo = Order::getOne($order_id);
if($orderInfo["status"] <= Order::$STATUS_FORAMT["待审核"] ){
return $this->response()->error(admin_trans("order.return_msg.50001"))->refresh();
}
Order::updateOrder(["order_id"=>$order_id],["status"=>$status]);
return $this->response()->success('order.return_msg.50000')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->hidden('order_id')->attribute('id', 'order_id');
$this->select("status",admin_trans("order.labels.将该订单状态置为"))->width(8, 3)->options(admin_trans("order.options.edit_status"));
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return [
];
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class OrderReturnItems extends Model
{
use HasDateTimeFormatter;
protected $table = 'order_return_items';
protected $primaryKey = 'return_items_id';
public $timestamps = false;
public static function getOrderReturnItemList($rec_ids=[]){
self::whereIn("rec_id")
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment