|
|
@@ -455,6 +455,7 @@ class RefundController extends BaseController
|
|
|
/**
|
|
|
* 销售售后记录列表:ghs /order/refund-list、小程序售后记录共用。
|
|
|
* matchPayTime/fromAffect=1 时按原单 payTime + 售后 addTime,与跨天影响统计同口径。
|
|
|
+ * passSearchTime 筛真实通过日 passTime,用来和花材销量跨天扣减对齐。
|
|
|
*/
|
|
|
public function actionList()
|
|
|
{
|
|
|
@@ -497,6 +498,15 @@ class RefundController extends BaseController
|
|
|
$period = dateUtil::formatTime($refundSearchTime, $refundStartTime, $refundEndTime);
|
|
|
$where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
|
|
|
}
|
|
|
+ // 通过日只认真实 passTime,不回落到申请日,避免未通过单混进来
|
|
|
+ $passSearchTime = $get['passSearchTime'] ?? '';
|
|
|
+ $passPeriod = null;
|
|
|
+ if (!empty($passSearchTime)) {
|
|
|
+ $passStartTime = $get['passStartTime'] ?? '';
|
|
|
+ $passEndTime = $get['passEndTime'] ?? '';
|
|
|
+ $passPeriod = dateUtil::formatTime($passSearchTime, $passStartTime, $passEndTime);
|
|
|
+ $where['passTime'] = ['between', [$passPeriod['startTime'], $passPeriod['endTime']]];
|
|
|
+ }
|
|
|
$customId = $get['customId'] ?? '';
|
|
|
if (!empty($customId)) {
|
|
|
$where['customId'] = $customId;
|
|
|
@@ -511,7 +521,7 @@ class RefundController extends BaseController
|
|
|
}
|
|
|
$export = $get['export'] ?? 0;
|
|
|
if ($export == 1) {
|
|
|
- if (isset($where['orderTime']) == false && isset($where['addTime']) == false) {
|
|
|
+ if (isset($where['orderTime']) == false && isset($where['addTime']) == false && isset($where['passTime']) == false) {
|
|
|
util::fail('请选时间');
|
|
|
}
|
|
|
ini_set('memory_limit', '2045M');
|
|
|
@@ -540,6 +550,18 @@ class RefundController extends BaseController
|
|
|
util::fail('最长可导出一个月');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (isset($where['passTime'])) {
|
|
|
+ $start = $where['passTime'][1][0];
|
|
|
+ $end = $where['passTime'][1][1];
|
|
|
+ $monthTime = bcmul(31, 86400);
|
|
|
+ $startArea = strtotime($start);
|
|
|
+ $endArea = strtotime($end);
|
|
|
+ $diff = bcsub($endArea, $startArea);
|
|
|
+ if ($diff > $monthTime) {
|
|
|
+ util::fail('最长可导出一个月');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// 从跨天售后影响点进来:按原单 payTime + 售后 addTime,且必须挂上批发单,与统计同口径
|
|
|
$matchPayTime = intval($get['matchPayTime'] ?? 0);
|
|
|
@@ -560,6 +582,8 @@ class RefundController extends BaseController
|
|
|
'sameDay' => $sameDay,
|
|
|
'customId' => $customId,
|
|
|
'shopAdminId' => $shopAdminId,
|
|
|
+ 'passStart' => $passPeriod['startTime'] ?? '',
|
|
|
+ 'passEnd' => $passPeriod['endTime'] ?? '',
|
|
|
]
|
|
|
);
|
|
|
} else {
|