Browse Source

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

rabin 3 years ago
parent
commit
a295d7eaca

+ 1 - 0
app/shop/database/sell_order.php

@@ -1040,6 +1040,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'page' => array(20, 'list'),
             'col' => '*',
         ),
     ),

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

+ 1 - 0
service/agent/database/member_goods.php

@@ -627,6 +627,7 @@ return array
                 
             ),
             'type' => 'all',
+            'page' => array(20,'list'),
             // 'order' => array('cdate'=>'desc'),
             'col' => '*',
         ),

+ 6 - 3
tool/stats/assets/pc/html/out.html

@@ -236,7 +236,8 @@ function search()
   order_num = $('#order_num').val();
   goods_name = $('#goods_name').val();
   shop_name = $('#shop_name').val();
-  location.href = config.host + 'lib/manage.list&start=' + s[0] + '&end=' + s[1] + '&fastart=' + a[0] + '&faend=' + a[1] + '&fstart=' + f[0] + '&fend=' + f[1] + '&cate=' + cate + '&order_num=' + order_num + '&shop_name=' + shop_name + '&goods_name=' + goods_name ;
+  var link = config.host + 'lib/manage.list&start=' + s[0] + '&end=' + s[1] + '&fastart=' + a[0] + '&faend=' + a[1] + '&fstart=' + f[0] + '&fend=' + f[1] + '&cate=' + cate + '&order_num=' + order_num + '&shop_name=' + shop_name + '&goods_name=' + goods_name + '&list_excel=1';
+  jump(link);
 }
 $('#search').click(function() {
   search();
@@ -271,7 +272,8 @@ function out()
   member_name = $("#member_name").val();
   card_num = $('#card_num').val();
   mobile = $('#mobile').val();
-  location.href = config.host + 'lib/manage.memberGoods&start=' + g[0] + '&end=' + g[1] + '&rstart=' + r[0] + '&rend=' + r[1] + '&cstart=' + c[0] + '&cend=' + c[1] + '&name=' + dh_name + '&card_num=' + card_num + '&mobile=' + mobile + '&member_name=' + member_name;
+  var link = config.host + 'lib/manage.memberGoods&start=' + g[0] + '&end=' + g[1] + '&rstart=' + r[0] + '&rend=' + r[1] + '&cstart=' + c[0] + '&cend=' + c[1] + '&name=' + dh_name + '&card_num=' + card_num + '&mobile=' + mobile + '&member_name=' + member_name+'&list_excel=1';
+  jump(link);
 }
 $('#out').click(function() {
   out();
@@ -293,7 +295,8 @@ function out_mingxi()
 	order_num = $('#order_nums').val();
 	mobile = $('#mobiles').val();
 	type = $('.type').val();
-	location.href = config.host + 'lib/manage.mingxi&start=' + d[0] + '&end=' + d[1] + '&name=' + dh_name + '&card_num=' + card_num + '&mobile=' + mobile + '&shop_name=' + shop_name + '&shop_num=' + shop_num + '&order_num=' + order_num + '&type=' + type;
+	var link = config.host + 'lib/manage.mingxi&start=' + d[0] + '&end=' + d[1] + '&name=' + dh_name + '&card_num=' + card_num + '&mobile=' + mobile + '&shop_name=' + shop_name + '&shop_num=' + shop_num + '&order_num=' + order_num + '&type=' + type + '&list_excel=1';
+  jump(link);
 }
 $('#out_mingxi').click(function() {
   out_mingxi();

+ 4 - 3
tool/stats/lib/Manage.php

@@ -362,13 +362,14 @@ Class Manage
 			$where['rend'] = 't_2.cdate<='.strtotime($rend);
 		} 
 		$where['t_1.state'] = 't_1.state=1';
+		$where['t_1.type'] = "t_1.type in (1,2)";
 		$header = array('权益名称','会员等级','姓名','手机号','卡号','类型','数量','单件价值','总价值','已兑换价值','已使用价值','未兑换价值','未使用价值','备注','获取方式','获取时间','代理商注册时间','礼品卡有效期');
 		$body = array();
 		if ($where) {
 			$where = implode(' and ', $where);
-			$data = Dever::db('agent/member_goods')->fetchAll("select t_1.*,t_2.id as aid from churen_agent_member_goods as t_1 left join churen_agent_member as t_2 on t_1.mid = t_2.id where " . $where);
+			$data = Dever::db('agent/member_goods')->fetchAll("select t_1.*,t_2.id as aid from churen_agent_member_goods as t_1 left join churen_agent_member as t_2 on t_1.mid = t_2.id where " . $where,array(),array(20, 'list'));
 			// $data = Dever::db('agent/member_goods')->getJoinAll($where);
-			// echo Dever::sql();die;
+			// echo Dever::sql();
 			// print_R($data);die;
 			if ($data) {
 				foreach ($data as $k => $v) {
@@ -542,7 +543,7 @@ Class Manage
 	            	if ($dh_order_ps) {
 		            	$leixing = '兑换权益';
 		            	foreach ($dh_order_ps as $k =>$v) {
-		            		$dh_order = Deverr::db('agent/dh_order_ps')->find($v['order_id']);
+		            		$dh_order = Dever::db('agent/dh_order_ps')->find($v['order_id']);
 		            		if ($dh_order && isset($dh_order['info']) && $dh_order['info']){
 		            			$desc = $dh_order['info'];
 		            		}