|
@@ -83,6 +83,7 @@ class Order extends Backend |
|
|
$item['have_received_status'] = $item['have_received']; |
|
|
$item['have_received_status'] = $item['have_received']; |
|
|
$item['have_commented_status'] = $item['have_commented']; |
|
|
$item['have_commented_status'] = $item['have_commented']; |
|
|
$item["is_carry"]=$item["is_carry"]?"已提货":"未提货"; |
|
|
$item["is_carry"]=$item["is_carry"]?"已提货":"未提货"; |
|
|
|
|
|
$item['refund_fee'] = $item['refund_status']==3?$item['refund_fee']:'--'; |
|
|
} |
|
|
} |
|
|
$result = array("total" => $total, "rows" => $list); |
|
|
$result = array("total" => $total, "rows" => $list); |
|
|
return json($result); |
|
|
return json($result); |
|
@@ -666,6 +667,7 @@ class Order extends Backend |
|
|
|
|
|
|
|
|
public function doRefund(){ |
|
|
public function doRefund(){ |
|
|
$order_id = $this->request->get('id'); |
|
|
$order_id = $this->request->get('id'); |
|
|
|
|
|
$refund_fee = $this->request->get("refund_fee",0); |
|
|
$order = $this->model->where([ |
|
|
$order = $this->model->where([ |
|
|
'id' => $order_id, |
|
|
'id' => $order_id, |
|
|
'status'=>1,//订单状态正常 |
|
|
'status'=>1,//订单状态正常 |
|
@@ -677,7 +679,7 @@ class Order extends Backend |
|
|
} |
|
|
} |
|
|
if ($order->have_paid>0){ |
|
|
if ($order->have_paid>0){ |
|
|
//已支付 |
|
|
//已支付 |
|
|
self::refundOrder($order); |
|
|
|
|
|
|
|
|
self::refundOrder($order,$refund_fee); |
|
|
}else{ |
|
|
}else{ |
|
|
$order->status = \addons\unishop\model\Order::STATUS_CANCEL; |
|
|
$order->status = \addons\unishop\model\Order::STATUS_CANCEL; |
|
|
$order->save(); |
|
|
$order->save(); |
|
@@ -689,16 +691,20 @@ class Order extends Backend |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static function refundOrder($order){ |
|
|
|
|
|
|
|
|
static function refundOrder($order,$refund_fee){ |
|
|
|
|
|
if ($refund_fee == 0) {//如果未传入金额,则使用总金额 |
|
|
|
|
|
$refund_fee = $order['total_price']; |
|
|
|
|
|
} |
|
|
$order->status = \addons\unishop\model\Order::STATUS_REFUND; |
|
|
$order->status = \addons\unishop\model\Order::STATUS_REFUND; |
|
|
$order->refund_status = \addons\unishop\model\Order::REFUND_STATUS_AGREE; |
|
|
$order->refund_status = \addons\unishop\model\Order::REFUND_STATUS_AGREE; |
|
|
|
|
|
$order->refund_fee = $refund_fee; |
|
|
$result = $order->save(); |
|
|
$result = $order->save(); |
|
|
if ($result !== false){ |
|
|
if ($result !== false){ |
|
|
//order_id:订单ID name:订单名称 total_fee:总金额-元 refund_fee退款金额 |
|
|
//order_id:订单ID name:订单名称 total_fee:总金额-元 refund_fee退款金额 |
|
|
$param = [ |
|
|
$param = [ |
|
|
"order_id"=>$order['out_trade_no'], |
|
|
"order_id"=>$order['out_trade_no'], |
|
|
"total_fee"=>$order['total_price'], |
|
|
"total_fee"=>$order['total_price'], |
|
|
"refund_fee"=>$order['total_price'], |
|
|
|
|
|
|
|
|
"refund_fee"=>$refund_fee, |
|
|
"memo"=>'订单退款', |
|
|
"memo"=>'订单退款', |
|
|
]; |
|
|
]; |
|
|
PayService::cancel($param,$order["pay_type"]); |
|
|
PayService::cancel($param,$order["pay_type"]); |
|
|