فهرست منبع

feat: EK-3320: 订单增加 Invoice 下载

zhangl 1 ماه پیش
والد
کامیت
960c99e00e
1فایلهای تغییر یافته به همراه16 افزوده شده و 20 حذف شده
  1. 16 20
      common/libs/export/BaseExport.php

+ 16 - 20
common/libs/export/BaseExport.php

@@ -1570,29 +1570,35 @@ ORDER;
         LoggerTool::debug([
             'sql' => $query->createCommand()->getRawSql(),
             'condition' => $this->params['condition'],
-            'params' => $this->params
+            'params' => $this->params,
+            'orderList' => $oderList
         ]);
 
-
         if ($oderList) {
             $userId = '';
             $userName = '';
             $address = '';
-            $mobile = '';
-            $orderAt = '';
+            $mobile = $oderList[0]['MOBILE'];
+            $orderAt = Date::convert($oderList[0]['CREATED_AT'],'Y/m/d');
             $orderDetails = '';
-            $orderSn = '';
+            $orderSn = $oderList[0]['SN'];;
             $orderAmount = 0;  // 合计总额
             $orderNums = 0; // 合计总数
             $totalTaxAmount = 0; // 合计税额
             $totalAmount = 0;
             $paymentStatus = 'Paid'; // 支付状态
-            $invoiceRemark = '';
-            $paymentMethod = ''; // 支付方式
-            $currency = '';
+            $invoiceRemark = $oderList[0]['INVOICE_REMARK'];
+            $paymentMethod = $oderList[0]['PAY_TYPE']; // 支付方式
+            $currency = Currency::findOne($oderList[0]['CURRENCY_ID'])['CODE'] ?? '';;
             $invoiceNo = $oderList[0]['INVOICE_NO'];
 
-            LoggerTool::debug($oderList);
+            $provinceName = $oderList[0]['PROVINCE'] ? Region::getCnName($oderList[0]['PROVINCE']) : '';
+            $cityName = $oderList[0]['CITY'] ? Region::getCnName($oderList[0]['CITY']) : '';
+            $countyName = $oderList[0]['COUNTY'] ? Region::getCnName($oderList[0]['COUNTY']) : '';
+            $address = $provinceName . $cityName . $countyName . $oderList[0]['ADDRESS'];
+
+            $paymentMethod = $oderList[0]['PAY_TYPE'] ?? '';
+            $paymentStatus = $oderList[0]['PAY_STATUS'] ?? '';
 
             $orderTotalBv = 0;
             $orderTotalTaxAmount = 0;
@@ -1603,20 +1609,10 @@ ORDER;
             $no = 0;
             foreach ($oderList as $key => $value) {
                 $no += 1;
-                $invoiceRemark = $value['INVOICE_REMARK'] ?: '';
-                $provinceName = $value['PROVINCE'] ? Region::getCnName($value['PROVINCE']) : '';
-                $cityName = $value['CITY'] ? Region::getCnName($value['CITY']) : '';
-                $countyName = $value['COUNTY'] ? Region::getCnName($value['COUNTY']) : '';
-                $paymentMethod = $value['PAY_TYPE'] ?? '';
-                $currency = Currency::findOne($value['CURRENCY_ID'])['CODE'] ?? '';
-                $paymentStatus = $value['PAY_STATUS'] ?? '';
 
                 $userId = $value['USER_NAME'];
                 $userName = $value['REAL_NAME'];
-                $address = $provinceName . $cityName . $countyName . $value['ADDRESS'];
-                $mobile = $value['MOBILE'];
-                $orderAt = Date::convert($value['CREATED_AT'],'Y/m/d');
-                $orderSn = $value['SN'];
+
                 // 总价
                 $totalAmount = $value['BUY_NUMS'] * $value['REAL_PRICE'];
                 $orderAmount += $totalAmount;