订单列表增加订单类型字段及名称显示;采购产品报价列表增加用户ID筛选
- 在 BeforehandOrderLists 类的 lists 方法中添加 order_type 字段,并增加对应的订单类型名称显示 - 在 PurchaseProductOfferController 类的 lists 方法中设置 uid 参数为当前用户 ID - 在 PurchaseProductOfferLists 类的 lists 方法中根据 uid 进行搜索条件设置,并在 count 方法中添加对应逻辑
This commit is contained in:
parent
ef47fe0147
commit
00fb209800
@ -43,7 +43,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return BeforehandOrder::where($this->searchWhere)
|
return BeforehandOrder::where($this->searchWhere)
|
||||||
->field(['id','order_id', 'uid','total_num','total_price','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark'])
|
->field(['id','order_id', 'uid','order_type','total_num','total_price','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item){
|
->select()->each(function ($item){
|
||||||
@ -52,6 +52,13 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
|||||||
}else{
|
}else{
|
||||||
$item->admin_name='';
|
$item->admin_name='';
|
||||||
}
|
}
|
||||||
|
if($item->order_type==1){
|
||||||
|
$item->order_type_name='普通订单';
|
||||||
|
}elseif($item->order_type==2){
|
||||||
|
$item->order_type_name='商贩订单';
|
||||||
|
}elseif($item->order_type==3){
|
||||||
|
$item->order_type_name='一条龙订单';
|
||||||
|
}
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ class PurchaseProductOfferController extends BaseApiController
|
|||||||
*/
|
*/
|
||||||
public function lists()
|
public function lists()
|
||||||
{
|
{
|
||||||
|
$this->request->__set('uid',$this->userId);
|
||||||
return $this->dataLists(new PurchaseProductOfferLists());
|
return $this->dataLists(new PurchaseProductOfferLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ use app\api\lists\BaseApiDataLists;
|
|||||||
class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchInterface
|
class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $userId;
|
||||||
/**
|
/**
|
||||||
* @notes 设置搜索条件
|
* @notes 设置搜索条件
|
||||||
* @return \string[][]
|
* @return \string[][]
|
||||||
@ -44,6 +44,12 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
|
$uid=$this->request->__get('uid');
|
||||||
|
if($uid){
|
||||||
|
$this->searchWhere[]=['buyer_id','=',$uid];
|
||||||
|
}else{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return PurchaseProductOffer::where($this->searchWhere)
|
return PurchaseProductOffer::where($this->searchWhere)
|
||||||
->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', ])
|
->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', ])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
@ -81,7 +87,11 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI
|
|||||||
*/
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
|
if($this->userId){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
return PurchaseProductOffer::where($this->searchWhere)->count();
|
return PurchaseProductOffer::where($this->searchWhere)->count();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user