| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674 |
- <template>
- <el-dialog
- :title="type == 2 ? '选择付款计划' : '选择收款计划'"
- custom-class="ele-dialog-form long-dialog-form"
- :visible.sync="collectionPlanDialogFlag"
- :before-close="handleClose"
- :close-on-click-modal="false"
- top="5vh"
- :close-on-press-escape="false"
- append-to-body
- width="70%"
- >
- <el-card shadow="never">
- <div>
- <el-form label-width="90px" :inline="true" ref="form" :rules="rules" labelWidth="120px" :model="searchForm">
- <el-form-item
- :label="type == 2 ? '供应商名称' : '客户名称'"
- prop="customerName"
- >
- <el-input
- clearable
- v-model="searchForm.customerName"
- @click.native="handParent"
- placeholder="请选择"
- readonly
- />
- </el-form-item>
- <el-form-item
- :label="type == 2 ? '购买方名称' : '销售方名称'"
- prop="initiatorId"
- >
- <el-select
- style="width: 100%"
- v-model="searchForm.initiatorId"
- placeholder="请选择"
- @change="getEnterprise()"
- >
- <el-option
- v-for="item in enterprisePage"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="交易方式"
- prop="transactionMode"
- >
- <el-select
- style="width: 100%"
- v-model="searchForm.transactionMode"
- placeholder="请选择"
- disabled
- >
- <el-option
- v-for="item in transactionMethodsOp"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- icon="el-icon-search"
- class="ele-btn-icon"
- @click="search"
- >
- 查询
- </el-button>
- <!-- <el-button @click="reset" icon="el-icon-refresh-left" type="primary"
- >重置</el-button
- > -->
- </el-form-item>
- </el-form>
- </div>
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- row-key="id"
- height="calc(100vh - 500px)"
- class="dict-table"
- :selection.sync="selection"
- @columns-change="handleColumnChange"
- :initLoad="false"
- >
- <!-- 表头工具栏 -->
- <template v-slot:action="{ row }">
- <el-button size="mini" type="text" @click="handleSelect(row)"
- >对账明细</el-button
- >
- </template>
- </ele-pro-table>
- </el-card>
- <div slot="footer">
- <el-button size="small" type="primary" @click="handleSelect">
- 选择
- </el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </div>
- <!-- 对账明细 -->
- <accountInfoDialog
- ref="accountInfoDialogRef"
- v-if="accountInfoDialogFlag"
- :account-info-dialog-flag.sync="accountInfoDialogFlag"
- @getAccountInfo="getAccountInfo"
- ></accountInfoDialog>
- <!-- 客户 -->
- <customerList ref="curtomerRef" @changeParent="changeParent"></customerList>
- <!-- 供应商 -->
- <supplierList
- ref="supplierRef"
- @changeParent="changeParent"
- :classType="2"
- ></supplierList>
- </el-dialog>
- </template>
- <script>
- import dictMixins from '@/mixins/dictMixins';
- import tabMixins from '@/mixins/tableColumnsMixin';
- import accountInfoDialog from './accountInfoDialog.vue';
- import { shippingModeOp, transactionMethodsOp, paymentStatus, paymentType, invoiceStatusOp } from '@/enum/dict.js';
- import { receiptPaymentPlanPage } from '@/api/financialManage/payAndCollectPlan';
- import customerList from '@/views/saleManage/contact/components/parentList.vue';
- import supplierList from '@/views/purchasingManage/supplierManage/components/parentList.vue';
- import { enterprisePage } from '@/api/contractManage/contractBook';
- export default {
- mixins: [dictMixins, tabMixins],
- components: {
- accountInfoDialog,
- customerList,
- supplierList
- },
- props: {
- form: {
- type: Object,
- default: () => {
- return {};
- }
- },
- type: {
- type: String,
- default: '1'
- },
- collectionPlanDialogFlag: {
- default: false,
- type: Boolean
- },
- contactData: {
- type: Object,
- default: () => {
- return {};
- }
- }
- },
- computed: {
- columns() {
- return [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center',
- fixed: 'left'
- },
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'detailNo',
- label: this.type == 2 ? '付款计划编码' : '收款计划编码',
- align: 'center',
- sortable: true,
- slot: 'detailNo',
- showOverflowTooltip: true,
- minWidth: 200,
- },
- {
- prop: 'sourceOrderNo',
- label: '订单编码',
- align: 'center',
- sortable: true,
- slot: 'sourceOrderNo',
- showOverflowTooltip: true,
- minWidth: 200,
- },
- {
- prop: 'sourceOrderType',
- label: '订单类型',
- align: 'center',
- sortable: true,
- showOverflowTooltip: true,
- minWidth: 200,
- formatter: (row) => {
- return row.sourceOrderType == 2 ? '采购订单' : '销售订单';
- }
- },
- {
- prop: 'contractNo',
- label: '合同编码',
- align: 'center',
- sortable: true,
- showOverflowTooltip: true,
- minWidth: 200,
- },
- {
- prop: 'contractCode',
- label: '合同编号',
- align: 'center',
- sortable: true,
- showOverflowTooltip: true,
- minWidth: 200,
- },
- {
- prop: 'contractName',
- label: '合同名称',
- align: 'center',
- sortable: true,
- showOverflowTooltip: true,
- minWidth: 200,
- },
- {
- prop: 'invoiceOrderNo',
- label: '发票号',
- align: 'center',
- sortable: true,
- showOverflowTooltip: true,
- minWidth: 200,
- },
- {
- prop: 'relatedReceivableOrderNo',
- label: this.type == 2 ? '关联应付编码' : '关联应收编码',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150
- },
- {
- prop: 'customerCode',
- label: '客户编号',
- align: 'center',
- slot: 'customerCode',
- showOverflowTooltip: true,
- minWidth: 250
- },
- {
- prop: 'customerName',
- label: '客户名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'initiatorName',
- label: this.type == 2 ? '购买方名称':'销售方名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'settlementMode',
- label: '结算方式',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140,
- formatter: (row) => {
- return this.getDictValue('结算方式', row.settlementMode);
- }
- },
- {
- prop: 'transactionMode',
- label: '交易方式',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200,
- formatter: (row) => {
- return this.transactionMethodsOp.find(item => item.value == row.transactionMode)?.label || '';
- }
- },
- {
- prop: 'deliveryMode',
- label: '发货模式',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130,
- formatter: (row) => {
- return this.shippingModeOp.find(item => item.value == row.deliveryMode)?.label || '';
- }
- },
- {
- prop: 'issueNumber',
- label: '期数',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130
- },
- {
- prop: 'paymentType',
- label: '款项类型',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'moneyName',
- label: '款项名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'paymentRatio',
- label: '比例',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'planPaymentAmount',
- label: this.type == 2 ? '计划付款金额' : '计划收款金额',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'planPaymentDate',
- label: this.type == 2 ? '计划付款日期' : '计划收款日期',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'isInvoice',
- label: '是否已开票',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- formatter: (_row, _column, cellValue) => {
- return cellValue ? '是' : '否';
- }
- },
- {
- prop: 'invoiceAmount',
- label: '已开票金额',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'invoiceDate',
- label: '开票日期',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130
- },
- {
- prop: 'isGenerateReceivablePayment',
- label: this.type == 2 ? '是否生成应付款项' : '是否生成应收款项',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130,
- formatter: (_row, _column, cellValue) => {
- return cellValue == 1 ? '是' : '否';
- }
- },
- {
- prop: 'receivableAmount',
- label: this.type == 2 ? '应付金额' : '应收金额',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'receivedAmount',
- label: this.type == 2 ? '已付款金额' : '已收款金额',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 170
- },
- {
- prop: 'actualReceivablePaymentDate',
- label: this.type == 2 ? '实际付款日期' : '实际收款日期',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 170
- },
- {
- prop: 'deliveryStatus',
- label: this.type == 2 ? '收货状态' : '发货状态',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- let options = this.menu === 'purchase' ? [
- { value: 0, label: '待收货' },
- { value: 1, label: '部分收货' },
- { value: 2, label: '全部收货' }
- ] : [
- { value: 0, label: '待发货' },
- { value: 1, label: '部分发货' },
- { value: 2, label: '全部发货' }
- ];
- return options.find(item => item.value == cellValue)?.label || '';
- },
- minWidth: 120
- },
- {
- prop: 'reconciliationStatus',
- label: '对账状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- let options = [
- { value: 0, label: '未对账' },
- { value: 1, label: '部分对账' },
- { value: 2, label: '全部对账' }
- ];
- return options.find(item => item.value == cellValue)?.label || '';
- }
- },
- {
- prop: 'invoiceStatus',
- label: '开票状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- return this.invoiceStatusOp.find(item => item.value == cellValue)?.label || '';
- }
- },
- {
- prop: 'paymentStatus',
- label: this.type == 2 ? '付款状态' : '收款状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- let options = this.menu === 'purchase' ? this.paymentType : this.paymentStatus;
- return options.find(item => item.value == cellValue)?.label || '';
- }
- },
- {
- prop: 'overdueStatus',
- label: '逾期状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- return _row.overdueStatus == 1 ? '逾期中' : '未逾期';
- }
- },
- // {
- // columnKey: 'action',
- // label: '操作',
- // width: 180,
- // align: 'center',
- // resizable: false,
- // slot: 'action',
- // showOverflowTooltip: true,
- // fixed: 'right'
- // }
- ]
- },
- rules() {
- return {
- initiatorId: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- customerName: [
- { required: true, message: '请选择', trigger: 'blur' }
- ],
- transactionMode: [
- { required: true, message: '请选择', trigger: 'blur' }
- ]
- }
- },
- },
- data() {
- return {
- enterprisePage: [],
- searchForm: {
- initiatorId: '',
- customerId: '',
- customerName: '',
- transactionMode: 1
- },
- currentIndex: null,
- accountInfoDialogFlag: false,
- currentRow: {},
- radio: null,
- shippingModeOp,
- transactionMethodsOp,
- selection: [],
- paymentStatus,
- paymentType,
- invoiceStatusOp
- };
- },
- created() {
- this.requestDict('结算方式');
- this.getEnterprisePage();
- },
- methods: {
- handParent() {
- let item = {
- id: this.searchForm.customerId
- };
- if (this.type == 2) {
- this.$refs.supplierRef.open(item);
- } else {
- this.$refs.curtomerRef.open(item);
- }
- },
- search() {
- this.$refs.form.validate(async (valid) => {
- if (!valid) return this.$message.warning('请选择查询条件');
- this.reload(this.searchForm);
- });
- },
- reset() {
- this.searchForm = {
- initiatorId: '',
- customerId: '',
- customerName: '',
- transactionMode: 1
- };
- this.reload(this.searchForm);
- },
- changeParent(item) {
- this.searchForm.customerName = item.name;
- this.searchForm.customerId = item.id;
- },
- getEnterprisePage() {
- enterprisePage({
- pageNum: 1,
- size: 100
- }).then((res) => {
- this.enterprisePage = [];
- this.enterprisePage.push(...res.list);
- this.searchForm.initiatorId = this.enterprisePage[0].id;
- this.reload(this.searchForm);
- });
- },
- getEnterprise(val) {
- let data = this.enterprisePage.find(
- (item) => item.id == val
- );
- // this.searchForm.customerName = data.name;
- // this.searchForm.initiatorId = data.id;
- },
- init(item = {}, currentIndex = '') {
- this.currentIndex = currentIndex;
- // if (item.id) {
- // this.radio = item.id;
- // }
- },
- getAccountInfo(item) {
- this.currentRow.children = item;
- this.$emit('getAccountData', this.currentRow);
- this.handleClose();
- },
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- return receiptPaymentPlanPage({
- pageNum: page,
- size: limit,
- ...where,
- invoiceStatus: '0,1',
- // reviewStatus: 2,
- sourceType: this.type
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ pageNum: 1, where: where });
- },
- handleSelect(row, index) {
- if(this.selection.length == 0) {
- this.$message({
- message: '请选择计划',
- type: 'warning'
- });
- return;
- }
- let customerIds = this.selection.map((item) => item.customerId);
- let initiatorIds = this.selection.map((item) => item.initiatorId);
- let invoiceStatus = this.selection.map((item) => item.invoiceStatus);
- console.log(customerIds, initiatorIds);
- let flag = false
- // if(this.type == 2) {
- // this.selection.forEach(item => {
- // if(item.transactionMode == 2 && item.paymentStatus == 0) {
- // console.log('selection', item);
- // flag = true
- // }
- // })
- // }
-
- console.log(customerIds, initiatorIds, flag);
- // if(flag) {
- // this.$message.warning('先款后票的计划需要付款后再开票!');
- // return
- // }
- if(invoiceStatus.includes(2)) {
- this.$message.warning('请选择未开票的计划!');
- return
- }
- if(this.selection.length == 0 || new Set(customerIds).size != 1 || new Set(initiatorIds).size != 1) {
- this.$message.warning('请选择相同客户和销售方的计划!');
- return
- }
- this.$emit('getPlanData', this.selection)
- this.handleClose()
- // this.currentRow = row;
- // this.accountInfoDialogFlag = true;
- // this.$nextTick(() => {
- // this.$refs.accountInfoDialogRef.init(row, index);
- // });
- },
- handleClose() {
- this.$emit('update:collectionPlanDialogFlag', false);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .tree_col {
- border: 1px solid #eee;
- padding: 10px 0;
- box-sizing: border-box;
- height: 500px;
- overflow: auto;
- }
- .table_col {
- padding-left: 10px;
- ::v-deep .el-table th.el-table__cell {
- background: #f2f2f2;
- }
- }
- .pagination {
- text-align: right;
- padding: 10px 0;
- }
- .btns {
- text-align: center;
- padding: 10px 0;
- }
- .topsearch {
- margin-bottom: 15px;
- }
- </style>
|