You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

606 lines
14 KiB

<template>
<div class="content_max">
<!-- 配送服务类型 -->
<div class="el_Storage">
<span class="el_table_span">仓储计费类型</span>
<el-select
class="el_Cselect"
v-model="form.Warehousebillingmode"
filterable
clearable
placeholder="选择计费类型"
style="width: 240px"
1 year ago
@change="chargetype"
>
<el-option
v-for="item in Warehousebillingmode"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<!-- 配送计费模式 -->
<div class="el_select_check">
<div class="el_Storage el_Service">
<span class="el_table_span name">服务类型</span>
<el-select
v-model="form.ServiceType"
filterable
placeholder="请选择服务类型"
:popper-append-to-body="false"
style="width: 660px"
multiple
@remove-tag="removeTag"
>
<el-option
v-for="item in ServiceList"
:key="item.value"
:label="item.label"
:value="item.value"
>
<el-checkbox v-model="item.check" @change="isChecked(item)">
{{ item.label }}
</el-checkbox>
</el-option>
</el-select>
</div>
</div>
<!-- 是否区分品类 -->
<div class="el_Storage">
<span class="el_table_span">是否区分品类</span>
1 year ago
<el-radio-group v-model="form.Distinguishcategories" class="el_Cselect">
<el-radio v-for="item in Distinguishcategories" :key="item.label" :label="item.value">{{
item.label
}}</el-radio>
</el-radio-group>
</div>
1 year ago
<!-- 是否有遗留件 -->
<div class="el_Storage">
<span class="el_table_span">是否有遗留件</span>
<el-radio-group v-model="form.Leftoverparts" class="el_Cselect">
<el-radio v-for="item in Leftoverparts" :key="item.label" :label="item.value">{{
item.label
}}</el-radio>
</el-radio-group>
</div>
<!-- 商配/市配 -->
<div class="el_Storage">
<el-tabs class="demo-tabs">
<el-tab-pane :label="WarehousebillingmodeTitle">
<!-- 商配/市配内容 -->
<div class="el_Commercial_ercial">
<!-- 按件计费 -->
<template v-for="Item in Commercialcial" :key="Item.title">
<div class="el_Storage">
<div class="Storage-cont">
<!-- 标题 -->
<span class="el_table_span">{{ Item.title }}</span>
<!-- 表格 -->
<div
class="el_Storagecategory"
v-loading="Item.Storageloading"
element-loading-text="Loading..."
>
<div class="el_table_span">
<div class="el_table_id">序号</div>
<div class="el_table_title">产品品类</div>
</div>
<!-- 表格循环 -->
<div class="el_table_td" v-for="item in Item.sequence" :key="item.id">
<!-- 序号 -->
<div class="el_table_idNumber">{{ item.id }}</div>
<!-- 选择的品类 -->
<el-select
class="el_Cselect"
v-model="item.Warehousecategory"
filterable
clearable
placeholder="请选择品类"
style="width: 240px"
>
<!-- 品类列表 -->
<el-option
v-for="option in item.StoragecategoryList"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
<div class="el_table_operation">
<span
@click="storagereduce(Item, item.id)"
v-if="item.reduce"
class="el_table_operation_span_a"
>-</span
>
<span
@click="storageplus(Item, item.id)"
v-if="item.plus"
class="el_table_operation_span_b"
>+</span
>
</div>
</div>
</div>
</div>
</div>
</template>
</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
1 year ago
const form = ref({
Warehousebillingmode: '1', //仓储计费类型
Distinguishcategories: '1', //是否区分品类
Leftoverparts: '1', //是否有遗留件
}); //表单
// 配送服务类型
const Warehousebillingmode = ref([
{ label: '市配', value: '1' },
{ label: '商配', value: '2' },
]);
1 year ago
const WarehousebillingmodeTitle = ref('市配'); //配送服务类型标题
// 配送计费模式
const ServiceList = ref([
{
label: '按计件计费',
value: '1',
check: false,
},
{
label: '按重量计费',
value: '2',
check: false,
},
{
label: '按方计费',
value: '3',
check: false,
},
{
label: '按整车计费',
value: '4',
state: false,
check: false,
},
{
label: '按点位计费',
value: '5',
check: false,
},
{
label: '按吨计费',
value: '6',
check: false,
},
{
label: '按公里计费',
value: '7',
check: false,
},
]);
1 year ago
const Commercialcial = ref([
{
title: '按件数计费', // 标题
state: false, //是否显示
Storageloading: false, //加载效果
sequence: [
//表格
{
id: 1, //序号
plus: true, //加号显示
reduce: false, //减号显示
StoragecategoryList: [], //品类
},
{
id: 2,
plus: true,
reduce: true,
StoragecategoryList: [],
},
],
},
{
title: '按重量计费',
state: false, //是否显示
Storageloading: false, //加载效果
sequence: [
//表格
{
id: 1, //序号
plus: true, //加号显示
reduce: false, //减号显示
StoragecategoryList: [], //品类
},
{
id: 2,
plus: true,
reduce: true,
StoragecategoryList: [],
},
],
},
{
title: '按方计费',
state: false, //是否显示
Storageloading: false, //加载效果
sequence: [
//表格
{
id: 1, //序号
plus: true, //加号显示
reduce: false, //减号显示
StoragecategoryList: [], //品类
},
{
id: 2,
plus: true,
reduce: true,
StoragecategoryList: [],
},
],
},
{
title: '按整车计费',
state: false, //是否显示
Storageloading: false, //加载效果
sequence: [
//表格
{
id: 1, //序号
plus: true, //加号显示
reduce: false, //减号显示
StoragecategoryList: [], //品类
},
{
id: 2,
plus: true,
reduce: true,
StoragecategoryList: [],
},
],
},
{
title: '按点位计费',
state: false,
state: false, //是否显示
Storageloading: false, //加载效果
sequence: [
//表格
{
id: 1, //序号
plus: true, //加号显示
reduce: false, //减号显示
StoragecategoryList: [], //品类
},
{
id: 2,
plus: true,
reduce: true,
StoragecategoryList: [],
},
],
},
{
title: '按吨计费',
state: false, //是否显示
Storageloading: false, //加载效果
sequence: [
//表格
{
id: 1, //序号
plus: true, //加号显示
reduce: false, //减号显示
StoragecategoryList: [], //品类
},
{
id: 2,
plus: true,
reduce: true,
StoragecategoryList: [],
},
],
},
{
title: '按公里计费',
state: false, //是否显示
Storageloading: false, //加载效果
sequence: [
//表格
{
id: 1, //序号
plus: true, //加号显示
reduce: false, //减号显示
StoragecategoryList: [], //品类
},
{
id: 2,
plus: true,
reduce: true,
StoragecategoryList: [],
},
],
},
]);
// 是否区分品类
const Distinguishcategories = ref([
1 year ago
{ label: '是', value: '1' },
{ label: '否', value: '0' },
]);
// 是否有遗留件
const Leftoverparts = ref([
{ label: '是', value: '1' },
{ label: '否', value: '0' },
]);
// 计费类型选择
const chargetype = val => {
console.log(val);
if (val) {
WarehousebillingmodeTitle.value = Warehousebillingmode.value.find(
res => res.value == val
).label;
}
};
//案件计费
const Storageloading = ref(false);
// 仓储品类配置
const StoragecategoryList = ref([
{
id: 1,
plus: true,
reduce: false,
},
{
id: 2,
plus: true,
reduce: true,
},
]);
// 附加费品类
const Additionalcategories = ref([
{
label: '衣柜',
value: '1',
},
{
label: '橱柜',
value: '2',
},
]);
Commercialcial.value.forEach(res => {
console.log(res, '第一层');
res.sequence.forEach(rues => {
console.log(rues, '第二曾');
rues.StoragecategoryList = { ...Additionalcategories.value };
});
});
// 点击菜单
const isChecked = val => {
console.log(val, '点击的');
};
// 点击移除
const removeTag = value => {
ServiceList.value.find(res => res.value == value).check = false;
};
1 year ago
// 移除对象
function removeItemById(array, id) {
const index = array.sequence.findIndex(item => item.id === id);
if (index !== -1) {
array.sequence.splice(index, 1);
array.sequence.forEach((item, index) => {
item.id = index + 1;
});
}
let timerId = setTimeout(() => {
array.Storageloading = false;
clearTimeout(timerId); // 在回调函数内部清除定时器
}, 300);
}
// 添加对象
function addItemAfterId(array, id) {
console.log(array, 'array');
const newItem = {
id: array.sequence.length + 1, // 新对象的 ID 为当前数组长度加 1
plus: true, //加号
reduce: true, //减号
StoragecategoryList: [ ...Additionalcategories.value ], //品类
};
const index = array.sequence.findIndex(item => item.id === id);
if (index !== -1) {
array.sequence.splice(index + 1, 0, newItem); // 在找到的 ID 后面插入新对象
// 重新排序 ID
array.sequence.forEach((item, index) => {
item.id = index + 1;
});
}
let timerId = setTimeout(() => {
array.Storageloading = false;
clearTimeout(timerId); // 在回调函数内部清除定时器
}, 300);
// 取消定时器
}
// 仓储减
const storagereduce = (item, id) => {
console.log(item);
item.Storageloading = true;
removeItemById(item, id);
};
// 仓储加
const storageplus = (item, id) => {
console.log(item, '按钮接收参数');
item.Storageloading = true;
addItemAfterId(item, id);
};
</script>
<style scoped lang="scss">
.content_max {
padding: 10px;
}
.el_Service {
display: flex;
align-items: center;
.name {
margin-right: 10px;
}
.el-checkbox {
width: 100% !important;
padding: 0 30px;
.el-checkbox__label {
margin-left: 20px;
}
}
.name {
font-size: 16px;
}
}
.el-checkbox {
width: 100% !important;
padding-left: 10px;
box-sizing: border-box;
.el-checkbox__label {
margin-left: 20px;
}
}
.el-select-dropdown__item {
padding: 0;
}
.el-select-dropdown__item::after {
content: '';
display: none;
}
.el_Storage {
margin-bottom: 30px;
.el_Cselect {
margin-left: 10px;
}
.el_table_span {
font-size: 16px;
1 year ago
font-weight: bold;
display: inline-block;
width: 160px;
}
.Storage-cont {
/* 禁止双击选中文本 */
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE 10+/Edge */
user-select: none; /* Standard syntax */
display: flex;
.el_Storagecategory {
border: 1px solid #ccc;
.el_table_span {
display: flex;
width: 100%;
background-color: #ebeef5;
padding: 4px;
box-sizing: border-box;
}
.el_table_id {
width: 62px;
font-weight: 600;
color: #606266;
}
.el_table_title {
font-weight: 600;
color: #606266;
}
.el_table_td {
display: flex;
height: 40px;
align-items: center;
border-bottom: 1px solid #ccc;
position: relative;
.el_table_operation {
width: 70px;
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
position: absolute;
right: -80px;
.el_table_operation_span_a,
.el_table_operation_span_b {
font-size: 20px;
font-weight: bold;
width: 40%;
border: 2px solid #f00;
color: #f00;
height: 70%;
border-radius: 6px;
display: block;
line-height: 23px;
text-align: center;
cursor: pointer;
}
.el_table_operation_span_b {
border: 2px solid #0d83b7;
color: #0d83b7;
}
.el_table_operation_span_a:hover {
background-color: #f00;
color: #ccc;
}
.el_table_operation_span_b:hover {
background-color: #0d83b7;
color: #ccc;
}
}
}
.el_table_idNumber {
width: 50px;
text-align: center;
font-size: 16px;
font-weight: 400;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
border-right: 1px solid #ccc;
}
:deep(.el-input__wrapper) {
box-shadow: none;
}
}
}
}
1 year ago
:deep(.demo-tabs) {
.el-tabs__item {
font-size: 26px;
font-weight: bold;
}
.el_Commercial_ercial {
width: 100%;
height: 500px;
box-sizing: border-box;
border: 1px solid #ccc;
padding: 4px;
border-radius: 4px;
overflow-y: scroll;
}
}
</style>