Bläddra i källkod

Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev

From-wh 2 år sedan
förälder
incheckning
2f1447b72b

+ 2 - 0
crmeb/app/adminapi/controller/v1/order/StoreOrderInvoice.php

@@ -45,6 +45,8 @@ class StoreOrderInvoice extends AuthController
     {
     {
         $where = $this->request->getMore([
         $where = $this->request->getMore([
             ['data', '', '', 'time'],
             ['data', '', '', 'time'],
+            ['real_name', ''],
+            ['field_key', ''],
             [['type', 'd'], 0],
             [['type', 'd'], 0],
         ]);
         ]);
         $data = $this->services->chart($where);
         $data = $this->services->chart($where);

+ 2 - 3
crmeb/app/adminapi/controller/v1/user/member/MemberCardBatch.php

@@ -43,14 +43,13 @@ class MemberCardBatch extends AuthController
     {
     {
         $where = $this->request->getMore([
         $where = $this->request->getMore([
             ['title', ''],
             ['title', ''],
-//            ['page', 1],
-//            ['limit', 20],
         ]);
         ]);
         $data = $this->services->getList($where);
         $data = $this->services->getList($where);
         return app('json')->success($data);
         return app('json')->success($data);
     }
     }
 
 
-    /** 保存卡片资源
+    /**
+     * 保存卡片资源
      * @param $id
      * @param $id
      * @return mixed
      * @return mixed
      */
      */

+ 8 - 8
crmeb/app/api/controller/v1/admin/StoreOrderController.php

@@ -15,6 +15,7 @@ use app\services\order\DeliveryServiceServices;
 use app\services\order\StoreOrderCartInfoServices;
 use app\services\order\StoreOrderCartInfoServices;
 use app\services\order\StoreOrderCreateServices;
 use app\services\order\StoreOrderCreateServices;
 use app\services\order\StoreOrderDeliveryServices;
 use app\services\order\StoreOrderDeliveryServices;
+use app\services\order\StoreOrderEconomizeServices;
 use app\services\order\StoreOrderRefundServices;
 use app\services\order\StoreOrderRefundServices;
 use app\services\order\StoreOrderServices;
 use app\services\order\StoreOrderServices;
 use app\services\order\StoreOrderWapServices;
 use app\services\order\StoreOrderWapServices;
@@ -105,17 +106,16 @@ class StoreOrderController
      * @param UserServices $userServices
      * @param UserServices $userServices
      * @param $orderId
      * @param $orderId
      * @return mixed
      * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function detail(Request $request, StoreOrderServices $services, UserServices $userServices, $orderId)
     public function detail(Request $request, StoreOrderServices $services, UserServices $userServices, $orderId)
     {
     {
-        $order = $this->service->getOne(['order_id' => $orderId], '*', ['pink']);
-        if (!$order) return app('json')->fail(410173);
-        $order = $order->toArray();
-        $nickname = $userServices->value(['uid' => $order['uid']], 'nickname');
-        $orderInfo = $services->tidyOrder($order, true);
-        unset($orderInfo['uid'], $orderInfo['seckill_id'], $orderInfo['pink_id'], $orderInfo['combination_id'], $orderInfo['bargain_id'], $orderInfo['status'], $orderInfo['total_postage']);
-        $orderInfo['nickname'] = $nickname;
-        return app('json')->success($orderInfo);
+        $economizeServices = app()->make(StoreOrderEconomizeServices::class);
+        $orderData = $services->getUserOrderByKey($economizeServices, $orderId, (int)$request->uid());
+        $orderData['nickname'] = $userServices->value(['uid' => $orderData['uid']], 'nickname');
+        return app('json')->success($orderData);
     }
     }
 
 
     /**
     /**

+ 5 - 1
crmeb/app/dao/article/ArticleCategoryDao.php

@@ -32,11 +32,15 @@ class ArticleCategoryDao extends BaseDao
     }
     }
 
 
     /**
     /**
-     * 获取文章列表
+     * 获取文章分类列表
      * @param array $where
      * @param array $where
      * @param int $page
      * @param int $page
      * @param int $limit
      * @param int $limit
      * @return mixed
      * @return mixed
+     * @throws \ReflectionException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getList(array $where, int $page = 0, int $limit = 0)
     public function getList(array $where, int $page = 0, int $limit = 0)
     {
     {

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

@@ -495,7 +495,7 @@ class StoreOrderDao extends BaseDao
      */
      */
     public function chartTimePrice($start, $stop)
     public function chartTimePrice($start, $stop)
     {
     {
-        return $this->search(['is_del' => 0, 'paid' => 1, 'refund_status' => 0])
+        return $this->search(['pid' => 0, 'is_del' => 0, 'paid' => 1, 'refund_status' => [0, 3]])
             ->where('add_time', '>=', $start)
             ->where('add_time', '>=', $start)
             ->where('add_time', '<', $stop)
             ->where('add_time', '<', $stop)
             ->field('sum(pay_price) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time')
             ->field('sum(pay_price) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time')
@@ -511,7 +511,7 @@ class StoreOrderDao extends BaseDao
      */
      */
     public function chartTimeNumber($start, $stop)
     public function chartTimeNumber($start, $stop)
     {
     {
-        return $this->search(['is_del' => 0, 'paid' => 1, 'refund_status' => 0])
+        return $this->search(['pid' => 0, 'is_del' => 0, 'paid' => 1, 'refund_status' => [0, 3]])
             ->where('add_time', '>=', $start)
             ->where('add_time', '>=', $start)
             ->where('add_time', '<', $stop)
             ->where('add_time', '<', $stop)
             ->field('count(id) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time')
             ->field('count(id) as num,FROM_UNIXTIME(add_time, \'%Y-%m-%d\') as time')

+ 1 - 1
crmeb/app/model/user/MemberCardBatch.php

@@ -45,7 +45,7 @@ class MemberCardBatch extends BaseModel
     public function searchTitleAttr($query, $value)
     public function searchTitleAttr($query, $value)
     {
     {
         if ($value !== '') {
         if ($value !== '') {
-            $query->where('title', $value);
+            $query->where('title', 'like', '%' . $value . '%');
         }
         }
     }
     }
 
 

+ 4 - 13
crmeb/app/services/article/ArticleCategoryServices.php

@@ -39,23 +39,14 @@ class ArticleCategoryServices extends BaseServices
      * 获取文章分类列表
      * 获取文章分类列表
      * @param array $where
      * @param array $where
      * @return array
      * @return array
+     * @throws \ReflectionException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getList(array $where)
     public function getList(array $where)
     {
     {
-        [$page, $limit] = $this->getPageValue();
         $list = $this->dao->getList($where);
         $list = $this->dao->getList($where);
-        if (!empty($list) && $where['title'] !== '') {
-            $pids = Arr::getUniqueKey($list, 'pid');
-            $parentList = $this->dao->getList(['id' => $pids]);
-            $list = array_merge($list, $parentList);
-            foreach ($list as $key => $item) {
-                $arr = $item;
-                unset($list[$key]);
-                if (!in_array($arr, $list)) {
-                    $list[] = $arr;
-                }
-            }
-        }
         $list = get_tree_children($list);
         $list = get_tree_children($list);
         $count = $this->dao->count($where);
         $count = $this->dao->count($where);
         return compact('list', 'count');
         return compact('list', 'count');

+ 12 - 5
crmeb/app/services/order/StoreOrderInvoiceServices.php

@@ -36,21 +36,28 @@ class StoreOrderInvoiceServices extends BaseServices
 
 
     public function chart(array $where)
     public function chart(array $where)
     {
     {
+        $where['is_pay'] = 1;
         //全部
         //全部
-        $data['all'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time']]);
+        $data['all'] = (string)$this->dao->count($where);
         //待开
         //待开
-        $data['noOpened'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time'], 'type' => 1]);
+        $where['type'] = 1;
+        $data['noOpened'] = (string)$this->dao->count($where);
         //已开
         //已开
-        $data['opened'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time'], 'type' => 2]);
+        $where['type'] = 2;
+        $data['opened'] = (string)$this->dao->count($where);
         //退款
         //退款
-        $data['refund'] = (string)$this->dao->count(['is_pay' => 1, 'time' => $where['time'], 'type' => 3]);
+        $where['type'] = 3;
+        $data['refund'] = (string)$this->dao->count($where);
         return $data;
         return $data;
     }
     }
 
 
     /**
     /**
      * 后台获取开票列表
      * 后台获取开票列表
-     * @param $where
+     * @param array $where
      * @return array
      * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getList(array $where)
     public function getList(array $where)
     {
     {

+ 8 - 2
crmeb/app/services/other/export/ExportServices.php

@@ -336,13 +336,19 @@ class ExportServices extends BaseServices
         $filename = $data['title'] . '批次列表_' . date('YmdHis', time());
         $filename = $data['title'] . '批次列表_' . date('YmdHis', time());
         $export = $fileKey = [];
         $export = $fileKey = [];
         if (!empty($data['data'])) {
         if (!empty($data['data'])) {
+            $userIds = array_column($data['data']->toArray(), 'use_uid');
+            /** @var  UserServices $userService */
+            $userService = app()->make(UserServices::class);
+            $userList = $userService->getColumn([['uid', 'in', $userIds]], 'nickname,phone,real_name', 'uid');
+
+
             $i = 0;
             $i = 0;
             foreach ($data['data'] as $item) {
             foreach ($data['data'] as $item) {
                 $one_data = [
                 $one_data = [
                     'card_number' => $item['card_number'],
                     'card_number' => $item['card_number'],
                     'card_password' => $item['card_password'],
                     'card_password' => $item['card_password'],
-                    'user_name' => $item['user_name'],
-                    'user_phone' => $item['user_phone'],
+                    'user_name' => $userList[$item['use_uid']]['real_name'] ?: $userList[$item['use_uid']]['nickname'],
+                    'user_phone' => $userList[$item['use_uid']] ? $userList[$item['use_uid']]['phone'] : "",
                     'use_time' => $item['use_time'],
                     'use_time' => $item['use_time'],
                     'use_uid' => $item['use_uid'] ? '已领取' : '未领取'
                     'use_uid' => $item['use_uid'] ? '已领取' : '未领取'
                 ];
                 ];

+ 1 - 1
crmeb/app/services/product/product/StoreProductServices.php

@@ -1259,7 +1259,7 @@ class StoreProductServices extends BaseServices
             $page = 1;
             $page = 1;
             $limit = $num;
             $limit = $num;
         }
         }
-        $list = $this->dao->getSearchList($where, $page, $limit, ['id,store_name,cate_id,image,IFNULL(sales, 0) + IFNULL(ficti, 0) as sales,price,stock,activity,unit_name,presale']);
+        $list = $this->dao->getSearchList($where, $page, $limit, ['id,store_name,cate_id,image,IFNULL(sales, 0) + IFNULL(ficti, 0) as sales,price,stock,activity,unit_name,presale,is_vip,vip_price']);
         $list = $this->getActivityList($list);
         $list = $this->getActivityList($list);
         return $list;
         return $list;
     }
     }

+ 4 - 0
crmeb/app/services/user/member/MemberCardBatchServices.php

@@ -32,6 +32,10 @@ class MemberCardBatchServices extends BaseServices
     /**
     /**
      * 获取会员卡批次列表
      * 获取会员卡批次列表
      * @param array $where
      * @param array $where
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getList(array $where = [])
     public function getList(array $where = [])
     {
     {

+ 8 - 9
crmeb/app/services/user/member/MemberCardServices.php

@@ -49,16 +49,15 @@ class MemberCardServices extends BaseServices
         }
         }
         unset($where['is_use']);
         unset($where['is_use']);
         $list = $this->dao->getSearchList($where, $page, $limit);
         $list = $this->dao->getSearchList($where, $page, $limit);
-        if ($list) {
-            foreach ($list as $k => $v) {
-                if ($v['use_uid']) {
-                    $user_info = $userService->getUserInfo($v['use_uid'], ['nickname', 'phone', 'real_name']);
-                    $list[$k]['username'] = $user_info['real_name'] ? $user_info['real_name'] : $user_info['nickname'];
-                    $list[$k]['phone'] = $user_info ? $user_info['phone'] : "";
-                }
-                $list[$k]['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
-                $list[$k]['use_time'] = $v['use_time'] != 0 ? date('Y-m-d H:i:s', $v['use_time']) : "未使用";
+        $userIds = array_column($list->toArray(), 'use_uid');
+        $userList = $userService->getColumn([['uid', 'in', $userIds]], 'nickname,phone,real_name', 'uid');
+        foreach ($list as $k => $v) {
+            if ($v['use_uid']) {
+                $list[$k]['username'] = $userList[$v['use_uid']]['real_name'] ?: $userList[$v['use_uid']]['nickname'];
+                $list[$k]['phone'] = $userList[$v['use_uid']] ? $userList[$v['use_uid']]['phone'] : "";
             }
             }
+            $list[$k]['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
+            $list[$k]['use_time'] = $v['use_time'] != 0 ? date('Y-m-d H:i:s', $v['use_time']) : "未使用";
         }
         }
         $count = $this->dao->count($where);
         $count = $this->dao->count($where);
         return compact('list', 'count');
         return compact('list', 'count');

+ 3 - 2
template/admin/src/pages/order/invoice/index.vue

@@ -151,7 +151,7 @@
           <div class="list">
           <div class="list">
             <div class="title row">联系信息</div>
             <div class="title row">联系信息</div>
             <Row class="row">
             <Row class="row">
-              <Col span="12">真实姓名: {{ invoiceDetails.real_name }}</Col>
+              <Col span="12">真实姓名: {{ invoiceDetails.name }}</Col>
               <Col span="12">联系电话: {{ invoiceDetails.user_phone }}</Col>
               <Col span="12">联系电话: {{ invoiceDetails.user_phone }}</Col>
             </Row>
             </Row>
             <Row class="row">
             <Row class="row">
@@ -178,7 +178,7 @@
           <div class="list">
           <div class="list">
             <div class="title row">联系信息</div>
             <div class="title row">联系信息</div>
             <Row class="row">
             <Row class="row">
-              <Col span="12">真实姓名: {{ invoiceDetails.real_name }}</Col>
+              <Col span="12">真实姓名: {{ invoiceDetails.name }}</Col>
               <Col span="12">联系电话: {{ invoiceDetails.user_phone }}</Col>
               <Col span="12">联系电话: {{ invoiceDetails.user_phone }}</Col>
             </Row>
             </Row>
             <Row class="row">
             <Row class="row">
@@ -555,6 +555,7 @@ export default {
       this.timeVal = e;
       this.timeVal = e;
       this.orderData.data = this.timeVal[0] ? this.timeVal.join('-') : '';
       this.orderData.data = this.timeVal[0] ? this.timeVal.join('-') : '';
       this.getList();
       this.getList();
+      this.getTabs();
     },
     },
     //订单状态搜索()
     //订单状态搜索()
     selectChange() {
     selectChange() {