调整砍价bug
parent
0d3e62305d
commit
d77c7394bc
|
|
@ -130,7 +130,7 @@ class BargainActivityController extends AdminController
|
|||
$form->block(6, function (Form\BlockForm $form) {
|
||||
$form->text('name')->required();
|
||||
$form->switch('is_enable');
|
||||
$form->dateRange('start_at', 'end_at', '活动时间')->required();
|
||||
$form->datetimeRange('start_at', 'end_at', '活动时间')->required();
|
||||
$form->multipleSelectTable('skus')
|
||||
->from(ProductSkuSimpleTable::make())
|
||||
->model(ProductSku::class, 'id', 'name')
|
||||
|
|
|
|||
|
|
@ -281,6 +281,9 @@ class OrderController extends AdminController
|
|||
$show->field('reduced_amount')->as(function ($v) {
|
||||
return bcdiv($v, 100, 2);
|
||||
})->prepend('- ¥');
|
||||
$show->field('bargain_amount')->as(function ($v) {
|
||||
return bcdiv($v, 100, 2);
|
||||
})->prepend('- ¥');
|
||||
$show->field('total_amount')->as(function ($v) {
|
||||
return bcdiv($v, 100, 2);
|
||||
})->prepend('¥');
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ class BargainController extends Controller
|
|||
'user_id'=> $request->user()->id,
|
||||
])->where('status', '>', 0)
|
||||
->where('expire_at', '>', now())
|
||||
->whereNull('order_id')
|
||||
->orderBy('created_at', 'desc')->first();
|
||||
|
||||
if (!$order) {
|
||||
|
|
@ -207,7 +208,7 @@ class BargainController extends Controller
|
|||
}
|
||||
|
||||
//砍价超时
|
||||
if ($bargainOrder->expire_at > now()) {
|
||||
if ($bargainOrder->expire_at < now()) {
|
||||
throw new BizException('当前砍价已结束,无法下单');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class OrderResource extends JsonResource
|
|||
'coupon_discount_amount' => $this->coupon_discount_amount_format,
|
||||
'vip_discount_amount' => $this->vip_discount_amount_format,
|
||||
'reduced_amount' => $this->reduced_amount_format,
|
||||
'bargain_amount' => $this->bargain_amount_format,
|
||||
'shipping_fee' => $this->shipping_fee_format,
|
||||
'products_total_amount' => $this->products_total_amount_format,
|
||||
'total_amount' => $this->total_amount_format,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use Illuminate\Support\Arr;
|
|||
class BargainService
|
||||
{
|
||||
/**
|
||||
* 创建砍价单-todo
|
||||
* 创建砍价单
|
||||
*
|
||||
* @param User $user
|
||||
* @param ProductSku $productSku
|
||||
|
|
@ -68,7 +68,7 @@ class BargainService
|
|||
}
|
||||
|
||||
//砍价超时
|
||||
if ($order->expire_at > now()) {
|
||||
if ($order->expire_at < now()) {
|
||||
throw new BizException('当前砍价已结束,无法再砍');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class OrderService
|
|||
?UserCoupon $coupon = null,
|
||||
?BargainOrder $bargainOrder = null,
|
||||
): Order {
|
||||
// 订单支付金额=商品总额-券折扣金额-会员折扣金额+邮费
|
||||
// 订单支付金额=商品总额-券折扣金额-会员折扣金额+邮费-砍价金额
|
||||
$totalAmount = $productsTotalAmount - $couponDiscountAmount - $vipDiscountAmount;
|
||||
|
||||
//如果有砍价优惠
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ return [
|
|||
'coupon_discount_amount' => '优惠券金额',
|
||||
'vip_discount_amount' => '会员优惠',
|
||||
'reduced_amount' => '减免金额',
|
||||
'bargain_amount' => '砍价金额',
|
||||
'shipping_fee' => '运费',
|
||||
'products_total_amount' => '商品总额',
|
||||
'total_amount' => '订单总额',
|
||||
|
|
|
|||
Loading…
Reference in New Issue