This commit is contained in:
mkm 2023-12-29 11:33:32 +08:00
parent d2ece017df
commit 2046caf5f8
3 changed files with 18 additions and 9 deletions

View File

@ -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');
}

View File

@ -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;

View File

@ -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');
}