From 2046caf5f8ce6040167d9f6b374adb63d281d7e3 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 29 Dec 2023 11:33:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/store/order/StoreOrderOtherDao.php | 8 ++++---- .../model/store/order/StoreOrderOther.php | 2 -- .../store/order/StoreOtherOrderRepository.php | 17 ++++++++++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/common/dao/store/order/StoreOrderOtherDao.php b/app/common/dao/store/order/StoreOrderOtherDao.php index c33f39ae..74e7f728 100644 --- a/app/common/dao/store/order/StoreOrderOtherDao.php +++ b/app/common/dao/store/order/StoreOrderOtherDao.php @@ -15,7 +15,7 @@ namespace app\common\dao\store\order; use app\common\dao\BaseDao; -use app\common\model\store\order\StoreOtherGroupOrder; +use app\common\model\store\order\StoreGroupOrderOther; use app\common\model\store\order\StoreOrderOther; use app\common\model\store\order\StoreOrderProductOther; use app\common\model\store\order\StoreOrderStatusOther; @@ -108,7 +108,7 @@ class StoreOrderOtherDao extends BaseDao $query->where('StoreOrderOther.paid', 1)->whereIn('StoreOrderOther.status', [10, 11]); break; case 2: - $query->where('StoreOrderOther.paid', 1)->where('StoreOrderOther.status', $where['status'])->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY); + $query->where('StoreOrderOther.paid', 1)->where('StoreOrderOther.status', $where['status'])->where('pay_type', '<>', StoreGroupOrderOther::PAY_TYPE_CREDIT_BUY); break; case 20: $query->where('StoreOrderOther.paid', 1)->whereIn('StoreOrderOther.status', [2, 3]); @@ -206,7 +206,7 @@ class StoreOrderOtherDao extends BaseDao $query->where('order_sn', 'like', '%' . $where['order_search'] . '%')->whereOr('user_phone', $where['order_search']); }) ->when(isset($where['group_order_sn']) && $where['group_order_sn'] !== '', function ($query) use ($where) { - $query->join('StoreGroupOrder GO', 'StoreOrderOther.group_order_id = GO.group_order_id')->where('group_order_sn', $where['group_order_sn']); + $query->join('StoreGroupOrderOther GO', 'StoreOrderOther.group_order_id = GO.group_order_id')->where('group_order_sn', $where['group_order_sn']); }) ->when(isset($where['keywords']) && $where['keywords'] !== '', function ($query) use ($where) { $query->where(function ($query) use ($where) { @@ -533,7 +533,7 @@ class StoreOrderOtherDao extends BaseDao { return StoreOrderStatusOther::getDB()->alias('A')->leftJoin('StoreOrderOther B', 'A.order_id = B.order_id') ->where('A.change_type', 'take') - ->where('A.change_time', '<', $end)->where('B.paid', 1)->where('B.status', 2)->where('B.pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY) + ->where('A.change_time', '<', $end)->where('B.paid', 1)->where('B.status', 2)->where('B.pay_type', '<>', StoreGroupOrderOther::PAY_TYPE_CREDIT_BUY) ->column('A.order_id'); } diff --git a/app/common/model/store/order/StoreOrderOther.php b/app/common/model/store/order/StoreOrderOther.php index 3898f22a..084c1cfe 100644 --- a/app/common/model/store/order/StoreOrderOther.php +++ b/app/common/model/store/order/StoreOrderOther.php @@ -18,9 +18,7 @@ use app\common\model\BaseModel; use app\common\model\community\Community; use app\common\model\store\product\ProductGroupUser; use app\common\model\store\service\StoreService; -use app\common\model\store\shipping\Express; use app\common\model\system\merchant\Merchant; -use app\common\model\system\merchant\MerchantIntention; use app\common\model\user\User; use app\common\repositories\store\MerchantTakeRepository; diff --git a/app/common/repositories/store/order/StoreOtherOrderRepository.php b/app/common/repositories/store/order/StoreOtherOrderRepository.php index 751c6fc8..aaff1531 100644 --- a/app/common/repositories/store/order/StoreOtherOrderRepository.php +++ b/app/common/repositories/store/order/StoreOtherOrderRepository.php @@ -686,7 +686,7 @@ class StoreOtherOrderRepository extends BaseRepository // $param['StoreOrderOther.paid'] = 0; break; // 未支付 case 2: - $param['StoreOrderOther.paid'] = 1; + $param['StoreOrderOther.paid'] = [1,2]; $param['StoreOrderOther.status'] = 0; break; // 待发货 case 3: @@ -1254,7 +1254,7 @@ class StoreOtherOrderRepository extends BaseRepository ->with([ 'orderProduct', 'merchant' => function ($query) { - return $query->field('mer_id,mer_name,is_trader,financial_bank'); + return $query->field('mer_id,mer_name,is_trader,financial_bank,auto_margin_rate,commission_rate'); }, 'verifyService' => function ($query) { return $query->field('service_id,nickname'); @@ -1275,7 +1275,18 @@ class StoreOtherOrderRepository extends BaseRepository }, ]); $count = $query->count(); - $list = $query->page($page, $limit)->select(); + $list = $query->page($page, $limit)->select()->each(function ($item) { + $auto_margin= Db::name('financial_record_transfer') + ->where('order_id',$item['order_id'])->where('financial_type','auto_margin')->where('financial_pm',0)->value('number'); + $order_charge= Db::name('financial_record_transfer') + ->where('order_id',$item['order_id'])->where('financial_type','order_charge')->where('financial_pm',0)->value('number'); + $item['financial_record']=[ + 'auto_margin'=>$auto_margin, + 'auto_margin_lv'=>$item->merchant->auto_margin_rate, + 'order_charge'=>$order_charge, + 'order_charge_lv'=>$item->merchant->commission_rate?round($item->merchant->commission_rate,2):0, + ]; + }); return compact('count', 'list'); }