Merge pull request 'dev' (#507) from dev into main

Reviewed-on: #507
This commit is contained in:
mkm 2025-02-08 16:36:57 +08:00
commit c6548ffb4f
6 changed files with 26 additions and 13 deletions

View File

@ -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;

View File

@ -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'];

View File

@ -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'] ?? '',
]
]
];

View File

@ -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'],

View File

@ -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();

View File

@ -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([