Quellcode durchsuchen

展示退款金额

yijia
v-Brocloni vor 3 Jahren
Ursprung
Commit
798d6ec511
2 geänderte Dateien mit 10 neuen und 3 gelöschten Zeilen
  1. +9
    -3
      application/admin/controller/unishop/Order.php
  2. +1
    -0
      public/assets/js/backend/unishop/order.js

+ 9
- 3
application/admin/controller/unishop/Order.php Datei anzeigen

@@ -83,6 +83,7 @@ class Order extends Backend
$item['have_received_status'] = $item['have_received'];
$item['have_commented_status'] = $item['have_commented'];
$item["is_carry"]=$item["is_carry"]?"已提货":"未提货";
$item['refund_fee'] = $item['refund_status']==3?$item['refund_fee']:'--';
}
$result = array("total" => $total, "rows" => $list);
return json($result);
@@ -666,6 +667,7 @@ class Order extends Backend

public function doRefund(){
$order_id = $this->request->get('id');
$refund_fee = $this->request->get("refund_fee",0);
$order = $this->model->where([
'id' => $order_id,
'status'=>1,//订单状态正常
@@ -677,7 +679,7 @@ class Order extends Backend
}
if ($order->have_paid>0){
//已支付
self::refundOrder($order);
self::refundOrder($order,$refund_fee);
}else{
$order->status = \addons\unishop\model\Order::STATUS_CANCEL;
$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->refund_status = \addons\unishop\model\Order::REFUND_STATUS_AGREE;
$order->refund_fee = $refund_fee;
$result = $order->save();
if ($result !== false){
//order_id:订单ID name:订单名称 total_fee:总金额-元 refund_fee退款金额
$param = [
"order_id"=>$order['out_trade_no'],
"total_fee"=>$order['total_price'],
"refund_fee"=>$order['total_price'],
"refund_fee"=>$refund_fee,
"memo"=>'订单退款',
];
PayService::cancel($param,$order["pay_type"]);


+ 1
- 0
public/assets/js/backend/unishop/order.js Datei anzeigen

@@ -103,6 +103,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// {field: 'delivery_price', title: __('Delivery_price'), operate:'BETWEEN'},
{field: 'total_price', title: __('Total_price'), operate:false},
{field: 'status', title: __('Status'),operate:false, searchList: {"-1":__('Refund'),"0":__('Cancel'),"1":__('Normal')}, formatter: Table.api.formatter.status},
{field: 'refund_fee', title: __('退款金额'), operate:false},
{field: 'pay_type', title: __('Pay_type'),operate:false, searchList: {"1":__('Online'),"2":__('Offline'),"3":__('wxPay'),"4":__('aliPay')}, formatter: Table.api.formatter.normal},
// {field: 'ip', title: __('Ip'), visible:false},
// {field: 'have_paid_status', title: __('Have_paid'), searchList: {"0":__('No'),"1":__('Yes')}, formatter: Table.api.formatter.statusCustom},


Laden…
Abbrechen
Speichern