fix: 兑换码无法显示select
This commit is contained in:
parent
df8b667bf8
commit
41d07e3771
|
@ -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
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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" }}
|
||||
|
|
Loading…
Reference in New Issue