fix: 修复编辑、复制、新增落地页白名单数据
This commit is contained in:
parent
0318356dfa
commit
4fc4bbdbeb
|
@ -64,7 +64,6 @@ export default class add extends React.Component {
|
|||
whiteStyle: false,
|
||||
keyStyle: 1,
|
||||
direct_reseller_id: 0,
|
||||
keyType: 1, // 1兑换码 2优惠券
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -275,8 +274,10 @@ export default class add extends React.Component {
|
|||
|
||||
// 获取落地页
|
||||
getStep3Theme() {
|
||||
if (this.state.card_visible) {
|
||||
this.refs.step3.getThemeData();
|
||||
}
|
||||
}
|
||||
|
||||
send(e) {
|
||||
let plan_id = sessionStorage.getItem("plan_id");
|
||||
|
@ -410,8 +411,6 @@ export default class add extends React.Component {
|
|||
this.onStyleChange(e);
|
||||
}}
|
||||
getStep3Theme={() => this.getStep3Theme()}
|
||||
changeKeyType={(e) => this.setState({ keyType: e })}
|
||||
keyType={this.state.keyType}
|
||||
keyStyle={this.state.keyStyle}
|
||||
isload={this.state.isload}
|
||||
curstep={this.state.curstep}
|
||||
|
|
|
@ -216,17 +216,16 @@ export default class add extends React.Component {
|
|||
|
||||
// 获取落地页
|
||||
getStep3Theme() {
|
||||
if (this.state.card_visible) {
|
||||
this.refs.step3.getThemeData();
|
||||
}
|
||||
}
|
||||
|
||||
/* 转译 */
|
||||
tranFormData(req) {
|
||||
// 需要转译的类型
|
||||
let type = Number(req.keys[0].bind_object[0]);
|
||||
sessionStorage.setItem("keyType", type);
|
||||
this.setState({
|
||||
keyType: Number(type),
|
||||
});
|
||||
if (type === 2) {
|
||||
// 优惠券的转译-弹窗已做了优化
|
||||
return req.keys;
|
||||
|
@ -679,13 +678,8 @@ export default class add extends React.Component {
|
|||
this.onStyleChange(e);
|
||||
}}
|
||||
is_Edit={true}
|
||||
changeKeyType={(e) => {
|
||||
sessionStorage.setItem("keyType", e);
|
||||
this.setState({ keyType: e });
|
||||
}}
|
||||
getStep3Theme={() => this.getStep3Theme()}
|
||||
curstep={this.state.curstep}
|
||||
keyType={this.state.keyType}
|
||||
whiteStyle={this.state.whiteStyle}
|
||||
keyStyle={this.state.keyStyle}
|
||||
isload={this.state.isload}
|
||||
|
|
|
@ -94,7 +94,6 @@ export default class add extends React.Component {
|
|||
});
|
||||
}
|
||||
componentDidMount(e) {
|
||||
sessionStorage.setItem("white", 3);
|
||||
sessionStorage.setItem("plan_id", "");
|
||||
let plan_id_copy = sessionStorage.getItem("plan_id_copy");
|
||||
this.setState({ plan_id_detail: plan_id_copy });
|
||||
|
@ -159,9 +158,7 @@ export default class add extends React.Component {
|
|||
tranFormData(req) {
|
||||
// 需要转译的类型
|
||||
let type = Number(req.keys[0].bind_object[0]);
|
||||
this.setState({
|
||||
keyType: Number(type),
|
||||
});
|
||||
sessionStorage.setItem("keyType", type);
|
||||
if (type === 2) {
|
||||
// 优惠券的转译-弹窗已做了优化
|
||||
return req.keys;
|
||||
|
@ -214,8 +211,10 @@ export default class add extends React.Component {
|
|||
|
||||
// 获取落地页
|
||||
getStep3Theme() {
|
||||
if (this.state.card_visible) {
|
||||
this.refs.step3.getThemeData();
|
||||
}
|
||||
}
|
||||
|
||||
onConfirm(e) {
|
||||
let plan_id = sessionStorage.getItem("plan_id");
|
||||
|
@ -520,11 +519,6 @@ export default class add extends React.Component {
|
|||
this.onStyleChange(e);
|
||||
}}
|
||||
keyStyle={this.state.keyStyle}
|
||||
changeKeyType={(e) => {
|
||||
sessionStorage.setItem("keyType", e);
|
||||
this.setState({ keyType: e });
|
||||
}}
|
||||
keyType={this.state.keyType}
|
||||
getStep3Theme={() => this.getStep3Theme()}
|
||||
curstep={this.state.curstep}
|
||||
isCopy={true}
|
||||
|
|
|
@ -210,6 +210,9 @@ export default class acclist extends React.Component {
|
|||
width: "auto",
|
||||
},
|
||||
],
|
||||
keyType: sessionStorage.getItem("keyType")
|
||||
? Number(sessionStorage.getItem("keyType"))
|
||||
: 1,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -230,7 +233,7 @@ export default class acclist extends React.Component {
|
|||
submit() {
|
||||
let valide = false;
|
||||
// 兑换码
|
||||
if (this.props.keyType === 1) {
|
||||
if (this.state.keyType === 1) {
|
||||
if (this.refs.form1.validator()) {
|
||||
/* 处理数据 区分立减金和商品 开始 2022-05-30 13:40*/
|
||||
const dataCopy = this.refs.tempdata.getSelectData();
|
||||
|
@ -257,7 +260,7 @@ export default class acclist extends React.Component {
|
|||
data.batch_name = this.state.model.batch_name;
|
||||
data.style = this.state.model.style;
|
||||
data.quantity = this.state.model.quantity;
|
||||
data.bind_object = [this.props.keyType];
|
||||
data.bind_object = [this.state.keyType];
|
||||
data.allow_repetition = this.state.model.allow_repetition;
|
||||
data.allow_loss = this.state.model.allow_loss;
|
||||
data.merge_stock = this.state.model.merge_stock;
|
||||
|
@ -274,7 +277,7 @@ export default class acclist extends React.Component {
|
|||
data.batch_name = this.state.model.batch_name;
|
||||
data.style = this.state.model.style;
|
||||
data.quantity = this.state.model.quantity;
|
||||
data.bind_object = [this.props.keyType];
|
||||
data.bind_object = [this.state.keyType];
|
||||
data.allow_repetition = this.state.model.allow_repetition;
|
||||
data.allow_loss = this.state.model.allow_loss;
|
||||
data.merge_stock = this.state.model.merge_stock;
|
||||
|
@ -292,9 +295,12 @@ export default class acclist extends React.Component {
|
|||
}
|
||||
|
||||
onCheckChange = ({ target }) => {
|
||||
this.props.changeKeyType(target.value);
|
||||
sessionStorage.setItem("keyType", target.value);
|
||||
if (this.props.getStep3Theme && this.props.curstep === 3) {
|
||||
this.setState({
|
||||
keyType: target.value,
|
||||
});
|
||||
// 获取落地页 select
|
||||
if (this.props.getStep3Theme) {
|
||||
this.props.getStep3Theme();
|
||||
}
|
||||
};
|
||||
|
@ -308,17 +314,19 @@ export default class acclist extends React.Component {
|
|||
model2.style = e.target.value;
|
||||
model2.quantity = 0;
|
||||
this.setState({ model: model2 });
|
||||
|
||||
if (e.target.value == 6) {
|
||||
sessionStorage.setItem("white", 1);
|
||||
console.log("this.props.curstep =>", this.props.curstep);
|
||||
if (this.props.getStep3Theme && this.props.curstep === 3) {
|
||||
this.props.getStep3Theme();
|
||||
}
|
||||
this.setState({ white_visible: true });
|
||||
} else {
|
||||
sessionStorage.setItem("white", 3);
|
||||
this.setState({ white_visible: false });
|
||||
}
|
||||
|
||||
// 获取落地页 select
|
||||
if (this.props.getStep3Theme) {
|
||||
this.props.getStep3Theme();
|
||||
}
|
||||
}
|
||||
|
||||
onRepetitionChange(e) {
|
||||
|
@ -555,7 +563,7 @@ export default class acclist extends React.Component {
|
|||
|
||||
codeSubmit() {
|
||||
// 优惠券数据
|
||||
if (this.props.keyType === 2) {
|
||||
if (this.state.keyType === 2) {
|
||||
let coupon_validator = this.refs.addEditCouponEl.submit();
|
||||
if (coupon_validator) {
|
||||
let param = this.refs.addEditCouponEl.getModel();
|
||||
|
@ -654,7 +662,7 @@ export default class acclist extends React.Component {
|
|||
let text = e.target.value;
|
||||
text = text.replace(/[^\d]/g, "");
|
||||
|
||||
if (this.props.keyType === 1) {
|
||||
if (this.state.keyType === 1) {
|
||||
this.state.distdata[index].restrict = text;
|
||||
this.setState({ distdata: this.state.distdata });
|
||||
} else {
|
||||
|
@ -735,7 +743,10 @@ export default class acclist extends React.Component {
|
|||
this.setState({ mobile_excel: data.mobile_excel });
|
||||
this.setState({ mobile_repeat: data.mobile_repeat });
|
||||
if (model.style == 6) {
|
||||
sessionStorage.setItem("white", 1);
|
||||
this.setState({ white_visible: true });
|
||||
} else {
|
||||
sessionStorage.setItem("white", 3);
|
||||
}
|
||||
|
||||
this.setState({ model: model });
|
||||
|
@ -765,7 +776,10 @@ export default class acclist extends React.Component {
|
|||
this.setState({ mobile_excel: data.mobile_excel });
|
||||
this.setState({ mobile_repeat: data.mobile_repeat });
|
||||
if (model.style == 6) {
|
||||
sessionStorage.setItem("white", 1);
|
||||
this.setState({ white_visible: true });
|
||||
} else {
|
||||
sessionStorage.setItem("white", 3);
|
||||
}
|
||||
this.setState({ model: model });
|
||||
|
||||
|
@ -873,7 +887,7 @@ export default class acclist extends React.Component {
|
|||
|
||||
rowItemClick(row, rowIndex) {
|
||||
// 兑换码
|
||||
if (this.props.keyType === 1) {
|
||||
if (this.state.keyType === 1) {
|
||||
let codeInfo = {
|
||||
//数据模型不可少
|
||||
code_name: row.title,
|
||||
|
@ -1346,7 +1360,7 @@ export default class acclist extends React.Component {
|
|||
) : null}
|
||||
<FormItem labelname="绑定类型" prop="bind_object" id="bind_object">
|
||||
<Radio.Group
|
||||
value={this.props.keyType}
|
||||
value={this.state.keyType}
|
||||
onChange={(e) => {
|
||||
this.onCheckChange(e);
|
||||
}}
|
||||
|
@ -1361,7 +1375,7 @@ export default class acclist extends React.Component {
|
|||
</FormItem>
|
||||
|
||||
<FormItem labelname="" prop="btn" required={false}>
|
||||
{this.props.keyType === 1 ? (
|
||||
{this.state.keyType === 1 ? (
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
this.checkIndex(0);
|
||||
|
@ -1386,12 +1400,12 @@ export default class acclist extends React.Component {
|
|||
isShowPageBar={false}
|
||||
spliteColor={"#fff"}
|
||||
tableData={
|
||||
this.props.keyType === 1
|
||||
this.state.keyType === 1
|
||||
? this.state.distdata
|
||||
: this.state.couponData
|
||||
}
|
||||
Column={
|
||||
this.props.keyType === 1
|
||||
this.state.keyType === 1
|
||||
? this.state.Column
|
||||
: this.state.Column_coupon
|
||||
}
|
||||
|
@ -1418,7 +1432,7 @@ export default class acclist extends React.Component {
|
|||
);
|
||||
}
|
||||
// 优惠券范围
|
||||
if (com === "product" && this.props.keyType === 2) {
|
||||
if (com === "product" && this.state.keyType === 2) {
|
||||
return coupon_range(rowData.product);
|
||||
}
|
||||
if (com == "edit") {
|
||||
|
@ -1497,7 +1511,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" }}
|
||||
|
@ -1626,7 +1640,7 @@ export default class acclist extends React.Component {
|
|||
this.onRankChange(e);
|
||||
}}
|
||||
/>
|
||||
{this.props.keyType === 1 ? (
|
||||
{this.state.keyType === 1 ? (
|
||||
<>
|
||||
<Button
|
||||
type="primary"
|
||||
|
|
|
@ -45,16 +45,16 @@ export default class acclist extends React.Component {
|
|||
}
|
||||
|
||||
getThemeData() {
|
||||
console.log("编辑 -1");
|
||||
let params = {};
|
||||
|
||||
// 第一步:判断是否优惠券
|
||||
let white = sessionStorage.getItem("white");
|
||||
let keyType = sessionStorage.getItem("keyType");
|
||||
console.log("white =>", white);
|
||||
console.log("keyType =>", keyType);
|
||||
// 2 优惠券
|
||||
if (keyType == 2) {
|
||||
// 并且是 白名单
|
||||
if (white == 1) {
|
||||
// 并且是 白名单
|
||||
params.page = 8;
|
||||
} else {
|
||||
params.page = 4;
|
||||
|
@ -62,10 +62,10 @@ export default class acclist extends React.Component {
|
|||
} else {
|
||||
// 兑换码
|
||||
if (white == 1) {
|
||||
params.page = 3;
|
||||
} else {
|
||||
// 并且是 白名单
|
||||
params.page = 1;
|
||||
} else {
|
||||
params.page = 3;
|
||||
}
|
||||
}
|
||||
getThemeChoice(params).then((res) => {
|
||||
|
|
Loading…
Reference in New Issue