Browse Source

零售端-订单列表需要返回花店名称、订单状态

ouyang 1 week ago
parent
commit
daf2e3b9eb
1 changed files with 12 additions and 1 deletions
  1. 12 1
      biz-mall/order/services/OrderService.php

+ 12 - 1
biz-mall/order/services/OrderService.php

@@ -4,6 +4,7 @@ namespace bizMall\order\services;
 
 use bizMall\base\services\BaseService;
 use bizMall\goods\classes\GoodsClass;
+use bizMall\hd\classes\HdClass;
 use bizMall\item\classes\ItemClass;
 use bizMall\merchant\services\MerchantCapitalService;
 use bizMall\order\classes\OrderClass;
@@ -13,6 +14,7 @@ use bizMall\promote\services\CouponService;
 use bizMall\shop\classes\ShopClass;
 use bizMall\user\classes\UserAssetClass;
 use common\components\dict;
+use common\components\delivery\platform\fengniao\OrderStatusUtil;
 use common\components\imgUtil;
 use common\components\orderSn;
 use common\components\stringUtil;
@@ -224,12 +226,17 @@ class OrderService extends BaseService
     //获取订单信息 TODO 重新实现,要限制查询字段与返回字段,性能第一???? -- 商品项(商品规格)、商品数量
     public static function getOrderList($where)
     {
-        $fields = 'id, shopId, hdId, orderSn, orderType, actPrice, goodsNum, reachDate, reachPeriod, addTime';
+        $fields = 'id, shopId, hdId, orderSn, orderType, actPrice, goodsNum, reachDate, reachPeriod, status, addTime';
         $data = self::getList($fields, $where, 'addTime DESC');
         if (empty($data['list'])) {
             return $data;
         }
         $list = $data['list'];
+        $hdIds = array_values(array_filter(array_unique(array_column($list, 'hdId'))));
+        $hdMap = [];
+        if (!empty($hdIds)) {
+            $hdMap = HdClass::getByIds($hdIds, null, 'id');
+        }
         $orderSns = array_values(array_filter(array_unique(array_column($list, 'orderSn'))));
         // 花束订单明细在 xhOrderGoods,花材订单明细在 xhOrderItem,orderType=3 时两者都有
         $goodsListMap = OrderGoodsService::getGoodsListByOrderSns($orderSns);
@@ -238,6 +245,10 @@ class OrderService extends BaseService
         foreach ($data['list'] as $key => $val) {
             $orderSn = $val['orderSn'] ?? '';
             $orderType = intval($val['orderType'] ?? 1);
+            $hdId = intval($val['hdId'] ?? 0);
+            $orderStatus = intval($val['status'] ?? 0);
+            $data['list'][$key]['hdName'] = $hdMap[$hdId]['name'] ?? '';
+            $data['list'][$key]['statusDesc'] = OrderStatusUtil::getSystemStatusDesc($orderStatus);
             $goodsInfoList = [];
             if (!empty($orderSn)) {
                 if ($orderType == 1) {