diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index f5e2653b..9aac402a 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -11,7 +11,7 @@ import Form from "@/components/form/main" import Grid from "@/components/gird/main.js" import Ipt from "@/components/input/main" import { knockGoldFun, submitIsKm } from "@/tools/index" -import { mulNum } from "@/tools/number" +import { mulNum, divNum } from "@/tools/number" import { isAmount } from "@/tools/validate" import { useSetState } from "ahooks" import { isSameDay } from "date-fns" @@ -31,6 +31,7 @@ import { Sweetalert } from "zent" import UseGoodsScopePop from "../UseGoodsScopePop/index" + import "./style.less" const initArray = (targetNum) => { @@ -498,13 +499,21 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 所选商品库存和总发行数校验 -- 总库存(不是消耗库存) let sum = 0 arr.map((item) => { - // sum += parseInt(item.quantity) - sum += item.all_budget + // 1.判断 如何是商品直接 返回库存 + if (item.type === 1) { + sum += parseInt(item.quantity) + } else { + // 2.计算库存 + sum += parseInt( + divNum(item.only.all_budget, mulNum(item.only.reduce_amount, item.only.send_num)) + ) + } }) if (sum < Number(form_rule_data.quantity)) { Notify.error("所选商品库存总数小于发放量") return false } + // 第三步:判断提交类型 新建还是计划的新建 if (couponType === 1) { return true diff --git a/src/components/UseProductPop/index.jsx b/src/components/UseProductPop/index.jsx index b7028789..c05366ce 100644 --- a/src/components/UseProductPop/index.jsx +++ b/src/components/UseProductPop/index.jsx @@ -175,7 +175,6 @@ const UseProductPop = forwardRef((props, ref) => { return new Promise((resolve, reject) => { // 编辑 if (productData) { - debugger setModel({ goods_id: productData.goods_id, cost_price: productData.cost_price,