1) key兑换码兼容老数据

This commit is contained in:
zhangds 2022-04-15 11:55:56 +08:00
parent 5ab234362e
commit 6b2e6d59a2
4 changed files with 126 additions and 45 deletions

View File

@ -43,6 +43,7 @@ import {
getReseller,
getAccessVerification,
keyApproval,
getProductInfoSelect,
} from "../../../assets/api.js";
import Productform from "../product/add";
import Bus from "../../../assets/eventBus.js";
@ -129,6 +130,8 @@ export default class acclist extends React.Component {
excel_count: 0,
success_count: 0,
error_count: 0,
direct_reseller_id: 0,
newGoodsBtnLoading: false,
};
}
@ -206,6 +209,9 @@ export default class acclist extends React.Component {
this.setState({ phone_list: req.contact_phone });
this.setState({ email_list: req.contact_email });
this.setState({
direct_reseller_id: req.direct_reseller_id,
});
});
});
@ -347,8 +353,36 @@ export default class acclist extends React.Component {
this.setState({ drawerVisible: false });
}
addProduct() {
this.setState({ drawerVisible2: true });
let direct_reseller_ids = this.state.direct_reseller_id;
if (direct_reseller_ids <= 0) {
// 老数据不能进行新增商品操作
Notify.error(`请编辑映射分销商`);
return;
}
this.setState({
newGoodsBtnLoading: true,
});
let param = {
reseller_id: direct_reseller_ids,
};
try {
getProductInfoSelect(param).then((res) => {
if (res.code === 200) {
sessionStorage.setItem("productsList", JSON.stringify(res.data.data));
this.setState({ productData: null });
this.setState({ drawerVisible2: true });
}
this.setState({
newGoodsBtnLoading: false,
});
});
} catch (err) {
this.setState({
newGoodsBtnLoading: false,
});
}
}
async productSubmit() {
let visible = await this.refs.product.submit();
@ -1400,6 +1434,7 @@ export default class acclist extends React.Component {
/>
</FormItem>
<FormItem labelname="商品范围" prop="rank" id="rank">
<div className="goods-boxs">
<Select
options={this.state.rankoptions}
multiple
@ -1411,14 +1446,16 @@ export default class acclist extends React.Component {
}}
/>
<Button
className="import-btn"
type="primary"
loading={this.state.newGoodsBtnLoading}
style={{ marginLeft: "20px" }}
onClick={() => {
this.addProduct();
}}
>
新建商品
</Button>
</div>
</FormItem>
<FormItem labelname="" prop="range" id="range">
<Grid

View File

@ -262,3 +262,7 @@
.isImport{
cursor: "pointer";
}
.goods-boxs{
display: flex;
justify-content: flex-start;
}

View File

@ -116,6 +116,8 @@ export default class acclist extends React.Component {
key_status: -1,
mobile_excel: "",
mobile_repeat: "",
newGoodsBtnLoading: false,
direct_reseller_id: 0,
};
}
@ -130,9 +132,6 @@ export default class acclist extends React.Component {
let batch_id = sessionStorage.getItem("keybatch_id");
let reseller_id = sessionStorage.getItem("key_reseller_id");
let approval_id = sessionStorage.getItem("approval_id");
console.log("编辑-获取直连天下数据-------1");
//编辑
if (batch_id > 0) {
getReseller(reseller_id).then((res) => {
@ -140,6 +139,9 @@ export default class acclist extends React.Component {
this.setState({ reseller: req });
this.setState({ phone_list: req.contact_phone });
this.setState({ email_list: req.contact_email });
this.setState({
direct_reseller_id: req.direct_reseller_id,
});
});
});
@ -327,8 +329,38 @@ export default class acclist extends React.Component {
this.setState({ drawerVisible: false });
}
addProduct() {
this.setState({ drawerVisible2: true });
let direct_reseller_ids = this.state.direct_reseller_id;
if (direct_reseller_ids <= 0) {
// 老数据不能进行新增商品操作
Notify.error(`请编辑映射分销商`);
return;
}
this.setState({
newGoodsBtnLoading: true,
});
let param = {
reseller_id: direct_reseller_ids,
};
try {
getProductInfoSelect(param).then((res) => {
if (res.code === 200) {
sessionStorage.setItem(
"productData",
JSON.stringify(this.state.tempdata)
);
this.setState({ productData: null });
this.setState({ drawerVisible2: true });
}
this.setState({
newGoodsBtnLoading: false,
});
});
} catch (err) {
this.setState({
newGoodsBtnLoading: false,
});
}
}
async productSubmit() {
let visible = await this.refs.product.submit();
@ -1378,6 +1410,7 @@ export default class acclist extends React.Component {
/>
</FormItem>
<FormItem labelname="商品范围" prop="rank" id="rank">
<div className="goods-boxs">
<Select
options={this.state.rankoptions}
multiple
@ -1389,14 +1422,16 @@ export default class acclist extends React.Component {
}}
/>
<Button
className="import-btn"
type="primary"
style={{ marginLeft: "20px" }}
loading={this.state.newGoodsBtnLoading}
onClick={() => {
this.addProduct();
}}
>
新建商品
</Button>
</div>
</FormItem>
<FormItem labelname="" prop="range" id="range">
<Grid

View File

@ -29,3 +29,8 @@
height: 36px;
border-bottom: 1px solid #e0e0e0;
}
.goods-boxs{
display: flex;
justify-content: flex-start;
}