Commit 036e0ae6 by 朱继来

确认退款

parent c47147cd
...@@ -28,6 +28,8 @@ use App\Model\ShoppingCartModel; ...@@ -28,6 +28,8 @@ use App\Model\ShoppingCartModel;
use App\Model\OrderServiceModel; use App\Model\OrderServiceModel;
use App\Model\OrderServiceItemsModel; use App\Model\OrderServiceItemsModel;
use App\Model\OrderServiceLogModel; use App\Model\OrderServiceLogModel;
use App\Model\OrderRefundModel;
use App\Model\OrderRefundLogModel;
class ApiController extends Controller class ApiController extends Controller
{ {
...@@ -453,5 +455,40 @@ class ApiController extends Controller ...@@ -453,5 +455,40 @@ class ApiController extends Controller
$this->ExportLayui($OrderServiceItemsModel->lists($request)); $this->ExportLayui($OrderServiceItemsModel->lists($request));
} }
// 确认退款
public function ApiConfirmRefund($request)
{
$id = $request->input('id', 0);
if (!$id) $this->Export(-1, '参数缺失');
$OrderServiceModel = new OrderServiceModel;
$order_service = $OrderServiceModel->find($id);
$OrderRefundModel = new OrderRefundModel;
$OrderRefundLogModel = new OrderRefundLogModel;
$res = $OrderServiceModel->where('id', $id)->update(['refund_status' => 3]);
if ($res === false) $this->Export(-1, '更新售后退款状态失败');
$update = [];
$update['is_refund'] = 1;
$update['status'] = 10;
$update['is_sys'] = 2; // 同步财务
$update['refund_time'] = time();
$res = $OrderRefundModel->where('refund_id', $order_service->refund_id)->update($update);
if ($res === false) $this->Export(-1, '更新退款表失败');
$update_log = [];
$update_log['refund_status'] = 10;
$update_log['refund_time'] = time();
$res = $OrderRefundLogModel->where('refund_id', $order_service->refund_id)->update($update_log);
if ($res === false) $this->Export(-1, '更新退款日志失败');
$this->Export(0, '成功');
}
} }
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class OrderRefundLogModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_refund_log';
protected $primaryKey = 'refund_log_id';
public $timestamps = false;
}
\ No newline at end of file
...@@ -72,11 +72,17 @@ layui.use(['form', 'table', 'laydate'], function(){ ...@@ -72,11 +72,17 @@ layui.use(['form', 'table', 'laydate'], function(){
content = '确定审核该申请吗?'; content = '确定审核该申请吗?';
datax = {id: data.id, service_status: 3}; datax = {id: data.id, service_status: 3};
}else if(layEvent === 'cancel'){ // 取消 } else if(layEvent === 'cancel'){ // 取消
title = '取消申请'; title = '取消申请';
content = '确定取消该申请吗?'; content = '确定取消该申请吗?';
datax = {id: data.id, service_status: -1}; datax = {id: data.id, service_status: -1};
} else if(layEvent === 'confirm'){ // 确认退款
title = '确认退款';
content = '确认已退款吗?';
url = '/api/ApiConfirmRefund';
datax = {id: data.id};
} }
layer.open({ layer.open({
......
...@@ -126,6 +126,8 @@ ...@@ -126,6 +126,8 @@
@{{# } else if (d.service_status == 2) { }} @{{# } else if (d.service_status == 2) { }}
<a class="btn btn-xs btn-outline btn-success" lay-event="audit">审核</a> <a class="btn btn-xs btn-outline btn-success" lay-event="audit">审核</a>
<a class="btn btn-xs btn-outline btn-danger" lay-event="cancel">取消</a> <a class="btn btn-xs btn-outline btn-danger" lay-event="cancel">取消</a>
@{{# } else if (d.service_status == 3 && d.refund_status != 3) { }}
<a class="btn btn-xs btn-outline btn-success" lay-event="confirm">确认退款</a>
@{{# } }} @{{# } }}
</script> </script>
\ No newline at end of file
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