Your Name 2 tahun lalu
induk
melakukan
f405300f81
2 mengubah file dengan 37 tambahan dan 6 penghapusan
  1. 13 0
      learn/active/database/info.php
  2. 24 6
      learn/active/lib/Manage.php

+ 13 - 0
learn/active/database/info.php

@@ -487,6 +487,19 @@ return array
             // 'list'      => true,
             'tab'       => 3,
         ),
+        'refundagin_type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '退款后是否可以再次退款',
+            'default'   => '1',
+            'desc'      => '是否可以退款',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $refund_type,
+            // 'search'    => 'select',
+            // 'list'      => true,
+            'tab'       => 3,
+        ),
 
         'sit_type'        => array
         (

+ 24 - 6
learn/active/lib/Manage.php

@@ -491,22 +491,35 @@ Class Manage
                 // }
                 $active = Dever::db('active/info')->find($v['active_id']);
                 $m = '';
-                if ($v['status'] == 1 && $active['refund_type'] == 2 ) {
+                if ($active['refund_type'] == 2 ) {
                     // && time()<$active['act_start'] 
                     if ($active['off_type'] == 2) {
+                        // print_r($v);die;
                         if ($v['status']!=3) {
                             $url = Dever::url('project/database/update?project=active&table=info_refund_log&search_option_price='.$active['price'].'&search_option_code_id='.$v['id'].'&search_option_order_id='.$id.'&col=price,order_id,code_id,desc', 'manage');
+                            $name = '退款';
                         }
+                    } else if ($active['refundagin_type'] == 2) {
+                        if ($v['status'] == 3) {
+                            $log = Dever::db('active/info_refund_log')->find(array('code_id'=>$v['id'],'status'=>2));
+                            if ($log['price'] < $active['price']) {
+                                $url = Dever::url('project/database/update?project=active&table=info_refund_log&search_option_price='.$active['price'].'&search_option_code_id='.$v['id'].'&search_option_order_id='.$id.'&col=price,order_id,code_id,desc', 'manage');
+                                $name = '再次退款';
+                            }
+                        } 
                     } else {
                        if ($v['status']==1) {
                             $url = Dever::url('project/database/update?project=active&table=info_refund_log&search_option_price='.$active['price'].'&search_option_code_id='.$v['id'].'&search_option_order_id='.$id.'&col=price,order_id,code_id,desc', 'manage');
+                            $name = '退款';
                         } 
                     }
-                    // $url = Dever::url('lib/manage.setOrder&order_id=' . $v['order_id'].'&code_id='.$v['id'].'&col=price', 'active');
-                    
                     if (Dever::load('manage/auth')->checkFunc('active.order', 'editorder', '退款')) {
-                        $m = '<a href="javascript:;" onclick="fastEdit($(this), \''.$url.'\')" class="layui-btn">退款</a>';
+                        if (isset($url) && $url) {
+                            $m = '<a href="javascript:;" onclick="fastEdit($(this), \''.$url.'\')" class="layui-btn">'.$name.'</a>';
+                        }
+                        
                     }
+                    // $url = Dever::url('lib/manage.setOrder&order_id=' . $v['order_id'].'&code_id='.$v['id'].'&col=price', 'active');
                 }
                 
                 $d = array
@@ -548,9 +561,14 @@ Class Manage
         if ($price > $active['price']) {
             Dever::alert('退款金额大于购买金额');
         }
-        $data = Dever::db('active/info_refund_log')->find(Array('order_id'=>$order_id,'code_id'=>$code_id));
+        $data = Dever::db('active/info_refund_log')->find(Array('order_id'=>$order_id,'code_id'=>$code_id,'status'=>2));
         if($data) {
-            // Dever::alert('不可重复退款');
+            if (isset($data['price']) && $data['price']) {
+                $tprice = $price+$data['price'];
+                 if ($t_price>$active['price']) {
+                    Dever::alert('退款金额大于购买金额');
+                }
+            }
         }
     }
     public function updateInfoRefundLog($id,$name,$data)