退款流程: 后台最终处理挂起订单流程,
售后单超时自动挂起 售后同意结算单收益释放(余留未退金额情况下 后台帮商户售后功能 后台帮用户取消和申请售后功能 后台用户维度查看提现,结算,订单记录 结算单,活动单,活动,提现记录增加 万以上数据导出excel
This commit is contained in:
parent
28f2056fb6
commit
a9a4ebe154
@ -205,4 +205,119 @@ class Order extends Backend
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**发布者售后确认
|
||||
* @return string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function shop_confirmation($ids = ""){
|
||||
|
||||
if($this->request->isPost())
|
||||
{
|
||||
try{
|
||||
$params = $this->request->post("row/a");
|
||||
$order_no = $params["order_no"];
|
||||
$reject_reason = $params["reject_reason"];
|
||||
$price = $params["price"];
|
||||
$status = $params["status"];
|
||||
$model = (new \app\common\model\school\activity\order\Order());
|
||||
$model->shopConfirmation($order_no,$status,$price,$reject_reason,0,true,'admin',$this->auth->id,true);
|
||||
}catch (\Exception $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$this->success("已完成售后审核");
|
||||
}
|
||||
|
||||
$row = $this->model->where(array('id'=>$ids))->find();
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
|
||||
// $row = $this->model->get($param['ids']);
|
||||
$this->view->assign("statusList", ["yes"=>"同意", "no"=>"拒绝(订单将被挂起)"]);
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**系统确认
|
||||
* @return string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function admin_confirmation($ids = ""){
|
||||
|
||||
if($this->request->isPost())
|
||||
{
|
||||
try{
|
||||
$params = $this->request->post("row/a");
|
||||
$order_no = $params["order_no"];
|
||||
$status = $params["status"];
|
||||
$price = $params["price"];
|
||||
$model = (new \app\common\model\school\activity\order\Order());
|
||||
$model->adminConfirmation($order_no,$status,$price,0,true,'admin',$this->auth->id,true);
|
||||
}catch (\Exception $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$this->success("已完成审核");
|
||||
}
|
||||
|
||||
$row = $this->model->where(array('id'=>$ids))->find();
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
|
||||
// $row = $this->model->get($param['ids']);
|
||||
|
||||
$this->view->assign("statusList", ["yes"=>"同意", "no"=>"拒绝(订单将按完成走结算)"]);
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**发起售后
|
||||
* @return string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function after_sales($ids = ""){
|
||||
|
||||
if($this->request->isPost())
|
||||
{
|
||||
try{
|
||||
$params = $this->request->post("row/a");
|
||||
$classes_order = $params["id"];
|
||||
$reason = $params["reason"];
|
||||
$num = $params["num"];
|
||||
|
||||
$model = (new \app\common\model\school\activity\order\Order());
|
||||
$order = $model->afterSales($classes_order,$num,$reason,0 ,false,'admin',$this->auth->id,true);
|
||||
|
||||
}catch (\Exception $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success("执行成功");
|
||||
}
|
||||
|
||||
$row = $this->model->where(array('id'=>$ids))->find();
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$order_info = \app\common\model\school\activity\order\Order::getDetail($row["id"]);
|
||||
// $row = $this->model->get($param['ids']);
|
||||
$this->view->assign('row',$order_info);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ namespace app\admin\controller\user;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use app\common\library\Auth;
|
||||
use app\common\model\school\activity\order\SettleLog;
|
||||
use fast\Tree;
|
||||
use think\Model;
|
||||
|
||||
@ -53,6 +54,10 @@ class User extends Backend
|
||||
->paginate($limit);
|
||||
foreach ($list as $k => $v) {
|
||||
$v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
|
||||
|
||||
//结算钱包信息
|
||||
$v["settle_info"] = SettleLog::getUserSettleInfo($v->id);
|
||||
|
||||
$v->hidden(['password', 'salt']);
|
||||
}
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
@ -18,10 +18,14 @@ class Userwithdrawal extends Backend
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $qSwitch = true;
|
||||
protected $qFields = ["user_id"];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
$this->model = new \app\admin\model\user\withdrawal\Userwithdrawal;
|
||||
parent::_initialize();
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
<ul class="row list-inline faupload-preview" id="p-images"></ul>
|
||||
<span style="color: red">( 推荐图片比例为 690*580 )</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -33,6 +33,8 @@
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
<ul class="row list-inline faupload-preview" id="p-images"></ul>
|
||||
<span style="color: red">( 推荐图片比例为 690*580 )</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
<ul class="row list-inline faupload-preview" id="p-images"></ul>
|
||||
<span style="color: red">( 推荐图片比例为 690*580 )</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
<form id="admin_confirmation-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
<input name="row[order_no]" type="hidden" value="{$row.order_no}">
|
||||
<fieldset>
|
||||
<legend><h4>平台处理挂起单(如果拒绝退款,则视为订单完成将正常结算给商家,如果同意退款,提交后需等待微信退款回调,回调成功才会更新订单状态!)</h4></legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('处理结果')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<div class="radio">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="yes"}checked{/in} /> {$vo}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="status_yes" >
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('确定的退款金额')} :</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-price" data-rule="required" class="form-control" disabled step="0.01" name="row[price]" type="number" value="{$row.sub_refundprice|htmlentities}">
|
||||
<span style="color: red">( 如果未全退,剩余未退金额将正常结算给商家 )</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="status_no" style="display: none;">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="button" id="admin_confirmation" data-type="admin_confirmation" class="btn btn-success btn-embossed">确认提交结果</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
@ -0,0 +1,31 @@
|
||||
<form id="after_sales-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
<input name="row[id]" type="hidden" value="{$row.id}">
|
||||
<fieldset>
|
||||
<legend><h4>帮用户售后需填写原因!</h4></legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('售后原因')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-reason" class="form-control" data-rule="required" name="row[reason]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="status_yes" >
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('退款人数')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-num" data-rule="required" class="form-control" step="1" name="row[num]" type="number" value="{$row.num}">
|
||||
<span style="color: red">( 当前订单数量为 {$row.num|htmlentities} 当前单人单价为 {$row.detail.price|htmlentities} )</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="button" id="after_sales" data-type="after_sales" class="btn btn-success btn-embossed">确认提交结果</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,47 @@
|
||||
<form id="shop_confirmation-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
<input name="row[order_no]" type="hidden" value="{$row.order_no}">
|
||||
<fieldset>
|
||||
<legend><h4>代商家处理售后</h4></legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('处理结果')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<div class="radio">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="yes"}checked{/in} /> {$vo}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="status_yes" >
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('同意退款金额')}(默认损耗后额度):</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.auto_recommend_price >0 ? $row.auto_recommend_price : $row.sub_refundprice }">
|
||||
<span style="color: red">( 当前订单损耗比为 {$row.loss_proportion|htmlentities}% | 忽略损耗应退全额为 {$row.auto_price|htmlentities} [若为0说明课时已用完或计算应退金额小于0.01,请自行决定是否退全款] | 退款金额不能超过订单应退全额{$row.sub_refundprice|htmlentities} )</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="status_no" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Reject_reason')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-reject_reason" class="form-control" name="row[reject_reason]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="button" id="shop_confirmation" data-type="shop_confirmation" class="btn btn-success btn-embossed">确认提交结果</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
@ -3,7 +3,7 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="">
|
||||
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
|
||||
<span style="color: red">
|
||||
|
||||
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
||||
|
@ -323,6 +323,9 @@ $newactivityOrderHooks = [
|
||||
'activity_order_shop_reject_after' => [ // 订单售后拒绝
|
||||
'app\\common\\listener\\activity\\OrderHook'
|
||||
],
|
||||
'activity_order_timeout_reject_after'=> [ // 订单售后拒绝
|
||||
'app\\common\\listener\\activity\\OrderHook'
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
|
@ -586,7 +586,7 @@ class OrderHook
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"activity_order_after_sales_after",
|
||||
"event"=>"activity_order_shop_confirm_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"activity_id"=>$order["activity_id"],
|
||||
@ -644,7 +644,7 @@ class OrderHook
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"activity_order_after_sales_after",
|
||||
"event"=>"activity_order_shop_reject_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"activity_id"=>$order["activity_id"],
|
||||
@ -688,6 +688,62 @@ class OrderHook
|
||||
|
||||
|
||||
|
||||
// 订单售后超时自动拒绝
|
||||
public function activityOrderTimeoutRejectAfter(&$params)
|
||||
{
|
||||
["order"=>$order] = $params;
|
||||
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"activity_order_timeout_reject_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"activity_id"=>$order["activity_id"],
|
||||
"title"=>$detail["title"],
|
||||
"images"=>$detail["images"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"total_refundprice" => $order["total_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"auth_reason" => $order["auth_reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"sign_start_time" => date("Y-m-d H:i",$detail["sign_start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"sign_end_time" => date("Y-m-d H:i",$detail["sign_end_time"]),
|
||||
];
|
||||
|
||||
//发用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1238,7 +1238,7 @@ class Activity extends BaseModel
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage());
|
||||
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ class Order extends BaseModel
|
||||
self::paySetData($order,$notify);
|
||||
|
||||
//释放结算订单
|
||||
// (new SettleLog)->generatorLog($order['id']);
|
||||
(new SettleLog)->timeoutSettleActivityCheck($order["activity_id"]);
|
||||
|
||||
// //如果需要快捷预约
|
||||
// $classes_lib_spec_id = $order['classes_lib_spec_id'];
|
||||
@ -1239,7 +1239,7 @@ class Order extends BaseModel
|
||||
|
||||
|
||||
//释放结算订单
|
||||
// (new SettleLog)->generatorLog($order['id']);
|
||||
(new SettleLog)->timeoutSettleActivityCheck($order["activity_id"]);
|
||||
|
||||
//调用支付成功事件
|
||||
$data = ['order' => $order];
|
||||
@ -1825,19 +1825,23 @@ class Order extends BaseModel
|
||||
$order->refundtime = time();
|
||||
$order->refund_json = json_encode($pay_json);
|
||||
$order->save();
|
||||
|
||||
//报废旧的结算单
|
||||
SettleLog::where("activity_order_id",$order['id'])
|
||||
->where("status" ,"in",["1","2"])
|
||||
->update([
|
||||
"status"=>"-1",
|
||||
"canceltime" => time()
|
||||
]);
|
||||
|
||||
//若存在剩余金额,结算给发布者
|
||||
if($order->sub_refundprice > $order->fee_scale){
|
||||
//报废旧的结算单
|
||||
SettleLog::where("activity_order_id",$order['id'])
|
||||
->where("status" ,"in",["1","2"])
|
||||
->update([
|
||||
"status"=>"-1",
|
||||
"canceltime" => time()
|
||||
]);
|
||||
|
||||
//插入新结算单
|
||||
(new SettleLog)->generatorLog($order['id']);
|
||||
// (new SettleLog)->generatorLog($order['id']);
|
||||
//对活动订单进行结算记录插入
|
||||
(new SettleLog)->timeoutSettleActivityCheck($order["activity_id"]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2062,8 +2066,9 @@ class Order extends BaseModel
|
||||
public static function updateShopConfirmationOrder($order,$price){
|
||||
if(is_string($order))$order = self::getHaveShopConfirmationOrder($order);
|
||||
$order->status = "5";//refund_status
|
||||
$order->service_stauts = "6";
|
||||
$order->server_status = "6";
|
||||
$order->auth_status = 1;
|
||||
$order['suspend_status'] = '1';
|
||||
$order->total_refundprice = $price;
|
||||
$order->refundtime = time();
|
||||
$order->save();
|
||||
@ -2081,11 +2086,11 @@ class Order extends BaseModel
|
||||
*/
|
||||
public static function updateShopConfirmationFailOrder($order,$reason){
|
||||
if(is_string($order))$order = self::getHaveShopConfirmationOrder($order);
|
||||
$order->status = "7";//refund_status
|
||||
$order->service_stauts = "6";
|
||||
$order->auth_status = 2;
|
||||
$order->reason = $reason;
|
||||
$order->suspend_status = '1';
|
||||
$order["status"] = "7";//refund_status
|
||||
$order["server_status"] = "6";
|
||||
$order["auth_status"] = 2;
|
||||
$order["reason"] = $reason;
|
||||
$order['suspend_status'] = '1';
|
||||
$order->save();
|
||||
return $order;
|
||||
}
|
||||
@ -2106,6 +2111,10 @@ class Order extends BaseModel
|
||||
*/
|
||||
public function shopConfirmation($order_no,$status,$price,$reject_reason,$user_id=0,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
|
||||
|
||||
//得到机构售后提交确认订单
|
||||
$order = self::getHaveShopConfirmationOrder($order_no);
|
||||
$this->timeoutSuspension($order['id'],$trans);
|
||||
//得到机构售后提交确认订单
|
||||
$order = self::getHaveShopConfirmationOrder($order_no);
|
||||
if($check){
|
||||
@ -2156,6 +2165,8 @@ class Order extends BaseModel
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
|
||||
|
||||
//事务逻辑
|
||||
//更新售后为取消状态
|
||||
switch ($status){
|
||||
@ -2195,9 +2206,9 @@ class Order extends BaseModel
|
||||
|
||||
//插入订单日志
|
||||
if(!$user_id ||$order["user_id"] !=$user_id ){
|
||||
$order::log($order['id'],"[系统操作]活动订单售后驳回,订单挂起,等待官方处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
OrderLog::log($order['id'],"[系统操作]活动订单售后驳回,订单挂起,等待官方处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
}else{
|
||||
$order::log($order['id'],"活动订单售后驳回,订单挂起,等待官方处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
OrderLog::log($order['id'],"活动订单售后驳回,订单挂起,等待官方处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
}
|
||||
|
||||
//调用订单取消事件
|
||||
@ -2210,7 +2221,200 @@ class Order extends BaseModel
|
||||
throw new \Exception("参数错误!");
|
||||
}
|
||||
//执行课时数更新
|
||||
$res1 = order::statisticsAndUpdateClassesNumber($order['classes_order_id']);
|
||||
$res1 = order::statisticsAndUpdateClassesNumber($order);
|
||||
|
||||
|
||||
if($trans){
|
||||
self::commitTrans();
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage());
|
||||
}
|
||||
return $res1;
|
||||
}
|
||||
|
||||
|
||||
/** 检测售后订单超时未处理自动挂起定时任务
|
||||
* @param $id 售后订单id非必填,不填则检测所有超时未处理的
|
||||
* @param $trans
|
||||
* @return true
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function timeoutSuspension($id=0,$trans=false){
|
||||
//去超时时间戳配置
|
||||
$timeout = config('site.activity_end_sales');
|
||||
//当前时间
|
||||
$time = time();
|
||||
//延期时间过了当前时间的时间点(用时间戳相减特性)
|
||||
$delay_time = $time - $timeout;
|
||||
//初始查询model
|
||||
$as = $this->getWithAlisaName();
|
||||
$model = self::with(["detail"])
|
||||
->where("{$as}.server_status",'3')
|
||||
->where("{$as}.suspend_status",'0')
|
||||
->where("{$as}.status",'4');
|
||||
if($id){
|
||||
$model = $model->where("{$as}.id",$id);
|
||||
}
|
||||
//查询条件2:过了活动结束时间加延期时间的订单
|
||||
$model = $model->where("detail.end_time","<",$delay_time);
|
||||
$list = $model->select();
|
||||
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
//遍历订单,执行挂起操作
|
||||
foreach ($list as $row){
|
||||
//执行挂起操作
|
||||
$row["status"] = "7";
|
||||
$row["server_status"] = "6";
|
||||
$row["suspend_status"] = "2";
|
||||
$row["auth_status"] = 2;
|
||||
$row["auth_time"] = time();
|
||||
$row->save();
|
||||
|
||||
//写订单日志
|
||||
OrderLog::log($row['id'],"活动订单售后超时自动驳回,订单挂起,等待官方处理",'admin', 0);
|
||||
//调用挂起事件
|
||||
$data = ['order' => self::where("id",$row['id'])->find(),"user_id"=>0,"oper_type"=>"admin","oper_id"=>0];
|
||||
\think\Hook::listen('activity_order_timeout_reject_after', $data);
|
||||
|
||||
|
||||
|
||||
}
|
||||
if($trans){
|
||||
self::commitTrans();
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**总后台最后处理售后挂起的订单
|
||||
* @param $order_no
|
||||
* @param int $user_id
|
||||
* @param string $status yes同意 no拒绝(即订单按完成算)
|
||||
* @param string $price 商定价格
|
||||
* @param bool $check
|
||||
* @param bool $trans
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function adminConfirmation($order_no,$status,$price,$user_id=0,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
//得到机构售后提交确认订单
|
||||
$order = self::getHaveShopConfirmationOrder($order_no);
|
||||
|
||||
if($check){
|
||||
//用户操作权限检测
|
||||
Order::checkOptionAuth($order['id'],$user_id ?: $oper_id,$oper_type,false,false,true);
|
||||
}
|
||||
$classesorder = $order;
|
||||
if(!$classesorder)throw new \Exception("订单不存在!");
|
||||
|
||||
switch ($status){
|
||||
case 'yes':
|
||||
//同意
|
||||
//验证价格正确性
|
||||
//金额必须小于等于剩余未退全额
|
||||
$price = floatval($price);
|
||||
if($price > $classesorder['sub_refundprice']){
|
||||
throw new \Exception("价格必须小于等于剩余应退全额!");
|
||||
}
|
||||
//数据修正大于剩余未退全额 则等于剩余未退
|
||||
$price = $price > $classesorder['sub_refundprice'] ? $classesorder['sub_refundprice'] : $price;
|
||||
if($price<=0)throw new \Exception("同意退款必须大于0!");
|
||||
|
||||
//如果非全额退款,剩余金额必须大于订单支付时的手续费
|
||||
if($price < $classesorder['sub_refundprice']){
|
||||
$sub_price = bcsub($classesorder['sub_refundprice'] , $price,2);
|
||||
if($sub_price <= $classesorder['fee_price']){
|
||||
throw new \Exception("如果未退全款,剩余未退金额必须大于订单支付时的手续费{$classesorder['fee_price']}!");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'no':
|
||||
//拒绝
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("参数错误!");
|
||||
}
|
||||
|
||||
|
||||
//判断逻辑
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
|
||||
|
||||
//事务逻辑
|
||||
//更新售后为取消状态
|
||||
switch ($status){
|
||||
case 'yes':
|
||||
//同意
|
||||
|
||||
//更新订单状态为同意
|
||||
$order = self::updateShopConfirmationOrder($order,$price);
|
||||
|
||||
//插入订单日志
|
||||
if(!$user_id ||$order["user_id"] !=$user_id ){
|
||||
OrderLog::log($order['id'],"[系统操作]活动订单售后最终处理结果:用户发起金额为{$order['first_refundprice']},确认退款金额为{$price}元,等待退款到账",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
}else{
|
||||
OrderLog::log($order['id'],"活动订单售后最终处理结果:用户发起金额为{$order['first_refundprice']},确认退款金额为{$price}元,等待退款到账",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
}
|
||||
|
||||
//调用订单事件
|
||||
$data = ['order' => self::where("id",$order['id'])->find(),"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
|
||||
\think\Hook::listen('activity_order_shop_confirm_after', $data);
|
||||
|
||||
|
||||
//执行退款
|
||||
//执行退款
|
||||
self::orderRefund($order['order_no'],$price,$oper_type,$oper_id);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 'no':
|
||||
//拒绝
|
||||
|
||||
//插入订单日志
|
||||
if(!$user_id ||$order["user_id"] !=$user_id ){
|
||||
OrderLog::log($order['id'],"[系统操作]活动订单售后最终判定为不进行售后,将不退款,按订单完成处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
}else{
|
||||
OrderLog::log($order['id'],"活动订单售后最终判定为不进行售后,将不退款,按订单完成处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
|
||||
}
|
||||
|
||||
//调用订单完成
|
||||
//执行订单完成的更新逻辑
|
||||
self::updateFinish($order);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("参数错误!");
|
||||
}
|
||||
//执行课时数更新
|
||||
$res1 = order::statisticsAndUpdateClassesNumber($order);
|
||||
|
||||
|
||||
if($trans){
|
||||
@ -2230,5 +2434,4 @@ class Order extends BaseModel
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -180,6 +180,10 @@ class SettleLog extends BaseModel
|
||||
try {
|
||||
//查询更新所有活动状态
|
||||
Activity::timeoutCheck();
|
||||
|
||||
//执行售后单挂起操作
|
||||
(new order)->timeoutSuspension();
|
||||
|
||||
//延后时间(秒)
|
||||
$delay = config("site.activity_end_settle") ?: 0;
|
||||
$time = time();
|
||||
|
@ -129,6 +129,55 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
// }
|
||||
},
|
||||
|
||||
{
|
||||
name: 'activity_order',
|
||||
text: __('参与的活动订单'),
|
||||
title: __('参与的活动订单'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-cart-arrow-down',
|
||||
dropdown : '更多',
|
||||
url: activity_order_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
|
||||
{
|
||||
name: 'user',
|
||||
text: __('发布用户查看'),
|
||||
title: __('发布用户查看'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-cart-arrow-down',
|
||||
dropdown : '更多',
|
||||
url: user_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
name: 'settle_log',
|
||||
text: __('活动生成的结算日志'),
|
||||
title: __('活动生成的结算日志'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-cart-arrow-down',
|
||||
dropdown : '更多',
|
||||
url: settle_log_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
|
||||
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
|
||||
|
||||
|
||||
@ -299,5 +348,22 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var activity_order_url = function (row,dom) {
|
||||
return 'school/activity/order/order/index?activity_id='+row.id;
|
||||
}
|
||||
|
||||
var user_url = function (row,dom) {
|
||||
return 'user/user/index?id='+row.user_id;
|
||||
}
|
||||
|
||||
|
||||
var settle_log_url = function (row,dom) {
|
||||
return 'school/activity/order/settle_log/index?activity_id='+row.id;
|
||||
}
|
||||
|
||||
|
||||
return Controller;
|
||||
});
|
||||
|
@ -15,6 +15,10 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
import_url: 'school/activity/order/order/import',
|
||||
verification_url: 'school/activity/order/order/verification',
|
||||
refund_url: 'school/activity/order/order/refund',
|
||||
shop_confirmation_url: 'school/activity/order/order/shop_confirmation',
|
||||
after_sales_url: 'school/activity/order/order/after_sales',
|
||||
admin_confirmation_url: 'school/activity/order/order/admin_confirmation',
|
||||
|
||||
table: 'school_activity_order',
|
||||
}
|
||||
});
|
||||
@ -87,6 +91,54 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
|
||||
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
||||
|
||||
{
|
||||
name: 'after_sales',
|
||||
text: __('帮用户发起售后'),
|
||||
title: __('帮用户发起售后'),
|
||||
classname: 'btn btn-xs btn-danger btn-dialog',
|
||||
icon: 'fa fa-sign-in',
|
||||
url: $.fn.bootstrapTable.defaults.extend.after_sales_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
visible: function (row) {
|
||||
//只有付费订单有售后
|
||||
return (row.status == '2' || row.status == '3') && row.detail.feel == '0';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
name: 'shop_confirmation',
|
||||
text: __('代商家处理售后'),
|
||||
title: __('代商家处理售后'),
|
||||
classname: 'btn btn-xs btn-danger btn-dialog',
|
||||
icon: 'fa fa-sign-in',
|
||||
url: $.fn.bootstrapTable.defaults.extend.shop_confirmation_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
visible: function (row) {
|
||||
return row.status == '4';
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'admin_confirmation',
|
||||
text: __('处理挂起单'),
|
||||
title: __('处理挂起单'),
|
||||
classname: 'btn btn-xs btn-danger btn-dialog',
|
||||
icon: 'fa fa-sign-in',
|
||||
url: $.fn.bootstrapTable.defaults.extend.admin_confirmation_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
visible: function (row) {
|
||||
return row.status == '7';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
{name: 'freecancel',
|
||||
text: '取消订单',
|
||||
icon: 'fa fa-user-times',
|
||||
@ -462,6 +514,27 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
admin_confirmation: function(){
|
||||
$("#admin_confirmation").on('click', function() {
|
||||
$("#admin_confirmation-form").attr("action",'school/activity/order/order/admin_confirmation').submit();
|
||||
});
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
shop_confirmation: function(){
|
||||
$("#shop_confirmation").on('click', function() {
|
||||
$("#shop_confirmation-form").attr("action",'school/activity/order/order/shop_confirmation').submit();
|
||||
});
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
|
||||
after_sales: function(){
|
||||
$("#after_sales").on('click', function() {
|
||||
$("#after_sales-form").attr("action",'school/activity/order/order/after_sales').submit();
|
||||
});
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
|
||||
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
|
@ -30,6 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'activity_order_id', title: __('Activity_order_id') ,visible:false},
|
||||
{field: 'activity_id', title: __('活动id') ,visible:false},
|
||||
{field: 'activity_order_detail_id', title: __('订单详情id') ,visible:false},
|
||||
{field: 'withdrawal_log_id',visible:false, title: __('Withdrawal_log_id') },
|
||||
{field: 'to_user_id', title: __('To_user_id')},
|
||||
{field: 'touser.nickname', title: __('Touser.nickname'), operate: 'LIKE'},
|
||||
|
@ -34,6 +34,13 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
{field: 'username', title: __('Username'), operate: 'LIKE'},
|
||||
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
|
||||
{field: 'realname', title: __('真实姓名'), operate: 'LIKE'},
|
||||
|
||||
{field: 'settle_info.settled_amount', title: __('可提现金额'), operate: false},
|
||||
{field: 'settle_info.expected_incoming_amount', title: __('预期收益'), operate: false},
|
||||
{field: 'settle_info.accumulated_incoming_amount', title: __('累计收入'), operate: false},
|
||||
|
||||
|
||||
|
||||
{field: 'work', title: __('职业'), operate: 'LIKE'},
|
||||
{field: 'email', title: __('Email'), operate: 'LIKE'},
|
||||
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
|
||||
@ -135,6 +142,22 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
// }
|
||||
},
|
||||
|
||||
{
|
||||
name: 'activity',
|
||||
text: __('发布的活动'),
|
||||
title: __('发布的活动'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-calendar',
|
||||
dropdown : '更多',
|
||||
url: activity_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
// {
|
||||
// name: 'classes_order',
|
||||
@ -152,25 +175,76 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
// // }
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// name: 'classes_hourorder',
|
||||
// text: __('课时预约单'),
|
||||
// title: __('课时预约单'),
|
||||
// classname: 'btn btn-dialog',
|
||||
// icon: 'fa fa-calendar',
|
||||
// dropdown : '更多',
|
||||
// url: classes_hourorder_url,
|
||||
// callback: function (data) {
|
||||
//
|
||||
// },
|
||||
// // visible: function (row) {
|
||||
// // return row.status == '2'||row.status == '3';
|
||||
// // }
|
||||
// },
|
||||
{
|
||||
name: 'userwithdrawal',
|
||||
text: __('用户提现银行卡'),
|
||||
title: __('用户提现银行卡'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-calendar',
|
||||
dropdown : '更多',
|
||||
url: userwithdrawal_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
{
|
||||
name: 'userwithdrawal_log',
|
||||
text: __('用户提现记录'),
|
||||
title: __('用户提现记录'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-calendar',
|
||||
dropdown : '更多',
|
||||
url: userwithdrawal_log_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
name: 'pay_user',
|
||||
text: __('贡献资金结算'),
|
||||
title: __('贡献资金结算'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-calendar',
|
||||
dropdown : '更多',
|
||||
url: settle_log_pay_user_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
{
|
||||
name: 'to_user',
|
||||
text: __('获取的资金结算'),
|
||||
title: __('获取的资金结算'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-calendar',
|
||||
dropdown : '更多',
|
||||
url: settle_log_to_user_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
name: 'activity_order',
|
||||
text: __('活动订单'),
|
||||
title: __('活动订单'),
|
||||
text: __('参与的活动订单'),
|
||||
title: __('参与的活动订单'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-cart-arrow-down',
|
||||
dropdown : '更多',
|
||||
@ -182,6 +256,7 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
|
||||
// {
|
||||
// name: 'evaluate',
|
||||
// text: __('查看用户评价'),
|
||||
@ -310,5 +385,26 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
}
|
||||
|
||||
|
||||
var userwithdrawal_url = function (row,dom) {
|
||||
return 'user/withdrawal/userwithdrawal/index?user_id='+row.id;
|
||||
}
|
||||
|
||||
var userwithdrawal_log_url = function (row,dom) {
|
||||
return 'user/withdrawal/userwithdrawal_log/index?user_id='+row.id;
|
||||
}
|
||||
|
||||
var settle_log_to_user_url = function (row,dom) {
|
||||
return 'school/activity/order/settle_log/index?to_user_id='+row.id;
|
||||
}
|
||||
|
||||
var settle_log_pay_user_url = function (row,dom) {
|
||||
return 'school/activity/order/settle_log/index?pay_user_id='+row.id;
|
||||
}
|
||||
|
||||
var activity_url = function (row,dom) {
|
||||
return 'school/activity/activity/index?user_id='+row.id;
|
||||
}
|
||||
|
||||
|
||||
return Controller;
|
||||
});
|
@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'user/withdrawal/userwithdrawal/index' + location.search,
|
||||
add_url: 'user/withdrawal/userwithdrawal/add',
|
||||
edit_url: 'user/withdrawal/userwithdrawal/edit',
|
||||
add_url: 'user/withdrawal/userwithdrawal/add'+ location.search,
|
||||
edit_url: 'user/withdrawal/userwithdrawal/edit'+ location.search,
|
||||
del_url: 'user/withdrawal/userwithdrawal/del',
|
||||
multi_url: 'user/withdrawal/userwithdrawal/multi',
|
||||
import_url: 'user/withdrawal/userwithdrawal/import',
|
||||
|
Loading…
x
Reference in New Issue
Block a user