优化:客服端 - 商品详情页面显示当前商品的最小起订量、并且如果购买数量低于最小起购量时禁止下单和添加购物车
This commit is contained in:
parent
b679d66adb
commit
2e36e35e17
|
|
@ -54,6 +54,7 @@ class ProductDetail extends JsonResource
|
|||
'in_wishlist' => $this->inCurrentWishlist->id ?? 0,
|
||||
'active' => (bool) $this->active,
|
||||
'price_setting' => $this->price_setting ?? '',
|
||||
'minimum_order' => $this->minimum_order ?? 0,
|
||||
'numPrices' => NumPricesDetail::collection($this->numprices)->jsonSerialize() ?? '',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,5 +28,6 @@ return [
|
|||
'active' => 'Active',
|
||||
'inactive' => 'Inactive',
|
||||
'has_been_inactive' => 'The product has been inactive',
|
||||
'minimum_order' => 'Min Order'
|
||||
'minimum_order' => 'Min Order',
|
||||
'minimum_order_error' => 'The purchase quantity must be greater than or equal to :num'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -29,5 +29,6 @@ return [
|
|||
'active' => '上架',
|
||||
'inactive' => '下架',
|
||||
'has_been_inactive' => '该商品已下架',
|
||||
'minimum_order' => '起订量'
|
||||
'minimum_order' => '起订量',
|
||||
'minimum_order_error' => '采购数量必须大于等于:num'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -221,12 +221,18 @@
|
|||
@endif
|
||||
|
||||
@hookwrapper('product.detail.sku')
|
||||
<div class="d-flex"><span class="title text-muted">SKU:</span>@{{ product.sku }}</div>
|
||||
<div class="d-flex" v-if="product.sku">
|
||||
<span class="title text-muted">SKU:</span>@{{ product.sku }}
|
||||
</div>
|
||||
@endhookwrapper
|
||||
|
||||
@hookwrapper('product.detail.model')
|
||||
<div class="d-flex" v-if="product.model"><span class="title text-muted">{{ __('shop/products.model') }}:</span> @{{ product.model }}</div>
|
||||
@endhookwrapper
|
||||
|
||||
<div v-if="minimum_order > 0" class="d-flex" >
|
||||
<span class="title text-muted">{{__('product.minimum_order')}}:</span> @{{ minimum_order }}
|
||||
</div>
|
||||
</div>
|
||||
@if (0)
|
||||
<div class="rating-wrap d-flex">
|
||||
|
|
@ -589,6 +595,7 @@
|
|||
product_id: "{{$product_id}}",
|
||||
price_setting: @json($product['price_setting'] ?? 'sku'),
|
||||
numPrices: @json($product['numPrices'] ?? []),
|
||||
minimum_order: @json($product['minimum_order'] ?? 0),
|
||||
centerDialogVisable: false, // 设置显示框的状态
|
||||
registerForm: { // 添加的信息
|
||||
contacts: '',
|
||||
|
|
@ -833,6 +840,11 @@
|
|||
layer.msg('{{ __('shop/products.quantity_error') }}');
|
||||
return;
|
||||
}
|
||||
// 判断:当前商品购买数量是否大于等于最小起订量
|
||||
if(_this.minimum_order > total){
|
||||
layer.msg('{{ __('product.minimum_order_error',['num'=>$product['minimum_order']]) }}');
|
||||
return;
|
||||
}
|
||||
// 请求参数
|
||||
params = {
|
||||
isBuyNow,
|
||||
|
|
@ -845,6 +857,11 @@
|
|||
layer.msg('{{ __('shop/products.quantity_error') }}');
|
||||
return;
|
||||
}
|
||||
// 判断:当前商品购买数量是否大于等于最小起订量
|
||||
if(_this.minimum_order > _this.quantity){
|
||||
layer.msg('{{ __('product.minimum_order_error',['num'=>$product['minimum_order']]) }}');
|
||||
return;
|
||||
}
|
||||
// 请求参数
|
||||
params = {
|
||||
sku_id: _this.product.id,
|
||||
|
|
@ -856,6 +873,13 @@
|
|||
params.products_country_id = _this.country_id;
|
||||
params.change_logistics_id = _this.change_logistics_id;
|
||||
|
||||
|
||||
console.log(_this.minimum_order);
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
// 提交内容
|
||||
bk.addCart(params, null, () => {
|
||||
if (isIframe) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue