Your Name 3 年之前
父節點
當前提交
fe1063bd33
共有 3 個文件被更改,包括 66 次插入10 次删除
  1. 25 0
      learn/active/database/info_refund.php
  2. 12 0
      learn/active/database/info_refund_log.php
  3. 29 10
      learn/active/lib/Manage.php

+ 25 - 0
learn/active/database/info_refund.php

@@ -62,6 +62,31 @@ return array
             // 'list'      => true,
         ),
 
+        'price'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '退款金额-单张票价',
+            'default'   => '0',
+            'desc'      => '票价-单位:元',
+            'match'     => 'option',
+            'update'    => 'text',
+            'value'     => Dever::input('search_option_price'),
+            // 'list'      => $search_auth == 1 ? true : false,
+            // 'list_order' => '3',
+            // 'tab'       => 2,
+        ),
+
+        'desc'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            // 'tab'       => 3,
+        ),
+
         'status'        => array
         (
             'type'      => 'tinyint-1',

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

@@ -89,6 +89,18 @@ return array
             // 'tab'       => 2,
         ),
 
+        'desc'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            // 'tab'       => 3,
+        ),
+
+
         'status'        => array
         (
             'type'      => 'tinyint-1',

+ 29 - 10
learn/active/lib/Manage.php

@@ -40,6 +40,7 @@ Class Manage
     public function insertInfoRefund ($id,$name,$data)
     {
         $num = Dever::param('num',$data);
+        $price = Dever::param('price',$data);
         $order_id = Dever::param('order_id',$data);
         $data = Dever::db('active/order')->find($order_id);
         if ($num < 1) {
@@ -48,6 +49,11 @@ Class Manage
         if($num > $data['num']) {
             Dever::alert('退款数量大于购买数量');
         }
+        $info = Dever::db('active/info')->find($data['active_id']);
+        // $refund_price = $num*$info['price'];
+        if ($price > $info['price']) {
+            Dever::alert('退款金额大于购买金额');
+        }
         $code = Dever::db('active/code')->getCode(array('order_id' => $order_id,'status'=>'1,2'));
         $use_code = count($code);#已领取的所有数量
         if (!$data['refund_num']) {
@@ -70,12 +76,14 @@ Class Manage
     public function updateInfoRefund ($id,$name,$data)
     {
         $num = Dever::param('num',$data);
+        $price = Dever::param('price',$data);
+        $desc = Dever::param('desc',$data);
         $order_id = Dever::param('order_id',$data);
         $code_id = Dever::param('code_id',$data);
         $data = Dever::db('active/order')->find($order_id);
         // $info = Dever::db('active/info_refund')->state(array('order_id'=>$order_id));
         // $active = Dever::db('active/info')->find($data['active_id']);
-       $this->common($data,2,$num,$id);
+       $this->common($data,2,$num,$id,$price,$desc);
         return 'reload';
     }
     
@@ -373,7 +381,7 @@ Class Manage
         if ($info['status'] > 1 && $no_code > 0 && $info['status'] != 3  && $active['refund_type'] == 2) {
             // && time()<$active['act_start']
             if (Dever::load('manage/auth')->checkFunc('active.order', 'editrefund1', '未使用退款')) {
-                $purl = Dever::url('project/database/update?project=active&table=info_refund&search_option_order_id='.$info['id'].'&col=num,order_id', 'manage');
+                $purl = Dever::url('project/database/update?project=active&table=info_refund&search_option_price='.$active['price'].'&search_option_order_id='.$info['id'].'&col=num,order_id,price,desc', 'manage');
                 $button[] = array
                 (
                     'type' => 'edit',
@@ -442,13 +450,13 @@ Class Manage
                 $m = '';
                 if ($v['status'] == 1 && $active['refund_type'] == 2 ) {
                     // && time()<$active['act_start'] 
-                    if ($active['refund_type'] == 2) {
+                    if ($active['off_type'] == 2) {
                         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', 'manage');
+                            $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');
                         }
                     } 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', 'manage');
+                            $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');
@@ -507,12 +515,14 @@ Class Manage
         $price = Dever::param('price',$data);
         $order_id = Dever::param('order_id',$data);
         $code_id = Dever::param('code_id',$data);
+        $desc = Dever::param('desc',$data);
         $order = Dever::db('active/order')->find($order_id);
         $where['order_id'] = $order_id;
         $where['code_id'] = $code_id;
         $where['price'] = trim($price);
+        $where['desc'] = $desc;
         $data = Dever::db('active/order')->find($order_id);
-        $ids = $this->common($data,3,false,false,$price);
+        $ids = $this->common($data,3,false,false,$price,$desc);
         if ($ids) {
             Dever::db('active/info_refund_log')->insert($where);
             $admin = Dever::load('manage/auth.info');
@@ -538,7 +548,7 @@ Class Manage
         return 'reload';
     }
 
-    public function common($data,$type,$num=false,$refund_id=false,$refund_price=false){
+    public function common($data,$type,$num=false,$refund_id=false,$refund_price=false,$refund_desc=false){
         Dever::config('base')->hook = true;
         $active = Dever::db('active/info')->find($data['active_id']);
         $info = Dever::db('active/info_refund')->state(array('order_id'=>$data['id']));
@@ -558,7 +568,12 @@ Class Manage
             $price = $data['price'];
         }
         if ($type == 2) {
-            $price = $num * $active['price'];
+            if ($refund_price) {
+                $price = $num * $refund_price;
+            } else {
+                $price = $num * $active['price'];
+            }
+            
             $refund_num = $num;
         }
         if ($type == 3) {
@@ -570,8 +585,9 @@ Class Manage
             }
             
         }
-        
-        
+        // if ($refund_desc) {
+        //     $where['desc'] = $refund_desc;
+        // }
         $param = array
         (
             'project_id' => 6,
@@ -615,6 +631,9 @@ Class Manage
                     $insert['status'] = 2;
                     $insert['where_id'] = $refund_id;
                     $insert['audit_admin'] = $admin['id'];
+                    if ($refund_price) {
+                        $insert['desc'] = $refund_price;
+                    }
                     Dever::db('active/info_refund')->update($insert);
                 } elseif ($type == 3) {
                     $add['status'] = 2;