fix: 兑换码无法显示select

This commit is contained in:
zhangds 2022-09-29 15:18:27 +08:00
parent df8b667bf8
commit 41d07e3771
4 changed files with 643 additions and 605 deletions

View File

@ -203,7 +203,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
plan_id: "",
key_batch_id: "",
title: "",
date_time: JSON.parse(sessionStorage.getItem("datetime")),
date_time: sessionStorage.getItem("datetime")
? JSON.parse(sessionStorage.getItem("datetime"))
: "",
});
const form_info_el = useRef(null);
@ -217,21 +219,43 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
});
const form_rule_el = useRef(null);
const isEditFun = () => {
//
if (sessionStorage.getItem("isState") === "2") {
setState({
isEdit: true,
});
}
//
if (editData.approval_status === 2) {
setState({
isEdit: false,
});
}
};
// //
useEffect(() => {
(async function init() {
// 1. couponType
console.log("couponType =>", couponType);
console.log("editData =>", editData);
let isState = sessionStorage.getItem("isState");
setState({
isState: isState,
});
if (couponType === 0) {
sessionStorage.setItem("keyType", 2);
// 1.1
await getPlanList().then((arr) => {
console.log("arr =>1", arr);
// 1.2
if (editData && editData !== "") {
isEditFun();
// 1.3
let plan_row = arr.find(
(item) => item.text === editData.plan_title
);
if (
plan_row &&
plan_row !== undefined &&
@ -258,23 +282,15 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
// 1.6
editFun();
let isState = sessionStorage.getItem("isState");
if (isState) {
setState({
isState: isState,
});
}
// 1.7
if (isState && isState === "1") {
if (state.isState === "1") {
setForm_info_data({
title: `${editData.title}_${editData.copy_count + 1}`,
});
}
// 1.8
if (isState && isState === "2") {
setState({ isEdit: true });
if (state.isState === "2") {
setState({
oldProduct: editData.product,
});
@ -282,7 +298,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
}
});
} else {
// 1.3
if (editData && editData !== "") {
editFun();
}
@ -300,19 +315,22 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
end_time: editData.end_time,
})
);
//
setForm_info_data({
title: editData.title,
date_time: [editData.begin_time, editData.end_time],
});
//
setForm_rule_data({
full: editData.full,
reduce: editData.reduce,
quantity: editData.quantity,
budget: editData.budget,
budget: mulNum(Number(editData.reduce), Number(editData.quantity)),
restrict: editData.restrict,
});
//
//
let goods_arr = editData.product.legal.map((item) => {
@ -362,12 +380,14 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
rank: arr,
tableData: scope_data,
});
} catch (err) {}
} catch (err) {
console.log(err);
}
};
const getPlanList = () => {
return new Promise((resolve, reject) => {
try {
queryPlans({ status: "3,4,5" }).then((res) => {
queryPlans({ bind_object: "2" }).then((res) => {
handelResponse(res, (req, msg) => {
let arr = req.map((item) => {
return {
@ -1009,7 +1029,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
renderOptionList={renderOptionList}
options={state.plan_OPTIONS}
value={form_info_data.plan_id}
disabled={state.isEdit}
disabled={state.isState === "2" ? true : false}
onChange={(e) => {
changePlan(e);
}}
@ -1025,7 +1045,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
renderOptionList={renderOptionList}
options={state.key_OPTIONS}
value={form_info_data.key_batch_id}
disabled={state.isEdit}
disabled={state.isState === "2" ? true : false}
onChange={(e) => {
setForm_info_data({ key_batch_id: e });
}}
@ -1060,7 +1080,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
defaultTime: [moment().format("HH:mm:ss"), "23:59:59"],
}}
format="YYYY-MM-DD HH:mm:ss"
disabled={[state.isEdit, false]}
disabled={[state.isState === "2" ? true : false, false]}
value={form_info_data.date_time}
onChange={(e) => {
onChangeCombinedDate(e);
@ -1250,13 +1270,13 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
>
编辑
</span>
<span
{/* <span
style={{ color: "red" }}
className="grid-link"
onClick={() => deleteGoodsScope(rowIndex)}
>
删除
</span>
</span> */}
</div>
);
}

File diff suppressed because it is too large Load Diff

View File

@ -129,7 +129,6 @@ export default class add extends React.Component {
this.setState({ curstep: 2 });
//转译
req.keys = this.tranFormData(req);
console.log("req.keys =>", req.keys);
for (let i = 0; i < req.keys.length; i++) {
this.addNewkey();
}
@ -145,7 +144,6 @@ export default class add extends React.Component {
this.refs["step2-" + i].submit();
}
}, 500);
console.log("详情 =>", req);
} else {
this.addNewkey();
}

View File

@ -1596,7 +1596,7 @@ export default class acclist extends React.Component {
}}
maskClosable={false}
>
{this.props.keyType === 1 ? (
{this.state.keyType === 1 ? (
<div className="draw">
<Card
style={{ width: "95%", margin: "10px auto" }}