import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import buildFn from './buildCommons.js';
import Utils from "~/utils/index";

export default {
    mixins: [commonFunctions,buildFn],
    methods: {
        // 业务信息=》基本信息=》保函编号-----获取保函编号
        queryOwnref() {
            let params = this.model.nidgrp.rec;
            if (!this.model.nidgrp.apl.pts.ptainr) {
                return
            }
            let ptainr = this.model.nidgrp.apl.pts.ptainr;
            const loading = this.loading();
            Api.post(`/business/ref/nid?ptaInr=${ptainr}`, params).then(res => {
                if (res.respCode === SUCCESS) {
                    loading.close();
                    this.model.nidgrp.rec.ownref = res.data;
                }
            }).catch(() => {
                loading.close();
            });
        },
        // async onAmebutButtxmsel() {
        //     const rtnmsg = await Api.post('/business/netame/buttxmsel', this.model);
        //     if (rtnmsg.respCode === SUCCESS) {
        //         //TODO 处理数据逻辑

        //     } else {
        //         this.$notify.error({title: '错误', message: '服务请求失败!'});
        //     }
				// },
				newamtBlur() {},
				ameamtBlur() {},
				async query2122(){
					let trnName = this.root ? this.root.trnName : this.trnName
					if (this.model.rmbbop.rmb2122.rmbflg == '1') {
						let rmbbop = this.buildRobbop(this.model, trnName);
        		let opertype = "2";
        		let rtnmsg = await Api.post('/business/rmbbopnid/rmbbop2122Cal', rmbbop);
        		if (rtnmsg.respCode == SUCCESS) {
          		Utils.copyValueFromVoData(this.model.rmbbop.rmb2122,rtnmsg.data.rmb2122);
          		this.model.rmbbop.rmb2122.recgrp.ads.opertype = opertype;
        		}
					}
				}
    },
};