Your Name 2 gadi atpakaļ
vecāks
revīzija
c3dc5affa2
3 mainītis faili ar 68 papildinājumiem un 20 dzēšanām
  1. 3 2
      app/shop/database/info.php
  2. 50 0
      app/shop/src/Excel.php
  3. 15 18
      tool/stats/lib/Manage.php

+ 3 - 2
app/shop/database/info.php

@@ -74,7 +74,8 @@ $method = array
 $stat_type = Dever::db('cash/shop')->config['config_type'];
 $add = false;
 //$add = array('银联签约','"sign&search_option_shop_id={id}&oper_table=info&where_id={id}"', '"{mid}" == ""');
-
+$excel = false;
+$excel[] = array('导出数据', '导出门店列表', 'shop/excel.shop_info');
 return array
 (
     # 表名
@@ -711,7 +712,7 @@ return array
     (
         //'mul' => true,
         //'insert' => false,
-        'excel' => true,
+        'excel' => $excel,
         'list_button' => array
         (
             'delete' => '删除',

+ 50 - 0
app/shop/src/Excel.php

@@ -1009,4 +1009,54 @@ class Excel
 
         return Dever::excelExport($body, $header, $file);
     }
+    #门店列表数据导出
+    public function shop_info ($data)
+    {
+        $header = array('店铺id', '店铺编号-一般为5位数字,不能重复', '门店名称', '联系人姓名', '联系人电话', '营业状态', '门店类型-自营为平台店,当没有找到加盟店时,将自动获取平台店', '合作状态', '所属代理商名称', '所属代理商手机号', '分账商户号','录入时间');
+        $body = array();
+        if ($data) {
+            $type = Dever::db('shop/info')->config['config_type'];
+            foreach ($data as $k => $v) {
+                if ($v['open'] == 1) {
+                    $open = '开启';
+                } else {
+                    $open = '关闭';
+                }
+                if ($v['status'] == 1) {
+                    $status = '合作中';
+                } else {
+                    $status = '已终止合作';
+                }
+                $member_name = '';
+                $member_mobile = '';
+                if ($v['agent_mid'] && $v['agent_mid']>0) {
+                    $member = Dever::db('agent/member')->find($v['agent_mid']);
+                    if ($member) {
+                         $member_name = $member['name'];
+                         $member_mobile = $member['mobile'];
+                    }
+                }
+                $d = array
+                (
+                    $v['id'],
+                    $v['sid'],
+                    $v['name'],
+                    $v['truename'],
+                    $v['mobile'],
+                    $open,
+                    $type[$v['type']],
+                    $status,
+                    $member_name,
+                    $member_mobile,
+                    $v['mid'],
+                    date('Y-m-d H:i',$v['cdate']),
+                );
+                $body[] = $d;
+            }
+        } else {
+            Dever::alert('无导出数据');
+        }
+        $file = Dever::input('excel_name');
+        return Dever::excelExport($body, $header, $file);
+    }
 }

+ 15 - 18
tool/stats/lib/Manage.php

@@ -251,21 +251,7 @@ Class Manage
 							$bili = round($val['price']*$dnum /$heji,2);#比例
 							// print_R($bili);die;
 							$price_money = $val['price']*$dnum*$v['discount_cash'];#支付
-							// if ($v['discount_id']>0) {
-							// 	$youhui = round($val['price']*$dnum-$price_money,2);
-							// } else {
-							// 	$youhui = 0;
-							// }
 							
-							
-							// $card_price = round(($v['card_code_cash']/$v['oprice']*($val['price']*$dnum *$bili)),2);
-							// // print_R($card_price);die;
-							// $wallet_price = round(($v['wallet_cash']/$heji*($val['price']*$dnum*$bili)),2);
-							
-							// // print_R($price_money);die;
-							// $goodsfu = $val['price']*$dnum-$youhui-$card_price-$wallet_price;
-							// $youhui = 0;
-							// print_R($v1);die;
 							if ($v['card_code_cash'] && $v['card_code_cash']>0){
 								$card_price = round(($v['card_code_cash']/$v['oprice']*($val['price']*$dnum)),2);
 							} else {
@@ -389,6 +375,16 @@ Class Manage
 							$body[] = $d;
 						}
 					} else {
+						if ($ka > 0 || $money > 0) {
+							$st = Dever::db('shop/sell_order_goods')->find(Array('order_id'=>$v['id'],'status'=>3));
+							if ($v1['goods_id'] == $st['goods_id']) {
+								$ka = round($ka,2);
+								$money = round($money,2);
+							} else {
+								$ka = 0;
+								$money = 0;
+							}
+						} 
 						if ($k1 == 0 ) {
 							$discount_cash = round($v['discount_cash'],2);
 							$card_code_cash = round($v['card_code_cash'],2);
@@ -398,8 +394,8 @@ Class Manage
 							$order_num = $v['num'];//订单总数量
 							$oprice = round($v['oprice'],2);#订单总金额
 							$coupon_cash = round($v['coupon_cash'],2);
-							$ka = round($ka,2);
-							$money = round($money,2);
+							// $ka = round($ka,2);
+							// $money = round($money,2);
 						} else {
 							$discount_cash = 0;
 							$card_code_cash = 0;
@@ -409,8 +405,8 @@ Class Manage
 							$order_num = 0;
 							$oprice = 0;
 							$coupon_cash = 0;
-							$ka = 0;
-							$money = 0;
+							// $ka = 0;
+							// $money = 0;
 						}
 						$dyouhui = round($v1['discount_cash'],2);
 						$dcard_price = $v['card_code_cash']/$v['oprice']*($v1['price']*$v1['num']);
@@ -421,6 +417,7 @@ Class Manage
 						if ($dgoodsfu<0){
 							$dgoodsfu = 0;
 						}
+						// print_R($ka);
 						$d = array
 						(
 							$shop_type,