|
|
@@ -15,9 +15,15 @@ class GhsClass extends BaseClass
|
|
|
public static $baseFile = '\bizGhs\ghs\models\Ghs';
|
|
|
|
|
|
//供货商列表 ssh 20221220
|
|
|
- public static function getGhsList($where)
|
|
|
+ public static function getGhsList($where, $sortType = 'all')
|
|
|
{
|
|
|
- $data = self::getList('*', $where, 'debtAmount DESC,inTurn DESC,addTime DESC');
|
|
|
+ $order = 'inTurn DESC,addTime DESC';
|
|
|
+ if ($sortType === 'debt') {
|
|
|
+ $order = 'balance ASC,inTurn DESC,addTime DESC';
|
|
|
+ } elseif ($sortType === 'expend') {
|
|
|
+ $order = 'expendAmount DESC,inTurn DESC,addTime DESC';
|
|
|
+ }
|
|
|
+ $data = self::getList('*', $where, $order);
|
|
|
$data['list'] = self::groupBaseInfo($data['list']);
|
|
|
return $data;
|
|
|
}
|
|
|
@@ -25,6 +31,20 @@ class GhsClass extends BaseClass
|
|
|
/**
|
|
|
* 批发店采购:按 xhGhs 净 balance 汇总总待结(balance<0 部分之和,合并后模型)
|
|
|
*/
|
|
|
+ /** 供货商列表 Tab 数量(一次返回,避免前端多次 list 请求) */
|
|
|
+ public static function getSupplierTabCounts($ownShopId)
|
|
|
+ {
|
|
|
+ if (empty($ownShopId)) {
|
|
|
+ return ['all' => 0, 'debtRank' => 0, 'expendRank' => 0];
|
|
|
+ }
|
|
|
+ $base = ['ownShopId' => $ownShopId, 'delStatus' => 0];
|
|
|
+ return [
|
|
|
+ 'all' => (int)self::getCount($base),
|
|
|
+ 'debtRank' => (int)self::getCount(['and', $base, ['<', 'balance', 0]]),
|
|
|
+ 'expendRank' => (int)self::getCount($base),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
public static function sumTotalOutstandingDebt($mainId, $delStatus = 0)
|
|
|
{
|
|
|
if (empty($mainId)) {
|