import BptbckCheck from '~/components/business/bptbck/model/check.js';

import BigNumber from 'bignumber.js';
export default {
	data() {
		return {
			rules: {
        ...new BptbckCheck(this).check,
        "setmod.docamt": [
          {
            validator:(rule, value, callback) => {
              if (value < 0) {
                return callback(new Error('金额必须为正数'));
              } else {
                callback();
              }
            }, trigger: ['blur', 'change']
          }
        ],
        "setmod.redamt": [
          {
            validator: (rule, value, callback) => {
              if (value < 0) {
                return callback(new Error('金额必须为正数'));
              } else {
                callback();
              }
              console.log('1111',this.model)
              if (new BigNumber(value) > new BigNumber(this.model.setmod.docamt)) {
                return callback(new Error('扣减金额不得大于付款金额'));
              } else {
                callback();
              }
            }, trigger: ['blur', 'change']
          }
        ],
        "strinf": [
					{
						validator:(rule, value, callback)=> {
              if (this.model.sndmsg=='X') {
                if(this.model.dedgrp.iss!=null && !this.model.strinf){
                callback(new Error('报文的79场为必输项!'));
                }else {
                  callback();
                }
              }else {
								callback();
							}
						}, trigger: ['blur', 'change']
					}
				],
			}
		}
	}
}