index.js 5.9 KB
import Api from "~/service/Api"
import commonFunctions from '~/mixin/commonFunctions.js';

export default {
    mixins: [commonFunctions],
    methods: {
        commonValidate() {
            if (this.model.unionOrgCode == "") {
                this.$notify.warning({
                    title: '提示',
                    message: '统一社会信用代码不能为空!'
                });
                return false;
            }
            if (this.model.orderNo == "") {
                this.$notify.warning({
                    title: '提示',
                    message: '平台订单编号不能为空!'
                });
                return false;
            }
            return true;
        },
        async queryGdye() {
            if (!this.commonValidate()) {
                return;
            }
            let rtnmsg = await Api.post(`/${this.moduleRouter()}/gmgf/queryGdye`, this.model);
            if (rtnmsg.respCode == SUCCESS) {
                this.bgdlst = rtnmsg.data ? rtnmsg.data : [];
                if (this.bgdlst.length <= 0) {
                    this.$notify.warning({ title: '提示', message: '无此报关单信息' });
                }else{
                    this.$notify.success("查询成功!");
                }
            } else {
                this.$notify.error({ title: '错误', message: rtnmsg.respCode + "|" + rtnmsg.respMsg });
            }
        },
        async queryGdmx(row) {
            if (!this.commonValidate()) {
                return;
            }
            if (row.customNo == "") {
                this.$notify.warning({
                    title: '提示',
                    message: '报关单号不能为空!'
                });
                return;
            }
            let rtnmsg = await Api.post(`/${this.moduleRouter()}/gmgf/queryGdmx`, {
                unionOrgCode: this.model.unionOrgCode,
                orderNo: this.model.orderNo,
                choiceCustomNo: row.customNo
            });
            if (rtnmsg.respCode == SUCCESS) {
                if (!rtnmsg.data.formatData) {
                    this.$notify.warning({
                        title: '提示',
                        message: '关单明细展示失败!'
                    });
                } else {
                    this.$notify.success("查询成功!");
                    this.$nextTick(() => {
                        if (!this.$refs.msgView.directViewDispaly(rtnmsg.data)) {
                            this.$notify.warning({
                                title: '提示',
                                message: '关单明细展示失败!'
                            });
                        }
                    })
                }
            } else {
                this.$notify.error({ title: '错误', message: rtnmsg.respCode + "|" + rtnmsg.respMsg });
            }
        },
        async queryYzbg(row) {
            if (!this.commonValidate()) {
                return;
            }
            let rtnmsg = await Api.post(`/${this.moduleRouter()}/gmgf/queryYzbg`, {
                orderNo: this.model.orderNo,
                choiceCustomNo: row.customNo
            });
            if (rtnmsg.respCode == SUCCESS) {
                this.$notify.success("产生验真报告!");
            } else {
                this.$notify.error({ title: '错误', message: rtnmsg.respCode + "|" + rtnmsg.respMsg });
            }
        },
        async queryImage(row) {
            if (!this.commonValidate()) {
                return;
            }
            if (row.customNo == "") {
                this.$notify.warning({
                    title: '提示',
                    message: '报关单号不能为空!'
                });
                return;
            }
            let rtnmsg = await Api.post(`/${this.moduleRouter()}/gmgf/queryImage`, {
                orderNo: this.model.orderNo,
                choiceCustomNo: row.customNo
            });
            if (rtnmsg.respCode == SUCCESS) {
                this.$notify.success("产生关单PDF!");
            } else {
                this.$notify.error({ title: '错误', message: rtnmsg.respCode + "|" + rtnmsg.respMsg });
            }
        },
        async queryPdf(row) {
            if (!this.commonValidate()) {
                return;
            }
            if (row.customNo == "") {
                this.$notify.warning({
                    title: '提示',
                    message: '报关单号不能为空!'
                });
                return;
            }
            let rtnmsg = await Api.post(`/${this.moduleRouter()}/gmgf/queryPdf`, {
                orderNo: this.model.orderNo,
                choiceCustomNo: row.customNo
            });
            if (rtnmsg.respCode == SUCCESS) {
                this.yzbglst = rtnmsg.data.yzbgs ? rtnmsg.data.yzbgs : [];
                this.gdpdflst = rtnmsg.data.imges ? rtnmsg.data.imges : [];
            } else {
                this.$notify.error({ title: '错误', message: rtnmsg.respCode + "|" + rtnmsg.respMsg });
            }
        },
        async showPdf(row) {
            if (row.inr == "") {
                this.$notify.warning({
                    title: '提示',
                    message: '报关单号不能为空!'
                });
                return;
            }
            let rtnmsg = await Api.post(`/${this.moduleRouter()}/gmgf/showPdf`, row.inr);
            if (rtnmsg.respCode == SUCCESS) {
                this.$nextTick(() => {
                    if (!this.$refs.msgView.directViewDispaly(rtnmsg.data)) {
                        this.$notify.warning({
                            title: '提示',
                            message: 'pdf展示失败!'
                        });
                    }
                })
            } else {
                this.$notify.error({ title: '错误', message: rtnmsg.respCode + "|" + rtnmsg.respMsg });
            }
        }
    },

}