修改入库单列表、入库商品列表

This commit is contained in:
lewis 2025-02-18 16:15:14 +08:00
parent ca1570abb2
commit debfc5cb62
5 changed files with 47 additions and 69 deletions

View File

@ -105,25 +105,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
if ($item->store_staff_id) { if ($item->store_staff_id) {
$item->admin_name = SystemStoreStaff::where(['id' => $item->store_staff_id])->value('staff_name'); $item->admin_name = SystemStoreStaff::where(['id' => $item->store_staff_id])->value('staff_name');
} }
if ($item->order_type == 1) { $item->order_type_name = BeforehandOrder::getOrderTypeName($item->order_type);
$item->order_type_name = '铺货订单'; if ($item->order_type == 5) {
} elseif ($item->order_type == 2) {
$item->order_type_name = '商贩订单';
} elseif ($item->order_type == 3) {
$item->order_type_name = '一条龙订单';
} elseif ($item->order_type == 4) {
$item->order_type_name = '线上订单';
} elseif ($item->order_type == 5) {
$item->order_type_name = '仓库补货';
$item->outbound = '无须出库'; $item->outbound = '无须出库';
} elseif ($item->order_type == 6) {
$item->order_type_name = '往期补单-出库';
} elseif ($item->order_type == 7) {
$item->order_type_name = '采购订单';
} elseif ($item->order_type == 8) {
$item->order_type_name = '其他订单';
}elseif ($item->order_type == 9) {
$item->order_type_name = '往期补单-入库';
} }
$item->msg = ''; $item->msg = '';
$count1 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 0)->count('id'); $count1 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 0)->count('id');

View File

@ -4,6 +4,7 @@ namespace app\admin\lists\warehouse_order;
use app\admin\lists\BaseAdminDataLists; use app\admin\lists\BaseAdminDataLists;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\model\warehouse_order\WarehouseOrder; use app\common\model\warehouse_order\WarehouseOrder;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
use app\common\model\auth\Admin; use app\common\model\auth\Admin;
@ -49,7 +50,7 @@ class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInter
public function lists(): array public function lists(): array
{ {
return WarehouseOrder::where($this->searchWhere) return WarehouseOrder::where($this->searchWhere)
->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'code', 'financial_pm', 'admin_id', 'batch', 'mark', 'purchase', 'total_price', 'status', 'create_time', 'completed_amount', 'outstanding_amount', 'oid']) ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'code', 'financial_pm', 'admin_id', 'batch', 'mark', 'purchase', 'total_price', 'status', 'create_time', 'completed_amount', 'outstanding_amount', 'oid', 'order_type'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($item) { ->select()->each(function ($item) {
@ -80,6 +81,12 @@ class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInter
}else{ }else{
$item->supplier_name = ''; $item->supplier_name = '';
} }
if (!empty($item['order_type'])) {
$item->order_type_name = BeforehandOrder::getOrderTypeName($item->order_type);
} else {
$orderType = BeforehandOrder::where('id', $item['oid'])->value('order_type');
$item->order_type_name = BeforehandOrder::getOrderTypeName($orderType);
}
}) })
->toArray(); ->toArray();
} }

View File

@ -4,6 +4,8 @@ namespace app\admin\lists\warehouse_product;
use app\admin\lists\BaseAdminDataLists; use app\admin\lists\BaseAdminDataLists;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\model\warehouse_order\WarehouseOrder;
use app\common\model\warehouse_product\WarehouseProduct; use app\common\model\warehouse_product\WarehouseProduct;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
use app\common\model\auth\Admin; use app\common\model\auth\Admin;
@ -135,25 +137,17 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
$item->expiration_date = $item->expiration_date ? date('Y-m-d', $item->expiration_date) : ''; $item->expiration_date = $item->expiration_date ? date('Y-m-d', $item->expiration_date) : '';
$item->manufacture = $item->manufacture ? date('Y-m-d', $item->manufacture) : ''; $item->manufacture = $item->manufacture ? date('Y-m-d', $item->manufacture) : '';
if ($item->order_type == 1) { if (!empty($item['order_type'])) {
$item->order_type_name = '铺货订单'; $item->order_type_name = BeforehandOrder::getOrderTypeName($item->order_type);
} elseif ($item->order_type == 2) { } else {
$item->order_type_name = '商贩订单'; $beforehandOrderId = WarehouseOrder::where('id', $item['oid'])->value('oid');
} elseif ($item->order_type == 3) { if ($beforehandOrderId) {
$item->order_type_name = '一条龙订单'; $orderType = BeforehandOrder::where('id', $beforehandOrderId)->value('order_type');
} elseif ($item->order_type == 4) { $item->order_type_name = BeforehandOrder::getOrderTypeName($orderType);
$item->order_type_name = '线上订单'; }
} elseif ($item->order_type == 5) { }
$item->order_type_name = '仓库补货'; if ($item->order_type == 5) {
$item->outbound = '无须出库'; $item->outbound = '无须出库';
} elseif ($item->order_type == 6) {
$item->order_type_name = '往期补单-出库';
} elseif ($item->order_type == 7) {
$item->order_type_name = '采购订单';
} elseif ($item->order_type == 8) {
$item->order_type_name = '其他订单';
}elseif ($item->order_type == 9) {
$item->order_type_name = '往期补单-入库';
} }
}) })
->toArray(); ->toArray();

