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.
 
 
 
 

674 lines
17 KiB

<template>
<basic-container v-loading="details.loadingObj.pageLoading">
<div class="avue-crud">
<div class="add_row">
<!-- 列表模块 -->
<div style="width: 49%">
<el-divider content-position="left">未转为直发商家的订单</el-divider>
<!-- <div v-if="!search">
<el-form :inline="true" label-width="80px" :model="details.oldQuery" class="el-fr-d">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="onLoad"> </el-button>
<el-button icon="el-icon-delete" @click="searchReset()">重置</el-button>
</el-form-item>
</el-form>
</div> -->
<div style="margin-bottom: 10px" class="flex-c-sb">
<!-- 控件 -->
<div class="avue-crud__right">
<el-button icon="el-icon-refresh" @click="onLoad" circle></el-button>
<el-button icon="Operation" @click="showdrawer(true, 1)" circle></el-button>
<el-button icon="el-icon-search" @click="searchHide" circle></el-button>
</div>
<el-button type="text" style="cursor: pointer" @click="handleOrderStatus(1)">
加入
<el-icon><CaretRight /></el-icon>
</el-button>
</div>
<tablecmt
:columnList="details.oldColumnList"
:tableData="details.oldData"
:loading="loadingObj.oldListLoading"
@inputTxt="inputsc"
@timeCheck="timesc"
@btnCheck="btnsc"
@selectCheck="selectsc"
@selection="selectionChange"
>
</tablecmt>
<div class="avue-crud__pagination flex-c-sb" style="width: 100%">
<!-- 分页模块 -->
<el-pagination
style="zoom: 0.9"
align="right"
background
@size-change="sizeChange"
@current-change="currentChange"
:current-page="oldPage.pageNum"
:page-sizes="[30, 50, 80, 120]"
:page-size="oldPage.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="oldPage.total"
>
</el-pagination>
</div>
</div>
<!-- 列表模块 -->
<div style="width: 49%">
<el-divider content-position="left">转为直发商家的订单</el-divider>
<!-- <div v-if="!search">
<el-form :inline="true" label-width="80px" :model="details.newQuery" class="el-fr-d">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="searchReset()"
> </el-button
>
<el-button icon="el-icon-delete" @click="searchReset()">重置</el-button>
</el-form-item>
</el-form>
</div> -->
<div style="margin-bottom: 10px" class="flex-c-sb">
<div>
<el-button type="text" class="pointer" @click="handleOrderStatus(0)">
<el-icon><CaretLeft /></el-icon>
移除
</el-button>
</div>
<!-- 控件 -->
<div class="avue-crud__right">
<el-button icon="el-icon-refresh" @click="handleRefresh" circle></el-button>
<el-button icon="Operation" @click="showdrawer(true, 2)" circle></el-button>
<el-button icon="el-icon-search" @click="searchHide" circle></el-button>
</div>
</div>
<tablecmt
:columnList="details.newColumnList"
:tableData="details.newData"
:loading="loadingObj.newListLoading"
@inputTxt="newInputsc"
@timeCheck="newTimesc"
@selectCheck="newSelectsc"
@selection="newSelectionChange"
>
<template #default="slotProps">
<template v-if="slotProps.scope.column.label === '装车件数'">
<el-input-number
v-model="slotProps.scope.row.loadingNum"
controls-position="right"
:precision="0"
:min="0"
:max="slotProps.scope.row.stockNum"
:step="1"
/>
</template>
</template>
</tablecmt>
<div class="avue-crud__pagination flex-c-sb" style="width: 100%">
<!-- 分页模块 -->
<el-pagination
style="zoom: 0.9"
align="right"
background
@size-change="newSizeChange"
@current-change="newCurrentChange"
:current-page="details.newPage.pageNum"
:page-sizes="[30, 50, 80, 120]"
:page-size="details.newPage.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="details.newPage.total"
>
</el-pagination>
</div>
</div>
</div>
</div>
</basic-container>
<!-- 提交按钮 -->
<el-button type="primary" class="submitBtn" icon="CircleClose" @click="back"> 返 回 </el-button>
<!-- 列表配置显示 -->
<edittablehead
@setcolum="setnewcolum"
@closce="showdrawer"
:drawerShow="drawerShow"
:columnList="details.columnList"
></edittablehead>
</template>
<script setup lang="ts">
import { ref, reactive, toRefs, computed, onMounted, nextTick } from 'vue';
import functions from '@/utils/functions';
import dayjs from 'dayjs';
import { mapGetters } from 'vuex';
/** 获取字典 */
import { getDictionaryBiz } from '@/api/system/dict';
import {
psotFindWaybillOrderListNoIsToMall,
postFindWaybillOrderListToMall,
getUpdateWaybillOrderIsCustemer,
} from '@/api/distribution/directGoMarket';
import { downloadXls, deepClone, debounce } from '@/utils/util';
import { oldColumnList, newColumnList } from '@/option/distribution/zeroAdditionalRecording';
import { ElMessage } from 'element-plus';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
import { watch } from 'vue';
// 路由实例
const $route = useRoute();
const $router = useRouter();
// 实例化仓库
const $store = useStore();
const details = reactive<any>({
/** 是否开启搜索 */
search: true,
/** 运单池搜索条件 */
oldQuery: {},
/** 调度池搜索条件 */
newQuery: {},
/** 时间快捷选择设置 */
shortcuts: [
{
text: '最近一周',
value: () => {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
return [start, end];
},
},
{
text: '最近一个月',
value: () => {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
return [start, end];
},
},
{
text: '最近三个月',
value: () => {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
return [start, end];
},
},
],
/** 时间选择器数据 */
stockupDate: [],
/** 列表 */
columnList: [],
oldColumnList: deepClone(oldColumnList),
newColumnList: deepClone(newColumnList),
/** 订单池数据 */
oldData: [],
/** 调度池数据 */
newData: [],
/** 页面loading */
loadingObj: {
/** 列表加载loading */
list: false,
oldListLoading: false,
newListLoading: false,
pageLoading: false,
},
/** 订单池列表复选框选中的数据 */
oldSelectionList: [],
/** 调度池复选框选中数据 */
newSelectionList: [],
/** 是否显示设置表格 */
drawerShow: false,
/** 分页参数 */
page: {
pageNum: 1,
pageSize: 30,
total: 0,
},
oldPage: {
pageSize: 30,
pageNum: 1,
total: 0,
},
newPage: {
pageSize: 30,
pageNum: 1,
total: 0,
},
/** 弹出层显示 */
popUpShow: {},
/** 列表Dom节点 */
listNode: '',
form: {},
/** 被选中的零担订单 */
orderCodeList: [],
/** 运单Id */
loadId: '',
/** 页面数据 */
pageInfo: {
/** 运单Id */
loadId: '',
/** 返回路径 */
backPath: '',
},
/** 弹出层 */
showPopUpObj: {
editNodeIdDialogVisible: false,
},
/** 选择的Id */
finalNodeId: '',
/** 确认框的事件类型 add -- 新增 edit -- 修改 */
confirmType: 'add',
});
const { search, loadingObj, drawerShow, oldPage } = toRefs(details);
/** vuex */
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList']));
console.log('permission :>> ', permission);
onMounted(() => {
const timer = setTimeout(() => {
details.listNodeList = document.querySelectorAll('.maboxhi');
details.listNodeList.forEach(_node => {
_node.style.transition = 'all .3s ease-out';
});
clearTimeout(timer);
}, 100);
});
const initOldData = debounce(async function (params = {}) {
try {
details.loadingObj.oldListLoading = true;
const submitData = {
...details.oldPage,
...details.oldQuery,
loadId: details.pageInfo.loadId,
...params,
};
const res = await psotFindWaybillOrderListNoIsToMall(submitData);
const { code, data } = res.data;
if (code !== 200) return;
details.oldData = data.records;
details.oldPage.total = data.total;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.oldListLoading = false;
}
}, 10);
const initNewData = debounce(async function (params = {}) {
try {
details.loadingObj.newListLoading = true;
const submitData = {
...details.newPage,
...details.newQuery,
loadId: details.pageInfo.loadId,
...params,
};
const res = await postFindWaybillOrderListToMall(submitData);
const { code, data } = res.data;
if (code !== 200) return;
details.newData = data.records;
details.newPage.total = data.total;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.newListLoading = false;
}
}, 10);
/** 请求页面数据 */
const onLoad = () => {
initOldData();
initNewData();
};
/** 清空表单 */
const searchReset = () => {
details.query = {};
details.stockupDate = [];
details.page.pageNum = 1;
onLoad();
};
/** 展开列表控件 */
const showdrawer = (_flag?: boolean, _type?: number) => {
switch (_type) {
case 1:
details.columnList = oldColumnList;
break;
case 2:
details.columnList = newColumnList;
break;
}
console.log('details.columnList :>> ', details.columnList);
details.drawerShow = _flag;
};
/** 是否开启搜索区 */
const searchHide = () => {
function getWinHight() {
var windowHight = 0;
if (document.body.clientHeight && document.documentElement.clientHeight) {
windowHight =
document.body.clientHeight < document.documentElement.clientHeight
? document.body.clientHeight
: document.documentElement.clientHeight;
} else {
}
return document.documentElement.clientHeight;
}
details.search = !details.search;
const timer = setTimeout(() => {
details.listNodeList.forEach(_node => {
console.log('_node :>> ', _node);
_node.style.height = getWinHight() - _node.getBoundingClientRect().top - 70 + 'px';
});
clearTimeout(timer);
}, 10);
};
/** 表格表头输入框搜索 */
const inputsc = (index, row) => {
details.oldQuery[row.prop] = index;
if (index === '') delete details.oldQuery[row.prop];
initOldData();
};
/** 表格表头时间选择 */
const timesc = (index, row) => {
console.log(index, row);
if (!!index) {
index = dayjs(index).format('YYYY-MM-DD');
}
details.oldQuery[row.prop] = index;
if (!index) {
delete details.oldQuery[row.prop];
}
initOldData();
};
/** 表格表头输入框搜索 */
const btnsc = () => {};
/** 表格表头下拉框选择 */
const selectsc = (index, row) => {
details.oldQuery[row.prop] = index;
if (!index) delete details.oldQuery[row.prop];
if (row.prop === 'certificateTypeName') {
details.oldQuery['certificateType'] = index;
if (!index) delete details.oldQuery['certificateType'];
}
initOldData();
};
/** 表格表头复选框选择 */
const selectionChange = (list: any) => {
details.oldSelectionList = list;
};
/** 表格表头输入框搜索 */
const newInputsc = (index, row) => {
details.newQuery[row.prop] = index;
initNewData();
};
/** 表格表头时间选择 */
const newTimesc = (index, row) => {
console.log(index, row);
if (!!index) {
index = dayjs(index).format('YYYY-MM-DD');
}
details.newQuery[row.prop] = index;
if (!index) {
delete details.newQuery[row.prop];
}
initNewData();
};
/** 表格表头输入框搜索 */
const newBtnsc = () => {};
/** 表格表头下拉框选择 */
const newSelectsc = (index, row) => {
details.newQuery[row.prop] = index;
if (!index) delete details.newQuery[row.prop];
if (row.prop === 'certificateTypeName') {
details.newQuery['certificateType'] = index;
if (!index) delete details.newQuery['certificateType'];
}
initNewData();
};
/** 表格表头复选框选择 */
const newSelectionChange = (list: any) => {
details.newSelectionList = list;
};
/** 每页数量改变执行的回调 */
const sizeChange = (pageSize: number) => {
details.oldPage.pageSize = pageSize;
initOldData();
};
/** 页码改变执行的回调 */
const currentChange = pageNum => {
details.oldPage.pageNum = pageNum;
initOldData();
};
/** 每页数量改变执行的回调 */
const newSizeChange = (pageSize: number) => {
details.newPage.pageSize = pageSize;
initNewData();
};
/** 页码改变执行的回调 */
const newCurrentChange = pageNum => {
details.newPage.pageNum = pageNum;
initNewData();
};
/**
* 设置列表 -- 固定函数
* 弹窗的勾选回调,用于更改头部数组
* 固定搭配,只需要更换 columnList
* */
const setnewcolum = (newarr, headarr, type) => {
if (type == 1) {
details.columnList = newarr;
functions.setStorage(window.location.pathname + 'checkList', headarr);
} else if (type == 2) {
details.columnList = newarr;
functions.setStorage(window.location.pathname + 'flexList', headarr);
} else if (type == 3) {
details.columnList = newarr;
functions.setStorage(window.location.pathname + 'sortlist', headarr);
}
};
/** 清空调度池 */
const handleRefresh = () => {
details.newData = [];
details.newSelectionList = [];
details.orderCodeList = [];
details.page.pageNum = 1;
onLoad();
};
/** 处理是否为直发商家订单状态 */
const handleOrderStatus = async type => {
try {
details.loadingObj.pageLoading = true;
const submitData = {
carsOrderIds: '',
isCustomer: type,
};
// 添加为直发商家
if (type === 1) {
if (details.oldSelectionList.length === 0) return ElMessage.warning('最少选择一条订单');
submitData.carsOrderIds = details.oldSelectionList.map(val => val.carsOrderId).join(',');
} else {
console.log('details.newSelectionList :>> ', details.newSelectionList);
// 移除为不是直发商家
if (details.newSelectionList.length === 0) return ElMessage.warning('最少选择一条订单');
submitData.carsOrderIds = details.newSelectionList.map(val => val.carsOrderId).join(',');
}
await getUpdateWaybillOrderIsCustemer(submitData);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 返回上一页 */
const back = () => {
$router.push({
path: details.pageInfo.backPath,
});
$store.commit('DEL_TAG_CURRENT');
};
watch(
() => $route,
() => {
console.log('$route.query :>> ', $route);
if ($route.path !== '/distribution/artery/directGoMarket') return;
details.pageInfo = { ...$route.query };
onLoad();
},
{
immediate: true,
}
);
</script>
<style scoped lang="scss">
.fo-fl {
display: flex;
flex-wrap: wrap;
zoom: 0.9;
}
// 日期选择器
:deep(.el-date-editor.el-input) {
height: 100% !important;
width: 100% !important;
}
:deep(.el-range-editor.el-input__wrapper) {
height: 100% !important;
}
:deep(.el-form--inline .el-form-item) {
margin-right: 0;
}
// 新增行
.add_row {
display: flex;
justify-content: space-between;
}
.add_row_title {
text-align: center;
margin-bottom: 10px;
font-size: 18px;
font-weight: bold;
}
// 统计行
.statistics_row {
margin: 10px 0;
font-size: 14px;
zoom: 0.9;
display: flex;
> div {
margin-right: 20px;
}
}
// 卡片容器
.crad_container {
display: flex;
.card_container_item {
flex: 1;
// padding: 10px;
border-radius: 5px;
box-shadow: 0 0 5px #ccc;
&:first-child {
margin-right: 20px;
}
.card_container_item_title {
padding: 10px;
border-bottom: 1px solid #ccc;
display: flex;
justify-content: space-between;
align-items: center;
}
.card_container_item_box {
padding: 10px;
}
}
}
.pointer {
cursor: pointer;
}
// 提交按钮
.submitBtn {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}
// 表格内数字输入框
:deep(.el-input-number__decrease) {
zoom: 0.8;
}
:deep(.el-input-number__increase) {
zoom: 0.8;
}
.el-select {
width: 100%;
}
// 标题
:deep(.el-divider__text.is-left) {
font-size: 20px;
font-weight: bold;
color: var(--el-color-primary);
}
</style>