xieruidong 2 anos atrás
pai
commit
bbc5b48aad

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

@@ -27,7 +27,8 @@
                            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')}"
+                           data-operate-hasrec="{:$auth->check('order_info_refund/has_rec')}"
+                           data-operate-tk="{:$auth->check('order_info_refund/tk')}"
                            width="100%">
                     </table>
                 </div>

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

@@ -26,6 +26,7 @@ use Yansongda\Supports\Arr;
  * @property bool has_money
  * @property bool is_goods_back
  * @property bool need_rec
+ * @property bool need_tk
  * @property string audit_remark
  * @property string order_no
  * @property float amount_last
@@ -40,6 +41,7 @@ class Refund Extends Model
         'is_goods_back',
         'refund_status_text',
         'need_rec',
+        'need_tk',
     ];
     const REFUND_ING=100;
     const REFUND_PASS=200;
@@ -408,6 +410,10 @@ class Refund Extends Model
     public function getNeedRecAttr($_,$model){
         return $this->is_goods_back && $this->user_send_time;
     }
+    #是否可以退款
+    public function getNeedTkAttr($_,$model){
+        return $this->refund_status==self::REFUND_REFUNDING;
+    }
     public function getTimelineAttr(){
         $arr=[
             [

+ 17 - 2
public/assets/js/backend/order_info_refund.js

@@ -56,7 +56,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                         $('.btn-refresh').trigger('click')
                                     },
                                     visible: function (row) {
-                                        return row.refund_status===100 && table.data('operate-audit');
+                                        return table.data('operate-audit');
                                     }
                                 },
                                 {
@@ -81,13 +81,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     classname: 'btn btn-xs btn-primary btn-ajax',
                                     icon: 'fa',
                                     url: 'order_info_refund/has_rec',
-                                    callback: function (data) {
+                                    success: function (data) {
                                         $('.btn-refresh').trigger('click')
                                     },
                                     visible: function (row) {
                                         return row.need_rec && table.data('operate-hasrec');
                                     }
                                 },
+                                {
+                                    name: 'detail',
+                                    text: __('退款'),
+                                    title: __('退款'),
+                                    confirm:'确认退款吗?',
+                                    classname: 'btn btn-xs btn-primary btn-ajax',
+                                    icon: 'fa',
+                                    url: 'order_info_refund/tk',
+                                    success: function (data) {
+                                        $('.btn-refresh').trigger('click')
+                                    },
+                                    visible: function (row) {
+                                        return row.need_tk && table.data('operate-tk');
+                                    }
+                                },
                             ]
                         }
                     ]