This commit is contained in:
mkm 2024-12-26 18:05:27 +08:00
commit b1b3396c0b
6 changed files with 36 additions and 21 deletions

View File

@ -112,6 +112,8 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
$item->order_type_name = '往期补单';
} elseif ($item->order_type == 7) {
$item->order_type_name = '采购订单';
} elseif ($item->order_type == 8) {
$item->order_type_name = '其他订单';
}
$item->msg = '';
$count1 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 0)->count('id');

View File

@ -71,8 +71,13 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc
->select()->each(function($item) use($job_ids){
$item->order_sn=BeforehandOrder::where('id',$item['order_id'])->value('order_id');
$find=StoreProduct::where('id',$item->product_id)->withTrashed()->find();
$item->store_info = empty($item['store_info']) ? ($find['store_info'] ?? '') : $item['store_info'];
$item->after_sales = empty($item['after_sales']) ? ($find['after_sales'] ?? '') : $item['after_sales'];
$item->marques = empty($item['marques']) ? ($find['marques'] ?? '') : $item['marques'];
$item->package = empty($item['package']) ? ($find['package'] ?? '') : $item['package'];
$item->expiration_date = $item->expiration_date ? date('Y-m-d', $item->expiration_date) : '';
$item->manufacture = $item->manufacture ? date('Y-m-d', $item->manufacture) : '';
$item->store_name=$find->store_name;
$item->store_info=$find->store_info;
$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');

View File

@ -235,6 +235,8 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
$data['purchase'] = $v['price'];
$data['total_price'] = $v['total_price'];
$data['financial_pm'] = 1;
$data['manufacture'] = $v['manufacture'] > 0 ? date('Y-m-d H:i:s', $v['manufacture']) : '';
$data['expiration_date'] = $v['expiration_date'] > 0 ? date('Y-m-d H:i:s', $v['expiration_date']) : '';
$product_arr=[];
if($v['package']!=''){
$product_arr['package']=$v['package'];

View File

@ -62,9 +62,6 @@ class PurchaseProductOfferLogic extends BaseLogic
}
$find=StoreProduct::where('id',$params['product_id'])->find();
$purchaseProductOffer = PurchaseProductOffer::where(['order_id' => $procurementOrder['id'], 'product_id' => $params['product_id']])->find();
$procurementOrder->total_price = bcadd($procurementOrder->total_price, bcmul($find['price'], $params['need_num'], 2), 2);
$procurementOrder->pay_price = $procurementOrder->total_price;
$procurementOrder->save();
if ($purchaseProductOffer) {
$purchaseProductOffer->need_num = $purchaseProductOffer['need_num'] + $params['need_num'];
if (!empty($purchaseProductOffer['source_order_info'])) {
@ -159,6 +156,8 @@ class PurchaseProductOfferLogic extends BaseLogic
*/
public static function setProcureInfo(array $params): bool
{
$params['manufacture'] = !empty($params['manufacture']) ? strtotime($params['manufacture']) : '';
$params['expiration_date'] = !empty($params['expiration_date']) ? strtotime($params['expiration_date']) : '';
$offer = PurchaseProductOffer::where(['id' => $params['id']])->find();
// $uid=Admin::where('id',$params['admin_id'])->value('uid');
// if($params['admin_id']!=1){
@ -180,10 +179,16 @@ class PurchaseProductOfferLogic extends BaseLogic
'store_info' => $params['store_info'],
'marques' => $params['marques'],
'after_sales' => $params['after_sales'],
'manufacture' => $params['manufacture'],
'expiration_date' => $params['expiration_date'],
]);
// $find = StoreProductPrice::where(['offer_id' => $params['id']])->find();
$product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('id,store_name,top_cate_id,two_cate_id')->find();
$unit_name=StoreProductUnit::where('id', $offer['unit'])->value('name');
$order = BeforehandOrder::where('id', $params['bhoid'])->find();
$order->pay_price = bcadd($offer['total_price'], $order->pay_price, 2);
$order->total_price = $order->pay_price;
$order->save();
self::setProductGroupPrice($params, $product);
// $data = [];
// $dict_data = DictData::where('type_value', 'price_lv_' . $product['top_cate_id'])->field('name,value')->select();

View File

@ -73,6 +73,7 @@ class StoreProductLogic extends BaseLogic
'store_batch' => $params['store_batch'] ?? 1,
'product_type' => $params['product_type'] ?? 0,
'is_show' => $params['is_show'] ?? 0,
'made_place' => $params['made_place'] ?? '',
];
$rose = 0;
//零售-供货
@ -222,6 +223,7 @@ class StoreProductLogic extends BaseLogic
'manufacturer_information' => $params['manufacturer_information'] ?? '',
'swap' => $params['swap'] ?? 0,
'is_show' => $params['is_show'] ?? 0,
'made_place' => $params['made_place'] ?? '',
];
$rose = 0;
//零售-供货

View File

@ -193,7 +193,6 @@ class WarehouseProductLogic extends BaseLogic
*/
public static function edit(array $params)
{
Db::startTrans();
try {
$before_nums = 0;
@ -221,24 +220,24 @@ class WarehouseProductLogic extends BaseLogic
$before_nums = $warehouseProductStorege['nums'];
$after_nums = bcsub($warehouseProductStorege['nums'], $params['nums'], 2);
}
$datas = [
'nums' => $params['nums'],
'before_nums' => $before_nums,
'after_nums' => $after_nums,
'total_price' => $params['total_price'],
];
if($find['financial_pm']==1){
$datas=[
'nums' => $params['nums'],
'supplier_id' => $params['supplier_id'],
'pay_type' => $params['pay_type'],
'purchase' => $params['purchase'],
'before_nums' => $before_nums,
'after_nums' => $after_nums,
'total_price' => $params['total_price'],
];
$datas['supplier_id'] = $params['supplier_id'];
$datas['pay_type'] = $params['pay_type'];
$datas['purchase'] = $params['purchase'];
}else{
$datas=[
'nums' => $params['nums'],
'price' => $params['price'],
'before_nums' => $before_nums,
'after_nums' => $after_nums,
'total_price' => $params['total_price'],
];
$datas['price'] = $params['price'];
}
if (isset($params['manufacture']) && $params['manufacture'] != '') {
$datas['manufacture'] = strtotime($params['manufacture']);
}
if (isset($params['expiration_date']) && $params['expiration_date'] != '') {
$datas['expiration_date'] = strtotime($params['expiration_date']);
}
WarehouseProduct::where('id', $params['id'])->update($datas);
$finds = WarehouseProduct::where('oid', $params['oid'])->field('sum(nums) as nums,sum(total_price) as total_price')->find();