diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index 1a1180fb..3d48fac6 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -246,6 +246,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { (async function init() { let KeyPcType = sessionStorage.getItem("KeyPcType"); console.log("KeyPcType UseCouponAddEdit 1编辑 2复制 3新增 =>", KeyPcType); + console.log("editData =>", editData); // 第一步:1.判断组件是否是 优惠券管理 couponType if (couponType === 0) { // 如果是编辑 @@ -259,13 +260,18 @@ const UseCouponAddEdit = forwardRef((props, ref) => { plan_row !== undefined && plan_row !== "undefined" ) { - sessionStorage.setItem( - "datetime", - JSON.stringify(plan_row.key.dateTime) - ); setForm_info_data({ plan_id: plan_row, }); + + sessionStorage.setItem( + "knockGold_effectDate", + JSON.stringify({ + begin_time: plan_row.key.dateTime[0], + end_time: plan_row.key.dateTime[1], + }) + ); + // 1.4 设置分销商 getResellerFun(plan_row.key.reseller_id); // 1.5 设置归属计划key @@ -310,11 +316,11 @@ const UseCouponAddEdit = forwardRef((props, ref) => { statusDisabledFun(editData.status); } else { // 如果是新增,给计划时间 - let deDateTime = sessionStorage.getItem("datetime"); + let deDateTime = sessionStorage.getItem("knockGold_effectDate"); if (deDateTime) { let times = JSON.parse(deDateTime); setForm_info_data({ - date_time: [times[0], times[1]], + date_time: [times.begin_time, times.end_time], }); } } @@ -325,14 +331,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 编辑处理函数 const editFun = () => { try { - sessionStorage.setItem( - "knockGold_effectDate", - JSON.stringify({ - begin_time: editData.begin_time, - end_time: editData.end_time, - }) - ); - // 基本信息 setForm_info_data({ title: editData.title, @@ -768,7 +766,13 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 计划select改变 const changePlan = async (e) => { - sessionStorage.setItem("datetime", JSON.stringify(e.key.dateTime)); + sessionStorage.setItem( + "knockGold_effectDate", + JSON.stringify({ + begin_time: e.key.dateTime[0], + end_time: e.key.dateTime[1], + }) + ); setForm_info_data({ plan_id: e, key_batch_id: "",