const common = require("./common");
const system = require("../../../system");

//待分配 1020
module.exports.toBeAllocated=async function(params){
  console.log("//待分配 1020");
  let _apply =await common.applyVerification(params);
  if(_apply.status==-1){return _apply;}

  if (Number(params.isPay) != 1) {
    return system.getResult(null, `参数错误 请核对付款信息`);
  }
  params.nextStatus = common.trim(params.nextStatus);
  params.remark = common.trim(params.remark);
  _apply.status = params.nextStatus;
  _apply.remark = params.remark;
  _apply.isPay = Number(params.isPay);
  try {
    await _apply.save();
    return system.getResultSuccess();
  } catch (error) {
    return system.getResult(null, `系统错误 错误信息 ${error}`);
  }
}