
/**
 * 扣除额 相关业务
 */

import React from "react";
import { InvoiceController } from "../../../../../..";

/**
 * 扣除额 相关业务
 */
export default function useDeduction(controller: InvoiceController, deduction = 0) {

  // 更新 扣除额
  React.useEffect(() => { controller.pipeline(async s => s.goodsListState.deduction = deduction)(); }, [controller, deduction]);

  // 重新计算
  React.useEffect(()=>{
    controller.pipeline(async s=>{
      s.goodsListState.editGood = undefined;
      s.goodsListState.goodsList = [];
    })()
  }, [controller, deduction])
}
