moonsflyer před 8 měsíci
rodič
revize
7625cc6955

+ 3 - 2
addon/store/shop/view/stat/store.html

@@ -263,7 +263,7 @@
 				var dateObj = new Date(Date.now() - 604800000);
 				var date = dateObj.getFullYear() + '-' + (dateObj.getMonth() + 1) + '-' + dateObj.getDate();
 				var date1 = new Date(Date.now()).getFullYear() + '-' + (new Date(Date.now()).getMonth() + 1) + '-' + new Date(Date.now()).getDate();
-				var data1 = {start_time: new Date(date).getTime() / 1000, end_time:new Date(date1).getTime() / 1000};
+				var data1 = {start_time: new Date(date).getTime() / 1000, end_time:new Date(date1).getTime() / 1000,store_id};
 				getShopStatistics(data1);
 				getShopStatData(data1, 'day');
 				break;
@@ -307,7 +307,8 @@
 						}
 						var time = {
 							start_time: (new Date(start_time)).getTime() / 1000,
-							end_time: (new Date(end_time)).getTime() / 1000
+							end_time: (new Date(end_time)).getTime() / 1000,
+							store_id
 						};
 						getShopStatistics(time);
 						getShopStatData(time, 'day');

+ 2 - 10
app/shop/controller/BaseShop.php

@@ -65,7 +65,6 @@ class BaseShop extends Controller
         $this->checkLogin();
         //检测用户组
         $this->getGroupInfo();
-
         if ($this->app_module == 'store') {
 
             $this->replace = [
@@ -96,8 +95,6 @@ class BaseShop extends Controller
             }
 
         }
-
-
         //获取店铺信息
         $site_model = new Site();
         $shop_info = $site_model->getSiteInfo([ [ 'site_id', '=', $this->site_id ] ], 'site_id,site_name,logo,seo_keywords,seo_description, create_time');
@@ -111,6 +108,7 @@ class BaseShop extends Controller
 
             $this->initBaseInfo();
         }
+
         // 加载自定义图标库
         $diy_view = new DiyViewModel();
         $diy_icon_url = $diy_view->getIconUrl()[ 'data' ];
@@ -140,7 +138,6 @@ class BaseShop extends Controller
         $this->getTopMenu();
         $menu_model = new Menu();
         $info_result = $menu_model->getMenuInfoByUrl($this->url, $this->app_module, $this->addon);
-
         $info = [];
         if (!empty($info_result[ "data" ])) {
             $info = $info_result[ "data" ];
@@ -153,7 +150,6 @@ class BaseShop extends Controller
             }
         }
         $this->menu_info = $info;
