Merge pull request 'dev' (#332) from dev into main

Reviewed-on: #332
This commit is contained in:
mkm 2024-11-14 17:58:39 +08:00
commit 896009e336
2 changed files with 15 additions and 2 deletions

View File

@ -7,6 +7,7 @@ use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\model\purchase_product_offer\PurchaseProductOffer;
use app\common\lists\ListsSearchInterface;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\model\delivery_service\DeliveryService;
use app\common\model\store_category\StoreCategory;
use app\common\model\store_product\StoreProduct;
@ -58,10 +59,17 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc
}
}
$job_ids=$this->adminInfo['job_ids']??[];
if($this->request->get('order_sn')){
$ids=BeforehandOrder::where('order_id','like','%'.$this->request->get('order_sn'))->column('id');
if($ids){
$this->searchWhere[]=['order_id','in',$ids];
}
}
return PurchaseProductOffer::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($item) use($job_ids){
$item->order_sn=BeforehandOrder::where('id',$item['order_id'])->value('order_id');
$find=StoreProduct::where('id',$item->product_id)->withTrashed()->find();
$item->store_name=$find->store_name;
$item->store_info=$find->store_info;

View File

@ -5,8 +5,10 @@ namespace app\admin\logic\purchase_product_offer;
use app\common\model\purchase_product_offer\PurchaseProductOffer;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo;
use app\common\model\delivery_service\DeliveryService;
use app\common\model\dict\DictData;
use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_price\StoreProductPrice;
@ -112,8 +114,11 @@ class PurchaseProductOfferLogic extends BaseLogic
public static function setProcureInfo(array $params): bool
{
$offer = PurchaseProductOffer::where(['id' => $params['id']])->find();
if($offer['buyer_id']!=$params['admin_id']){
throw new BusinessException('您不是当事采购员,无法设置采购信息');
$uid=Admin::where('id',$params['admin_id'])->value('uid');
if($params['admin_id']!=1){
if($offer['buyer_id']!=$uid){
throw new BusinessException('您不是当事采购员,无法设置采购信息');
}
}
Db::startTrans();
try {