emis-frontend/src/views/emis/emisSettleBill/panel/CancelAccountApplicationFormPanel.vue

885 lines
32 KiB
Vue
Raw Normal View History

2025-09-17 10:18:39 +00:00
<template>
<div style="margin-bottom: 20px;">
<el-form ref="form" size="mini" :model="form" :rules="rules" :disabled="disabled" label-width="80px"
class="overflowhidden">
<el-row>
<el-col :span="12">
<el-form-item :label="$t('上传图片')" prop="batchNo">
<ImageUpload ref="imageUpload" :fileSize="5" :limit="10" v-model="form.picUrl"></ImageUpload>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" style="display: flex;flex-wrap: wrap;">
<el-col :span="4">
<el-form-item :label="$t('收款方式')" prop="payType">
<template slot-scope="scope">
<el-select v-model="form.payType" placeholder="请选择收款方式" clearable="">
<el-option v-for="item in dict.type.emis_settlebill_pay_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('销账金额')" prop="writeoffAmount" label-width="110px">
<el-input v-model="form.writeoffAmount" clearable="" placeholder=""></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('收款人')" prop="recipient">
<EmpNamePicker v-model="form.recipient" placeholder="请输入收款人"></EmpNamePicker>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="发出时间" prop="tradeDate">
<el-date-picker clearable v-model="form.tradeDate" type="date" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择发出时间" style="width:100%">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" v-if="!disabled">
<el-button type="primary" plain icon="el-icon-plus" size="mini"
@click="handleAddWayBill">加入运单</el-button>
</el-col>
<el-col :span="1.5" v-if="!disabled">
<el-button type="primary" plain size="mini" @click="handleCoPackListDelete"
:disabled="multiple">移除运单</el-button>
</el-col>
<el-col :span="1.5" v-if="this.form.id != null">
<el-button style="margin-right: 5px;" type="warning" plain icon="el-icon-download" size="mini"
@click="handleExport">导出</el-button>
</el-col>
</el-row>
</div>
<el-table class="cargoList" max-height="400px" v-loading="loading" border size="mini"
storageName="queryByBillCodesList_main_240917" ref="refTable" :data="waitBatchDtlList"
:queryParams="queryParams" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('序号')" align="center" type="index" width="50" />
<el-table-column :label="$t('运单号')" align="center" prop="emisWaybill.billCode" min-width="170" />
<el-table-column :label="$t('运费')" align="center" prop="emisWaybill.freight" min-width="80"
:show-overflow-tooltip="true" />
<el-table-column :label="$t('已收金额')" align="center" prop="emisSettleSubBill.recedMoney" min-width="100">
</el-table-column>
<el-table-column :label="$t('收/退款金额')" align="center" prop="applyMoney" min-width="100">
<template slot-scope="scope">
<el-input-number v-model="scope.row.applyMoney" placeholder="" :controls="false" :precision="2" >
<span slot="suffix">(CNY)</span>
</el-input-number>
</template>
</el-table-column>
<el-table-column :label="$t('寄件日期')" align="center" prop="emisWaybill.sendDate" min-width="170"
:show-overflow-tooltip="true" />
<el-table-column :label="$t('快件类型')" align="center" prop="emisWaybill.transLineTypeName" min-width="100" />
<el-table-column :label="$t('发件人')" align="center" prop="emisWaybill.sendName" min-width="100" />
<el-table-column :label="$t('寄件公司')" align="center" prop="emisWaybill.sendCompany" min-width="170"></el-table-column>
<el-table-column :label="$t('支付方式')" align="center" prop="emisWaybill.paymentType" min-width="140">
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_payment_type" :value="scope.row.emisWaybill.paymentType"/>
</template>
</el-table-column>
<el-table-column :label="$t('产品类型')" align="center" prop="emisWaybill.productType" min-width="100"></el-table-column>
<el-table-column :label="$t('件数')" align="center" prop="emisWaybill.parcelQty" min-width="100"> </el-table-column>
<el-table-column :label="$t('结算重量 ')" align="center" prop="emisWaybill.settlementWeight" min-width="100" />
</el-table>
<div style="text-align: center;margin-bottom: 10px;" v-if="!disabled">
<el-button type="primary" :loading="isDoing" @click="submitSaveBatchForm">确定</el-button>
<el-button @click="handleCancelCo">取 消</el-button>
</div>
<el-dialog :title="titleBatch" :visible.sync="openBatch" width="50%" v-dialogDrag :close-on-click-modal="false"
append-to-body>
<el-form ref="formBatch" size="mini" label-width="60px">
<el-row>
<el-col :span="24">
<el-form-item :label="$t('运单号')" prop="inputBatchBillCode">
<el-input v-model="inputBatchBillCode" type="textarea" :rows="8" placeholder="运单号" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align:center">
<el-button type="primary" @click="addBillToBatch">确定</el-button>
<el-button @click="cancelAddBillToBatch">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import emisTmsPackForm from '@/views/emis/emisTmsPack/emisTmsPackForm';
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import EmisGetNextSitePicker from '@/views/emis/EmisBaseTools/EmisGetNextSitePicker.vue';
import TransProductPicker from '@/views/emis/EmisBaseTools/TransProductPicker.vue';
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
import { parseTime } from "@/utils/custom";
import PackListView from '@/views/emis/emisTmsSiteBatch/packListView';
import EmisSupplierPicker from '@/views/emis/EmisBaseTools/EmisSupplierPicker';
import EmisTmsSiteBatchSupplierPicker from '@/views/emis/EmisBaseTools/EmisTmsSiteBatchSupplierPicker';
import EmisTmsSiteBatchNextSitePicker from '@/views/emis/EmisBaseTools/EmisTmsSiteBatchNextSitePicker.vue';
import { uploadFile } from '@/api/common';
import { queryByBillCodes , writeoffApply ,getWriteoffApply ,updateWriteoffApply } from "@/api/emis/emisSettleCancelAccount";
import EmpNamePicker from '@/views/emis/EmisBaseTools/EmpNamePicker.vue';
export default {
name: "CancelAccountApplicationFormPanel",
props: {
applyId: {
type: [Number, Array],
required: false
},
isCopy: {
type: Boolean
},
disabled: {
type: [Boolean],
required: false
},
name: {
type: String,
default: ''
}
},
components: { EmisGetNextSitePicker, CountryPicker, EmisSiteSimplePicker, elDateAdvPicker, emisTmsPackForm, TransLinePicker, TransProductPicker, PackListView, EmisSupplierPicker, EmisTmsSiteBatchSupplierPicker, EmisTmsSiteBatchNextSitePicker, uploadFile ,EmpNamePicker },
dicts: ['emis_waybill_status', 'emis_payment_type', 'emis_biz_shipping_method', 'emis_qujian_fangshi', 'cebp_return_status', 'emis_declare_mode', 'emis_customs_clear', 'emis_big_batch_type', 'emis_settlebill_pay_type'],
data() {
return {
// 遮罩层
loading: false,
isDoing: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
addWayBillDisabled: true,
// packDisabled: true,
activeName: 'third',
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange: [],
// 总条数
total: 0,
// TMS组批次表格数据
emisTmsPackList: [],
// 待组批次列表
emisTmsWaitPackList: [],
waitTotal: 0,
// 已组批次列表
emisTmsDonePackList: [],
doneTotal: 0,
waitPackList: [],//选择未组包的运单先保存起来,在后续新增组批次的弹框中使用
// 新增/修改弹窗数据
form: {},
rules: {
payType: [
{ required: true, message: "支付方式不能为空", trigger: ["blur", "change"] },
],
writeoffAmount: [
{ required: true, message: "销账金额不能为空", trigger: ["blur", "change"] },
],
recipient: [
{ required: true, message: "收款人不能为空", trigger: ["blur", "change"] },
],
tradeDate: [
{ required: true, message: "交易日期不能为空", trigger: ["blur", "change"] },
],
},
openBatch: false,
titleBatch: "",
inputBatchBillCode: "",
waitBatchDtlList: [],
blUnpack: "1",
// 追加的运单数据
emisWayBillList: [],
wayBillotal: 0,
currentId: null,
openForm: false,
titleForm: "",
titleWayBill: null,
openWayBillForm: false,
// 临时存储
tempCoPackInfo: {},
// 弹出展示层
id: null,
titleView: "",
openView: false,
tableData: [
{ 1: '', 2: '', 3: '', 4: '', 5: '', 6: '' },
{ 1: '', 2: '', 3: '', 4: '', 5: '', 6: '' },
{ 1: '', 2: '', 3: '', 4: '', 5: '', 6: '' }
],
tableDataId: [
{ 1: '', 2: '', 3: '', 4: '', 5: '', 6: '' },
{ 1: '', 2: '', 3: '', 4: '', 5: '', 6: '' },
{ 1: '', 2: '', 3: '', 4: '', 5: '', 6: '' }
],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
billCode: null,
orderSN: null,
batchNo: null,
// packNo: null,
// packName: null,
// packDate: null,
destCountry: null,
destCountryName: null,
// blUnpack: null,
// sendSiteCode: null,
// totalParcelQty: null,
// totalWaybillQty: null,
// totalVolume: null,
// totalWeight: null,
// packStatus: null,
// opMan: null,
// remark: null,
// delFlag: null,
params: {
queryOrderType: '0',
queryOrderDateType: '1'
},
},
queryCoParams: {
params: {}
},
// 查询参数
queryWaitParams: {
pageNum: 1,
pageSize: 20,
packNo: null,
beginCreateTime: null,
endCreateTime: null,
params: {}
},
// 查询参数
queryDoneParams: {
pageNum: 1,
pageSize: 20,
packNo: null,
params: {}
},
};
},
created() {
this.initData();
},
methods: {
initData() {
if (this.applyId != null) {
console.log('initData', this.applyId);
this.loading = true;
getWriteoffApply(this.applyId).then(response => {
this.form = response.data;
this.waitBatchDtlList = this.form.detailList;
console.log('initData form', this.form);
this.form.picUrl = this.form.imageList.map(item => item.imagePath).join(',');
this.loading = false;
});
} else {
this.reset();
this.form.startSiteCode = this.$store.getters.ownerSiteCode;
this.form.batchType = '1';
this.form.batchNo = null;
// getTmsGroupBatchNo().then(resPack => {
// this.form.batchNo = resPack.data;
// });
this.form.batchDate = parseTime(new Date());
}
},
initBatchBillRel(batchNo) {
this.waitBatchDtlList = [];
listEmisTmsSiteBatchDtl({ batchNo: batchNo }).then(response => {
let rows = response.rows;
let cvtBillList = rows.map(item => {
let batchVolume = item.batchVolume;
let batchParcelQty = item.batchParcelQty;
let batchWeight = item.batchWeight;
return { ...item.waybillDetail, batchVolume, batchParcelQty, batchWeight, batchId: item.id };
// return item.waybillDetail
});
this.waitBatchDtlList = cvtBillList;
this.computeTotal();
});
},
// 表单重置
reset() {
this.form = {
id: null,
batchNo: null,
batchName: null,
batchDate: null,
supplierCode: null,
supplierName: null,
supplierNameEn: null,
transLineType: null,
productType: null,
batchType: null,
transType: null,
startSiteCode: null,
startSiteSizeCode3: null,
sendCountry: null,
nextSiteCode: null,
nextSiteSizeCode3: null,
airBilllNo: null,
etd: null,
eta: null,
carNo: null,
shipNo: null,
clearanceResStatus: null,
declareResStatus: null,
destCountry: null,
destCountryName: null,
transWeight: null,
packNum: null,
totalParcelQty: null,
totalWaybillQty: null,
totalVolume: null,
totalWeight: null,
opMan: null,
remark: null,
tenantId: null,
loadingList: [],
batchDtlList: [],
};
this.resetForm("form");
},
submitSaveBatchForm() {
if (this.waitBatchDtlList.length == 0) {
this.$modal.msgError("请加入销账运单列表")
return;
}
this.$refs["form"].validate(async valid => {
if (valid) {
if (this.isCopy) {
this.form.id = null;
}
this.form.detailList = this.waitBatchDtlList;
// 新增配载数据 tableData
this.form.imageList = [];
if (this.form.picUrl) {
this.form.imageList = [];
this.form.picUrl.split(',').forEach(item => {
this.form.imageList.push({
imageName: item,
imagePath: item,
})
});
}
if (this.form.id != null) { // 编辑
this.isDoing = true;
try {
const ret = await updateWriteoffApply(this.form);
this.isDoing = false;
this.$modal.msgSuccess("修改成功");
this.$emit("on-changed");
} catch (e) {
this.isDoing = false;
}
} else { // 新增
this.isDoing = true;
try {
if (this.isCopy) {
this.form.updateTime = null;
this.form.updateBy = null;
this.form.updateByName = null;
this.form.updateSite = null;
this.form.updateSiteName = null;
}
let res = await writeoffApply(this.form);
this.isDoing = false;
this.$modal.msgSuccess("新增成功");
this.$emit("on-changed");
} catch (e) {
this.isDoing = false;
}
}
}
});
},
handleCancelCo() {
this.form = {};
this.blUnpack = "1";
this.waitBatchDtlList = [];
this.$emit("on-cancel");
},
// 加入订单
async addBillToBatch() {
if (this.inputBatchBillCode == null || this.inputBatchBillCode == '') {
this.$modal.msgError("请输入单号");
return;
}
// 剔除重复值,并剔除已存在列表中的数据
let addBillCodeArr = this.inputBatchBillCode.trim().split(/[;\;\,\,\n]/) || [];
let oldBillCodeArr = this.waitBatchDtlList.map(item => { return item.billCode });
// 唯一值处理
const uniqueSet = new Set([...addBillCodeArr, ...oldBillCodeArr]);
const uniqueArr = [...uniqueSet];
// 剔除已存在的值
const billCodeArr = uniqueArr.filter(
item => !oldBillCodeArr.some(oldItem => item === oldItem)
);
for (let i = 0; i < billCodeArr.length; i++) {
let billcode = billCodeArr[i].trim();
let queryParams = {
params: {
queryParams: billcode,
}
}
queryByBillCodes(queryParams).then(res => {
const billData = res.data;
console.log('queryByBillCodes', billData);
let item = { ...billData[0]};
this.waitBatchDtlList.push(item);
})
}
console.log('addBillToBatch', this.waitBatchDtlList);
this.titleBatch = "";
this.openBatch = false;
this.inputBatchBillCode = "";
},
handleCoPackListDelete() {
this.$confirm('确认删除?', '确认信息')
.then((isPass) => {
if (isPass) {
let newList = [];
this.waitBatchDtlList.forEach(item => {
if (this.coSelection.filter(cs => cs.billCode == item.billCode) == 0) {
newList.push(item);
}
});
this.waitBatchDtlList = newList;
console.log('handleCoPackListDelete', newList);
}
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
// this.queryParams.pageSize = 20;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selection = selection;
this.single = selection.length !== 1
this.multiple = !selection.length
this.coSelection = selection;
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
handleAddWayBill() {
this.openBatch = true;
this.titleBatch = "批量输入运单号";
},
cancelAddBillToBatch() {
this.openBatch = false;
this.titleBatch = "";
this.inputBatchBillCode = "";
},
handleView(row) {
this.id = row.id;
this.titleView = "查看";
this.openView = true;
// this.router.push({ path: '/emis/emisTmsPack/viewDetail', query: { id: row.id }})
},
handleFormChanged() {
this.openForm = false;
this.getList();
},
cancelForm() {
this.openForm = false;
},
/** 导出按钮操作 */
handleDownBatchDtl() {
const loadingInstance = this.$loading({
text: '正在导出...'
})
this.exportData(this.waitBatchDtlList, loadingInstance);
// let qExportParam={
// pageNum:1,
// pageSize:20000,
// batchNo: this.form.batchNo
// };
// listEmisTmsSiteBatchDtl(qExportParam).then(response => {
// if (response.code === 200) {
// this.exportData(response.rows,loadingInstance);
// }
// });
},
exportData(selData, loadingInstance) {
const curList = selData
import('@/vendor/Export2Excel').then(excel => {
const exportParam = this.$refs.refTable.getExportParam();
const tHeader = exportParam.header;
const filterVal = exportParam.filter;
console.log("===>filterVal===>", filterVal);
const data = this.formatJson(filterVal, curList, selData)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '批次明细导出',
autoWidth: true
})
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
// console.log("===>1111===>",v);
if (j === 'index') {
return ++index
}
if (j === 'kjlx') {
return v['sendSiteName'] + '--' + v['dispatchUnderlingSiteName'];
}
if (j === 'fjr') {
return v['sendName'] + '--' + v['receiveName'];
}
if (j === 'receiveCountryName') {
return v['receiveCountryName'];
}
if (j === 'sendCountryName') {
return v['sendCountryName'];
}
if (j === 'estimateDate') {
return v['estimateDate'];
}
if (j === 'sendSiteName') {
return v['sendSiteName'];
}
if (j === 'sendName') {
return v['sendName'];
}
if (j === 'receiveName') {
return v['receiveName'];
}
if (j === 'sendDate') {
return v['sendDate'];
}
if (j === 'sendCompany') {
return v['sendCompany'];
}
if (j === 'receiveCompany') {
return v['receiveCompany'];
}
if (j === 'transLineTypeName') {
return v['transLineTypeName'];
}
if (j === 'productTypeName') {
return v['productTypeName'];
}
if (j === 'sendName') {
return v['sendName'];
}
if (j === 'parcelQty') {
return v['parcelQty'];
}
if (j === 'billWeight') {
return v['billWeight'];
}
if (j === 'volumeWeight') {
return v['volumeWeight'];
}
if (j === 'totalVolume') {
return v['totalVolume'];
}
if (j === 'settlementWeight') {
return v['settlementWeight'];
}
if (j === 'freight') {
return v['freight'];
}
if (j === 'realFee') {
return v['realFee'];
}
if (j === 'remark') {
return v['remark'];
}
if (j === 'feeRemark') {
return v['feeRemark'];
}
if (j === 'salesmen') {
return v['salesmen'];
}
if (j === 'payee') {
return v['payee'];
}
if (j === 'payee') {
return v['payee'];
}
if (j === 'problemTypeName') {
return v['problemTypeName'];
}
if (j === 'problemCause') {
return v['problemCause'];
}
if (j === 'sendMobile') {
return "";
}
if (j === 'calcFeeType') {
return this.selectDictLabel(this.dict.type.emis_calc_fee_type, v['calcFeeType']);
}
if (j === 'waybillDetail.paymentStatus') {
return this.selectDictLabel(this.dict.type.emis_payment_status, v['paymentStatus']);
}
if (j === 'pickupMethod') {
return this.selectDictLabel(this.dict.type.emis_qujian_fangshi, v['pickupMethod']);
}
if (j === 'customsEclaration') {
return this.selectDictLabel(this.dict.type.emis_declare_mode, v['customsEclaration']);
}
if (j === 'customsClear') {
return this.selectDictLabel(this.dict.type.emis_customs_clear, v['customsClear']);
}
if (j === 'packType') {
return this.selectDictLabels(this.dict.type.emis_tab_packing_type, v['packType']);
}
if (j === 'dispatchMethod') {
if (v['dispatchMethod'] == 1) {
return '派送';
} else {
return '自提';
}
}
if (j === 'blMessage') {
if (v['blMessage'] == 1) {
return '发送';
} else {
return '不发送';
}
}
if (j === 'blAcceptMessage') {
if (v['blAcceptMessage'] == 1) {
return '发送';
} else {
return '不发送';
}
}
if (j === 'blSign') {
if (v['blSign'] == 1) {
return '已签收';
} else {
return '未签收';
}
}
if (j === 'paymentType') {
return this.selectDictLabel(this.dict.type.emis_payment_type, v['paymentType']);
}
return v[j]
}))
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
/** 时间搜索响应函数 */
dateTimeChange(value) {
this.dateTimeRange = value;
},
/** 导出按钮操作 */
handleExport() {
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = { ...this.queryParams };
qParam.pageNum = 1;
qParam.pageSize = 5000;
listEmisTmsSiteBatchDtl({ batchNo: this.form.batchNo }).then(response => {
this.downloadLoading = false
if (response.code === 200) {
const curList = response.rows.map(item => {
return {
"billCode": item.billCode,
...item.waybillDetail,
}
})
console.log(curList)
setTimeout(() => {
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['运单号', '寄件网点', '寄件国家', '目的国家', '线路', '产品类型', '寄件日期', '预计到达时间', '总件数', '实际重量', '总体积', '体积重量', '结算重量', '收件人', '收件公司', '报关方式', '清关方式', '取件方式', '付款方式', '运费', '寄件人', '寄件公司', '录单备注'];
const filterVal = ['billCode', 'sendSiteName', 'sendCountryName', 'receiveCountryName', 'transLineTypeName', 'productTypeName', 'sendDate', 'estimateDate', 'parcelQty', 'billWeight', 'totalVolume', 'volumeWeight', 'settlementWeight', 'receiveName', 'receiveCompany', 'customsEclaration', 'customsClear', 'pickupMethod', 'paymentType', 'freight', 'sendName', 'sendCompany', 'remark'];
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '批次明细导出',
autoWidth: true
})
loadingInstance.close()
})
}, 500)
}
});
},
}
};
</script>
<style lang="scss">
.el-divider {
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
.query-label {
.el-radio {
display: block;
line-height: 23px;
white-space: normal;
margin-right: 0;
}
}
.overflowhidden {
overflow: hidden;
}
.ellipsis {
width: 100px;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
}
.cargoList {
.el-input__inner {
height: 28px;
line-height: 28px;
border: none;
background: #ffffcd;
font-size: 10px;
padding: 0px;
text-align: center;
}
.el-input-number {
width: 100% !important;
}
.el-input-number.is-without-controls .el-input__inner {
height: 28px;
line-height: 28px;
border: none;
background: #ffffcd;
font-size: 10px;
padding: 0px;
text-align: center;
}
}
</style>