diff --git a/beike/Admin/Http/Controllers/LogisticsController.php b/beike/Admin/Http/Controllers/LogisticsController.php
index 1b9eb3a3..eae69d60 100644
--- a/beike/Admin/Http/Controllers/LogisticsController.php
+++ b/beike/Admin/Http/Controllers/LogisticsController.php
@@ -15,6 +15,7 @@ use Beike\Repositories\CategoryRepo;
use Beike\Repositories\CountryRepo;
use Beike\Repositories\LanguageRepo;
use Beike\Repositories\LogisticsRepo;
+use Beike\Repositories\SettingRepo;
use Illuminate\Http\Request;
class LogisticsController extends Controller
@@ -31,10 +32,14 @@ class LogisticsController extends Controller
$logistics = LogisticsResource::collection($logisticsList);
$logisticsFormat = $logistics->jsonSerialize();
+
+ $countries = LogisticsRepo::getDefaultCountries();
$data = [
'logistics_format' => $logisticsFormat,
'logistics' => $logistics,
'type' => 'logistics',
+ 'default_countries' => $countries,
+ 'default_countries_name' => is_array($countries) ? array_values($countries)[0]['name'] : ''
];
$data = hook_filter('admin.logistics.index.data', $data);
@@ -166,7 +171,6 @@ class LogisticsController extends Controller
// 获取
$countryIds = (array)explode(',',$logistics->country_ids);
$logistics->country_ids = CountryRepo::getInList($countryIds);
-
$data = [
'logistics' => $logistics,
'types' => $types,
@@ -227,4 +231,22 @@ class LogisticsController extends Controller
{
LogisticsRepo::forceDeleteTrashed();
}
+ /**
+ * Common: 设置默认物流国家
+ * Author: wu-hui
+ * Time: 2023/08/25 13:48
+ * @return array
+ * @throws \Throwable
+ */
+ public function defaultCountries(){
+ $country = request()->post('country');
+ SettingRepo::storeValue('default_country', $country,'logistics','plugin');
+
+ return json_success(trans('common.updated_success'), []);
+ }
+
+
+
+
+
}
diff --git a/beike/Admin/Routes/admin.php b/beike/Admin/Routes/admin.php
index 0e4665e5..cf38d108 100644
--- a/beike/Admin/Routes/admin.php
+++ b/beike/Admin/Routes/admin.php
@@ -227,6 +227,7 @@ Route::prefix($adminName)
Route::middleware('can:logistics_show')->get('logistics/{logistics}/edit', [Controllers\LogisticsController::class, 'edit'])->name('logistics.edit');
Route::middleware('can:logistics_update')->put('logistics/{logistics}', [Controllers\LogisticsController::class, 'update'])->name('logistics.update');
Route::middleware('can:logistics_delete')->delete('logistics/{logistics}', [Controllers\LogisticsController::class, 'destroy'])->name('logistics.destroy');
+ Route::middleware('can:logistics_default_countries')->post('logistics/default_countries', [Controllers\LogisticsController::class, 'defaultCountries'])->name('logistics.default_countries');
// 区域组
Route::middleware('can:regions_index')->get('regions', [Controllers\RegionController::class, 'index'])->name('regions.index');
diff --git a/beike/Repositories/LogisticsRepo.php b/beike/Repositories/LogisticsRepo.php
index 573fb56e..f08ba193 100644
--- a/beike/Repositories/LogisticsRepo.php
+++ b/beike/Repositories/LogisticsRepo.php
@@ -373,4 +373,18 @@ class LogisticsRepo
$products->forceDelete();
}
+ /**
+ * Common: 获取默认国家
+ * Author: wu-hui
+ * Time: 2023/08/25 13:50
+ * @param false $isGetInfo
+ * @return array|mixed
+ */
+ public static function getDefaultCountries($isGetInfo = false){
+ $set = plugin_setting('logistics.default_country');
+ if($set && !$isGetInfo) $set = array_column([$set],null,'id');
+
+ return $set ?? [];
+ }
+
}
diff --git a/resources/beike/admin/views/pages/logistics/index.blade.php b/resources/beike/admin/views/pages/logistics/index.blade.php
index 44957eca..2ad4998d 100644
--- a/resources/beike/admin/views/pages/logistics/index.blade.php
+++ b/resources/beike/admin/views/pages/logistics/index.blade.php
@@ -41,6 +41,21 @@
.fcm-content .fcm-footer .title{
margin-right: 10px;
}
+ .default-countries{
+ margin-left: 30px!important;
+ display: inline-flex;
+ align-items: flex-end;
+ justify-content: flex-start;
+ font-size: 15px;
+ -webkit-user-select: none; /* Safari */
+ -moz-user-select: none; /* Firefox */
+ -ms-user-select: none; /* IE 10+ */
+ user-select: none; /* 标准语法 */
+ }
+ .countries-select-btn{
+ color: #409eff;
+ cursor: pointer;
+ }
@if ($errors->has('error'))
@@ -54,11 +69,17 @@
-
+
@if ($type != 'trashed')
+
+ {{ __('admin/logistics.default_countries') }}:
+
+ @{{ showCurrentCountry() }}
+
+
@else
@if ($logistics->total())
@@ -161,12 +182,15 @@
@endif
+
+
@hook('admin.product.list.content.footer')
@endsection
@push('footer')
+ @include('shared.select-countries')
diff --git a/resources/lang/en/admin/logistics.php b/resources/lang/en/admin/logistics.php
index 7952dcc2..5b269692 100644
--- a/resources/lang/en/admin/logistics.php
+++ b/resources/lang/en/admin/logistics.php
@@ -1,82 +1,77 @@
* @created 2022-08-02 14:22:41
* @modified 2022-08-02 14:22:41
*/
-
return [
- 'logistics_index' => 'Index',
- 'logistics_name' => 'Logistics Name',
- 'logistics_img' => 'Logistics Image',
- 'logistics_create' => 'Create',
- 'logistics_show' => 'Detail',
- 'logistics_update' => 'Edit',
- 'logistics_delete' => 'Delete',
- 'logistics_trashed' => 'Trashed',
- 'logistics_restore' => 'Restore',
- 'clear_restore' => 'Empty Recycle Bin',
- 'logistics_filter_index' => 'View Filters',
- 'logistics_filter_update' => 'Modify Filters',
-
- 'batch_delete' => 'Batch Delete',
- 'batch_active' => 'Batch Active',
- 'batch_inactive' => 'Batch Inactive',
-
- 'basic_information' => 'Basic Information',
- 'product_details' => 'Product details',
- 'product_relations' => 'Related Logistics',
- 'stocks' => 'Product inventory',
- 'model' => 'Model',
- 'price' => 'Price',
- 'origin_price' => 'Original Price',
- 'cost_price' => 'Cost Price',
- 'quantity' => 'Quantity',
- 'enable_multi_spec' => 'Enable multi-spec',
- 'image_help' => 'The first picture will be used as the main picture of the product, and multiple pictures can be uploaded at the same time, and the position of multiple pictures can be adjusted at will',
- 'video_help' => 'If the prompt exceeds the system size limit, please modify the php.ini parameter post_max_size',
- 'add_variable' => 'Add Specs',
- 'add_variable_value' => 'Add Specification Value',
- 'add_variable_image' => 'Add Spec Image',
- 'default_main_product' => 'Default main product',
- 'modify_order' => 'Double-click to modify, drag to adjust the order',
- 'weight_text' => 'weight',
- 'length_width_height' => 'Length, width and height',
- 'length' => 'Length',
- 'width' => 'Width',
- 'height' => 'Height',
- 'weight_class' => 'weight unit',
-
- 'confirm_batch_product' => 'Are you sure you want to delete the selected logistics in batches? ',
- 'confirm_batch_status' => 'Confirm to modify the status of the selected logistics in batches? ',
- 'confirm_batch_restore' => 'Confirm to restore the selected product? ',
- 'confirm_delete_restore' => 'Are you sure you want to empty the recycle bin? ',
- 'warehouse_name' => 'Warehouse name',
- 'type'=>'Type',
-
- 'first_weight'=>'First weight',
- 'first_weight_fee'=>'First weight fee',
- 'continuation_weight_max'=>'Continuation weight max',
- 'add_weight'=>'Add weight',
- 'continuation_weight_fee'=>'Continuation weight fee',
- 'num_fee'=>'Num fee',
- 'throwing_ratio'=>'Throwing ratio',
- 'day_min'=>'Day min',
- 'day_max'=>'Day max',
- 'day'=>'Day',
- 'work_day'=>'Work day',
- 'type_weight'=>'Billing by weight',
- 'type_num'=>'Quantity based billing',
- 'type_free'=>'Merchant package shipping',
- 'first_num'=>'First num',
- 'first_num_fee'=>'First num fee',
- 'add_num'=>'Add num',
- 'continuation_num_fee'=>'Continuation num fee',
- 'freight_calculation_method'=>'Freight calculation method',
+ 'logistics_index' => 'Index',
+ 'logistics_name' => 'Logistics Name',
+ 'logistics_img' => 'Logistics Image',
+ 'logistics_create' => 'Create',
+ 'logistics_show' => 'Detail',
+ 'logistics_update' => 'Edit',
+ 'logistics_delete' => 'Delete',
+ 'logistics_trashed' => 'Trashed',
+ 'logistics_restore' => 'Restore',
+ 'clear_restore' => 'Empty Recycle Bin',
+ 'logistics_filter_index' => 'View Filters',
+ 'logistics_filter_update' => 'Modify Filters',
+ 'batch_delete' => 'Batch Delete',
+ 'batch_active' => 'Batch Active',
+ 'batch_inactive' => 'Batch Inactive',
+ 'basic_information' => 'Basic Information',
+ 'product_details' => 'Product details',
+ 'product_relations' => 'Related Logistics',
+ 'stocks' => 'Product inventory',
+ 'model' => 'Model',
+ 'price' => 'Price',
+ 'origin_price' => 'Original Price',
+ 'cost_price' => 'Cost Price',
+ 'quantity' => 'Quantity',
+ 'enable_multi_spec' => 'Enable multi-spec',
+ 'image_help' => 'The first picture will be used as the main picture of the product, and multiple pictures can be uploaded at the same time, and the position of multiple pictures can be adjusted at will',
+ 'video_help' => 'If the prompt exceeds the system size limit, please modify the php.ini parameter post_max_size',
+ 'add_variable' => 'Add Specs',
+ 'add_variable_value' => 'Add Specification Value',
+ 'add_variable_image' => 'Add Spec Image',
+ 'default_main_product' => 'Default main product',
+ 'modify_order' => 'Double-click to modify, drag to adjust the order',
+ 'weight_text' => 'weight',
+ 'length_width_height' => 'Length, width and height',
+ 'length' => 'Length',
+ 'width' => 'Width',
+ 'height' => 'Height',
+ 'weight_class' => 'weight unit',
+ 'confirm_batch_product' => 'Are you sure you want to delete the selected logistics in batches? ',
+ 'confirm_batch_status' => 'Confirm to modify the status of the selected logistics in batches? ',
+ 'confirm_batch_restore' => 'Confirm to restore the selected product? ',
+ 'confirm_delete_restore' => 'Are you sure you want to empty the recycle bin? ',
+ 'warehouse_name' => 'Warehouse name',
+ 'type' => 'Type',
+ 'first_weight' => 'First weight',
+ 'first_weight_fee' => 'First weight fee',
+ 'continuation_weight_max' => 'Continuation weight max',
+ 'add_weight' => 'Add weight',
+ 'continuation_weight_fee' => 'Continuation weight fee',
+ 'num_fee' => 'Num fee',
+ 'throwing_ratio' => 'Throwing ratio',
+ 'day_min' => 'Day min',
+ 'day_max' => 'Day max',
+ 'day' => 'Day',
+ 'work_day' => 'Work day',
+ 'type_weight' => 'Billing by weight',
+ 'type_num' => 'Quantity based billing',
+ 'type_free' => 'Merchant package shipping',
+ 'first_num' => 'First num',
+ 'first_num_fee' => 'First num fee',
+ 'add_num' => 'Add num',
+ 'continuation_num_fee' => 'Continuation num fee',
+ 'freight_calculation_method' => 'Freight calculation method',
'logistics_duration' => 'Delivery within :day working days after shipment',
- 'unit' => 'unit::unit',
+ 'unit' => 'unit::unit',
+ 'default_countries' => 'Default display country for the front desk',
];
diff --git a/resources/lang/zh_cn/admin/logistics.php b/resources/lang/zh_cn/admin/logistics.php
index 76b72aad..959651ff 100644
--- a/resources/lang/zh_cn/admin/logistics.php
+++ b/resources/lang/zh_cn/admin/logistics.php
@@ -8,44 +8,44 @@
* @modified 2022-08-02 14:22:41
*/
return [
- 'logistics_index' => '物流列表',
- 'logistics_name' => '物流名称',
- 'logistics_img' => '物流图片',
- 'logistics_create' => '创建物流',
- 'logistics_show' => '物流详情',
- 'logistics_update' => '更新物流',
- 'logistics_delete' => '删除物流',
- 'logistics_trashed' => '回收站',
- 'logistics_restore' => '恢复回收站',
- 'clear_restore' => '清空回收站',
- 'logistics_filter_index' => '查看高级筛选',
- 'logistics_filter_update' => '修改高级筛选',
- 'batch_delete' => '批量删除',
- 'batch_active' => '批量上架',
- 'batch_inactive' => '批量下架',
- 'basic_information' => '基础信息',
- 'product_details' => '物流详情',
- 'product_relations' => '相关物流',
- 'stocks' => '物流库存',
- 'model' => '型号',
- 'price' => '价格',
- 'origin_price' => '原价',
- 'cost_price' => '成本价',
- 'quantity' => '数量',
- 'enable_multi_spec' => '启用多规格',
- 'image_help' => '第一张图片将作为物流主图,支持同时上传多张图片,多张图片之间可随意调整位置',
- 'video_help' => '如果提示超出系统大小限制,请修改 php.ini 参数 post_max_size',
- 'add_variable' => '添加规格',
- 'add_variable_value' => '添加规格值',
- 'add_variable_image' => '添加规格图片',
- 'default_main_product' => '默认主物流',
- 'modify_order' => '双击修改、拖动调整顺序',
- 'weight_text' => '重量',
- 'length_width_height' => '长宽高',
- 'length' => '长',
- 'width' => '宽',
- 'height' => '高',
- 'weight_class' => '重量单位',
+ 'logistics_index' => '物流列表',
+ 'logistics_name' => '物流名称',
+ 'logistics_img' => '物流图片',
+ 'logistics_create' => '创建物流',
+ 'logistics_show' => '物流详情',
+ 'logistics_update' => '更新物流',
+ 'logistics_delete' => '删除物流',
+ 'logistics_trashed' => '回收站',
+ 'logistics_restore' => '恢复回收站',
+ 'clear_restore' => '清空回收站',
+ 'logistics_filter_index' => '查看高级筛选',
+ 'logistics_filter_update' => '修改高级筛选',
+ 'batch_delete' => '批量删除',
+ 'batch_active' => '批量上架',
+ 'batch_inactive' => '批量下架',
+ 'basic_information' => '基础信息',
+ 'product_details' => '物流详情',
+ 'product_relations' => '相关物流',
+ 'stocks' => '物流库存',
+ 'model' => '型号',
+ 'price' => '价格',
+ 'origin_price' => '原价',
+ 'cost_price' => '成本价',
+ 'quantity' => '数量',
+ 'enable_multi_spec' => '启用多规格',
+ 'image_help' => '第一张图片将作为物流主图,支持同时上传多张图片,多张图片之间可随意调整位置',
+ 'video_help' => '如果提示超出系统大小限制,请修改 php.ini 参数 post_max_size',
+ 'add_variable' => '添加规格',
+ 'add_variable_value' => '添加规格值',
+ 'add_variable_image' => '添加规格图片',
+ 'default_main_product' => '默认主物流',
+ 'modify_order' => '双击修改、拖动调整顺序',
+ 'weight_text' => '重量',
+ 'length_width_height' => '长宽高',
+ 'length' => '长',
+ 'width' => '宽',
+ 'height' => '高',
+ 'weight_class' => '重量单位',
'confirm_batch_product' => '确认要批量删除选中的物流吗?',
'confirm_batch_status' => '确认要批量修改选中的物流的状态吗?',
'confirm_batch_restore' => '确认要恢复选中的物流吗?',
@@ -77,5 +77,6 @@ return [
'continuation_num_fee' => '续件运费',
'freight_calculation_method' => '运费计算方式',
'logistics_duration' => '发货后:day个工作日内交货',
- 'unit' => '单位::unit',
+ 'unit' => '单位::unit',
+ 'default_countries' => '前台默认展示国家',
];
diff --git a/themes/default/shared/select-countries.blade.php b/themes/default/shared/select-countries.blade.php
index c0f0ec99..70e16815 100644
--- a/themes/default/shared/select-countries.blade.php
+++ b/themes/default/shared/select-countries.blade.php
@@ -159,6 +159,10 @@
default: {},
type: [Object,Array]
},
+ is_single: {
+ default: false,
+ type: Boolean
+ }
},
data: function () {
return {
@@ -213,7 +217,9 @@
// 点击当前国家
clickCountries(item){
let _this = this;
- let countryIds = Object.assign({}, _this.country_list);
+ // 判断:单选 || 多选
+ let countryIds = {};// 单选
+ if(!_this.is_single) countryIds = Object.assign({}, _this.country_list);// 多选
// 判断:根据是否已经存在进行对应的存在 不存在-添加;存在-删除
if(_this.isSelected(item)) delete countryIds[item.id];// 存在-删除
else countryIds[item.id] = item;// 不存在 添加