1
0

提交代码

This commit is contained in:
2020-08-06 14:45:56 +08:00
commit 9d0d5f4be9
361 changed files with 36445 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
<?php
namespace App\Admin\Extensions\Actions;
use Encore\Admin\Admin;
class OrderRefundAgree
{
protected $row;
protected $resource;
public function __construct($row)
{
$this->row = $row;
$this->resource = url()->current();
}
protected function script()
{
return <<<SCRIPT
$('.grid-deliver-row').unbind('click').click(function() {
var id = $(this).data('id');
swal({
title: "确认要同意退款吗?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "确认",
showLoaderOnConfirm: true,
cancelButtonText: "取消",
preConfirm: function() {
return new Promise(function(resolve) {
$.ajax({
method: 'post',
url: '{$this->resource}/' + id + '/agree',
data: {
_token:LA.token,
},
success: function (data) {
$.pjax.reload('#pjax-container');
resolve(data);
}
});
});
}
}).then(function(result) {
var data = result.value;
console.log(data);
if (typeof data === 'object') {
if (data.status) {
swal(data.message, '', 'success');
} else {
swal(data.message, '', 'error');
}
}
});
});
SCRIPT;
}
protected function render()
{
Admin::script($this->script());
return "<button type='button' class='btn btn-xs btn-success grid-deliver-row' data-id='{$this->row->orderid}'>确认退款</button>";
}
public function __toString()
{
return $this->render();
}
}