diff --git a/src/components/UsePlanCard/index.jsx b/src/components/UsePlanCard/index.jsx index 33d26ec8..ebf2bd49 100644 --- a/src/components/UsePlanCard/index.jsx +++ b/src/components/UsePlanCard/index.jsx @@ -14,6 +14,7 @@ import { RadioButton, RadioGroup, Notify, + Checkbox, } from "zent"; import Ipt from "../../components/input/main"; import Form from "../../components/form/main"; @@ -267,6 +268,11 @@ function reducerPlanKey(state, action) { ...state, white_visible: action.payload, }; + case "batch_name": + return { + ...state, + batch_name: action.payload, + }; default: throw new Error(); } @@ -280,6 +286,12 @@ const UsePlanCardStep02 = forwardRef((props, ref) => { }; const [model, dispatch] = useReducer(reducerPlanKey, initPlanKey); // form 表单数据 + const [checkedList, setCheckedList] = useState([]); + const form2 = useRef(null); + + useImperativeHandle(ref, () => ({ + submit: submit, + })); const onStyleChange = (e) => { if (props.name === 0) { @@ -303,9 +315,24 @@ const UsePlanCardStep02 = forwardRef((props, ref) => { } }; + const onCheckChange = () => {}; + + const submit = () => { + let valide = false; + if (form2.current.validator()) { + let data = {}; + data.style = model.style; + console.log("step 2 =>", data); + + valide = true; + } + + return valide; + }; + return (
-
+ { @@ -339,6 +366,38 @@ const UsePlanCardStep02 = forwardRef((props, ref) => { + + + { + onCheckChange(e); + }} + > + 兑换码 + + 优惠券 + + + + + + { + dispatch({ type: "batch_name", payload: e }); + }} + onClearItem={(e) => { + dispatch({ type: "batch_name", payload: "" }); + }} + value={model.batch_name} + placeholder={"请输入"} + labelWidth={"0px"} + maxLength={12} + height={"36px"} + width={"400px"} + alignment={"left"} + /> +
); diff --git a/src/pages/plan/copy/index.jsx b/src/pages/plan/copy/index.jsx index 35c817b9..74167721 100644 --- a/src/pages/plan/copy/index.jsx +++ b/src/pages/plan/copy/index.jsx @@ -64,7 +64,7 @@ const UseOneCopy = () => { const [direct_reseller_id, setDirect_reseller_id] = useState(0); const [whiteStyle, setWhiteStyle] = useState(false); const step1 = useRef(null); - const step2 = useRef(null); + const step2 = useRef([]); const step3 = useRef(null); /*** 👇👇👇👇👇👇👇 step 01 👇👇👇👇👇👇👇 ***/ @@ -93,6 +93,12 @@ const UseOneCopy = () => { let res = step1.current.submit(); if (res === true) { } + let arr1 = []; + keys.forEach((item) => { + let val = step2.current[item].submit(); + arr1.push(val); + }); + console.log("step 2 =>", arr1); }; // 返回 const onReturn = () => {}; @@ -175,13 +181,12 @@ const UseOneCopy = () => { } > { + step2.current[item] = f; + }} name={index} - addNewkey={() => { - addNewkey(); - }} - onStyleChange={() => { - onStyleChange(); - }} + addNewkey={addNewkey} + onStyleChange={onStyleChange} keyStyle={keyStyle} isload={isload} direct_reseller_id={direct_reseller_id}