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 });
this.setState({ productData: null });
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,25 +1434,28 @@ export default class acclist extends React.Component {
/>
</FormItem>
<FormItem labelname="商品范围" prop="rank" id="rank">
<Select
options={this.state.rankoptions}
multiple
value={this.state.rank}
placeholder="选择一项"
width={405}
onChange={(e) => {
this.onRankChange(e);
}}
/>
<Button
className="import-btn"
type="primary"
onClick={() => {
this.addProduct();
}}
>
新建商品
</Button>
<div className="goods-boxs">
<Select
options={this.state.rankoptions}
multiple
value={this.state.rank}
placeholder="选择一项"
width={405}
onChange={(e) => {
this.onRankChange(e);
}}
/>
<Button
type="primary"
loading={this.state.newGoodsBtnLoading}
style={{ marginLeft: "20px" }}
onClick={() => {
this.addProduct();
}}
>
新建商品
</Button>
</div>
</FormItem>
<FormItem labelname="" prop="range" id="range">
<Grid

View File

@ -261,4 +261,8 @@
}
.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 });
this.setState({ productData: null });
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,25 +1410,28 @@ export default class acclist extends React.Component {
/>
</FormItem>
<FormItem labelname="商品范围" prop="rank" id="rank">
<Select
options={this.state.rankoptions}
multiple
value={this.state.rank}
placeholder="选择一项"
width={405}
onChange={(e) => {
this.onRankChange(e);
}}
/>
<Button
className="import-btn"
type="primary"
onClick={() => {
this.addProduct();
}}
>
新建商品
</Button>
<div className="goods-boxs">
<Select
options={this.state.rankoptions}
multiple
value={this.state.rank}
placeholder="选择一项"
width={405}
onChange={(e) => {
this.onRankChange(e);
}}
/>
<Button
type="primary"
style={{ marginLeft: "20px" }}
loading={this.state.newGoodsBtnLoading}
onClick={() => {
this.addProduct();
}}
>
新建商品
</Button>
</div>
</FormItem>
<FormItem labelname="" prop="range" id="range">
<Grid

View File

@ -28,4 +28,9 @@
text-align: left;
height: 36px;
border-bottom: 1px solid #e0e0e0;
}
.goods-boxs{
display: flex;
justify-content: flex-start;
}