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

Reviewed-on: #395
This commit is contained in:
mkm 2024-12-18 12:22:23 +08:00
commit c949a84cfa
2 changed files with 55 additions and 56 deletions

View File

@ -307,12 +307,6 @@ class PurchaseProductOfferLogic extends BaseLogic
public static function setProductGroupPrice($params, $product)
{
$productCatePriceRate = StoreCategory::where('id', $product['top_cate_id'])->value('price_rate');
if (empty($productCatePriceRate)) {
return;
}
$storeProductGroupPrice = StoreProductGroupPrice::where('product_id', $product['id'])->select()->toArray();
$storeProductGroupPrice = reset_index($storeProductGroupPrice, 'group_id');
$priceConfig = [];
$data = [
'bhoid' => $params['bhoid'],
@ -323,6 +317,10 @@ class PurchaseProductOfferLogic extends BaseLogic
'update_time' => time(),
'status' => 0,
];
$productCatePriceRate = StoreCategory::where('id', $product['top_cate_id'])->value('price_rate');
if (!empty($productCatePriceRate)) {
$storeProductGroupPrice = StoreProductGroupPrice::where('product_id', $product['id'])->select()->toArray();
$storeProductGroupPrice = reset_index($storeProductGroupPrice, 'group_id');
foreach ($productCatePriceRate as $k => $v) {
if ($v['id'] == 4) {
$data['cost_lv'] = bcdiv($v['rate'], 100, 2);
@ -363,6 +361,7 @@ class PurchaseProductOfferLogic extends BaseLogic
}
$priceConfig[] = $item;
}
}
$data['price_config'] = $priceConfig;
$find = StoreProductPrice::where(['offer_id' => $params['id']])->find();
if ($find) {

View File

@ -106,13 +106,13 @@ class StoreOrderCartInfoLogic extends BaseLogic
if($find['is_pay']==1){
throw new BusinessException('已支付订单无法编辑');
}
$value=DictData::where('type_value','vendors_store')->column('value');
if(!$value){
throw new BusinessException('请先配置店铺');
}
if(!in_array($find['store_id'],$value)){
throw new BusinessException('该订单不属于可设置店铺');
}
// $value=DictData::where('type_value','vendors_store')->column('value');
// if(!$value){
// throw new BusinessException('请先配置店铺');
// }
// if(!in_array($find['store_id'],$value)){
// throw new BusinessException('该订单不属于可设置店铺');
// }
$find->cart_num = $params['cart_num'];
$find->total_price = bcmul($params['cart_num'], $find->price, 2);
$find->save();
@ -144,13 +144,13 @@ class StoreOrderCartInfoLogic extends BaseLogic
if($find['is_pay']==1){
throw new BusinessException('已支付订单无法删除');
}
$value=DictData::where('type_value','vendors_store')->column('value');
if(!$value){
throw new BusinessException('请先配置店铺');
}
if(!in_array($find['store_id'],$value)){
throw new BusinessException('该订单不属于可设置店铺');
}
// $value=DictData::where('type_value','vendors_store')->column('value');
// if(!$value){
// throw new BusinessException('请先配置店铺');
// }
// if(!in_array($find['store_id'],$value)){
// throw new BusinessException('该订单不属于可设置店铺');
// }
$find->delete_time=time();
$find->save();
$total_price = StoreOrderCartInfo::where('oid', $find['oid'])->sum('total_price');