View File

@ -403,34 +403,18 @@ class PurchaseProductOfferLogic extends BaseLogic
]; ];
$productPriceRate = self::getProductPriceRate($product); $productPriceRate = self::getProductPriceRate($product);
if (!empty($productPriceRate)) { if (!empty($productPriceRate)) {
$purchase = 0; $data['purchase_lv'] = bcdiv($productPriceRate['supply_rate'], 100, 2);
foreach ($productPriceRate as $v) { $data['purchase'] = bcmul($params['purchase'], $data['purchase_lv'], 2);
if ($v['price_type'] == StoreProductPriceList::PriceTypeSupply) { $data['cost_lv'] = bcdiv($productPriceRate['merchant_rate'], 100, 2);
$data['purchase_lv'] = bcdiv($v['rate'], 100, 2); $data['cost'] = bcmul($data['purchase'], $data['cost_lv'], 2);
$data['purchase'] = bcmul($params['purchase'], $data['purchase_lv'], 2); $data['vip_lv'] = bcdiv($productPriceRate['vip_rate'], 100, 2);
$purchase = $data['purchase']; $data['vip_price'] = bcmul($data['purchase'], $data['vip_lv'], 2);
break; $data['price_lv'] = bcdiv($productPriceRate['price_rate'], 100, 2);
} $data['price'] = bcmul($data['purchase'], $data['price_lv'], 2);
} $lastNum = substr($data['price'], -1);
if (!empty($purchase)) { if ($lastNum > 0) {
foreach ($productPriceRate as $v) { $data['price'] = ceil($data['price'] * 10);
if (empty($v['rate']) || $purchase <= 0) { $data['price'] = bcdiv($data['price'], 10, 2);
continue;
}
if ($v['price_type'] == StoreProductPriceList::PriceTypeBusiness) {
//商户价
$data['cost_lv'] = bcdiv($v['rate'], 100, 2);
$data['cost'] = bcmul($purchase, $data['cost_lv'], 2);
} elseif ($v['price_type'] == StoreProductPriceList::PriceTypeRetail) {
//零售价
$data['price_lv'] = bcdiv($v['rate'], 100, 2);
$data['price'] = bcmul($purchase, $data['price_lv'], 2);
} elseif ($v['price_type'] == StoreProductPriceList::PriceTypeVip) {
//会员价
$data['vip_lv'] = bcdiv($v['rate'], 100, 2);
$data['vip_price'] = bcmul($purchase, $data['vip_lv'], 2);
}
}
} }
} }
$data['price_config'] = $priceConfig; $data['price_config'] = $priceConfig;
@ -444,7 +428,16 @@ class PurchaseProductOfferLogic extends BaseLogic
public static function getProductPriceRate($product) public static function getProductPriceRate($product)
{ {
return StoreProductPriceList::where('product_id', $product['id'])->select()->toArray(); $list = StoreProductPriceList::where('product_id', $product['id'])->findOrEmpty()->toArray();
if (empty($list)) {
$list = [
'supply_rate' => 110,
'merchant_rate' => 106,
'vip_rate' => 110,
'price_rate' => 120,
];
}
return $list;
} }
/** /**

View File

@ -25,14 +25,14 @@ class BeforehandOrder extends BaseModel
{ {
$typeMap = [ $typeMap = [
1 => '铺货订单', 1 => '铺货订单',
2 => '贩订单', 2 => '贩订单',
3 => '一条龙订单', 3 => '一条龙订单',
4 => '线上订单', 4 => '线上订单',
5 => '仓库补货', 5 => '仓库补货',
6 => '往期补单', 6 => '往期补单-出库',
7 => '采购订单', 7 => '采购订单',
8 => '其他订单', 8 => '其他订单',
9 => '往期补单', 9 => '往期补单-入库',
]; ];
return $typeMap[$type] ?? ''; return $typeMap[$type] ?? '';
} }