|
|
@@ -735,19 +735,19 @@ class OrderController extends BaseController
|
|
|
$where['payTime'] = ['between', [$period['startTime'], $period['endTime']]];
|
|
|
}
|
|
|
|
|
|
- if($export == 1){
|
|
|
+ if ($export == 1) {
|
|
|
ini_set('memory_limit', '2045M');
|
|
|
set_time_limit(0);
|
|
|
- if(isset($where['payTime']) == false){
|
|
|
+ if (isset($where['payTime']) == false) {
|
|
|
util::fail('请选时间段');
|
|
|
}
|
|
|
$start = $where['payTime'][1][0];
|
|
|
$end = $where['payTime'][1][1];
|
|
|
- $monthTime = bcmul(31,86400);
|
|
|
+ $monthTime = bcmul(31, 86400);
|
|
|
$startArea = strtotime($start);
|
|
|
$endArea = strtotime($end);
|
|
|
- $diff = bcsub($endArea,$startArea);
|
|
|
- if($diff>$monthTime){
|
|
|
+ $diff = bcsub($endArea, $startArea);
|
|
|
+ if ($diff > $monthTime) {
|
|
|
util::fail('最长可导出一个月');
|
|
|
}
|
|
|
}
|
|
|
@@ -2204,15 +2204,16 @@ class OrderController extends BaseController
|
|
|
$totalPack = 0;
|
|
|
$totalFreight = 0;
|
|
|
$totalTkPrice = 0;
|
|
|
+ $totalNum = 0;
|
|
|
if (!empty($orderList)) {
|
|
|
foreach ($orderList as $orderInfo) {
|
|
|
$actPrice = $orderInfo['actPrice'] ?? 0;
|
|
|
- $orderPrice = $orderInfo['orderPrice']??0;
|
|
|
+ $orderPrice = $orderInfo['orderPrice'] ?? 0;
|
|
|
$customId = $orderInfo['customId'] ?? 0;
|
|
|
$status = $orderInfo['status'] ?? 0;
|
|
|
$book = $orderInfo['book'] ?? 0;
|
|
|
- $orderSn = $orderInfo['orderSn']??'';
|
|
|
- $tkPrice = $orderInfo['tkPrice']??0;
|
|
|
+ $orderSn = $orderInfo['orderSn'] ?? '';
|
|
|
+ $tkPrice = $orderInfo['tkPrice'] ?? 0;
|
|
|
if ($status == 1 || $status == 5) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -2222,75 +2223,76 @@ class OrderController extends BaseController
|
|
|
$carton = 0;
|
|
|
$pack = 0;
|
|
|
$freight = 0;
|
|
|
- $orderItemList = OrderItemClass::getAllByCondition(['orderSn'=>$orderSn],null,'*');
|
|
|
- if(!empty($orderItemList)){
|
|
|
- foreach($orderItemList as $orderItem){
|
|
|
- $num = $orderItem['xhNum']??0;
|
|
|
- $unitPrice = $orderItem['xhUnitPrice']??0;
|
|
|
- $refundNum = $orderItem['refundNum']??0;
|
|
|
- $classId = $orderItem['classId']??0;
|
|
|
+ $orderItemList = OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
|
|
|
+ if (!empty($orderItemList)) {
|
|
|
+ foreach ($orderItemList as $orderItem) {
|
|
|
+ $num = $orderItem['xhNum'] ?? 0;
|
|
|
+ $unitPrice = $orderItem['xhUnitPrice'] ?? 0;
|
|
|
+ $refundNum = $orderItem['refundNum'] ?? 0;
|
|
|
+ $classId = $orderItem['classId'] ?? 0;
|
|
|
if (getenv('YII_ENV') == 'production') {
|
|
|
- if($mainId == 23390){
|
|
|
- $remainNum = bcsub($num,$refundNum);
|
|
|
- $amount = bcmul($remainNum,$unitPrice,2);
|
|
|
- if($classId == 72106){
|
|
|
- $carton = bcadd($carton,$amount,2);
|
|
|
+ if ($mainId == 23390) {
|
|
|
+ $remainNum = bcsub($num, $refundNum);
|
|
|
+ $amount = bcmul($remainNum, $unitPrice, 2);
|
|
|
+ if ($classId == 72106) {
|
|
|
+ $carton = bcadd($carton, $amount, 2);
|
|
|
}
|
|
|
- if($classId == 72108){
|
|
|
- $pack = bcadd($pack,$amount,2);
|
|
|
+ if ($classId == 72108) {
|
|
|
+ $pack = bcadd($pack, $amount, 2);
|
|
|
}
|
|
|
- if($classId == 73118){
|
|
|
- $freight = bcadd($freight,$amount,2);
|
|
|
+ if ($classId == 73118) {
|
|
|
+ $freight = bcadd($freight, $amount, 2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- $totalCarton = bcadd($totalCarton,$carton,2);
|
|
|
- $totalPack = bcadd($totalPack,$pack,2);
|
|
|
- $totalFreight = bcadd($totalFreight,$freight,2);
|
|
|
- $totalTkPrice = bcadd($totalTkPrice,$tkPrice,2);
|
|
|
+ $totalCarton = bcadd($totalCarton, $carton, 2);
|
|
|
+ $totalPack = bcadd($totalPack, $pack, 2);
|
|
|
+ $totalFreight = bcadd($totalFreight, $freight, 2);
|
|
|
+ $totalTkPrice = bcadd($totalTkPrice, $tkPrice, 2);
|
|
|
$totalActPrice = bcadd($totalActPrice, $actPrice, 2);
|
|
|
- $totalOrderPrice = bcadd($totalOrderPrice,$orderPrice,2);
|
|
|
+ $totalOrderPrice = bcadd($totalOrderPrice, $orderPrice, 2);
|
|
|
+ $totalNum++;
|
|
|
if (isset($list[$customId])) {
|
|
|
$list[$customId]['actPrice'] = bcadd($list[$customId]['actPrice'], $actPrice, 2);
|
|
|
$list[$customId]['orderPrice'] = bcadd($list[$customId]['orderPrice'], $orderPrice, 2);
|
|
|
$list[$customId]['num'] = bcadd($list[$customId]['num'], 1);
|
|
|
- $list[$customId]['carton'] = bcadd($list[$customId]['carton'], $carton,2);
|
|
|
- $list[$customId]['pack'] = bcadd($list[$customId]['pack'], $pack,2);
|
|
|
- $list[$customId]['freight'] = bcadd($list[$customId]['freight'], $freight,2);
|
|
|
- $list[$customId]['tkPrice'] = bcadd($list[$customId]['tkPrice'], $tkPrice,2);
|
|
|
+ $list[$customId]['carton'] = bcadd($list[$customId]['carton'], $carton, 2);
|
|
|
+ $list[$customId]['pack'] = bcadd($list[$customId]['pack'], $pack, 2);
|
|
|
+ $list[$customId]['freight'] = bcadd($list[$customId]['freight'], $freight, 2);
|
|
|
+ $list[$customId]['tkPrice'] = bcadd($list[$customId]['tkPrice'], $tkPrice, 2);
|
|
|
} else {
|
|
|
$name = $customList[$customId] && $customList[$customId]['name'] ? $customList[$customId]['name'] : '未命名';
|
|
|
$mobile = $customList[$customId] && $customList[$customId]['mobile'] ? $customList[$customId]['mobile'] : '0';
|
|
|
$list[$customId] = [
|
|
|
'id' => $customId,
|
|
|
'name' => $name,
|
|
|
- 'mobile'=>$mobile,
|
|
|
- 'orderPrice'=>$orderPrice,
|
|
|
+ 'mobile' => $mobile,
|
|
|
+ 'orderPrice' => $orderPrice,
|
|
|
'actPrice' => $actPrice,
|
|
|
'num' => 1,
|
|
|
- 'carton'=>$carton,
|
|
|
- 'pack'=>$pack,
|
|
|
- 'freight'=>$freight,
|
|
|
- 'tkPrice'=>$tkPrice,
|
|
|
+ 'carton' => $carton,
|
|
|
+ 'pack' => $pack,
|
|
|
+ 'freight' => $freight,
|
|
|
+ 'tkPrice' => $tkPrice,
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
- foreach($customList as $key => $custom){
|
|
|
- $customId = $custom['id']??0;
|
|
|
- if(isset($list[$customId]) == false){
|
|
|
+ foreach ($customList as $key => $custom) {
|
|
|
+ $customId = $custom['id'] ?? 0;
|
|
|
+ if (isset($list[$customId]) == false) {
|
|
|
$list[$customId] = [
|
|
|
'id' => $customId,
|
|
|
'name' => $custom['name'],
|
|
|
- 'mobile'=>$custom['mobile'],
|
|
|
+ 'mobile' => $custom['mobile'],
|
|
|
'amount' => 0,
|
|
|
'num' => 0,
|
|
|
- 'carton'=>0,
|
|
|
- 'pack'=>0,
|
|
|
- 'freight'=>0,
|
|
|
- 'tkPrice'=>0,
|
|
|
- 'orderPrice'=>0,
|
|
|
+ 'carton' => 0,
|
|
|
+ 'pack' => 0,
|
|
|
+ 'freight' => 0,
|
|
|
+ 'tkPrice' => 0,
|
|
|
+ 'orderPrice' => 0,
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
@@ -2305,8 +2307,8 @@ class OrderController extends BaseController
|
|
|
// OrderClass::exportAccountList($list, $mainId);
|
|
|
// util::stop();
|
|
|
}
|
|
|
- util::success(['list' => $list, 'totalActPrice' => $totalActPrice,'totalOrderPrice'=>$totalOrderPrice,'totalCarton'=>$totalCarton,
|
|
|
- 'totalPack'=>$totalPack,'totalFreight'=>$totalFreight,'totalTkPrice'=>$totalTkPrice]);
|
|
|
+ util::success(['list' => $list, 'totalActPrice' => $totalActPrice, 'totalOrderPrice' => $totalOrderPrice, 'totalCarton' => $totalCarton, 'totalNum' => $totalNum,
|
|
|
+ 'totalPack' => $totalPack, 'totalFreight' => $totalFreight, 'totalTkPrice' => $totalTkPrice]);
|
|
|
}
|
|
|
|
|
|
}
|