-
         $this->assign("menu_info", $info);
         if (!empty($this->crumbs)) {
             $this->crumbs = array_reverse($this->crumbs);
@@ -312,19 +308,15 @@ class BaseShop extends Controller
         if ($this->user_info[ 'is_admin' ] || $this->group_info[ 'is_system' ] == 1) {
             $menus = $menu_model->getMenuList([ [ 'app_module', "=", $this->app_module ] ], '*', 'level asc, sort asc');
         } else {
-
             $menus = $menu_model->getMenuList([ [ 'name', 'in', $this->group_info[ 'menu_array' ] ], [ 'app_module', "=", $this->app_module ] ], '*', 'level asc,sort asc');
-
             $control_menu = $menu_model->getMenuList([ [ 'is_control', '=', 0 ], [ 'app_module', "=", $this->app_module ] ], '*', 'sort asc');
-
             $menus[ 'data' ] = array_merge($control_menu[ 'data' ], $menus[ 'data' ]);
-//            dump( $menus[ 'data' ]);die;
             $keys = array_column($menus[ 'data' ], 'sort');
-
             if (!empty($keys)) {
                 array_multisort($keys, SORT_ASC, SORT_NUMERIC, $menus[ 'data' ]);
             }
         }
+        //隐藏门店模块的概况
         $user_info = $this->user_info;
         if($user_info['is_admin'] ==0){
             $menus[ 'data' ]['1']['is_show']=0;

+ 47 - 51
app/shop/controller/Index.php

@@ -15,7 +15,6 @@ use addon\fenxiao\model\FenxiaoApply;
 use addon\fenxiao\model\FenxiaoWithdraw;
 use addon\niusms\model\Config as NiuSmsConfig;
 use addon\niusms\model\Sms as NiuSms;
-use addon\weapp\model\Config as WeappConfig;
 use addon\weapp\model\Config as WeappConfigModel;
 use app\model\goods\Goods as GoodsModel;
 use app\model\member\Member;
@@ -30,6 +29,7 @@ use Carbon\Carbon;
 use app\model\order\OrderRefund as OrderRefundModel;
 use think\facade\Cache;
 use addon\wechat\model\Config as WechatConfig;
+use addon\weapp\model\Config as WeappConfig;
 use addon\alipay\model\Config as AlipayConfig;
 use addon\wechatpay\model\Config as WechatpayConfig;
 use app\model\order\Order;
@@ -43,7 +43,6 @@ class Index extends BaseShop
     public function index()
     {
         $demain = $_SERVER['HTTP_HOST'];
-
         Cache::tag("cache_tablestat_shop")->clear();
         Cache::tag("cache_tablemember")->clear();
         Cache::tag("cache_tablegoods")->clear();
@@ -52,63 +51,60 @@ class Index extends BaseShop
         Cache::tag("cache_tablefenxiao_withdraw")->clear();
         $shop_info = $this->shop_info;
         $time = time();
+        
         $user_info = $this->user_info;
         if($user_info['is_admin']){
-            $this->assign('shop_status', 1);
-
-            $this->handlePromotion();
-
-            //分销插件是否存在
-            $is_fenxiao = addon_is_exit('fenxiao', $this->site_id);
-            $this->assign('is_fenxiao', $is_fenxiao);
-
-            //基础统计信息
-            $today = Carbon::now();
-            $this->assign("today", $today);
-
-            // 牛云短信余额查询
-            if (addon_is_exit('niusms', $this->site_id)) {
-                $sms_config = ( new NiuSmsConfig() )->getSmsConfig($this->site_id)[ 'data' ];
-                if ($sms_config[ 'is_use' ]) {
-                    $account_info = ( new NiuSms() )->getChildAccountInfo([
-                        'username' => $sms_config[ 'value' ][ 'username' ],
-                    ]);
-                    $this->assign('sms_num', $account_info[ 'data' ][ 'balance' ] ?? 0);
-                }
+        $this->assign('shop_status', 1);
+
+        $this->handlePromotion();
+
+        //分销插件是否存在
+        $is_fenxiao = addon_is_exit('fenxiao', $this->site_id);
+        $this->assign('is_fenxiao', $is_fenxiao);
+
+        //基础统计信息
+        $today = Carbon::now();
+        $this->assign("today", $today);
+
+        // 牛云短信余额查询
+        if (addon_is_exit('niusms', $this->site_id)) {
+            $sms_config = ( new NiuSmsConfig() )->getSmsConfig($this->site_id)[ 'data' ];
+            if ($sms_config[ 'is_use' ]) {
+                $account_info = ( new NiuSms() )->getChildAccountInfo([
+                    'username' => $sms_config[ 'value' ][ 'username' ],
+                ]);
+                $this->assign('sms_num', $account_info[ 'data' ][ 'balance' ] ?? 0);
+            }
+        }
+        $this->assign('guide_close', cookie('guideClose'));
+        if (!cookie('guideClose')) {
+            $goods = ( new GoodsModel() )->getGoodsInfo([ [ 'site_id', '=', $this->site_id ] ], 'goods_id')[ 'data' ];
+            $this->assign('goods_complete', !empty($goods));
+
+            $wechat_config = ( new WechatConfig() )->getWechatConfig($this->site_id)[ 'data' ][ 'value' ];
+            $this->assign('wechat_complete', !empty($wechat_config));
+            if (addon_is_exit('weapp', $this->site_id)) {
+                $weapp_config = ( new WeappConfig() )->getWeappConfig($this->site_id)[ 'data' ][ 'value' ];
+                $this->assign('weapp_complete', !empty($weapp_config));
+            } else {
+                $this->assign('weapp_complete', false);
             }
-            $this->assign('guide_close', cookie('guideClose'));
-            if (!cookie('guideClose')) {
-                $goods = ( new GoodsModel() )->getGoodsInfo([ [ 'site_id', '=', $this->site_id ] ], 'goods_id')[ 'data' ];
-                $this->assign('goods_complete', !empty($goods));
-
-                $wechat_config = ( new WechatConfig() )->getWechatConfig($this->site_id)[ 'data' ][ 'value' ];
-                $this->assign('wechat_complete', !empty($wechat_config));
-                if (addon_is_exit('weapp', $this->site_id)) {
-                    $weapp_config = ( new WeappConfig() )->getWeappConfig($this->site_id)[ 'data' ][ 'value' ];
-                    $this->assign('weapp_complete', !empty($weapp_config));
-                } else {
-                    $this->assign('weapp_complete', false);
-                }
 
-                $alipay_config = addon_is_exit('alipay', $this->site_id) ? ( new AlipayConfig() )->getPayConfig($this->site_id)[ 'data' ][ 'value' ] : [];
-                $wechatpay_config = [];
-                $wechatpay_config = ( new WechatpayConfig() )->getPayConfig($this->site_id)[ 'data' ][ 'value' ];
-                unset($wechatpay_config[ 'transfer_type' ]);
-                $this->assign('pay_complete', ( !( empty($alipay_config) ) || !( empty($wechatpay_config) ) ));
+            $alipay_config = addon_is_exit('alipay', $this->site_id) ? ( new AlipayConfig() )->getPayConfig($this->site_id)[ 'data' ][ 'value' ] : [];
+            $wechatpay_config = [];
+            $wechatpay_config = ( new WechatpayConfig() )->getPayConfig($this->site_id)[ 'data' ][ 'value' ];
+            unset($wechatpay_config[ 'transfer_type' ]);
+            $this->assign('pay_complete', ( !( empty($alipay_config) ) || !( empty($wechatpay_config) ) ));
 
-                $this->assign('site_complete', !empty($this->shop_info[ 'logo' ]));
-            }
-            $this->init();
-            $this->assign('img_extension_error', config('upload.driver') == 'imagick' && !extension_loaded('imagick'));
-            return $this->fetch("index/index");
+            $this->assign('site_complete', !empty($this->shop_info[ 'logo' ]));
+        }
+        $this->init();
+        $this->assign('img_extension_error', config('upload.driver') == 'imagick' && !extension_loaded('imagick'));
+        return $this->fetch("index/index");
         }else{
-            $demain = $_SERVER['HTTP_HOST'];
-            var_dump($demain);
-//            header('Localtion:zhongshen.demo.com/shop/stat/shop.html');
             header('Location:../../shop/stat/shop');
-            exit;
+            exit; 
         }
-
     }
 
     private function init()

+ 23 - 31
app/shop/controller/Order.php

@@ -1111,11 +1111,10 @@ class Order extends BaseShop
         $result = $order_export_model->orderExport($condition, $condition_desc, $this->site_id, $join ?? null, $is_verify, $order_label);
         return $result;
     }
-
     /**
-     * 订单导出(已订单商品为主)
+     * 订单导出(已订单为主)
      */
-    public function exportOrderGoods()
+    public function exportMoneyOrder()
     {
         $order_label_list = array (
             'order_no' => '订单号',
@@ -1132,22 +1131,20 @@ class Order extends BaseShop
         $order_from = input('order_from', '');
         $start_time = input('start_time', '');
         $end_time = input('end_time', '');
-        $order_ids = input('order_ids', '');
-
         $order_label = !empty($order_label_list[ input('order_label') ]) ? input('order_label') : '';
-
         $search_text = input('search', '');
         $promotion_type = input('promotion_type', '');
         $order_type = input('order_type', 'all');
         $is_verify = input('is_verify', 'all');
-        $store_id = input('store_id', 0); // 所属门店id
+        $order_ids = input('order_ids', '');
+        $store_id = input('store_id', 0);
         $condition_desc = [];
 
         $order_common_model = new OrderCommon();
         $condition = [
             [ 'o.site_id', '=', $this->site_id ],
             [ 'o.is_delete', '=', 0 ],
-            [ 'o.order_scene', '=', 'online' ]
+            [ 'o.order_scene', '=', 'cashier' ]
         ];
 
         if (!empty($order_ids)) {
@@ -1174,6 +1171,13 @@ class Order extends BaseShop
                 $order_status_list = $order_common_model->order_status;
                 $order_status_name = $order_status_list[ $order_status ][ 'name' ] ?? '';
             } else {
+                $join = [
+                    [
+                        'order_goods og',
+                        'og.order_id = o.order_id',
+                        'left'
+                    ]
+                ];
                 $condition[] = [ 'og.refund_status', 'not in', [ 0, 3 ] ];
                 $order_status_name = '维权中';
             }
@@ -1224,7 +1228,6 @@ class Order extends BaseShop
             $promotion_type_name = $promotion_type_list[ $promotion_type ] ?? '';
         }
         $condition_desc[] = [ 'name' => '营销活动', 'value' => $promotion_type_name ];
-
         $time_name = '';
         if (!empty($start_time) && empty($end_time)) {
             $condition[] = [ 'o.create_time', '>=', date_to_time($start_time) ];
@@ -1263,14 +1266,14 @@ class Order extends BaseShop
         }
 
         $order_export_model = new OrderExport();
-        $result = $order_export_model->orderGoodsExport($condition, $condition_desc, $this->site_id, $is_verify, $order_label);
+
+        $result = $order_export_model->orderExport($condition, $condition_desc, $this->site_id, $join ?? null, $is_verify, $order_label);
         return $result;
     }
-
     /**
-     * 收银订单导出(已订单为主)
+     * 订单导出(已订单商品为主)
      */
-    public function exportMoneyOrder()
+    public function exportOrderGoods()
     {
         $order_label_list = array (
             'order_no' => '订单号',
@@ -1287,20 +1290,22 @@ class Order extends BaseShop
         $order_from = input('order_from', '');
         $start_time = input('start_time', '');
         $end_time = input('end_time', '');
+        $order_ids = input('order_ids', '');
+
         $order_label = !empty($order_label_list[ input('order_label') ]) ? input('order_label') : '';
+
         $search_text = input('search', '');
         $promotion_type = input('promotion_type', '');
         $order_type = input('order_type', 'all');
         $is_verify = input('is_verify', 'all');
-        $order_ids = input('order_ids', '');
-        $store_id = input('store_id', 0);
+        $store_id = input('store_id', 0); // 所属门店id
         $condition_desc = [];
 
         $order_common_model = new OrderCommon();
         $condition = [
             [ 'o.site_id', '=', $this->site_id ],
             [ 'o.is_delete', '=', 0 ],
-            [ 'o.order_scene', '=', 'cashier' ]
+            [ 'o.order_scene', '=', 'online' ]
         ];
 
         if (!empty($order_ids)) {
@@ -1327,13 +1332,6 @@ class Order extends BaseShop
                 $order_status_list = $order_common_model->order_status;
                 $order_status_name = $order_status_list[ $order_status ][ 'name' ] ?? '';
             } else {
-                $join = [
-                    [
-                        'order_goods og',
-                        'og.order_id = o.order_id',
-                        'left'
-                    ]
-                ];
                 $condition[] = [ 'og.refund_status', 'not in', [ 0, 3 ] ];
                 $order_status_name = '维权中';
             }
@@ -1384,6 +1382,7 @@ class Order extends BaseShop
             $promotion_type_name = $promotion_type_list[ $promotion_type ] ?? '';
         }
         $condition_desc[] = [ 'name' => '营销活动', 'value' => $promotion_type_name ];
+
         $time_name = '';
         if (!empty($start_time) && empty($end_time)) {
             $condition[] = [ 'o.create_time', '>=', date_to_time($start_time) ];
@@ -1422,15 +1421,9 @@ class Order extends BaseShop
         }
 
         $order_export_model = new OrderExport();
-
-        $result = $order_export_model->orderExport($condition, $condition_desc, $this->site_id, $join ?? null, $is_verify, $order_label);
-
+        $result = $order_export_model->orderGoodsExport($condition, $condition_desc, $this->site_id, $is_verify, $order_label);
         return $result;
     }
-
-    /**
-     * 订单导出(已订单商品为主)
-     */
     public function exportMoneyOrderGoods()
     {
         $order_label_list = array (
@@ -1580,7 +1573,6 @@ class Order extends BaseShop
 
         $order_export_model = new OrderExport();
         $result = $order_export_model->orderGoodsExport($condition, $condition_desc, $this->site_id, $is_verify, $order_label);
-
         return $result;
     }
     /**

+ 0 - 1
app/shop/controller/Stat.php

@@ -71,7 +71,6 @@ class Stat extends BaseShop
             $fields[] = 'cashier_order_pay_money';
 
             $stat_list = $stat_model->getShopStatList($this->site_id, $start_time, $end_time)[ 'data' ];
-//            var_dump($stat_list);die;
             $stat_list = array_map(function($item) {
                 $item[ 'day_time' ] = date('Y-m-d', $item[ 'day_time' ]);
                 return $item;

+ 1 - 0
app/shop/controller/Store.php

@@ -60,6 +60,7 @@ class Store extends BaseShop
             $list = $store_model->getStorePageList($condition, $page, $page_size, $order);
             return $list;
         } else {
+
             //判断门店插件是否存在
             $store_is_exit = addon_is_exit('store', $this->site_id);
             $this->assign('store_is_exit', $store_is_exit);

+ 1 - 3
app/shop/controller/User.php

@@ -10,7 +10,6 @@
 
 namespace app\shop\controller;
 
-use app\model\member\Member;
 use app\model\store\Store;
 use app\model\system\Group;
 use app\model\system\Menu;
@@ -47,9 +46,8 @@ class User extends BaseShop
             if ($status != "") {
                 $condition[ "status" ] = [ "status", "=", $status ];
             }
-            $user_model = new UserModel();
-
 
+            $user_model = new UserModel();
             $list = $user_model->getUserPageList($condition, $page, $page_size, "is_admin desc,create_time desc");
             if (!empty($list['data']['list']) && addon_is_exit('cashier', $this->site_id)) {
                 $join = [