|
|
@@ -2,10 +2,7 @@
|
|
|
|
|
|
namespace bizGhs\order\classes;
|
|
|
|
|
|
-use biz\stat\classes\StatItemClass;
|
|
|
-use bizGhs\product\classes\ProductClass;
|
|
|
-use bizGhs\stock\classes\StockRecordClass;
|
|
|
-use common\components\dict;
|
|
|
+use bizGhs\order\models\RefundOrderItem;
|
|
|
use Yii;
|
|
|
use bizGhs\base\classes\BaseClass;
|
|
|
|
|
|
@@ -14,6 +11,32 @@ class RefundOrderItemClass extends BaseClass
|
|
|
|
|
|
public static $baseFile = '\bizGhs\order\models\RefundOrderItem';
|
|
|
|
|
|
+ public static function getRefundItemList($where)
|
|
|
+ {
|
|
|
+ $data = self::getList('*', $where, 'id DESC');
|
|
|
+ $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
|
|
|
+ if (empty($list)) {
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+ $orderSnList = array_column($list, 'orderSn');
|
|
|
+ $infoList = RefundOrderClass::getAllByCondition(['orderSn' => ['in', $orderSnList]], null, '*', 'orderSn');
|
|
|
+ foreach ($list as $key => $val) {
|
|
|
+ $orderSn = $val['orderSn'] ?? '';
|
|
|
+ $info = $infoList[$orderSn] ?? [];
|
|
|
+ $list[$key]['refundInfo'] = $info;
|
|
|
+ }
|
|
|
+ $data['list'] = $list;
|
|
|
+ $where2 = $where;
|
|
|
+ if (isset($where2['productId'])) {
|
|
|
+ $newIds = $where2['productId'][1];
|
|
|
+ unset($where2['productId']);
|
|
|
+ $where2['productId'] = $newIds;
|
|
|
+ }
|
|
|
+ $totalAmount = RefundOrderItem::find()->where($where2)->sum('xhPrice');
|
|
|
+ $data['totalAmount'] = $totalAmount;
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
public static function addData($data, $order)
|
|
|
{
|
|
|
self::add($data);
|