后台订单筛选,前台购物车显示SKU 规格名称

This commit is contained in:
pushuo 2022-11-02 11:33:41 +08:00 committed by Edward Yang
parent e38a6a8ab4
commit 315c31b5bd
8 changed files with 38 additions and 8 deletions

View File

@ -27,4 +27,20 @@ class ProductSku extends Base
$images = $this->images ?? [];
return $images[0] ?? '';
}
public function getVariantLabel(): string
{
$product = $this->product;
$localeCode = locale();
$variantLabel = '';
foreach ($product->variables as $index => $variable) {
$valueIndex = $this->variants[$index];
$variantName = $variable['name'][$localeCode] ?? '';
$variantValue = $variable['values'][$valueIndex]['name'][$localeCode] ?? '';
if ($variantName && $variantValue) {
$variantLabel .= $variantName . ': ' . $variantValue . '; ';
}
}
return $variantLabel;
}
}

View File

@ -26,6 +26,12 @@ class CartDetail extends JsonResource
$subTotal = $price * $this->quantity;
$image = $sku->image ?: $product->image;
$variantLabel = $sku->getVariantLabel();
if ($variantLabel) {
$productName .= ' - ' . trim($variantLabel);
}
return [
'cart_id' => $this->id,
'product_id' => $this->product_id,

View File

@ -20,6 +20,7 @@ $btn-border-radius: 0;
$btn-border-radius-sm: 0;
$btn-border-radius-lg: 0;
$input-btn-focus-box-shadow: 0 0 11px 0 rgba($color: $primary, $alpha: .1);
$form-select-focus-box-shadow: 0 0 11px 0 rgba($color: $primary, $alpha: .1);
// $btn-border-width: 0;
$font-size-base: 0.82rem;

View File

@ -48,4 +48,9 @@
}
}
}
}
.bs-el-input-inner-sm {
height: 32px;
margin-top: 3px;
}

View File

@ -14,6 +14,7 @@
<div>
<el-form-item label="{{ __('order.number') }}">
<el-input @keyup.enter.native="search" v-model="filter.number" size="small" placeholder="{{ __('order.number') }}"></el-input>
{{-- <input @keyup.enter="search" type="text" v-model="filter.number" class="form-control" placeholder="{{ __('order.number') }}"> --}}
</el-form-item>
<el-form-item label="{{ __('order.customer_name') }}">
<el-input @keyup.enter.native="search" v-model="filter.customer_name" size="small" placeholder="{{ __('order.customer_name') }}">
@ -22,12 +23,12 @@
<el-form-item label="{{ __('order.email') }}">
<el-input @keyup.enter.native="search" v-model="filter.email" size="small" placeholder="{{ __('order.email') }}"></el-input>
</el-form-item>
<el-form-item label="{{ __('common.status') }}">
{{-- <el-input @keyup.enter.native="search" v-model="filter.email" size="small" placeholder="{{ __('order.email') }}"></el-input> --}}
<select v-model="filter.status" class="form-control wp-100">
<el-form-item label="{{ __('common.status') }}" class="el-input--small">
<select v-model="filter.status" class="form-select wp-100 bg-white bs-el-input-inner-sm">
<option value="">{{ __('common.all') }}</option>
<option value="1">{{ __('product.active') }}</option>
<option value="0">{{ __('product.inactive') }}</option>
@foreach ($statuses as $item)
<option value="{{ $item['status'] }}">{{ $item['name'] }}</option>
@endforeach
</select>
</el-form-item>
</div>

View File

@ -32,7 +32,7 @@
<div class="col-xxl-20 col-xl-3 col-lg-4 col-md-4 d-flex align-items-center mb-3">
<label class="filter-title">{{ __('product.category') }}</label>
<select v-model="filter.category_id" class="form-control">
<select v-model="filter.category_id" class="form-select">
<option value="">{{ __('common.all') }}</option>
@foreach ($categories as $_category)
<option :value="{{ $_category->id }}">{{ $_category->name }}</option>
@ -42,7 +42,7 @@
<div class="col-xxl-20 col-xl-3 col-lg-4 col-md-4 d-flex align-items-center mb-3">
<label class="filter-title">{{ __('common.status') }}</label>
<select v-model="filter.active" class="form-control">
<select v-model="filter.active" class="form-select">
<option value="">{{ __('common.all') }}</option>
<option value="1">{{ __('product.active') }}</option>
<option value="0">{{ __('product.inactive') }}</option>

View File

@ -38,6 +38,7 @@ $border-radius: 0;
$input-btn-padding-y: .46rem;
$input-btn-font-size: 0.85rem;
$input-btn-focus-box-shadow: 0 0 11px 0 rgba($color: $primary, $alpha: .1);
$form-select-focus-box-shadow: 0 0 11px 0 rgba($color: $primary, $alpha: .1);
// $input-btn-padding-x: .75rem !default;
$btn-focus-width: 0;

View File

@ -33,7 +33,7 @@
{{ __('shop/carts.select_all') }}
</label>
</th>
<th>{{ __('shop/carts.index') }}</th>
<th width="40%">{{ __('shop/carts.index') }}</th>
<th width="170">{{ __('shop/carts.commodity') }}</th>
<th width="170">{{ __('shop/carts.subtotal') }}</th>
<th width="100" class="text-end">{{ __('common.action') }}</th>