xieruidong il y a 2 ans
Parent
commit
346a5107be

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

@@ -102,4 +102,12 @@ class OrderInfoRefund extends Backend
             $this->success();
         }
     }
+    public function has_rec($ids){
+        Db::startTrans();
+        $refund=$this->model->lock(true)->find($ids);
+        if(!$refund->need_rec){
+            $this->error('用户未发货无法已收货');
+        }
+        $this->success();
+    }
 }

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

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

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

@@ -25,6 +25,7 @@ use Yansongda\Supports\Arr;
  * @property bool is_wait_audit
  * @property bool has_money
  * @property bool is_goods_back
+ * @property bool need_rec
  * @property string audit_remark
  * @property string order_no
  * @property float amount_last
@@ -38,6 +39,7 @@ class Refund Extends Model
         'timeline',
         'is_goods_back',
         'refund_status_text',
+        'need_rec',
     ];
     const REFUND_ING=100;
     const REFUND_PASS=200;
@@ -402,6 +404,10 @@ class Refund Extends Model
     public function getRefundStatusTextAttr($_,$model){
         return Arr::get(self::getRefundStatus(),$model['refund_status']);
     }
+    #是否可以已收货
+    public function getNeedRecAttr($_,$model){
+        return $this->is_goods_back && $this->user_send_time;
+    }
     public function getTimelineAttr(){
         $arr=[
             [

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

@@ -73,6 +73,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                         return table.data('operate-orderdetail');
                                     }
                                 },
+                                {
+                                    name: 'detail',
+                                    text: __('已收货'),
+                                    title: __('已收货'),
+                                    classname: 'btn btn-xs btn-info btn-ajax',
+                                    icon: 'fa',
+                                    url: 'orders/has_rec',
+                                    callback: function (data) {
+                                        $('.btn-refresh').trigger('click')
+                                    },
+                                    visible: function (row) {
+                                        return row.need_rec && table.data('operate-hasrec');
+                                    }
+                                },
                             ]
                         }
                     ]