新增商品单位名称和导出功能,优化采购报价单列表
- 在预订单购物详情表中添加商品单位名称字段 - 实现预订单商品列表的导出功能 - 在采购报价单列表中添加顶级分类名称字段
This commit is contained in:
parent
465e882319
commit
bb0bc0c29a
@ -9,13 +9,15 @@ use app\common\lists\ListsSearchInterface;
|
|||||||
use app\common\model\purchase_product_offer\PurchaseProductOffer;
|
use app\common\model\purchase_product_offer\PurchaseProductOffer;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
||||||
|
use app\common\lists\ListsExcelInterface;
|
||||||
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预订单购物详情表列表
|
* 预订单购物详情表列表
|
||||||
* Class BeforehandOrderCartInfoLists
|
* Class BeforehandOrderCartInfoLists
|
||||||
* @package app\admin\listsbeforehand_order_cart_info
|
* @package app\admin\listsbeforehand_order_cart_info
|
||||||
*/
|
*/
|
||||||
class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchInterface
|
class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +52,7 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
|
|||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function($item){
|
||||||
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image,unit')->withTrashed()->find();
|
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image,unit')->withTrashed()->find();
|
||||||
|
$item->unit_name=StoreProductUnit::where('id',$find->unit)->value('name');
|
||||||
$item['warehouse_stock']=WarehouseProductStorege::where('product_id',$item['product_id'])->value('nums')??0;
|
$item['warehouse_stock']=WarehouseProductStorege::where('product_id',$item['product_id'])->value('nums')??0;
|
||||||
$item['store_name']=$find['store_name'];
|
$item['store_name']=$find['store_name'];
|
||||||
$item['image']=$find['image'];
|
$item['image']=$find['image'];
|
||||||
@ -79,4 +82,34 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
|
|||||||
return BeforehandOrderCartInfo::where($this->searchWhere)->count();
|
return BeforehandOrderCartInfo::where($this->searchWhere)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 导出文件名
|
||||||
|
* @return string
|
||||||
|
* @author 乔峰
|
||||||
|
* @date 2022/11/24 16:17
|
||||||
|
*/
|
||||||
|
public function setFileName(): string
|
||||||
|
{
|
||||||
|
return '预订单商品列表';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 导出字段
|
||||||
|
* @return string[]
|
||||||
|
* @author 乔峰
|
||||||
|
* @date 2022/11/24 16:17
|
||||||
|
*/
|
||||||
|
public function setExcelFields(): array
|
||||||
|
{
|
||||||
|
$data=[
|
||||||
|
'store_name' => '商品名称',
|
||||||
|
'warehouse_stock' => '仓库数量',
|
||||||
|
'cart_num' => '需求数量',
|
||||||
|
'unit_name' => '单位',
|
||||||
|
'price' => '单价',
|
||||||
|
'total_price' => '总价',
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
@ -58,6 +58,7 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc
|
|||||||
$item->image=$find->image;
|
$item->image=$find->image;
|
||||||
$item->unit_name=StoreProductUnit::where('id',$item->unit)->value('name');
|
$item->unit_name=StoreProductUnit::where('id',$item->unit)->value('name');
|
||||||
$item->cate_name=StoreCategory::where('id',$find->cate_id)->value('name');
|
$item->cate_name=StoreCategory::where('id',$find->cate_id)->value('name');
|
||||||
|
$item->top_cate_name=StoreCategory::where('id',$find->top_cate_id)->value('name');
|
||||||
if($item->is_buyer==1){
|
if($item->is_buyer==1){
|
||||||
$item->is_buyer_name='需要采购';
|
$item->is_buyer_name='需要采购';
|
||||||
}elseif($item->is_buyer==-1){
|
}elseif($item->is_buyer==-1){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user