/**version-1.0*/
import {initWf} from '../../components/wf/wfUtil'

let mixins = {};
mixins = {
  methods: {
    '_getBillInfo': async function (option) {
      let defaultOption = {
        url: null,
        method: `post`,
        data: {},
        isLoading: true,
        modalStrictly: true,
        success: null
      };
      let opt = Object.assign({}, defaultOption, option);
      delete opt.wfConfig;
      return this.$commonHttp({
        ...opt,
        success: (res, response) => {
          option.success && option.success(res, response);
          if (option.wfConfig) {
            let wfConfig = option.wfConfig(res);
            if (wfConfig) {
              let urlArr = opt.url.split('/');
              let opt2 = Object.assign({}, wfConfig, {
                serviceId: urlArr[1]
              });
              //初始化流程
              initWf.call(this, opt2);
            }
          }
        }
      });
    }
  }
}
export default mixins;
