|
|
@@ -31,278 +31,302 @@
|
|
|
</ele-pro-table>
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" size="small" @click="selected"
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="selected"
|
|
|
+ v-if="isContractBook"
|
|
|
>生成合同
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="selected"
|
|
|
+ v-if="!isContractBook"
|
|
|
+ >选择
|
|
|
+ </el-button>
|
|
|
<el-button size="small" @click="handleClose">关闭</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import searchQuotation from '@/views/saleManage/quotation/components/searchQuotation.vue';
|
|
|
+ import searchQuotation from '@/views/saleManage/quotation/components/searchQuotation.vue';
|
|
|
|
|
|
-import {
|
|
|
- getTableList,
|
|
|
- getDetail,
|
|
|
- isHasGeneratedContractAPI
|
|
|
-} from '@/api/saleManage/quotation';
|
|
|
-import dictMixins from '@/mixins/dictMixins';
|
|
|
+ import {
|
|
|
+ getTableList,
|
|
|
+ getDetail,
|
|
|
+ isHasGeneratedContractAPI
|
|
|
+ } from '@/api/saleManage/quotation';
|
|
|
+ import dictMixins from '@/mixins/dictMixins';
|
|
|
|
|
|
-export default {
|
|
|
- mixins: [dictMixins],
|
|
|
- components: {
|
|
|
- searchQuotation
|
|
|
- },
|
|
|
- //客户管理数据
|
|
|
- props: {
|
|
|
- contactData: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {};
|
|
|
- }
|
|
|
+ export default {
|
|
|
+ mixins: [dictMixins],
|
|
|
+ components: {
|
|
|
+ searchQuotation
|
|
|
},
|
|
|
- businessOpportunityData: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {};
|
|
|
+ //客户管理数据
|
|
|
+ props: {
|
|
|
+ contactData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
+ },
|
|
|
+ businessOpportunityData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isContractBook: {
|
|
|
+ type: Boolean,
|
|
|
+ default: true
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- radio: null,
|
|
|
- visible: false,
|
|
|
- loading: false,
|
|
|
- columns: [
|
|
|
- {
|
|
|
- action: 'action',
|
|
|
- slot: 'action',
|
|
|
- align: 'center',
|
|
|
- label: '选择'
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'contactName',
|
|
|
- label: '询价方名称',
|
|
|
- align: 'center',
|
|
|
- slot: 'contactName',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 200
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'contactLinkName',
|
|
|
- label: '询价方联系人',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 140
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'contactTel',
|
|
|
- label: '询价方联系电话',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 140
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'quoteName',
|
|
|
- label: '报价方名称',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 200
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'quoteLinkName',
|
|
|
- label: '报价方联系人',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 140
|
|
|
- },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ radio: null,
|
|
|
+ visible: false,
|
|
|
+ loading: false,
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ action: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ align: 'center',
|
|
|
+ label: '选择'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'contactName',
|
|
|
+ label: '询价方名称',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'contactName',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 200
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'contactLinkName',
|
|
|
+ label: '询价方联系人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'contactTel',
|
|
|
+ label: '询价方联系电话',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'quoteName',
|
|
|
+ label: '报价方名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 200
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'quoteLinkName',
|
|
|
+ label: '报价方联系人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- prop: 'quoteTel',
|
|
|
- label: '报价方联系电话',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 140
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'deliveryDate',
|
|
|
- label: '交货日期',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 100
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'settlementModeName',
|
|
|
- label: '付款方式',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 100
|
|
|
- },
|
|
|
+ {
|
|
|
+ prop: 'quoteTel',
|
|
|
+ label: '报价方联系电话',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'deliveryDate',
|
|
|
+ label: '交货日期',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 100
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'settlementModeName',
|
|
|
+ label: '付款方式',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 100
|
|
|
+ },
|
|
|
|
|
|
- // {
|
|
|
- // prop: 'taxRate',
|
|
|
- // label: '税率',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 140,
|
|
|
- // formatter: (_row, _column, cellValue) => {
|
|
|
- // return _row.taxRate + '%';
|
|
|
- // }
|
|
|
- // },
|
|
|
- {
|
|
|
- prop: 'totalPrice',
|
|
|
- label: '总金额',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 100
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createTime',
|
|
|
- label: '创建时间',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 170,
|
|
|
- formatter: (_row, _column, cellValue) => {
|
|
|
- return this.$util.toDateString(cellValue);
|
|
|
+ // {
|
|
|
+ // prop: 'taxRate',
|
|
|
+ // label: '税率',
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // minWidth: 140,
|
|
|
+ // formatter: (_row, _column, cellValue) => {
|
|
|
+ // return _row.taxRate + '%';
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ prop: 'totalPrice',
|
|
|
+ label: '总金额',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 100
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 170,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return this.$util.toDateString(cellValue);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {},
|
|
|
- created() {},
|
|
|
- methods: {
|
|
|
- open() {
|
|
|
- this.visible = true;
|
|
|
+ ]
|
|
|
+ };
|
|
|
},
|
|
|
+ computed: {},
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ open() {
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where, order }) {
|
|
|
- if(this.contactData.id){
|
|
|
- where['contactId']=this.contactData.id
|
|
|
- }
|
|
|
- if(this.businessOpportunityData.id){
|
|
|
- where['opportunityId']=this.businessOpportunityData.id
|
|
|
- }
|
|
|
-
|
|
|
- return getTableList({
|
|
|
- pageNum: page,
|
|
|
- size: limit,
|
|
|
- ...where,
|
|
|
- status: 2,
|
|
|
- dataStatus: 1
|
|
|
- });
|
|
|
- },
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- },
|
|
|
- // 单击获取id
|
|
|
- cellClick(row) {
|
|
|
- this.current = row;
|
|
|
- this.radio = row.id;
|
|
|
- },
|
|
|
- handleClose() {
|
|
|
- this.visible = false;
|
|
|
- this.current = null;
|
|
|
- },
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where, order }) {
|
|
|
+ if (this.contactData.id) {
|
|
|
+ where['contactId'] = this.contactData.id;
|
|
|
+ }
|
|
|
+ if (this.businessOpportunityData.id) {
|
|
|
+ where['opportunityId'] = this.businessOpportunityData.id;
|
|
|
+ }
|
|
|
|
|
|
- async selected() {
|
|
|
- if (!this.current) {
|
|
|
- return this.$message.warning('请至少选择一条数据');
|
|
|
- }
|
|
|
- let data = await this.addGenerateContract();
|
|
|
+ return getTableList({
|
|
|
+ pageNum: page,
|
|
|
+ size: limit,
|
|
|
+ ...where,
|
|
|
+ status: 2,
|
|
|
+ dataStatus: 1
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ },
|
|
|
+ // 单击获取id
|
|
|
+ cellClick(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.radio = row.id;
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.visible = false;
|
|
|
+ this.current = null;
|
|
|
+ },
|
|
|
|
|
|
- if (data) {
|
|
|
- this.$emit('changeParent', { data, sourceCode: this.current.code,sourceName:this.current.name });
|
|
|
+ async selected() {
|
|
|
+ if (!this.current) {
|
|
|
+ return this.$message.warning('请至少选择一条数据');
|
|
|
+ }
|
|
|
+ let data = null;
|
|
|
+ // if (this.isContractBook) {
|
|
|
+ // data = await this.addGenerateContract();
|
|
|
+ // } else {
|
|
|
+ // data = await getDetail(this.current.id);
|
|
|
+ // }
|
|
|
+ data = await this.addGenerateContract(true);
|
|
|
+ if (data) {
|
|
|
+ this.$emit('changeParent', {
|
|
|
+ data,
|
|
|
+ sourceCode: this.current.code,
|
|
|
+ sourceName: this.current.name,
|
|
|
+ sourceId: this.current.id
|
|
|
+ });
|
|
|
|
|
|
- this.handleClose();
|
|
|
+ this.handleClose();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //新增合同
|
|
|
+ async addGenerateContract(type) {
|
|
|
+ //报价单是否生成过合同
|
|
|
+ let res = await isHasGeneratedContractAPI(this.current.id);
|
|
|
+ if (res&&!type) this.$message.warning('该报价单已生成过合同,请注意');
|
|
|
+ //获取详情
|
|
|
+ const data = await getDetail(this.current.id);
|
|
|
+ data.quoteProductList.forEach((item) => {
|
|
|
+ this.$set(item, 'discountTotalPrice', Number(item.totalPrice));
|
|
|
+ this.$set(item, 'discountSinglePrice', Number(item.singlePrice));
|
|
|
+ });
|
|
|
+ let obj = {
|
|
|
+ contractVO: {
|
|
|
+ categoryId: '',
|
|
|
+ categoryName: '',
|
|
|
+ contractEndDate: '',
|
|
|
+ contractFile: [],
|
|
|
+ contractName: data.contactName,
|
|
|
+ contractNo: '',
|
|
|
+ contractNumber: '',
|
|
|
+ contractStartDate: '',
|
|
|
+ createDept: '',
|
|
|
+ createTime: '',
|
|
|
+ createUsername: '',
|
|
|
+ enabled: '',
|
|
|
+ id: '',
|
|
|
+ settlementMode: data.settlementMode,
|
|
|
+ settlementModeName: data.settlementModeName,
|
|
|
+ opportunityId: '',
|
|
|
+ partaAddress: data.contactAddress,
|
|
|
+ partaEmail: data.contactEmail,
|
|
|
+ partaFax: data.contactFax,
|
|
|
+ partaId: data.contactId,
|
|
|
+ partaLinkId: data.contactLinkId,
|
|
|
+ partaLinkName: data.contactLinkName,
|
|
|
+ partaName: data.contactName,
|
|
|
+ partaTel: data.contactTel,
|
|
|
+ partaUnifiedSocialCreditCode: '',
|
|
|
+ partbAddress: data.quoteAddress,
|
|
|
+ partbEmail: data.quoteEmail,
|
|
|
+ partbFax: data.quoteFax,
|
|
|
+ partbId: data.quoteCompanyId,
|
|
|
+ partbLinkId: data.quoteLinkId,
|
|
|
+ partbLinkName: data.quoteLinkName,
|
|
|
+ partbName: data.quoteName,
|
|
|
+ partbTel: data.quoteTel,
|
|
|
+ partbUnifiedSocialCreditCode: '',
|
|
|
+ receiptPaymentType: '',
|
|
|
+ reviewerId: '',
|
|
|
+ reviewerName: '',
|
|
|
+ reviewerTime: '',
|
|
|
+ sourceId: this.current.id,
|
|
|
+ sourceType: 1,
|
|
|
+ sourceName: data.code,
|
|
|
+ status: '',
|
|
|
+ totalPrice: data.totalPrice,
|
|
|
+ discountTotalPrice: data.totalPrice,
|
|
|
+ type: '1',
|
|
|
+ typeName: '销售合同',
|
|
|
+ updateUsername: ''
|
|
|
+ },
|
|
|
+ receiptPaymentList: [],
|
|
|
+ productList: data.quoteProductList
|
|
|
+ };
|
|
|
+ return obj;
|
|
|
}
|
|
|
- },
|
|
|
- //新增合同
|
|
|
- async addGenerateContract() {
|
|
|
- //报价单是否生成过合同
|
|
|
- let res = await isHasGeneratedContractAPI(this.current.id);
|
|
|
- if (res) this.$message.warning('该报价单已生成过合同,请注意');
|
|
|
- //获取详情
|
|
|
- const data = await getDetail(this.current.id);
|
|
|
- data.quoteProductList.forEach((item) => {
|
|
|
- this.$set(item, 'discountTotalPrice', Number(item.totalPrice));
|
|
|
- this.$set(item, 'discountSinglePrice', Number(item.singlePrice));
|
|
|
- });
|
|
|
- let obj = {
|
|
|
- contractVO: {
|
|
|
- categoryId: '',
|
|
|
- categoryName: '',
|
|
|
- contractEndDate: '',
|
|
|
- contractFile: [],
|
|
|
- contractName: data.contactName,
|
|
|
- contractNo: '',
|
|
|
- contractNumber: '',
|
|
|
- contractStartDate: '',
|
|
|
- createDept: '',
|
|
|
- createTime: '',
|
|
|
- createUsername: '',
|
|
|
- enabled: '',
|
|
|
- id: '',
|
|
|
- settlementMode: data.settlementMode,
|
|
|
- settlementModeName: data.settlementModeName,
|
|
|
- opportunityId: '',
|
|
|
- partaAddress: data.contactAddress,
|
|
|
- partaEmail: data.contactEmail,
|
|
|
- partaFax: data.contactFax,
|
|
|
- partaId: data.contactId,
|
|
|
- partaLinkId: data.contactLinkId,
|
|
|
- partaLinkName: data.contactLinkName,
|
|
|
- partaName: data.contactName,
|
|
|
- partaTel: data.contactTel,
|
|
|
- partaUnifiedSocialCreditCode: '',
|
|
|
- partbAddress: data.quoteAddress,
|
|
|
- partbEmail: data.quoteEmail,
|
|
|
- partbFax: data.quoteFax,
|
|
|
- partbId: data.quoteCompanyId,
|
|
|
- partbLinkId: data.quoteLinkId,
|
|
|
- partbLinkName: data.quoteLinkName,
|
|
|
- partbName: data.quoteName,
|
|
|
- partbTel: data.quoteTel,
|
|
|
- partbUnifiedSocialCreditCode: '',
|
|
|
- receiptPaymentType: '',
|
|
|
- reviewerId: '',
|
|
|
- reviewerName: '',
|
|
|
- reviewerTime: '',
|
|
|
- sourceId: this.current.id,
|
|
|
- sourceType: 1,
|
|
|
- sourceName: data.code,
|
|
|
- status: '',
|
|
|
- totalPrice: data.totalPrice,
|
|
|
- discountTotalPrice: data.totalPrice,
|
|
|
- type: '1',
|
|
|
- typeName: '销售合同',
|
|
|
- updateUsername: ''
|
|
|
- },
|
|
|
- receiptPaymentList: [],
|
|
|
- productList: data.quoteProductList
|
|
|
- };
|
|
|
- return obj;
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.btns {
|
|
|
- text-align: center;
|
|
|
- padding: 10px 0;
|
|
|
-}
|
|
|
+ .btns {
|
|
|
+ text-align: center;
|
|
|
+ padding: 10px 0;
|
|
|
+ }
|
|
|
</style>
|