修改:商品编辑页面、商品详情页面、首页商品样式布局调整优化

This commit is contained in:
wuhui_zzw 2023-10-10 17:59:33 +08:00
parent b35b056803
commit 61129e6971
10 changed files with 73 additions and 49 deletions

View File

@ -37,12 +37,15 @@ class ProductRequest extends FormRequest
'brand_id' => 'int',
// 'skus.*.sku' => 'required|string',
'skus.*.price' => 'required|numeric',
'skus.*.origin_price' => 'required|numeric',
// 'skus.*.origin_price' => 'required|numeric',
// 'skus.*.cost_price' => 'numeric',
];
// 判断:最小起订量是否必填 直接下单产品 - 必填
// 判断:根据是否为 直接下单产品 进行对应的判断
if($this->active == 1){
// 直接下单产品 - 最小起订量必填
$rules['minimum_order'] = 'required|numeric|gt:0';
}else{
$rules['skus.*.origin_price'] = 'required|numeric';
}
// 判断:销售方式为按 批 卖每批的数量必须大于0
if($this->sales_method == 'batches'){

View File

@ -77,7 +77,7 @@ class ProductService
$skus = [];
foreach ($data['skus'] as $index => $sku) {
$sku['position'] = $index;
$sku['origin_price'] = (float) $sku['origin_price'];
$sku['origin_price'] = (float) ($sku['origin_price'] ?? 0);
$sku['cost_price'] = (float) ($sku['cost_price'] ?? 0);
$sku['quantity'] = (int) $sku['quantity'];
$skus[] = $sku;

View File

@ -159,7 +159,7 @@
</div>
{{--交易信息--}}
<div>
<h5 class="border-bottom pb-3 mb-4">{{ __('product.transaction_info') }}</h5>
<h6 class="border-bottom pb-3 mb-4">{{ __('product.transaction_info') }}</h6>
{{--产品类型--}}
<x-admin::form.row title="{{ __('product.product_type') }}">
<div class="mb-1 mt-2">
@ -407,8 +407,13 @@
</div>
<input type="text" class="form-control me-2 bg-white" v-model="variablesBatch.model" placeholder="{{ __('admin/product.model') }}">
{{--<input type="text" class="form-control me-2 bg-white" v-model="variablesBatch.sku" placeholder="sku">--}}
<input type="number" v-if="form.price_setting === 'sku'" class="form-control me-2 bg-white" v-model="variablesBatch.price" placeholder="{{ __('admin/product.price') }}">
<input type="number" v-if="form.price_setting === 'sku'" class="form-control me-2 bg-white" v-model="variablesBatch.origin_price" placeholder="{{ __('admin/product.origin_price') }}">
<template v-if="form.active != 1">
<input type="number" v-if="form.price_setting === 'sku'" class="form-control me-2 bg-white" v-model="variablesBatch.price" placeholder="{{ __('admin/product.price') }}">
<input type="number" v-if="form.price_setting === 'sku'" class="form-control me-2 bg-white" v-model="variablesBatch.origin_price" placeholder="{{ __('admin/product.origin_price') }}">
</template>
<template v-else>
<input type="number" v-if="form.price_setting === 'sku'" class="form-control me-2 bg-white" v-model="variablesBatch.price" placeholder="{{ __('product.price_tag') }}">
</template>
{{-- <input type="number" class="form-control me-2 bg-white" v-model="variablesBatch.cost_price" placeholder="{{ __('admin/product.cost_price') }}">--}}
<input type="number" class="form-control me-2 bg-white" v-model="variablesBatch.quantity" placeholder="{{ __('product.quantity') }}">
<button type="button" class="btn btn-primary text-nowrap" @click="batchSettingVariant">{{ __('common.batch_setting') }}</button>
@ -422,8 +427,13 @@
<th width="106px">{{ __('common.image') }}</th>
<th class="w-min-100">{{ __('admin/product.model') }}</th>
{{--<th class="w-min-100">sku</th>--}}
<th v-if="form.price_setting === 'sku'" class="w-min-100">{{ __('admin/product.price') }}</th>
<th v-if="form.price_setting === 'sku'" class="w-min-100">{{ __('admin/product.origin_price') }}</th>
<template v-if="form.active != 1">
<th v-if="form.price_setting === 'sku'" class="w-min-100">{{ __('admin/product.price') }}</th>
<th v-if="form.price_setting === 'sku'" class="w-min-100">{{ __('admin/product.origin_price') }}</th>
</template>
<template v-else>
<th v-if="form.price_setting === 'sku'" class="w-min-100">{{ __('product.price_tag') }}</th>
</template>
{{--<th class="w-min-100">{{ __('admin/product.cost_price') }}</th>--}}
<th class="w-min-100">{{ __('product.quantity') }}</th>
</thead>
@ -458,16 +468,23 @@
<span role="alert" class="invalid-feedback">{{ __('common.error_required', ['name' => 'sku']) }}</span>
<span v-if="sku.is_default" class="text-success">{{ __('admin/product.default_main_product') }}</span>
</td>--}}
<td v-if="form.price_setting === 'sku'">
<input type="number" class="form-control" v-model="sku.price" :name="'skus[' + skuIndex + '][price]'" step="any"
placeholder="{{ __('admin/product.price') }}" required>
<span role="alert" class="invalid-feedback">{{ __('common.error_required', ['name' => __('admin/product.price')]) }}</span>
</td>
<td v-if="form.price_setting === 'sku'">
<input type="number" class="form-control" v-model="sku.origin_price" :name="'skus[' + skuIndex + '][origin_price]'" step="any"
placeholder="{{ __('admin/product.origin_price') }}" required>
<span role="alert" class="invalid-feedback">{{ __('common.error_required', ['name' => __('admin/product.origin_price')]) }}</span>
</td>
<template v-if="form.active != 1">
<td v-if="form.price_setting === 'sku'">
<input type="number" class="form-control" v-model="sku.price" :name="'skus[' + skuIndex + '][price]'" step="any" placeholder="{{ __('admin/product.price') }}" required>
<span role="alert" class="invalid-feedback">{{ __('common.error_required', ['name' => __('admin/product.price')]) }}</span>
</td>
<td v-if="form.price_setting === 'sku'">
<input type="number" class="form-control" v-model="sku.origin_price" :name="'skus[' + skuIndex + '][origin_price]'" step="any" placeholder="{{ __('admin/product.origin_price') }}" required>
<span role="alert" class="invalid-feedback">{{ __('common.error_required', ['name' => __('admin/product.origin_price')]) }}</span>
</td>
</template>
<template v-else>
<td v-if="form.price_setting === 'sku'">
<input type="number" class="form-control" v-model="sku.price" :name="'skus[' + skuIndex + '][price]'" step="any" placeholder="{{ __('product.price_tag') }}" required>
<span role="alert" class="invalid-feedback">{{ __('common.error_required', ['name' => __('product.price_tag')]) }}</span>
</td>
</template>
<input type="hidden" :name="'skus[' + skuIndex + '][price]'" v-if="form.price_setting === 'num'" placeholder="variants" :value="form.numPrices.length !== 0 ? form.numPrices[0].price : ''">
<input type="hidden" :name="'skus[' + skuIndex + '][origin_price]'" v-if="form.price_setting === 'num'" placeholder="position" :value="form.numPrices.length !== 0 ? form.numPrices[form.numPrices.length - 1].price : ''">
{{--<td>

View File

@ -75,5 +75,5 @@ return [
'unit' => 'unit:unit',
'default_countries' => 'Default display country for the front desk',
'choose_logistics' => 'Select Shipping Service',
'estimated_time' => 'Shipping Time',
'estimated_time' => 'Shipping Time(After Shipment)',
];

View File

@ -24,7 +24,7 @@ return [
'express_number' => 'Express Number',
'express_company' => 'Express Company',
'expected_arrival' => 'Expected to arrive between :start_time and :end_time',
'work_days' => '【:start_day】-【:end_day】work days',
'work_days' => ':start_day-:end_day work days',
'order_shipments' => 'shipment information',

View File

@ -15,6 +15,7 @@ return [
'price' => 'Price',
'origin_price' => 'Origin Price',
'cost_price' => 'Cost Price',
'price_tag' => 'Price Tag',
'brand' => 'Brand',
'category' => 'Category',
'model' => 'Model',

View File

@ -80,7 +80,7 @@ return [
'unit' => '单位::unit',
'default_countries' => '前台默认展示国家',
'choose_logistics' => '选择运输服务',
'estimated_time' => '运送时间',
'estimated_time' => '运送时间(装运后)',

View File

@ -14,6 +14,7 @@ return [
'sku' => 'SKU',
'price' => '区间低价',
'origin_price' => '区间高价',
'price_tag' => '价格',
'cost_price' => '起订量',
'brand' => '品牌',
'category' => '分类',
@ -49,5 +50,4 @@ return [
'trade_term' => '贸易术语',
'multi_specification_settings' => '多规格设置',
'multi_specification_settings_help' => '直接下单产品,根据规格设置价格时必须启用多规格!',
];

View File

@ -163,9 +163,7 @@
}
.sku-price-wrap-content{
width: 100%;
font-size: 2rem !important;
line-height: 20px !important;
font-weight: 700 !important;
}
.num-item-content{
white-space: nowrap;
@ -175,7 +173,16 @@
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
}
.num-trade-term-content {
height: 54px;
line-height: 85px;
display: inline-flex;
margin-right:10px;
font-size: calc(1.265rem + 0.18vw) !important;
}
.num-trade-term-content-i{
font-size: 15px;
}
</style>
<div class="container {{ request('iframe') ? 'pt-4' : '' }}" id="product-app" v-cloak>
@ -222,25 +229,22 @@
<h1 class="mb-4 product-name">{{ $product['name'] }}</h1>
@endhookwrapper
@hookwrapper('product.detail.price')
{{--阶梯价--}}
{{-- 阶梯价 --}}
<div class="price-wrap d-flex align-items-end sku-price-wrap" v-if="price_setting === 'sku'">
<div class="sku-price-wrap-content">
<span style="color: #1a9bff;">
{{$product['trade_term'] ?? 'DAP'}}
<i class="bi bi-question-circle" id="tradeTerm" style="font-size: 15px;"></i>
</span>
@{{ product.price_format }} -
<span v-if="product.price != product.origin_price && product.origin_price !== 0">@{{ product.origin_price_format }}</span>
<div class="sku-price-wrap-content fs-3">
<span>{{ $product['trade_term'] ?? 'DAP'}}<i class="bi bi-question-circle" id="tradeTerm" style="font-size: 15px;"></i></span>
@{{ product.price_format }}
<span v-if="product.price != product.origin_price && product.origin_price !== 0"> - @{{ product.origin_price_format }}</span>
@if($product['unit'])
<span>/ {{explode('/',$product['unit'])[0]}}</span>
@endif
<span v-if="minimum_order > 0" style="font-size: 15px;color: #484848;">
<span v-if="minimum_order > 0" style="font-size: 18px;">
@if($product['sales_method'] == 'piece')
|&nbsp;{{ $product['minimum_order'] }} {{explode('/',$product['unit'])[1]}}<span style="color: #999999;">({{__('product.minimum_order')}})</span>
|&nbsp;{{ $product['minimum_order'] }} {{explode('/',$product['unit'])[1]}}
@else
|&nbsp;{{ ($product['piece_to_batch'] * $product['minimum_order']) }} {{explode('/',$product['unit'])[1]}}
<span style="color: #999999;">({{__('product.minimum_order')}})</span>
@endif
<span style="color: #777777;">({{__('product.minimum_order')}})</span>
</span>
</div>
{{--<span class="new-price fs-1 lh-1 fw-bold me-2">{{$product['trade_term'] ?? 'DAP'}}</span>--}}
@ -267,11 +271,8 @@
</div>
{{--阶梯价--}}
<div class="num-price-content price-wrap d-flex align-items-end" v-if="price_setting === 'num'">
<div class="item" style="color: #1a9bff;font-size: 18px;height: 54px;line-height: 54px;display: inline-flex;margin-right:10px;">
{{$product['trade_term'] ?? 'DAP'}}
<div style="width: 25px;height: 54px;text-align: center;float: left;font-size: 15px;">
<i class="bi bi-question-circle" id="tradeTerm"></i>
</div>
<div class="item num-trade-term-content">
{{$product['trade_term'] ?? 'DAP'}}<i class="bi bi-question-circle num-trade-term-content-i" id="tradeTerm"></i>
</div>
<div class="item" v-for="(item,index) in numPrices" style="flex: 1" :style="{width: 100 / numPrices.length + '%'}">
<div class="num num-item-content" v-if="index < numPrices.length - 1">

View File

@ -54,17 +54,17 @@
<div class="product-name">{{ $product['name_format'] }}</div>
<div class="product-price">
@if ($product['price_setting'] === 'sku')
<span class="price-new">{{ $product['price_format'] }}</span>
<span>-</span>
<span class="price-new" style="font-size: calc(1.265rem + 0.18vw) !important;color: #212529">{{ $product['price_format'] }}</span>
@if ($product['price'] != $product['origin_price'] && $product['origin_price'] > 0)
<span class="price-new">{{ $product['origin_price_format'] }}</span>
<span style="font-size: calc(1.265rem + 0.18vw) !important;color: #212529">-</span>
<span class="price-new" style="font-size: calc(1.265rem + 0.18vw) !important;color: #212529">{{ $product['origin_price_format'] }}</span>
@endif
@elseif($product['price_setting'] === 'num')
@if ($product['price'] != $product['origin_price'] && $product['origin_price'] > 0)
<span class="price-new">{{ $product['origin_price_format'] }}</span>
<span class="price-new" style="font-size: calc(1.265rem + 0.18vw) !important;color: #212529">{{ $product['origin_price_format'] }}</span>
@endif
<span>-</span>
<span class="price-new">{{ $product['price_format'] }}</span>
<span style="font-size: calc(1.265rem + 0.18vw) !important;color: #212529">-</span>
<span class="price-new" style="font-size: calc(1.265rem + 0.18vw) !important;color: #212529">{{ $product['price_format'] }}</span>
@endif
{{--@if(!empty($product['unit_format']))
@ -74,8 +74,10 @@
<!--yt修改-->
@if ((int)$product['minimum_order'] > 0)
<div class="product-price">
<span class="price-new">{{$product['minimum_order'] ?? 0}} {{ $product['unit_format'] ?? '' }}</span>
<div class="product-price" style="font-size: 18px!important;">
<span class="price-new" style="color: #212529!important;">
{{$product['minimum_order'] ?? 0}} {{ $product['unit_format'] ? explode('/',$product['unit_format'])[1] : '' }}
</span>
<span style="color:#aaa;margin-left:4px">({{__('admin/product.minimum_order')}})</span>
</div>
@endif