兑换码管理查询接口

This commit is contained in:
red-deng-deng 2021-11-17 17:13:46 +08:00
parent 2f84eaa869
commit 81d43693aa
6 changed files with 80 additions and 259 deletions

View File

@ -24,7 +24,12 @@ const req = (method, url, params, responseType) => {
})
}
}
let http = fetch(url, obj).then(res => res.json());
let http = fetch(url, obj).then(res =>{
console.log(res.headers.get('Date-Time'));
return res.json()
});
return http.then(response => response).catch(error => console.error('Error:', error));
}

View File

@ -52,6 +52,8 @@ import classNames from 'classnames'
this.handleInputChange = this.handleInputChangeFn.bind(this)
this.losefofn=this.losefofn.bind(this)
this.focusFn= this.focusFn.bind(this)
this.sureFns= this.sureFns.bind(this)
}
handleInputChangeFn(event) {
@ -101,6 +103,12 @@ import classNames from 'classnames'
this.setState({'errshow':true});
}
}
//点击回车
sureFns(e){
if(e.target.value&&e.keyCode==13){
this.props.wordSearch();
}
}
showpwd(e){
console.log('sjaidj',e);
}
@ -152,7 +160,7 @@ import classNames from 'classnames'
<div className="iptright">
{icon? <Icon type="search" className="iconType"/>:null}
<input name={this.props.name} type={kind} onBlur={this.losefofn} onFocus={this.focusFn} style={{resize:'none'}} value={this.props.value} maxLength={maxLength} onChange={this.clearContent} onInput={this.handleInputChange} style={{height:height,lineHeight:height,width:width,textOverflow:'ellipsis'}} className={classes} placeholder={placeholder?placeholder:'请输入'}/>
<input name={this.props.name} type={kind} onBlur={this.losefofn} onFocus={this.focusFn} style={{resize:'none'}} value={this.props.value} onKeyDown={(e)=>this.sureFns(e)} maxLength={maxLength} onChange={this.clearContent} onInput={this.handleInputChange} style={{height:height,lineHeight:height,width:width,textOverflow:'ellipsis'}} className={classes} placeholder={placeholder?placeholder:'请输入'}/>
<div className="ipticonR">
{kind=='password'?<span className="showpwd" onClick={()=>this.showpwd(this)}>-</span>:null}
{clearShow==true&&this.state.iptVal?<svg onClick={this.clearItem.bind(this)} viewBox="0 0 16 16" width="16px" height="16px"><circle fill="#AAAFBA" fill-rule="evenodd" cx="8" cy="8" r="8"></circle><path d="M5.333 5.333l5.334 5.334M10.667 5.333l-5.334 5.334" stroke="#FFF" stroke-linecap="square"></path></svg>:null}

View File

@ -4,7 +4,6 @@
min-width: 300px;
display: flex;
box-sizing: border-box;
}
.nava a{
display: flex;
@ -40,6 +39,7 @@ line-height:60px;
margin-top: -5px;
margin-bottom: 60px;
position: absolute;
background: #F5F6F7;
}
.linkmenu .container{
width: 91%;

View File

@ -10,6 +10,6 @@
}
@media screen and (min-width: 1700px) {
#exchangeadd{
height:800px;
// height:800px;
}
}

View File

