1. 打开app/common/repositories/store/order/StoreOrderCreateRepository.php文件找到705行
2. 替换截图区域内容为下方代码
if (isset($platformCouponRate)) {
$_coupon_price = $platformCouponRate['coupon_price'];
foreach ($merchantCartList as &$merchantCart) {
$_ids = array_column($merchantCart['list'], 'cart_id');
usort($merchantCart['list'], function ($a, $b) {
return $a['true_price'] > $b['true_price'] ? 1 : -1;
});
$_price = 0;
foreach ($merchantCart['list'] as &$cart) {
if ($cart['true_price'] <= 0 || !$platformCouponRate['check']($cart)) continue;
if ($platformCouponRate['use_count'] === 1) {
$couponPrice = min($platformCouponRate['coupon_price'], $cart['true_price']);
} else {
$couponPrice = min(max(0.01, bcmul($_coupon_price, bcdiv($cart['true_price'], $platformCouponRate['price'], 6), 2)), $cart['true_price']);
}
$platformCouponRate['coupon_price'] = bcsub($platformCouponRate['coupon_price'], $couponPrice, 2);
$cart['true_price'] = bcsub($cart['true_price'], $couponPrice, 2);
$cart['platform_coupon_price'] = $couponPrice;
$platformCouponRate['use_count']--;
$_price = bcadd($couponPrice, $_price, 2);
}
unset($cart);
$merchantCart['order']['platform_coupon_price'] = $_price;
$merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'], $_price, 2);
$total_platform_coupon_price = bcadd($total_platform_coupon_price, $_price, 2);
usort($merchantCart['list'], function ($a, $b) use ($_ids) {
return array_search($a['cart_id'], $_ids) > array_search($b['cart_id'], $_ids) ? 1 : -1;
});
}
$usePlatformCouponId = $platformCouponRate['id'];
unset($merchantCart);
}
3. 重启swoole服务
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}