Browse Source

申请退款

lizhen_gitee 10 months ago
parent
commit
1186358c41

+ 25 - 6
addons/unishop/controller/Order.php

@@ -785,13 +785,23 @@ class Order extends Base
         if ($order['have_paid'] == 0) {
             $this->error(__('订单未支付,可直接取消,无需申请售后'));
         }
+        if($order->status == 0){
+            $this->error('当前订单不能申请退款');
+        }
+        if($order->status == -1){
+            $this->error('当前订单已经申请过退款');
+        }
 
-        $amount = input('amount', 0);
-        $serviceType = input('service_type');
-        $receivingStatus = input('receiving_status');
-        $reasonType = input('reason_type');
-        $refundExplain = input('refund_explain');
-        $orderProductId = input('order_product_id');
+        //$amount = input('amount', 0);
+        $amount = $order->total_price;
+        $serviceType = input('service_type',1);
+        $receivingStatus = input('receiving_status',1);
+        $reasonType = input('reason_type','');
+        $refundExplain = input('refund_explain','');
+        $images = input('images','');
+//        $orderProductId = input('order_product_id');
+        $orderProductId = Db::name('unishop_order_product')->where('order_id',$order_id)->column('product_id');
+        $orderProductId = implode(',', $orderProductId);
 
         if (!$orderProductId) {
             $this->error(__('Please select goods'));
@@ -819,6 +829,7 @@ class Order extends Base
             $orderRefund->reason_type = $reasonType;
             $orderRefund->amount = $amount;
             $orderRefund->refund_explain = $refundExplain;
+            $orderRefund->images = $images;
             $orderRefund->save();
 
             $productIdArr = explode(',', $orderProductId);
@@ -928,4 +939,12 @@ class Order extends Base
             'company' => $expressInfo['name'] ?? '快递单号'
         ]);
     }
+
+    /*
+     * 申请退货原因
+     * */
+    public function refund_reason(){
+        $list = Db::name('unishop_refundreason')->order('weigh asc')->select();
+        $this->success(1,$list);
+    }
 }

+ 1 - 1
application/admin/lang/zh-cn/unishop/order.php

@@ -10,7 +10,7 @@ return [
     'Pay_type'         => '付款方式',
     'Online'           => '在线支付',
     'Offline'          => '到货付款',
-    'Wallet'          => '钱包余额',
+    'Wallet'           => '钱包余额',
     'wxPay'            => '微信付款',
     'aliPay'           => '支付宝付',
     'Ip'               => '下单ip',

+ 1 - 1
application/admin/model/unishop/Order.php

@@ -36,7 +36,7 @@ class Order extends Model
 
     public function getPayTypeList()
     {
-        return ['1' => __('Online'), '2' => __('Offline'), '3' => __('wxPay'), '4' => __('aliPay')];
+        return ['1' => __('Online'), '2' => __('Wallet'), '3' => __('wxPay'), '4' => __('aliPay')];
     }
 
     public function getStatusList()

+ 1 - 1
public/assets/js/backend/unishop/order.js

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