Просмотр исходного кода

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

From-wh 2 лет назад
Родитель
Сommit
49fb43e42b

+ 1 - 1
crmeb/app/dao/activity/bargain/StoreBargainUserDao.php

@@ -106,7 +106,7 @@ class StoreBargainUserDao extends BaseDao
     {
         return $this->search($where)->with(['getBargain', 'getUser'])
             ->when(isset($where['real_name']) && $where['real_name'] != '', function ($query) use ($where) {
-                $query->where('uid|nickname', 'like', '%' . $where['keyword'] . '%');
+                $query->where('uid', $where['real_name']);
             })->when($page != 0, function ($query) use ($page, $limit) {
                 $query->page($page, $limit);
             })->order('add_time desc')->select()->toArray();

+ 2 - 2
crmeb/app/dao/order/StoreOrderDao.php

@@ -933,7 +933,7 @@ class StoreOrderDao extends BaseDao
         return $this->search($where)->where('seckill_id', $id)
             ->when($page && $limit, function ($query) use ($page, $limit) {
                 $query->page($page, $limit);
-            })->field(['order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->select()->toArray();
+            })->field(['order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
     }
 
     /**
@@ -952,7 +952,7 @@ class StoreOrderDao extends BaseDao
         return $this->search($where)->where('bargain_id', $id)
             ->when($page && $limit, function ($query) use ($page, $limit) {
                 $query->page($page, $limit);
-            })->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->select()->toArray();
+            })->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
     }
 
     /**

+ 2 - 2
crmeb/app/services/activity/bargain/StoreBargainServices.php

@@ -996,8 +996,8 @@ class StoreBargainServices extends BaseServices
         $spread_count = $bargainUserHelp->count(['bargain_id' => $id, 'type' => 0]);
         $start_count = $bargainUser->count(['bargain_id' => $id]);
         $success_count = $bargainUser->count(['bargain_id' => $id, 'status' => 3]);
-        $pay_price = $orderServices->sum(['bargain_id' => $id, 'paid' => 1], 'pay_price', true);
-        $pay_count = $orderServices->count(['bargain_id' => $id, 'paid' => 1]);
+        $pay_price = $orderServices->sum([['bargain_id', '=', $id], ['paid', '=', 1], ['refund_type', 'in', [0, 3]], ['is_del', '=', 0]], 'pay_price', false);
+        $pay_count = $orderServices->getDistinctCount([['bargain_id', '=', $id], ['paid', '=', 1], ['refund_type', 'in', [0, 3]], ['is_del', '=', 0]], 'uid', false);
         $pay_rate = $start_count > 0 ? bcmul(bcdiv((string)$pay_count, (string)$start_count, 2), '100', 2) : 0;
         return compact('people_count', 'spread_count', 'start_count', 'success_count', 'pay_price', 'pay_count', 'pay_rate');
     }

+ 1 - 1
crmeb/app/services/activity/live/LiveRoomServices.php

@@ -242,6 +242,7 @@ class LiveRoomServices extends BaseServices
     /**
      * 同步直播间状态
      * @return bool
+     * @throws \Exception
      */
     public function syncRoomStatus()
     {
@@ -249,7 +250,6 @@ class LiveRoomServices extends BaseServices
         $limit = 50;
         $data = $dataAll = [];
         $rooms = $this->dao->getColumn([], 'id,room_id,live_status', 'room_id');
-//        if (!$rooms) return true;
         do {
             $wxRooms = MiniProgramService::getLiveInfo($start, $limit);
             foreach ($wxRooms as $room) {

+ 15 - 45
crmeb/app/services/order/StoreOrderServices.php

@@ -1420,10 +1420,17 @@ HTML;
         return bcmul(bcdiv((bcsub($nowValue, $lastValue, 2)), $lastValue, 4), 100, 2);
     }
 
+    /**
+     * 后台首页顶部统计
+     * @return array
+     * @author 吴汐
+     * @email 442384644@qq.com
+     * @date 2023/04/03
+     */
     public function homeStatics()
     {
-        /** @var UserServices $uSercice */
-        $uSercice = app()->make(UserServices::class);
+        /** @var UserServices $userService */
+        $userService = app()->make(UserServices::class);
         /** @var StoreProductLogServices $productLogServices */
         $productLogServices = app()->make(StoreProductLogServices::class);
         //TODO 销售额
@@ -1433,22 +1440,12 @@ HTML;
         $yesterday_sales = $this->dao->todaySales('yesterday');
         //日同比
         $sales_today_ratio = $this->growth($today_sales, $yesterday_sales);
-//        //周销售额
-//        //本周
-//        $this_week_sales = $this->dao->thisWeekSales('week');
-//        //上周
-//        $last_week_sales = $this->dao->thisWeekSales('last week');
-//        //周同比
-//        $sales_week_ratio = $this->growth($this_week_sales, $last_week_sales);
         //总销售额
         $total_sales = $this->dao->totalSales('month');
         $sales = [
             'today' => $today_sales,
             'yesterday' => $yesterday_sales,
             'today_ratio' => $sales_today_ratio,
-//            'week' => $this_week_sales,
-//            'last_week' => $last_week_sales,
-//            'week_ratio' => $sales_week_ratio,
             'total' => $total_sales . '元',
             'date' => '今日'
         ];
@@ -1459,21 +1456,12 @@ HTML;
         $yesterday_visits = $productLogServices->count(['time' => 'yesterday', 'type' => 'visit']);
         //日同比
         $visits_today_ratio = $this->growth($today_visits, $yesterday_visits);
-//        //本周访问量
-//        $this_week_visits = $productLogServices->count(['time' => 'week', 'type' => 'visit']);
-//        //上周访问量
-//        $last_week_visits = $productLogServices->count(['time' => 'last week', 'type' => 'visit']);
-//        //周同比
-//        $visits_week_ratio = $this->growth($this_week_visits, $last_week_visits);
         //总访问量
         $total_visits = $productLogServices->count(['time' => 'month', 'type' => 'visit']);
         $visits = [
             'today' => $today_visits,
             'yesterday' => $yesterday_visits,
             'today_ratio' => $visits_today_ratio,
-//            'week' => $this_week_visits,
-//            'last_week' => $last_week_visits,
-//            'week_ratio' => $visits_week_ratio,
             'total' => $total_visits . 'Pv',
             'date' => '今日'
         ];
@@ -1484,46 +1472,28 @@ HTML;
         $yesterday_order = $this->dao->todayOrderVisit('yesterday', 1);
         //订单日同比
         $order_today_ratio = $this->growth($today_order, $yesterday_order);
-//        //本周订单量
-//        $this_week_order = $this->dao->todayOrderVisit('week', 2);
-//        //上周订单量
-//        $last_week_order = $this->dao->todayOrderVisit('last week', 2);
-//        //订单周同比
-//        $order_week_ratio = $this->growth($this_week_order, $last_week_order);
         //总订单量
         $total_order = $this->dao->count(['time' => 'month', 'paid' => 1, 'refund_status' => 0, 'pid' => 0]);
         $order = [
             'today' => $today_order,
             'yesterday' => $yesterday_order,
             'today_ratio' => $order_today_ratio,
-//            'week' => $this_week_order,
-//            'last_week' => $last_week_order,
-//            'week_ratio' => $order_week_ratio,
             'total' => $total_order . '单',
             'date' => '今日'
         ];
         //TODO 用户
         //今日新增用户
-        $today_user = $uSercice->todayAddVisits('today', 1);
+        $today_user = $userService->todayAddVisits('today', 1);
         //昨日新增用户
-        $yesterday_user = $uSercice->todayAddVisits('yesterday', 1);
+        $yesterday_user = $userService->todayAddVisits('yesterday', 1);
         //新增用户日同比
         $user_today_ratio = $this->growth($today_user, $yesterday_user);
-//        //本周新增用户
-//        $this_week_user = $uSercice->todayAddVisits('week', 2);
-//        //上周新增用户
-//        $last_week_user = $uSercice->todayAddVisits('last week', 2);
-//        //新增用户周同比
-//        $user_week_ratio = $this->growth($this_week_user, $last_week_user);
         //所有用户
-        $total_user = $uSercice->count(['time' => 'month']);
+        $total_user = $userService->count(['time' => 'month']);
         $user = [
             'today' => $today_user,
             'yesterday' => $yesterday_user,
             'today_ratio' => $user_today_ratio,
-//            'week' => $this_week_user,
-//            'last_week' => $last_week_user,
-//            'week_ratio' => $user_week_ratio,
             'total' => $total_user . '人',
             'date' => '今日'
         ];
@@ -2566,12 +2536,12 @@ HTML;
     public function autoComment()
     {
         //自动评价天数
-        $systemCommentTime = (int)sys_config('system_comment_time', 0);
+        $systemCommentTime = sys_config('system_comment_time', 0);
         //0为取消自动默认好评功能
         if ($systemCommentTime == 0) {
             return true;
         }
-        $sevenDay = strtotime(date('Y-m-d H:i:s', strtotime('-' . $systemCommentTime . ' day')));
+        $sevenDay = bcsub((string)time(), bcmul((string)$systemCommentTime, '86400'));
         /** @var StoreOrderStoreOrderStatusServices $service */
         $service = app()->make(StoreOrderStoreOrderStatusServices::class);
         $orderList = $service->getTakeOrderIds([
@@ -2579,7 +2549,7 @@ HTML;
             'is_del' => 0,
             'paid' => 1,
             'status' => 2,
-            'change_type' => ['take_delivery']
+            'change_type' => ['take_delivery','user_take_delivery']
         ], 30);
         foreach ($orderList as $item) {
             AutoCommentJob::dispatch([$item['id'], $item['cart_id']]);

+ 2 - 2
crmeb/app/services/order/StoreOrderTakeServices.php

@@ -522,12 +522,12 @@ class StoreOrderTakeServices extends BaseServices
     public function autoTakeOrder()
     {
         //7天前时间戳
-        $systemDeliveryTime = (int)sys_config('system_delivery_time', 0);
+        $systemDeliveryTime = sys_config('system_delivery_time', 0);
         //0为取消自动收货功能
         if ($systemDeliveryTime == 0) {
             return true;
         }
-        $sevenDay = strtotime(date('Y-m-d H:i:s', strtotime('-' . $systemDeliveryTime . ' day')));
+        $sevenDay = bcsub((string)time(), bcmul((string)$systemDeliveryTime, '86400'));
         /** @var StoreOrderStoreOrderStatusServices $service */
         $service = app()->make(StoreOrderStoreOrderStatusServices::class);
         $orderList = $service->getTakeOrderIds([

+ 1 - 2
template/admin/src/pages/marketing/storeBargain/statistics.vue

@@ -26,8 +26,7 @@
         <Row type="flex" :gutter="24">
           <Col span="6" v-if="type == 1">
             <FormItem label="订单状态:" label-for="status">
-              <Select v-model="pagination.status" placeholder="请选择订单状态">
-                <Option value="">全部</Option>
+              <Select v-model="pagination.status" placeholder="请选择订单状态" clearable @on-change="searchList">
                 <Option value="0">未支付</Option>
                 <Option value="1">待发货</Option>
                 <Option value="2">待收货</Option>

+ 1 - 2
template/admin/src/pages/marketing/storeCombination/statistics.vue

@@ -26,8 +26,7 @@
         <Row type="flex" :gutter="24">
           <Col span="6" v-if="type == 1">
             <FormItem label="订单状态:" label-for="status">
-              <Select v-model="pagination.status" placeholder="请选择订单状态">
-                <Option value="">全部</Option>
+              <Select v-model="pagination.status" placeholder="请选择订单状态" clearable  @on-change="searchList">
                 <Option value="0">未支付</Option>
                 <Option value="1">待发货</Option>
                 <Option value="2">待收货</Option>

+ 12 - 3
template/uni-app/components/pageFooter/index.vue

@@ -58,8 +58,7 @@
 		computed: mapGetters(['isLogin', 'cartNum', 'activityTab']),
 		watch: {
 			activityTab: {
-				handler(nVal, oVal) {
-				},
+				handler(nVal, oVal) {},
 				deep: true
 			},
 			configData: {
@@ -83,6 +82,14 @@
 			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
 			let curRoute = routes[routes.length - 1].route //获取当前页面路由
 			this.$store.commit('ACTIVITYTAB', '/' + curRoute);
+			uni.$on('uploadFooter', () => {
+				let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
+				let curRoute = routes[routes.length - 1].route //获取当前页面路由
+				this.$store.commit('ACTIVITYTAB', '/' + curRoute);
+			})
+		},
+		onShow() {
+
 		},
 		mounted() {
 			getNavigation().then(res => {
@@ -97,7 +104,9 @@
 				this.getCartNum()
 			}
 		},
-
+		onHide() {
+			uni.$off(['uploadFooter'])
+		},
 		methods: {
 			goRouter(item) {
 				var pages = getCurrentPages();

+ 4 - 2
template/uni-app/pages/goods_cate/goods_cate.vue

@@ -49,7 +49,7 @@
 				getCategoryVersion().then(res => {
 					if (!uni.getStorageSync('CAT_VERSION') || res.data.version != uni.getStorageSync(
 							'CAT_VERSION')) {
-						this.isNew = !this.isNew
+						this.isNew = !this.isNew
 						uni.setStorageSync('CAT_VERSION', res.data.version)
 					} else {
 						// this.isNew = false
@@ -58,7 +58,9 @@
 				})
 			},
 			jumpIndex() {
-				if (this.is_diy) {}
+				// uni.reLaunch({
+				// 	url: '/pages/index/index'
+				// })
 			},
 			classStyle() {
 				colorChange('category').then(res => {

+ 0 - 1
template/uni-app/pages/goods_cate/goods_cate3.vue

@@ -564,7 +564,6 @@
 						title: that.$t(`不能输入0喔`)
 					});
 				}
-				console.log(that.attr.productSelect.cart_num, 'that.attr.productSelect.cart_num')
 				let q = {
 					product_id: id,
 					num: duo ? that.attr.productSelect.cart_num : 1,

+ 5 - 3
template/uni-app/pages/index/diy/index.vue

@@ -13,7 +13,8 @@
 						:isSortType="isSortType" @bindSortId="bindSortId" @bindHeight="bindHeight" :isFixed="isFixed">
 					</component>
 				</view>
-				<!-- #endif -->
+				<!-- #endif -->
+				
 				<!-- #ifdef MP || APP-PLUS -->
 				<block v-for="(item, index) in styleConfig" :key="index">
 					<activeParty v-if="item.name == 'activeParty'" :dataConfig="item" :isSortType="isSortType">
@@ -141,7 +142,9 @@
 				<view v-if="site_config" class="site-config" @click="goICP">{{ site_config }}</view>
 				<!-- #endif -->
 				<view class="uni-p-b-98"></view>
+				<!-- #ifndef H5 -->
 				<pageFoot></pageFoot>
+				<!-- #endif -->
 			</view>
 		</view>
 		<view v-else>
@@ -460,7 +463,6 @@
 				uni.showLoading({
 					title: this.$t(`加载中`)
 				})
-				console.log('1111')
 				this.diyData();
 				this.getIndexData();
 				getShare().then(res => {
@@ -659,7 +661,7 @@
 			},
 			diyData() {
 				let that = this;
-				getDiy(0).then(res => {
+				getDiy(0).then(res => {
 					uni.hideLoading()
 					uni.setStorageSync('DIY_DATA', res.data)
 					setTimeout(() => {

+ 1 - 0
template/uni-app/pages/index/index.vue

@@ -39,6 +39,7 @@
 		},
 		methods: {
 			getVersion(name) {
+				uni.$emit('uploadFooter')
 				getVersion(name).then(res => {
 					this.version = res.data.version
 					this.isDiy = res.data.is_diy