diff --git a/app/admin/lists/warehouse_product/WarehouseProductLists.php b/app/admin/lists/warehouse_product/WarehouseProductLists.php index ec0fe5d90..20c42fcbd 100644 --- a/app/admin/lists/warehouse_product/WarehouseProductLists.php +++ b/app/admin/lists/warehouse_product/WarehouseProductLists.php @@ -35,7 +35,7 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt public function setSearch(): array { return [ - '=' => ['warehouse_id', 'financial_pm', 'store_id','oid','supplier_id','is_pay','code'], + '=' => ['warehouse_id', 'financial_pm', 'product_id','store_id','oid','supplier_id','is_pay','code'], 'between_time' => 'create_time' ]; } @@ -52,9 +52,9 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt */ public function lists(): array { - if ($this->request->get('product_id')) { - $product_id = $this->request->get('product_id'); - $ids = StoreProduct::where('store_name', 'like', '%' . $product_id . '%')->withTrashed()->column('id'); + if ($this->request->get('product_name')) { + $product_name = $this->request->get('product_name'); + $ids = StoreProduct::where('store_name', 'like', '%' . $product_name . '%')->withTrashed()->column('id'); if ($ids) { $this->searchWhere[] = ['product_id', 'in', $ids]; $this->ids = $ids; diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 63bdb3a90..a92fd5264 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -263,7 +263,7 @@ class BeforehandOrderLogic extends BaseLogic 'cart_id' => '', 'store_id' => $params['store_id'] ?? 0, 'shipping_type' => 2, //配送方式 1=快递 ,2=门店自提 - 'deduction_price' => 0, //抵扣金额 + 'deduction_price' => $params['deduction_price'] ?? 0, //抵扣金额 'source' => OrderEnum::SOURCE_20, //来源 'order_type' => $order['order_type'], 'is_storage' => 0, @@ -272,9 +272,15 @@ class BeforehandOrderLogic extends BaseLogic if ($_order['pay_price'] == 0) { throw new BusinessException('支付金额不能为0'); } + if ($_order['deduction_price'] > 0) { + $_order['pay_price'] = bcsub($_order['pay_price'], $_order['deduction_price'], 2); + if ($_order['pay_price'] < 0.01) { + throw new BusinessException('支付金额不能小于0.01元'); + } + } $_order['uid'] = $uid; $_order['spread_uid'] = 0; - $_order['mark'] = ''; + $_order['mark'] = $params['mark'] ?? ''; $_order['real_name'] = $user['real_name']; $_order['user_phone'] = $user['mobile']; $_order['pay_type'] = $params['pay_type']; @@ -613,8 +619,8 @@ class BeforehandOrderLogic extends BaseLogic 'paid' => 0, 'audit_status' => 1, 'mark' => $params['mark'] ?? '', - 'other_data' => json_encode($other_data, true) - + 'other_data' => json_encode($other_data, true), + 'is_arrears' => 2 ]); foreach ($datas as $k => $v) { $datas[$k]['bhoid'] = $order['id']; diff --git a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php index ca9e9a33a..a0f790afb 100644 --- a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php +++ b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php @@ -515,7 +515,7 @@ class PurchaseProductOfferLogic extends BaseLogic 'unit' => $product['unit'], 'cart_num' => $product['nums'], 'accept_num' => $product['nums'], - 'mark' => $product['mark'], + 'mark' => $product['mark'] ?? '', 'is_buyer' => 1, 'procurement_order_id' => $procurementOrder['id'], 'total_price' => bcmul($product['price'], $product['nums'], 2), @@ -533,7 +533,7 @@ class PurchaseProductOfferLogic extends BaseLogic 'unit' => $product['unit'], 'is_buyer' => 1, 'need_num' => $product['nums'], - 'mark' => $product['mark'], + 'mark' => $product['mark'] ?? '', 'buyer_id' => $params['buyer_id'], 'status' => 0, 'source_order_info' => [ @@ -541,7 +541,7 @@ class PurchaseProductOfferLogic extends BaseLogic 'source_order_id' => $procurementOrder['id'], 'product_id' => $product['product_id'], 'need_num' => $product['nums'], - 'mark' => $product['mark'], + 'mark' => $product['mark'] ?? '', ] ] ]; diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php index 56988889e..76ba8499e 100644 --- a/app/admin/logic/warehouse_product/WarehouseProductLogic.php +++ b/app/admin/logic/warehouse_product/WarehouseProductLogic.php @@ -129,7 +129,7 @@ class WarehouseProductLogic extends BaseLogic if ($params['order_type'] != 6) { $storege = WarehouseProductStorege::where('warehouse_id', $params['warehouse_id'])->where('product_id', $params['product_id'])->find(); if ($storege) { - if (in_array($params['order_type'], [1, 4])) { + if (($params['store_id'] == 3 && in_array($params['order_type'], [1, 2, 3, 4, 8])) || in_array($params['order_type'], [1, 4])) { SystemStoreStorage::create([ 'store_id' => $params['store_id'], 'admin_id' => $params['admin_id'], diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 8735ba11e..89be6ee27 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -290,6 +290,13 @@ class OrderLogic extends BaseLogic $_order['verify_code'] = $verify_code; $_order['reservation_time'] = null; $_order['reservation'] = 0; + if (isset($params['deduction_price']) && $params['deduction_price'] > 0) { + $_order['deduction_price'] = $params['deduction_price']; + $_order['pay_price'] = bcsub($_order['pay_price'], $_order['deduction_price'], 2); + if ($_order['pay_price'] < 0.01) { + throw new BusinessException('支付金额不能小于0.01元'); + } + } if ($uid > 0) { $address = UserAddress::where(['uid' => $uid])->find(); diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index e560ac23f..58069b0ed 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -630,7 +630,7 @@ class PayNotifyLogic extends BaseLogic continue; } } - if ($order['source'] != OrderEnum::SOURCE_20) { + if ($order['source'] != OrderEnum::SOURCE_20 || $order['store_id'] == 3) { if ($branchProduct) { $stock = bcsub($branchProduct['stock'], $v['cart_num'], 2); StoreBranchProduct::update([