import Api from '~/service/Api';
import commonFunctions from "~/mixin/commonFunctions.js";
import commonDepend from "~/mixin/commonDepend.js";

export default {
	mixins: [commonFunctions, commonDepend],
	methods: {
		async onSearch() {
			this.root.$refs['modelForm'].validate(async (validStatic) => {
				if (validStatic) {
					const loading = this.loading('正在调用接口');
					let params = {
						custCode: this.model.recpan.custcode,
						scod: this.model.recpan.scod
					}
					let rtnmsg = await Api.post('/Financing/cicsel/query', params);
					if (rtnmsg.respCode == SUCCESS) {
						this.model.info = rtnmsg.data;
						loading.close();
						this.$alert('接口调用成功!', '提示', {
							confirmButtonText: "确认",
							callback: action => {
								if (action == 'confirm') {
									this.visible = true;
								}
							}
						})
					} else {
						loading.close();
						this.$notify.error({
							title: '错误',
							message: '查询失败,失败原因:' + rtnmsg.respMsg,
							callback: action => {
								if (action == 'confirm') {
									this.model.info = null,
									this.visible = true;
								}
							}
						});
					}
					loading.close();
					return
				}
			});
    },

    //退出
    exit() {
      this.$confirm("确认退出?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$store.commit('delTagsArry', this.$route.path)
        this.$router.back()
      })
    },
	}
}