优化:物流编辑 - 续重范围取消添加按钮,仅使用一个。续重范围使用最小值同步首重禁止修改。物流列表单位调整和物流实际物流一致。

This commit is contained in:
wuhui_zzw 2023-08-31 11:16:11 +08:00
parent 5a83342538
commit 64fea5c8b3
2 changed files with 52 additions and 23 deletions

View File

@ -144,9 +144,25 @@
</x-admin::form.row>
<span v-if="form.type !== 'free'">
<span v-if="form.type === 'weight'">
<x-admin-form-input name="first_weight" type="number" :title="__('admin/logistics.first_weight')" :value="old('first_weight', $logistics->first_weight ?? '')" step="any" required>
<x-admin::form.row :title="__('admin/logistics.first_weight')">
<div class="d-flex mb-2 wp-400">
<input type="number"
name="first_weight"
@input="firstChange"
value="{{old('first_weight', $logistics->first_weight ?? '')}}"
class="form-control" step="any" required />
<div style="width: 40px;line-height: 34px;text-align:center"> {{ __('product.g') }} </div>
</div>
</x-admin::form.row>
{{--<x-admin-form-input name="first_weight" type="number" :title="__('admin/logistics.first_weight')" :value="old('first_weight', $logistics->first_weight ?? '')" step="any" required>
{{ __('admin/logistics.unit',['unit'=>__('product.g')]) }}
</x-admin-form-input>
</x-admin-form-input>--}}
<x-admin-form-input name="first_weight_fee" type="number" :title="__('admin/logistics.first_weight_fee')"
:value="old('first_weight_fee', $logistics->first_weight_fee ?? '')" step="any"
required> {{ __('admin/logistics.unit',['unit'=>'USD']) }}</x-admin-form-input>
@ -159,34 +175,34 @@
</x-admin-form-input>
{{-- 续重范围 START --------------------------------------------------------}}
<x-admin::form.row :title="__('admin/logistics.continuation_weight_max')">
{{--续重范围列表--}}
<div class="d-flex mb-2 wp-600" v-for="(cwItem,cwIndex) in continuation_weight_list" :key="cwIndex">
{{--续重范围列表 v-for="(cwItem,cwIndex) in continuation_weight_list" :key="cwIndex" --}}
<div class="d-flex mb-2 wp-600" >
<input type="number"
:name="'continuation_weight_list[' + cwIndex +'][min]'"
@input="continuationWeightChange($event,'min',cwIndex)"
:value="cwItem['min'] ?? 0"
:name="'continuation_weight_list[0][min]'"
@input="continuationWeightChange($event,'min',0)"
:value="continuation_weight_list[0] ? continuation_weight_list[0]['min'] : 0"
precision="2"
step="0.01"
class="form-control" style="flex: 0 0 130px" />
class="form-control" style="flex: 0 0 130px" readonly/>
<div style="width: 40px;line-height: 34px;text-align:center"> - </div>
<input type="number"
:name="'continuation_weight_list[' + cwIndex +'][max]'"
@input="continuationWeightChange($event,'max',cwIndex)"
:value="cwItem['max'] ?? 0"
:name="'continuation_weight_list[0][max]'"
@input="continuationWeightChange($event,'max',0)"
:value="continuation_weight_list[0] ? continuation_weight_list[0]['max'] : 0"
precision="2"
step="0.01"
class="form-control" style="flex: 0 0 130px" />
<div style="width: 40px;line-height: 34px;text-align:center"> {{ __('product.g') }} </div>
<div style="width: 40px;line-height: 34px;text-align:center">
<button type="button" class="btn btn-danger" @click="continuationWeightRemove(cwIndex)" style="margin-left: 10px;">
<i class="bi bi-trash-fill"></i>
</button>
</div>
{{--<div style="width: 40px;line-height: 34px;text-align:center">--}}
{{-- <button type="button" class="btn btn-danger" @click="continuationWeightRemove(cwIndex)" style="margin-left: 10px;">--}}
{{-- <i class="bi bi-trash-fill"></i>--}}
{{-- </button>--}}
{{--</div>--}}
</div>
{{--续重范围添加--}}
<button type="button" class=" btn btn-primary" @click="continuationWeightAdd">
<i class="bi bi-plus"></i>
</button>
{{--<button type="button" class=" btn btn-primary" @click="continuationWeightAdd">--}}
{{-- <i class="bi bi-plus"></i>--}}
{{--</button>--}}
</x-admin::form.row>
{{-- 续重范围 END --------------------------------------------------------}}
@ -351,7 +367,9 @@
}
}
},
created() {},
created() {
console.log(this.continuation_weight_list);
},
methods: {
dev() {
console.log(1);
@ -735,7 +753,12 @@
// 续重范围 - 续重范围改变
continuationWeightChange(e,field = 'min',cwIndex = 0){
let value = e.currentTarget.value || e.target.value;
this.continuation_weight_list[cwIndex][field] = value || 0;
let info = this.continuation_weight_list[cwIndex] || {};
info[field] = parseFloat(value) || 0;
this.continuation_weight_list[cwIndex] = info;
console.log(this.continuation_weight_list);
},
// 续重范围 - 删除续重范围
continuationWeightRemove(cwIndex){
@ -744,6 +767,12 @@
delete weightList[cwIndex];
_this.continuation_weight_list = Object.values(weightList);
},
// 首重改变
firstChange(event){
// let value = event.currentTarget.value || event.target.value;
this.continuationWeightChange(event,'min',0)
this.$forceUpdate();
}

View File

@ -120,7 +120,7 @@
<div class="fcm-top">
<div class="fcm-top-box">
<div class="title">{{ __('admin/logistics.first_weight') }}</div>
<div class="num">{{ $logistic['first_weight'] }}KG</div>
<div class="num">{{ $logistic['first_weight'] }}{{ __('product.g') }}</div>
</div>
<div class="fcm-top-box">
<div class="title">{{ __('admin/logistics.first_weight_fee') }}</div>
@ -130,7 +130,7 @@
<div class="fcm-top">
<div class="fcm-top-box">
<div class="title">{{ __('admin/logistics.add_weight') }}</div>
<div class="num">{{ $logistic['add_weight'] }}KG</div>
<div class="num">{{ $logistic['add_weight'] }}{{ __('product.g') }}</div>
</div>
<div class="fcm-top-box">
<div class="title">{{ __('admin/logistics.continuation_weight_fee') }}</div>