白名单更新

This commit is contained in:
姜棚 2022-01-20 11:15:25 +08:00
parent 3366a7fa6e
commit 1bb79a46b4
5 changed files with 462 additions and 148 deletions

View File

@ -222,16 +222,25 @@ export default class acclist extends React.Component{
}
return valide
}
importClick(){
if(this.state.accessVerify)
{
this.setState({accessVerify:false})
this.setState({excel_visible:true})
this.setState({import_visible:false})
}
else{
Notify.error("文件正在解析中请稍等")
}
if(this.state.file_loading)
{
Notify.error("文件正在解析中请稍等")
}
else{
if(this.state.success_visible)
{
this.setState({accessVerify:false})
this.setState({excel_visible:true})
this.setState({import_visible:false})
}
else{
Notify.error("请上传正确的文件")
}
}
}
Cancel(){
Sweetalert.confirm({
@ -256,7 +265,15 @@ export default class acclist extends React.Component{
onStyleChange(e){
let model2 = this.state.model;
model2.style = e.target.value;
model2.quantity = 0
this.setState({model:model2})
if(e.target.value == 1)
{
this.setState({white_visible:true})
}
else{
this.setState({white_visible:false})
}
}
onRepetitionChange(e){
@ -763,15 +780,17 @@ export default class acclist extends React.Component{
this.setState({"email":e.target.value})
}
initUpload(){
this.setState({import_visible:false})
this.setState({success_visible:false})
this.setState({fail_visible:false})
this.setState({file_loading:false})
this.setState({upload_visible:false})
this.setState({excel_visible:false})
this.setState({accessVerify:false})
}
initUpload(){
this.setState({import_visible:false})
this.setState({success_visible:false})
this.setState({fail_visible:false})
this.setState({file_loading:false})
this.setState({upload_visible:false})
this.setState({excel_visible:false})
this.setState({accessVerify:false})
}
fileChange(e){
// this.initUpload();
@ -810,7 +829,7 @@ export default class acclist extends React.Component{
this.setState({exceldata:req.validationFailed})
this.setState({file_loading:false})
this.setState({success_visible:false})
this.setState({success_visible:true})
}
else{
this.setState({file_loading:false})
@ -832,6 +851,9 @@ export default class acclist extends React.Component{
this.setState({success_visible:false})
}
}
resetUpload(){
this.setState({excel_visible:false})
this.setState({import_visible:true})
@ -847,14 +869,38 @@ export default class acclist extends React.Component{
this.setState({mobile_repeat:arr})
console.log(data)
}
importConfirmClick(){
let model = this.state.model;
model.quantity = this.state.excel_count - this.state.error_count + this.state.mobile_repeat.length;
this.setState({model:model})
this.setState({accessVerify:false})
importConfirmClick(){
let temp = this.state.exceldata.filter(o=>o.type == "success");
console.log("临时",temp)
let mobile_repeat= _.map(temp,(o)=>{
return o.mobile;
})
console.log("重复的手机号",mobile_repeat)
this.setState({mobile_repeat:mobile_repeat})
let model = this.state.model;
model.quantity = this.state.excel_count - this.state.error_count + this.state.mobile_repeat.length;
this.setState({model:model})
this.setState({accessVerify:false})
this.setState({excel_visible:false})
this.setState({import_visible:false})
this.setState({import_success:true})
}
resetUpload(){
this.setState({excel_visible:false})
this.setState({import_visible:false})
this.setState({import_visible:true})
this.setState({accessVerify:true})
}
switchChange(e,rowData){
if(e)
{
rowData.type = "success"
}
else{
rowData.type= rowData.type == "success" ? "repeat" :"error"
}
}
render(){
const Column = [
@ -973,7 +1019,7 @@ export default class acclist extends React.Component{
width:'auto',
},
{
title: '商品描述',
title: '商品',
prop: 'describe_url',
name: 'describe_url',
type: "slot",
@ -1081,10 +1127,21 @@ export default class acclist extends React.Component{
}
{
this.state.import_success ? (<Button type="primary" onClick={(e)=>{
this.setState({mobile_excel:""})
this.setState({mobile_repeat:[]})
this.setState({import_success:false})
this.setState({excel_count:0})
this.setState({accessVerify:false})
let model = this.state.model;
model.quantity = 0;
this.setState({model:model})
}}>清除白名单</Button>) :(
this.state.white_visible ? (<Button type="primary" onClick={(e)=>{
this.initUpload();
this.setState({import_visible:true})
}}>导入白名单</Button>) : null
}}>导入白名单</Button>) : null)
}
</div>
</FormItem>
@ -1433,7 +1490,7 @@ export default class acclist extends React.Component{
</div>) : (
<div>
<input type="file" className="upload-input" onChange={(e)=>this.fileChange(e)} />
<Button type="primary" className="btn-upload">
<Button className="btn-upload" style={{background:'#1890ff',color:"#FFFFFF",border:'none'}} >
上传文件
</Button> </div>)
@ -1458,7 +1515,7 @@ export default class acclist extends React.Component{
<div className="foot-bar">
<div className="btn-group">
<Button type="default" onClick={(e)=>{this.setState({import_visible:false}) }} >取消</Button>
<Button type="primary" onClick={(e)=>{this.importClick(e)}} >确定导入</Button>
<Button type="primary" onClick={(e)=>{this.importClick(e)}} style={{background:'#1890ff',color:"#FFFFFF",border:'none'}}>确定导入</Button>
</div>
</div>
</div>
@ -1472,6 +1529,35 @@ export default class acclist extends React.Component{
}
{
this.state.audit_visible ? (
<div className="audit">
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.setState({audit_visible:false})}} />
<div className="audit-box-title">提交审核</div>
<div className="payType">
<RadioGroup onChange={(e)=>{this.onPayTypeChange(e)}} value={this.state.paytype} className="audit-obj">
<Radio value={3}>预付款扣除</Radio>
<Radio value={1}>对私账户</Radio>
<Radio value={2}>对公账户</Radio>
</RadioGroup>
</div>
<div className="audit-btn-group">
<Button onClick={(e)=>{this.setState({audit_visible:false})}}>取消</Button>
<Button type="primary" onClick={(e)=>{this.onAudit(e)}} >确定</Button>
</div>
</div>
</div>
):null
}
{
this.state.excel_visible ? (
<div>
@ -1508,20 +1594,18 @@ export default class acclist extends React.Component{
ComponentHandler={(com,rowData,rowIndex)=>{
if(com=="is_import")
{
if(rowData.type == "repeat")
{
return <div className="isImport" onClick={(e)=>{
this.allowImport(rowData)
}}>允许导入</div>
}
if(rowData.type == "success")
{
return <div className="isImport">准备导入</div>
}
else{
return <div className="isImport">-</div>
}
if(rowData.type == "success" || rowData.type =="repeat")
{
let checked = rowData.type == "success"
return <Switch
checked={ checked }
onChange={ (e)=>{this.switchChange(e,rowData)}}
/>
}
else{
return <div className="isImport">-</div>
}
}
}}
/>
@ -1531,7 +1615,7 @@ export default class acclist extends React.Component{
<div className="btn-group">
<Button type="default" onClick={(e)=>{this.resetUpload() }} >重新上传
</Button>
<Button type="primary" onClick={(e)=>{this.importConfirmClick(e)}} >确定导入</Button>
<Button type="primary" onClick={(e)=>{this.importConfirmClick(e)}} style={{background:'#1890ff',color:"#FFFFFF",border:'none'}}>确定导入</Button>
</div>
</div>
@ -1544,38 +1628,6 @@ export default class acclist extends React.Component{
}
{
this.state.audit_visible ? (
<div className="audit">
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.setState({audit_visible:false})}} />
<div className="audit-box-title">提交审核</div>
<div className="payType">
<RadioGroup onChange={(e)=>{this.onPayTypeChange(e)}} value={this.state.paytype} className="audit-obj">
<Radio value={3}>预付款扣除</Radio>
<Radio value={1}>对私账户</Radio>
<Radio value={2}>对公账户</Radio>
</RadioGroup>
</div>
<div className="audit-btn-group">
<Button onClick={(e)=>{this.setState({audit_visible:false})}}>取消</Button>
<Button type="primary" onClick={(e)=>{this.onAudit(e)}} >确定</Button>
</div>
</div>
</div>
):null
}
</div>
)
}

View File

@ -20,4 +20,245 @@
color: #8a96aa;
background: #dfe8fc!important;
border: 1px solid #8a96aa!important;
}
}
.import-excel
{
width: 451px;
height:600px;
background-color: #FFFFFF;
border-radius: 5px;
box-shadow: 0 0 10px #DEE2E5;
position: fixed;
top: 50%;
margin-top: -280px;
left: 50%;
margin-left: -215px;
z-index: 100;
.import-header{
width: 100%;
height: 48px;
display: flex;
align-items: center;
.import-title{
width: 70%;
font-size: 18px;
font-weight: bold;
margin-left: 20px;
}
.closebtn{
width: 30%;
}
.import-close{
margin-left: 70px;
font-size: 20px;
font-weight: bold;
}
}
.step-bar{
width: 80%;
height: 60px;
margin: 10px auto;
display: flex;
justify-content: center;
}
.step-code{
width: 24px;
height: 24px;
border-radius: 50%;
border: 1px solid #e8e8e8;
display: flex;
align-items: center;
justify-content: center;
color: #e8e8e8;
}
.step-code.active
{
background-color: #1890ff;
}
.step-group{
width: 150px;
height: 50px;
display: flex;
align-items: center;
}
.step-center{
width: 60px;
height: 50px;
display: flex;
align-items: center;
margin-right: 40px;
}
.step-line{
width: 50px;
height: 1px;
background-color:#e8e8e8;
}
.step-line.active{
background-color: #1890ff;
}
.step-label{
color: #8d8d8d;
font-size: 14px;
margin-left: 10px;
font-weight: bold;
}
.step-label.active{
color: #000000;
}
.upload-panel1{
width: 80%;
margin: 10px auto;
margin-bottom: 20px;
.upload-label{
font-size: 15px;
font-weight: bold;
margin-bottom: 20px;
}
.upload-info{
color:#626366;
}
}
.btn-upload{
margin-top: 10px;
margin-left: 40px;
margin-bottom: 20px;
background-color:#1890ff;
}
.btn-download{
margin-top: 10px;
margin-left: 40px;
}
.foot-bar
{
width: 100%;
height: 50px;
position: absolute;
bottom: 20px;
.btn-group{
width: 240px;
margin-left: 160px;
}
button{
width: 100px;
}
}
.upload-msgbar{
width: 82%;
background-color: #f5f5f5;
margin: 0 auto;
min-height: 40px;
border-radius: 5px;
display: flex;
.execel-name{
width: 75%;
display: flex;
min-height: 40px;
align-items: center;
.excel-txt{
font-size: 12px;
margin-left: 10px;
}
.doc-flag{
font-size: 20px;
margin-left: 5px;
}
}
.file-tag{
width: 25%;
font-size: 12px;
display: flex;
align-items: center;
color: #1890ff;
.upload-flag{
font-size: 20px;
margin-left: 5px;
color: #1890ff;
margin-right: 3px;
}
}
}
.file-tip{
margin-left: 45px;
margin-top: 10px;
margin-bottom: 50px;
}
.error{
color: #e83f2e;
}
.success{
color: #98d673;
}
.error-icon{
color: #e83f2e;
font-size: 18px;
margin-right: 10px;
}
.success-icon{
color: #98d673;
font-size: 18px;
margin-right: 10px;
}
.file-upload-tip{
color: #000000;
font-size: 14px;
font-weight: bold;
margin-left: 40px;
margin-top: 20px;
}
.file-errmsg{
color: #000000;
font-size: 14px;
margin-left: 40px;
margin-top: 40px;
}
.gridpanel{
width: 90%;
height: 400px;
margin: 0 auto;
margin-top: 50px;
}
}
.audit-obj{
margin-left: 30px;
margin-bottom: 10px;
}
.upload-input{
opacity: 0;
width: 300px;
height: 48px;
position: absolute;
z-index: 5;
}
.file-loading{
font-size: 24px;
}
.isImport{
cursor: "pointer";
}

View File

@ -36,7 +36,8 @@ export default class add extends React.Component{
reseller:"",
payment_direction:["对私账户","对公账户","预付款扣除"],
isload:false,
is_audit:false
is_audit:false,
whiteStyle:false
}
}
@ -117,8 +118,13 @@ export default class add extends React.Component{
let data = null
if(this.refs[this.state.keys[i]])
{
console.log("生成key",this.refs[this.state.keys[i]])
console.log("key",this.state.keys[i])
console.log("key",this.refs[this.state.keys[i]])
data = this.refs[this.state.keys[i]].submit();
@ -210,9 +216,22 @@ export default class add extends React.Component{
this.state.keys.push(step)
this.setState({keys:this.state.keys})
this.setState({isload:true})
if(this.refs[this.state.keys[0]].state.model.style == 1)
{
this.setState({whiteStyle:true})
}
console.log(this.state.keys)
}
onStyleChange(e){
console.log("状态",e.target.value)
if(e.target.value == 1)
{
this.setState({whiteStyle:true})
}
else{
this.setState({whiteStyle:false})
}
}
onPhoneChange(e){
this.setState({phone_radio:e.target.value})
}
@ -341,7 +360,7 @@ export default class add extends React.Component{
}>
<Step2 ref={item} addNewkey ={()=>{this.addNewkey()}} isload={this.state.isload} />
<Step2 ref={item} addNewkey ={()=>{this.addNewkey()}} onStyleChange={(e)=>{this.onStyleChange(e)}} isload={this.state.isload} name={index} whiteStyle={this.state.whiteStyle} />
</Card>
) : null
})

View File

@ -24,6 +24,7 @@ export default class add extends React.Component{
{id:3,title:"落地页",child:[{step:1,title:"绑定落地页"}]},
],
phone_list:[],
email_list:[],
phone:"",
email:"",
@ -408,6 +409,9 @@ export default class add extends React.Component{
this.setState({audit_visible:false})
let approval_id = sessionStorage.getItem("approval_id")
if(approval_id > 0)
{
getApprovalsStatus(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
if(req.status == 0)
@ -451,7 +455,27 @@ export default class add extends React.Component{
})
})
}
else{
let data =
{
"reseller_id":this.state.reseller.id,
"reseller_name":this.state.reseller.name,
"company_name":this.state.reseller.company_name,
"receive_email":this.state.email_list[0],
"payment_direction":this.state.payment_direction[this.state.paytype - 1],
}
approvals(plan_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("成功发起审批")
this.setState({audit_visible:false})
this.props.history.push('/home/plan-list/');
},(err)=>{
Notify.error(err)
})
})
}
}

