Merge pull request 'dev' (#265) from dev into main
Reviewed-on: https://gitea.lihaink.cn/mkm/multi-store/pulls/265
This commit is contained in:
commit
f51add9a99
@ -9,13 +9,15 @@ use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\purchase_product_offer\PurchaseProductOffer;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\store_product_unit\StoreProductUnit;
|
||||
|
||||
/**
|
||||
* 预订单购物详情表列表
|
||||
* Class BeforehandOrderCartInfoLists
|
||||
* @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'])
|
||||
->select()->each(function($item){
|
||||
$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['store_name']=$find['store_name'];
|
||||
$item['image']=$find['image'];
|
||||
@ -79,4 +82,34 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
|
||||
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->unit_name=StoreProductUnit::where('id',$item->unit)->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){
|
||||
$item->is_buyer_name='需要采购';
|
||||
}elseif($item->is_buyer==-1){
|
||||
|
@ -131,6 +131,9 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
throw new BusinessException('请勿重复入库');
|
||||
}
|
||||
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();
|
||||
$total_price= PurchaseProductOffer::where(['order_id' => $params['bhoid']])->sum('total_price');
|
||||
$completed_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>1])->sum('total_price');
|
||||
$outstanding_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>2])->sum('total_price');
|
||||
Db::startTrans();
|
||||
try {
|
||||
$code = getNewOrderId('RK');
|
||||
@ -142,9 +145,9 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
'batch' => 0,
|
||||
'code' => $code,
|
||||
'mark' => $params['remark'] ?? '',
|
||||
'total_price' => $params['total_price'],
|
||||
'completed_amount' => $params['completed_amount'] ?? 0,
|
||||
'outstanding_amount' => $params['outstanding_amount'] ?? 0,
|
||||
'total_price' => $total_price,
|
||||
'completed_amount' => $completed_amount,
|
||||
'outstanding_amount' => $outstanding_amount,
|
||||
];
|
||||
$res = WarehouseOrder::create($arr);
|
||||
foreach ($offer_list as $k => $v) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user