@ -110,13 +110,13 @@ export default class acclist extends React.Component{
this.state={
codeList:[],
total:0,
page:1,
limit:10,
tabList:[{title:"全部"},{title:"未开始"},{title:"进行中"},{title:"暂停中"},{title:"已结束"},{title:"已作废"}],
combinedValue:[],
DateTime:'',//数据更新时间
key_word:'',
activepage:0,
distdata4:[],
distdata3:[],
distdata11:[],
tableHeight:600,
}
}
@ -173,6 +173,19 @@ export default class acclist extends React.Component{
if(index==1){
}
}
//page
pageChange(e){
this.setState({page:e});
}
//limit
countChange(e){
this.setState({page:1,limit:e});
this.getCodeListFn();
}
//敲回车查询
sureFn(){
this.getCodeListFn();
}
//作废
delFn(){
Sweetalert.confirm({
@ -196,35 +209,53 @@ export default class acclist extends React.Component{
}
//选择时间
onChangeCombinedDate(e){
this.setState({combinedValue:e});
this.setState({combinedValue:e});
this.getCodeListFn(e);
}
//获取兑换码列表
getCodeListFn(){
let _self=this;
let data={key_batch_id:93}
getCodesList(data).then(res=>{
handelResponse(res,(response,msg)=>{
const codeList_data=response.data;
const {total}=response;
_self.setState({codeList:codeList_data,total});
Notify.clear();
Notify.success(msg);
},(err)=>{
})
}).catch(err=>{
});
//获取兑换码列表
getCodeListFn(time={}){
let _self=this;
let {page,limit,key_word}=_self.state;
let data={key_batch_id:93,page,limit}
console.log(123,time);
if(time&&time[0]){
data.begin_time=time[0];
data.end_time=time[1];
}
if(key_word){
data.key_word=key_word;
}
getCodesList(data).then(res=>{
handelResponse(res,(response,msg)=>{
const codeList_data=response.data;
const {total}=response;
// const DateTime=
console.log(res);
_self.setState({codeList:codeList_data,total,});
Notify.clear();
Notify.success(msg);
},(err)=>{
})
}).catch(err=>{
});
}
componentWillMount(){
let selt=this;
this.setState({tableHeight:window.innerHeight-390});
this.getCodeListFn();
}
render(){
const date = <CombinedDateRangePicker
showTime={{
format: 'HH:mm:ss',
defaultTime: ['00:00:00', '23:59:59'],
}}
format="YYYY-MM-DD HH:mm:ss"
className="zent-datepicker-demo"
value={this.state.combinedValue}
format="YYYY-MM-DD"
onChange={(e)=>{this.onChangeCombinedDate(e)}}
/>
const { current, pageSize } = this.state;
@ -234,11 +265,10 @@ componentWillMount(){
<p className="codetable dflexajce">
{/* <Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}>新建兑换码</Button> */}
{/* <Button type="info">批量操作</Button> */}
<Ipt icon="search" placeholder={"请输入关键字进行匹配查询"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>
<Ipt onClearItem={(e)=>{this.setState({key_word:''})}} wordSearch={this.sureFn.bind(this)} onChange={(e)=>this.setState({key_word:e})} value={this.state.key_word} icon="search" placeholder={"请输入关键字进行匹配查询"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>
</p>
<div className="code-table">
{
this.state.activepage==0? <Grid
<Grid
spliteColor={'#fff'}
tableData={this.state.codeList}
Column={Column}
@ -251,6 +281,11 @@ componentWillMount(){
pageChange={(e)=>{
this.pageChange(e)
}}
countChange={
(e)=>{
this.countChange(e)
}
}
checkChange ={(selection)=>{
console.log(selection)
}}
@ -285,233 +320,7 @@ componentWillMount(){
</div>
}
}}
/>:null
}
{
this.state.activepage==1? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata2}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "quantity")
{
return <p>{rowData.quantity}({rowData.total_issued})</p>
}
if(com == "status")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.exchangeStatusBg(parseInt(rowData.status))}}></font>{menu.exchangeStatus(parseInt(rowData.status))}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 进行 */}
{
this.state.activepage==2? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata11}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.exchangeStatusBg(parseInt(rowData.status))}}></font>{menu.exchangeStatus(parseInt(rowData.status))}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 暂停 */}
{
this.state.activepage==3? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata2}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.exchangeStatusBg(parseInt(rowData.status))}}></font>{menu.exchangeStatus(parseInt(rowData.status))}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 一结束 */}
{
this.state.activepage==4? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata3}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.exchangeStatusBg(parseInt(rowData.status))}}></font>{menu.exchangeStatus(parseInt(rowData.status))}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
{/* 已作废 */}
{
this.state.activepage==5? <Grid
spliteColor={'#fff'}
tableData={this.state.distdata4}
Column={Column}
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
isMultiple={false}
pageChange={(e)=>{
this.pageChange(e)
}}
checkChange ={(selection)=>{
console.log(selection)
}}
ComponentHandler={(com,rowData)=>{
if(com == "codename")
{
return <span className="grid-link" onClick={(e)=>this.aboutFn(e,rowData)}>{rowData.name}</span>;
}
if(com == "name")
{
return <Switch size="small" checked={rowData.status} onChange={(e)=>this.changestatus(e,rowData)}></Switch>;
}
if(com == "status")
{
return <p className="dflexa" ><span><font className="icon" style={{background:menu.exchangeStatusBg(parseInt(rowData.status))}}></font>{menu.exchangeStatus(parseInt(rowData.status))}</span></p>
}
if(com == "opearo")
{
return <div>
{
rowData.status!=2|| rowData.status!=3?<span className="grid-link" onClick={(e)=>this.editinfo(e,rowData)}>编辑</span>:null
}
{
rowData.status!=2|| rowData.status!=3? <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)} >作废</span>:null
}
<span className="grid-link" >复制</span>
</div>
}
}}
/>:null
}
/>
</div>
</TabPage>
</div>

View File

@ -47,7 +47,7 @@
width: 100%;
flex: 1;
margin-top: 60px;
overflow: hidden;
overflow: scroll;
.subtitle{
height: 60px;
line-height: 60px;
@ -58,7 +58,6 @@
}
.route-box{
width: 100%;
height: 100%;
overflow-y: scroll;
// background: #ff0;
// height: 100%;
// overflow-y: scroll;
}