fix: 修复优惠券浮点计算精度缺失 修复分销商id不对

This commit is contained in:
zhangds 2022-10-12 10:35:46 +08:00
parent da538eabda
commit 19b4596892
2 changed files with 32 additions and 8 deletions

View File

@ -30,6 +30,7 @@ import {
addCoupon, addCoupon,
editCoupon, editCoupon,
queryPlans, queryPlans,
getReseller,
} from "@/assets/api.js"; } from "@/assets/api.js";
import Ipt from "@/components/input/main"; import Ipt from "@/components/input/main";
@ -256,15 +257,16 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
"datetime", "datetime",
JSON.stringify(plan_row.key.dateTime) JSON.stringify(plan_row.key.dateTime)
); );
console.log("plan_row =>", plan_row);
setForm_info_data({ setForm_info_data({
plan_id: plan_row, plan_id: plan_row,
}); });
// 1.4 // 1.4
setState({ getResellerFun(plan_row.key.reseller_id);
direct_reseller_id: plan_row.key.reseller_id,
});
// 1.5 key // 1.5 key
getKey(plan_row.key.key).then((arr_key) => { getKey(plan_row.key.key).then((arr_key) => {
console.log("归属key =>", arr_key);
let el_key = arr_key.find( let el_key = arr_key.find(
(item) => editData.key_batch_id === item.key (item) => editData.key_batch_id === item.key
); );
@ -353,7 +355,10 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
...item, ...item,
type: 1, type: 1,
upstream: "直连天下", upstream: "直连天下",
all_budget: Number(item.contract_price) * Number(item.quantity), all_budget: mulNum(
Number(item.contract_price),
Number(item.quantity)
),
effectDate: "-", effectDate: "-",
}; };
}); });
@ -721,6 +726,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 // select
const changePlan = async (e) => { const changePlan = async (e) => {
setForm_info_data({ setForm_info_data({
@ -728,7 +749,8 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
key_batch_id: "", key_batch_id: "",
date_time: e.key.dateTime, date_time: e.key.dateTime,
}); });
setState({ direct_reseller_id: e.key.reseller_id });
getResellerFun(e.key.reseller_id);
await getKey(e.key.key); await getKey(e.key.key);
}; };

View File

@ -3,7 +3,7 @@ import { Card, Drawer, Button } from "zent";
import Productform from "@/pages/plan/product/add"; /* 商品 */ import Productform from "@/pages/plan/product/add"; /* 商品 */
import KnockGold from "@/components/knockGold"; /* 立减金 */ import KnockGold from "@/components/knockGold"; /* 立减金 */
import { divNum } from "@/tools/number"; import { divNum, mulNum } from "@/tools/number";
const UseGoodsScopePop = forwardRef((props, ref) => { const UseGoodsScopePop = forwardRef((props, ref) => {
const { const {
@ -32,8 +32,10 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
let form_model = product_el.current.state.form_data; let form_model = product_el.current.state.form_data;
form_model.type = 1; form_model.type = 1;
form_model.upstream = "直连天下"; form_model.upstream = "直连天下";
form_model.all_budget = form_model.all_budget = mulNum(
Number(form_model.contract_price) * Number(form_model.quantity); Number(form_model.contract_price),
Number(form_model.quantity)
);
form_model.effectDate = "-"; form_model.effectDate = "-";
if (product_title === "编辑商品") { if (product_title === "编辑商品") {