From 24fc6a1349907ce1752e24033193b73e1bcd6fee Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 12 Oct 2022 14:28:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dgit=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseCouponAddEdit/index.jsx | 28 +++++++++++++++++++---- src/components/UseGoodsScopePop/index.jsx | 8 ++++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index 2fe66de5..007e7651 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -30,6 +30,7 @@ import { addCoupon, editCoupon, queryPlans, + getReseller, } from "@/assets/api.js"; import Ipt from "@/components/input/main"; @@ -260,9 +261,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { plan_id: plan_row, }); // 1.4 设置分销商 - setState({ - direct_reseller_id: plan_row.key.reseller_id, - }); + getResellerFun(plan_row.key.reseller_id); // 1.5 设置归属计划key getKey(plan_row.key.key).then((arr_key) => { let el_key = arr_key.find( @@ -353,7 +352,10 @@ const UseCouponAddEdit = forwardRef((props, ref) => { ...item, type: 1, upstream: "直连天下", - all_budget: Number(item.contract_price) * Number(item.quantity), + all_budget: mulNum( + Number(item.contract_price), + Number(item.quantity) + ), effectDate: "-", }; }); @@ -721,6 +723,22 @@ const UseCouponAddEdit = forwardRef((props, ref) => { } }; + // 获取分销商id + const getResellerFun = (id) => { + getReseller(id).then((res) => { + handelResponse( + res, + (req, msg) => { + console.log("分销商 id =>", req.direct_reseller_id); + setState({ direct_reseller_id: req.direct_reseller_id }); + }, + (err) => { + Notify.error(err); + } + ); + }); + }; + // 计划select改变 const changePlan = async (e) => { setForm_info_data({ @@ -728,7 +746,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { key_batch_id: "", date_time: e.key.dateTime, }); - setState({ direct_reseller_id: e.key.reseller_id }); + getResellerFun(e.key.reseller_id); await getKey(e.key.key); }; diff --git a/src/components/UseGoodsScopePop/index.jsx b/src/components/UseGoodsScopePop/index.jsx index 29724063..a33e4e94 100644 --- a/src/components/UseGoodsScopePop/index.jsx +++ b/src/components/UseGoodsScopePop/index.jsx @@ -3,7 +3,7 @@ import { Card, Drawer, Button } from "zent"; import Productform from "@/pages/plan/product/add"; /* 商品 */ import KnockGold from "@/components/knockGold"; /* 立减金 */ -import { divNum } from "@/tools/number"; +import { divNum, mulNum } from "@/tools/number"; const UseGoodsScopePop = forwardRef((props, ref) => { const { @@ -32,8 +32,10 @@ const UseGoodsScopePop = forwardRef((props, ref) => { let form_model = product_el.current.state.form_data; form_model.type = 1; form_model.upstream = "直连天下"; - form_model.all_budget = - Number(form_model.contract_price) * Number(form_model.quantity); + form_model.all_budget = mulNum( + Number(form_model.contract_price), + Number(form_model.quantity) + ); form_model.effectDate = "-"; if (product_title === "编辑商品") {