|
|
@@ -5,6 +5,7 @@ namespace hd\controllers;
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
use bizGhs\clear\classes\ClearClass;
|
|
|
use bizGhs\clear\services\ClearService;
|
|
|
+use bizGhs\custom\classes\CustomClass;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
@@ -15,11 +16,16 @@ class ClearController extends BaseController
|
|
|
public function actionList()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
- $where['status'] = 2;
|
|
|
+ $where = [];
|
|
|
+ if (isset($get['status']) && is_numeric($get['status'])) {
|
|
|
+ $where['status'] = $get['status'];
|
|
|
+ }
|
|
|
$ghsId = $get['ghsId'] ?? 0;
|
|
|
- $ghs = GhsClass::getById($ghsId, true);
|
|
|
- GhsClass::valid($ghs, $this->shopId);
|
|
|
- $where['ghsId'] = $ghsId;
|
|
|
+ if (!empty($ghsId)) {
|
|
|
+ $ghs = GhsClass::getById($ghsId, true);
|
|
|
+ GhsClass::valid($ghs, $this->shopId);
|
|
|
+ $where['ghsId'] = $ghsId;
|
|
|
+ }
|
|
|
$list = ClearService::getClearList($where);
|
|
|
util::success($list);
|
|
|
}
|
|
|
@@ -32,4 +38,27 @@ class ClearController extends BaseController
|
|
|
util::success($respond);
|
|
|
}
|
|
|
|
|
|
+ //获取结账单详情 ssh 20220509
|
|
|
+ public function actionDetail()
|
|
|
+ {
|
|
|
+ $id = Yii::$app->request->get('id');
|
|
|
+ $clear = ClearClass::getById($id);
|
|
|
+ if (empty($clear)) {
|
|
|
+ util::fail('没有结账信息');
|
|
|
+ }
|
|
|
+ $customId = $clear['customId'] ?? 0;
|
|
|
+ $custom = CustomClass::getById($customId, true);
|
|
|
+ $customShopId = $custom->shopId ?? 0;
|
|
|
+ if ($customShopId != $this->shopId) {
|
|
|
+ util::fail('没有权限');
|
|
|
+ }
|
|
|
+ $deadline = isset($clear['deadline']) && !empty($clear['deadline']) ? strtotime($clear['deadline']) : 0;
|
|
|
+ $now = time();
|
|
|
+ $remainSecond = bcsub($deadline, $now);
|
|
|
+ $remainSecond = bcsub($remainSecond, 100);
|
|
|
+ $remainSecond = $remainSecond > 0 ? $remainSecond : 0;
|
|
|
+ $clear['remainSecond'] = $remainSecond;
|
|
|
+ util::success($clear);
|
|
|
+ }
|
|
|
+
|
|
|
}
|