Parcourir la source

Merge branch 'master' of ssh://git.dever.cc:10022/dever-product/churen

rabin il y a 3 ans
Parent
commit
3257103587

+ 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
         (

+ 14 - 0
learn/active/database/info_refund_log.php

@@ -194,5 +194,19 @@ return array
             'order' => array('cdate' => 'desc'),
             'col' => '*',
         ),
+        'getTui' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'order_id' => 'yes',
+                'code_id' => 'yes',
+                'state' => 1,
+                'status' => 2,
+            ),
+            'type' => 'one',
+            'order' => array('cdate' => 'desc'),
+            'col' => 'sum(price) as price',
+        ),
     ),
 );

+ 37 - 13
learn/active/lib/Manage.php

@@ -491,22 +491,34 @@ Class Manage
                 // }
                 $active = Dever::db('active/info')->find($v['active_id']);
                 $m = '';
-                if ($v['status'] == 1 && $active['refund_type'] == 2 ) {
+                $url = $name = '';
+                if ($active['refund_type'] == 2 ) {
                     // && time()<$active['act_start'] 
-                    if ($active['off_type'] == 2) {
-                        if ($v['status']!=3) {
+                    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 = '退款';
+                    } elseif ($v['status'] == 2) {
+                        if ($active['off_type'] == 2) {
                             $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 = '退款';
+                        }
+                    } elseif ($v['status'] == 3) {
+                        if ($active['refundagin_type'] == 2) {
+                            $log = Dever::db('active/info_refund_log')->getTui(array('order_id'=>$id,'code_id'=>$v['id']));
+                            if ($log && $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');
-                        } 
                     }
-                    // $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 +560,15 @@ 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('不可重复退款');
+            Dever::setInput('noNum', 1);
+            if (isset($data['price']) && $data['price']) {
+                $tprice = $price+$data['price'];
+                 if ($tprice>$active['price']) {
+                    Dever::alert('退款金额大于购买金额');
+                }
+            }
         }
     }
     public function updateInfoRefundLog($id,$name,$data)
@@ -668,7 +686,13 @@ Class Manage
                 if (!$data['refund_num']) {
                     $data['refund_num'] = 0;
                 }
-                $where['refund_num'] = $refund_num + $data['refund_num'];
+                $noNum = Dever::input('noNum');
+                if ($noNum == 1) {
+                    $where['refund_num'] = $data['refund_num'];
+                } else {
+                    $where['refund_num'] = $refund_num + $data['refund_num'];
+                }
+                
 
                 if ($type == 1 || ($price == $data['price']) || ($data['num'] == $where['refund_num'])) {
                     $ids = Dever::db('active/order')->update($where);

+ 4 - 4
service/agent/database/soft_cash.php

@@ -421,8 +421,8 @@ return array
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'fstart' => array('yes-fdate', '>='),
-                'fend' => array('yes-fdate', '<='),
+                'fstart' => array('yes-zdate', '>='),
+                'fend' => array('yes-zdate', '<='),
                 'status' => array('yes', 'in'),
                 'role' =>'yes',
                 'mid' => 'yes',
@@ -452,8 +452,8 @@ return array
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'fstart' => array('yes-fdate', '>='),
-                'fend' => array('yes-fdate', '<='),
+                'fstart' => array('yes-zdate', '>='),
+                'fend' => array('yes-zdate', '<='),
                 'status' => array('yes', 'in'),
                 'role' =>'yes',
                 'mid' => 'yes',

+ 16 - 8
tool/stats/lib/Manage.php

@@ -92,6 +92,7 @@ Class Manage
 		}
 		$where['state'] = 1;
 		$data = Dever::db('shop/sell_order')->getExcel($where);
+		// print_R($data);die;
 		if ($data) {
 			foreach ($data as $k => $v) {
 				$v['card'] = '';
@@ -174,14 +175,20 @@ Class Manage
 	                 if ($v['status'] == 8 || $v1['status'] == 3) {
 	                    $num = $v1['num'];
 	                    $refund_cash = $v1['price']*$v1['num'];
-	                    if ($v['card_code_cash'] >0) {
-	                    	if ($v['refund_cash'] <= $v['card_code_cash']) {
-	                    		$ka = $v['refund_cash'];
-	                    	} else {
-	                    		$ka = $v['card_code_cash'];
-	                    		$money = $v['refund_cash'] - $v['card_code_cash'];
-	                    	}
+	                    if ($v['refund_cash'] && $v['refund_cash']>0) {
+	                    	$money = $v['refund_cash'];
 	                    }
+	                    if ($v['card_code_cash'] && $v['card_code_cash'] >0) {
+	                    	$ka = $v['card_code_cash'];
+	                    }
+	                    // if ($v['card_code_cash'] && $v['card_code_cash'] >0) {
+	                    // 	if ($v['refund_cash'] <= $v['card_code_cash']) {
+	                    // 		$ka = $v['refund_cash'];
+	                    // 	} else {
+	                    // 		$ka = $v['card_code_cash'];
+	                    // 		$money = $v['refund_cash'] - $v['card_code_cash'];
+	                    // 	}
+	                    // }
 	                    // $refund = Dever::db('shop/sell_order_refund')->find(array('order_id'=>$v['id']));
 	                    // if ($refund)
 	                    $refund_status = '已退款';
@@ -325,8 +332,9 @@ Class Manage
 	                        
 	                    }
 	                }
+	                $body[] = $d;
 				}
-				$body[] = $d;
+				
 			}
 			
 		}