489 lines
18 KiB
Vue
489 lines
18 KiB
Vue
<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-col :span="4">
|
||
<el-form-item :label="$t('申请说明')" prop="applyMemo">
|
||
<el-input v-model="form.applyMemo" type="textarea" :rows="2" clearable=""
|
||
placeholder="申请说明"></el-input>
|
||
</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-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="expressType" min-width="200" />
|
||
<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.productTypeName"
|
||
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 { 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: { uploadFile, EmpNamePicker },
|
||
dicts: [ 'emis_payment_type', 'emis_settlebill_pay_type'],
|
||
data() {
|
||
return {
|
||
// 遮罩层
|
||
loading: false,
|
||
isDoing: false,
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
// 创建时间搜索
|
||
dateTimeRange: [],
|
||
// 总条数
|
||
total: 0,
|
||
// 新增/修改弹窗数据
|
||
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: [],
|
||
currentId: null,
|
||
openForm: false,
|
||
titleForm: "",
|
||
id: null,
|
||
titleView: "",
|
||
openView: false,
|
||
// 查询参数
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 20,
|
||
billCode: null,
|
||
orderSN: null,
|
||
destCountry: null,
|
||
destCountryName: null,
|
||
params: {
|
||
queryOrderType: '0',
|
||
queryOrderDateType: '1'
|
||
},
|
||
},
|
||
queryCoParams: {
|
||
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;
|
||
this.form.picUrl = this.form.imageList.map(item => item.imagePath).join(',');
|
||
this.loading = false;
|
||
});
|
||
} else {
|
||
this.reset();
|
||
}
|
||
},
|
||
// 表单重置
|
||
reset() {
|
||
this.form = {
|
||
writeoffAmount: null,
|
||
payType: null,
|
||
recipient: null,
|
||
tradeDate: null,
|
||
applyMemo: null,
|
||
picUrl: null,
|
||
};
|
||
this.waitBatchDtlList = [];
|
||
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);
|
||
})
|
||
}
|
||
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;
|
||
},
|
||
/** 列索引函数 */
|
||
getIndex($index) {
|
||
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
|
||
},
|
||
/** 时间搜索响应函数 */
|
||
dateTimeChange(value) {
|
||
this.dateTimeRange = value;
|
||
},
|
||
}
|
||
};
|
||
</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>
|