xieruidong il y a 2 ans
Parent
commit
b7d3982678

+ 10 - 0
application/admin/controller/OrderInfoRefund.php

@@ -131,4 +131,14 @@ class OrderInfoRefund extends Backend
         Db::commit();
         $this->success();
     }
+    public function complete($ids){
+        Db::startTrans();
+        $refund=$this->model->lock(true)->find($ids);
+        if(!$refund->need_complete){
+            $this->error('该售后无法完成');
+        }
+        $refund->makeComplete();
+        Db::commit();
+        $this->success();
+    }
 }

+ 1 - 0
application/admin/view/order_info_refund/index.html

@@ -29,6 +29,7 @@
                            data-operate-orderdetail="{:$auth->check('orders/detail')}"
                            data-operate-hasrec="{:$auth->check('order_info_refund/has_rec')}"
                            data-operate-tk="{:$auth->check('order_info_refund/tk')}"
+                           data-operate-complete="{:$auth->check('order_info_refund/complete')}"
                            width="100%">
                     </table>
                 </div>

+ 14 - 0
application/common/model/Refund.php

@@ -27,6 +27,7 @@ use Yansongda\Supports\Arr;
  * @property bool is_goods_back
  * @property bool need_rec
  * @property bool need_tk
+ * @property bool need_complete
  * @property string audit_remark
  * @property string order_no
  * @property float amount_last
@@ -43,6 +44,7 @@ class Refund Extends Model
         'need_rec',
         'need_tk',
         'is_pass',
+        'need_complete',
     ];
     const REFUND_ING=100;
     const REFUND_PASS=200;
@@ -321,6 +323,12 @@ class Refund Extends Model
             }
         }*/
     }
+    public function makeComplete(){
+        $refund=$this;
+        $refund->over_time=time();
+        $refund->refund_status=Refund::REFUND_OVER;
+        return $refund->save();
+    }
 
 
     /**
@@ -415,6 +423,12 @@ class Refund Extends Model
     public function getNeedTkAttr($_,$model){
         return $this->refund_status==self::REFUND_REFUNDING;
     }
+    #是否需要完成
+    public function getNeedCompleteAttr($_,$model){
+        $con1 = $this->refund_type==self::REFUND_TYPE_HHBX;
+        $con2 = $model['refund_status']==self::REFUND_RUNNING;
+        return $con1 && $con2;
+    }
     public function getTimelineAttr(){
         $arr=[
             [

+ 15 - 0
public/assets/js/backend/order_info_refund.js

@@ -103,6 +103,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                         return row.need_tk && table.data('operate-tk');
                                     }
                                 },
+                                {
+                                    name: 'detail',
+                                    text: __('售后完成'),
+                                    title: __('售后完成'),
+                                    confirm:'确认售后完成吗?',
+                                    classname: 'btn btn-xs btn-success btn-ajax',
+                                    icon: 'fa',
+                                    url: 'order_info_refund/complete',
+                                    success: function (data) {
+                                        $('.btn-refresh').trigger('click')
+                                    },
+                                    visible: function (row) {
+                                        return row.need_tk && table.data('operate-complete');
+                                    }
+                                },
                             ]
                         }
                     ]