View File

@ -26,6 +26,8 @@ export default class acclist extends React.Component{
constructor(props){
super(props)
this.state={
model:{ //数据模型不可少
style:1,
@ -71,10 +73,12 @@ export default class acclist extends React.Component{
excel_count:0,
success_count:0,
error_count:0,
whiteStyle:false,
import_success:false,
}
}
componentDidMount(e){
@ -85,16 +89,18 @@ export default class acclist extends React.Component{
let input = items[1].getElementsByTagName("input")[0];
input.focus();
//除了主key批次窗口其他都禁用
if(this.props.name > 0)
{
this.setState({whiteStyle:true})
}
}
submit(){
let valide = false;
if(this.refs.form1.validator())
{
console.log("验证成功")
let data = {};
data.batch_name = this.state.model.batch_name;
data.style = this.state.model.style;
@ -120,8 +126,11 @@ export default class acclist extends React.Component{
onStyleChange(e){
this.props.onStyleChange(e)
let model2 = this.state.model;
model2.style = e.target.value;
model2.quantity = 0
this.setState({model:model2})
if(e.target.value == 1)
{
@ -213,7 +222,21 @@ export default class acclist extends React.Component{
},500)
}
}
componentWillReceiveProps(nextProps) {
if(this.state.whiteStyle != nextProps.whiteStyle)
{
if(this.props.name > 0)
{
console.log("更改状态")
this.setState({whiteStyle:nextProps.whiteStyle})
}
}
}
onChangeCombinedDate(e){
let model2 = this.state.codeInfo;
model2.date_time = e;
@ -223,7 +246,6 @@ export default class acclist extends React.Component{
this.refs.form2.validator()
}
onRankChange(e){
console.log(e)
_.forEach(this.state.tempdata, (item) => {
item.checked = e.findIndex((checks)=>{return checks.key == item.product_id}) > -1;
})
@ -310,6 +332,7 @@ export default class acclist extends React.Component{
}
}
addNewKey(){
this.props.addNewkey()
}
@ -351,7 +374,7 @@ export default class acclist extends React.Component{
};
onDisabledRange = (date, type)=>{
let step1 = JSON.parse (sessionStorage.getItem("step1"));
let step1 = JSON.parse (sessionStorage.getItem("step1"));
let isdisabled = false;
let str = moment(date).format("YYYY-MM-DD HH:mm:ss")
if( type == "start" )
@ -456,19 +479,18 @@ export default class acclist extends React.Component{
if(file.length > 0 && file[0].status == "success")
{
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
this.state.tempdata[rowIndex].describe_url =file[0].src;
this.setState({tempdata:this.state.tempdata})
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
this.state.tempdata[rowIndex].describe_url =file[0].src;
this.setState({tempdata:this.state.tempdata})
}
};
onUploadChange2(file,row){
if(file.length > 0 && file[0].status == "success")
{
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
this.state.tempdata[rowIndex].describe_url =file[0].src;
this.setState({tempdata:this.state.tempdata})
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
this.state.tempdata[rowIndex].describe_url =file[0].src;
this.setState({tempdata:this.state.tempdata})
}
}
@ -591,49 +613,6 @@ export default class acclist extends React.Component{
}
}
// if(this.state.accessVerify)
// {
// this.setState({accessVerify:false})
// this.setState({excel_visible:true})
// this.setState({import_visible:false})
// }
// else{
// Notify.error("文件正在解析中请稍等")
// }
// let my_file = this.state.myfile;
// let formdata = new FormData()
// formdata.append("file",my_file)
// formdata.append("path","common_image")
// uploadImg(formdata).then((res)=>{
// handelResponse(res,(req,msg)=>{
// let path = req.path
// let data={
// excel:path
// }
// getAccessVerification(data).then((res)=>{
// handelResponse(res,(req,msg)=>{
// console.log("excel结果")
// console.log(req)
// },(err)=>{
// })
// });
// },(err)=>{
// })
// });
}
fileChange(e){
// this.initUpload();
@ -827,7 +806,7 @@ export default class acclist extends React.Component{
width:'auto',
},
{
title: '商品描述',
title: '商品',
prop: 'describe_url',
name: 'describe_url',
type: "slot",
@ -904,19 +883,18 @@ export default class acclist extends React.Component{
type: "slot",
}
];
return(
<div id="step2">
<Form model={this.state.model} rules={rules} ref="form1">
<FormItem labelname=" key样式" prop="style" id="style">
<RadioGroup onChange={(e)=>{ this.onStyleChange(e)} } value={this.state.model.style}>
<RadioButton value={1}>串码</RadioButton>
<RadioButton value={2} >链接</RadioButton>
<RadioButton value={4} >二维码</RadioButton>
<RadioButton value={2} disabled={this.state.whiteStyle} >链接</RadioButton>
<RadioButton value={4} disabled={this.state.whiteStyle}>二维码</RadioButton>
</RadioGroup>
</FormItem>
@ -963,7 +941,7 @@ export default class acclist extends React.Component{
this.setState({model:model2})
}}
value={this.state.model.quantity} disabled={this.state.white_visible} placeholder={"请输入"} labelWidth={'0px'} maxLength={5} height={'36px'} width={'400px'} alignment={'left'}/>
value={this.state.model.quantity} disabled={this.state.import_success} placeholder={"请输入"} labelWidth={'0px'} maxLength={5} height={'36px'} width={'400px'} alignment={'left'}/>