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

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) {
$item->admin_name = SystemStoreStaff::where(['id' => $item->store_staff_id])->value('staff_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 = '一条龙订单';
} elseif ($item->order_type == 4) {
$item->order_type_name = '线上订单';
} elseif ($item->order_type == 5) {
$item->order_type_name = '仓库补货';
$item->order_type_name = BeforehandOrder::getOrderTypeName($item->order_type);
if ($item->order_type == 5) {
$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 = '';
$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\common\model\beforehand_order\BeforehandOrder;
use app\common\model\warehouse_order\WarehouseOrder;
use app\common\lists\ListsSearchInterface;
use app\common\model\auth\Admin;
@ -49,7 +50,7 @@ class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInter
public function lists(): array
{
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)
->order(['id' => 'desc'])
->select()->each(function ($item) {
@ -80,6 +81,12 @@ class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInter
}else{
$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();
}

View File

@ -4,6 +4,8 @@ namespace app\admin\lists\warehouse_product;
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\lists\ListsSearchInterface;
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->manufacture = $item->manufacture ? date('Y-m-d', $item->manufacture) : '';
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 = '一条龙订单';
} elseif ($item->order_type == 4) {
$item->order_type_name = '线上订单';
} elseif ($item->order_type == 5) {
$item->order_type_name = '仓库补货';
if (!empty($item['order_type'])) {
$item->order_type_name = BeforehandOrder::getOrderTypeName($item->order_type);
} else {
$beforehandOrderId = WarehouseOrder::where('id', $item['oid'])->value('oid');
if ($beforehandOrderId) {
$orderType = BeforehandOrder::where('id', $beforehandOrderId)->value('order_type');
$item->order_type_name = BeforehandOrder::getOrderTypeName($orderType);
}
}
if ($item->order_type == 5) {
$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();

View File

@ -403,34 +403,18 @@ class PurchaseProductOfferLogic extends BaseLogic
];
$productPriceRate = self::getProductPriceRate($product);
if (!empty($productPriceRate)) {
$purchase = 0;
foreach ($productPriceRate as $v) {
if ($v['price_type'] == StoreProductPriceList::PriceTypeSupply) {
$data['purchase_lv'] = bcdiv($v['rate'], 100, 2);
$data['purchase'] = bcmul($params['purchase'], $data['purchase_lv'], 2);
$purchase = $data['purchase'];
break;
}
}
if (!empty($purchase)) {
foreach ($productPriceRate as $v) {
if (empty($v['rate']) || $purchase <= 0) {
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['purchase_lv'] = bcdiv($productPriceRate['supply_rate'], 100, 2);
$data['purchase'] = bcmul($params['purchase'], $data['purchase_lv'], 2);
$data['cost_lv'] = bcdiv($productPriceRate['merchant_rate'], 100, 2);
$data['cost'] = bcmul($data['purchase'], $data['cost_lv'], 2);
$data['vip_lv'] = bcdiv($productPriceRate['vip_rate'], 100, 2);
$data['vip_price'] = bcmul($data['purchase'], $data['vip_lv'], 2);
$data['price_lv'] = bcdiv($productPriceRate['price_rate'], 100, 2);
$data['price'] = bcmul($data['purchase'], $data['price_lv'], 2);
$lastNum = substr($data['price'], -1);
if ($lastNum > 0) {
$data['price'] = ceil($data['price'] * 10);
$data['price'] = bcdiv($data['price'], 10, 2);
}
}
$data['price_config'] = $priceConfig;
@ -444,7 +428,16 @@ class PurchaseProductOfferLogic extends BaseLogic
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 = [
1 => '铺货订单',
2 => '贩订单',
2 => '贩订单',
3 => '一条龙订单',
4 => '线上订单',
5 => '仓库补货',
6 => '往期补单',
6 => '往期补单-出库',
7 => '采购订单',
8 => '其他订单',
9 => '往期补单',
9 => '往期补单-入库',
];
return $typeMap[$type] ?? '';
}