修改活动下创建订单价格为商品的市场价

This commit is contained in:
liu 2024-06-08 10:10:00 +08:00
parent 8299b9b428
commit da2f12b219

View File

@ -57,11 +57,15 @@ class OrderLogic extends BaseLogic
try {
self::$total = 0;
/** 计算价格 */
$check = DictType::where('type','activities')->find();
foreach ($cart_select as $k => $v) {
$find = StoreBranchProduct::where(['id' => $v['goods']])->field('store_name,image,unit,price')->find();
$find = StoreBranchProduct::where(['id' => $v['goods']])->field('store_name,image,unit,price,product_id')->find();
if (!$find) {
continue;
}
if(isset($check) && $check['status'] == 1){
$find['price'] = StoreProduct::where('product_id',$find['product_id'])->value('ot_price');
}
$cart_select[$k]['total'] = bcmul($v['cart_num'], $find['price'], 2);//钱
$cart_select[$k]['price'] = $find['price'];
$cart_select[$k]['product_id'] = $v['goods'];
@ -87,7 +91,6 @@ class OrderLogic extends BaseLogic
//TODO 收单打9.9折 会员按照比例打折 等级按照充值去升级
$pay_price = self::$total;
// $check = StoreOrder::where('uid',\request()->userId)->count();//首单逻辑
$check = DictType::where('type','activities')->find();
$vipPrice = 0;
if(isset($check) && $check['status'] == 1){
// $discountRate = '0.99';//首单逻辑