更改二维码状态为4 key码列表对接api调整细节

This commit is contained in:
姜棚 2021-12-22 16:16:14 +08:00
parent 18a9269827
commit 69585f9908
6 changed files with 47 additions and 412 deletions

View File

@ -121,6 +121,10 @@ import _ from "lodash";
this.onJumpPage(1)
switch(key)
{
case "0":
this.setState({count:5})
this.props.onCountChange(5);
break;
case "1":
this.setState({count:10})
this.props.onCountChange(10);
@ -183,6 +187,7 @@ import _ from "lodash";
</DropdownClickTrigger>
<DropdownContent>
<Menu onClick={(e,key) => {this.onMenuClick(e,key)}} className="mymenu" >
<MenuItem key={0}>5</MenuItem>
<MenuItem key={1}>10</MenuItem>
<MenuItem key={2}>20</MenuItem>
<MenuItem key={3}>50</MenuItem>

View File

@ -920,7 +920,7 @@ export default class acclist extends React.Component{
<RadioGroup onChange={(e)=>{ this.onStyleChange(e)} } value={this.state.model.style} disabled={this.state.isEdit} >
<RadioButton value={1}>串码</RadioButton>
<RadioButton value={2} >链接</RadioButton>
<RadioButton value={3} >二维码</RadioButton>
<RadioButton value={4} >二维码</RadioButton>
</RadioGroup>
</FormItem>

View File

@ -720,7 +720,7 @@ export default class acclist extends React.Component{
<RadioGroup onChange={(e)=>{ this.onStyleChange(e)} } value={this.state.model.style}>
<RadioButton value={1}>串码</RadioButton>
<RadioButton value={2} >链接</RadioButton>
<RadioButton value={3} >二维码</RadioButton>
<RadioButton value={4} >二维码</RadioButton>
</RadioGroup>
</FormItem>

View File

@ -13,7 +13,10 @@ import _ from "lodash";
import menu from "../../../../assets/enum.js"
import common from "../../../../assets/comm.js"
const PAGE_SIZE_OPTIONS = [10, 20, 30];
// <Button onClick={this.clickFn.bind(this)}>批量作废</Button>
// <Button onClick={this.clickFn.bind(this)}>批量标记已使用</Button>
// <Button type="primary" onClick={this.clickFn.bind(this)}>导出excel</Button>
// <Button type="primary" onClick={this.clickFn.bind(this)}>导出关联订单</Button>
export default class acclist extends React.Component{
constructor(props){
@ -50,12 +53,7 @@ export default class acclist extends React.Component{
}
}
clickFn(){
let link = window.location.href.replace(window.location.hash,"#/home/plan-create");
console.log(link)
window.open(link, "_blank")
}
//分页
onPageChange(e){
this.setState({page:e});
@ -64,60 +62,7 @@ export default class acclist extends React.Component{
},0);
}
send(e)
{
let phoneReg = new RegExp("^[1][3,4,5,6,7,8,9][0-9]{9}$");
let emailReg = new RegExp( "^[A-Za-z0-9\u4e00-\u9fa5\.]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$");
let plan_id = this.state.plan_id;
let data ={
phone: this.state.phone_radio > -1 ? this.state.phone_list[this.state.phone_radio] : this.state.phone ,
email: this.state.email_radio > -1 ? this.state.email_list[this.state.email_radio] : this.state.email
}
if (!phoneReg.test(data.phone)) {
Notify.error("手机号格式不正确")
return;
}
if(!emailReg.test(data.email)){
Notify.error("邮箱格式不正确")
return;
}
planSend(plan_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
let data = {
"operation": 1
}
startOrStopPlan(plan_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
let data = {
page:this.state.page,
limit:this.state.limit
}
this.getPlanList(data);
},(err)=>{
Notify.error(err)
})
})
this.setState({audit_visible:false})
Notify.success("发送成功")
},(err)=>{
Notify.error(err)
})
})
}
componentDidMount(e){
let data = {
page:1,
@ -155,265 +100,17 @@ export default class acclist extends React.Component{
let data = {
page:this.state.page,
limit:this.state.limit,
status:this.state.status,
key_word:this.state.key_word
key:this.state.key
}
this.getPlanList(data);
this.getKeyCodeList(data);
}
//切换siwtch
onSwitchChange(status,row){
let self = this;
Sweetalert.confirm({
type:'warning',
closeBtn:true,
title:'确认操作',
content: <p>是否改变{row.open==1?'关闭':'开启'}<b>[{row.title}]</b></p>,
onConfirm:()=>{ this.changeState(status,row)},
onCancel: this.onCancel,
className:'questModal',
parentComponent: this
});
}
cancel(e){
this.setState({audit_visible:false})
}
//修改状态
changeState(status,row){
let self=this;
let data = {
"operation": status ? 1 : 2
}
if(row.status == 3)
{
this.setState({plan_id:row.id})
planIsSend(row.id).then((res)=>{
handelResponse(res,(req,msg)=>{
if(req.is_send == false)
{
this.setState({cur_item:row})
getReseller(row.reseller_id).then((res)=>{
handelResponse(res,(req,msg)=>{
this.setState({phone_list:req.contact_phone})
this.setState({email_list:req.contact_email})
this.setState({audit_visible:true})
},(err)=>{
Notify.error(err)
})
})
}
else{
startOrStopPlan(row.id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
let id = _.findIndex(this.state.distdata,(o)=>{return o.id == row.id});
console.log(row.status)
this.state.distdata[id].open = status ? 2 : 1;
this.setState({distdata:this.state.distdata})
let data = {
page:this.state.page,
limit:this.state.limit,
status:this.state.status,
key_word:this.state.key_word
}
self.getPlanList(data);
Notify.success("更改状态成功")
},(err)=>{
Notify.error(err)
})
})
}
})
});
}
else{
startOrStopPlan(row.id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
let id = _.findIndex(this.state.distdata,(o)=>{return o.id == row.id});
this.state.distdata[id].open = status ? 2 : 1;
this.setState({distdata:this.state.distdata})
let data = {
page:this.state.page,
limit:this.state.limit,
status:this.state.status,
key_word:this.state.key_word
}
self.getPlanList(data);
Notify.success("更改状态成功")
},(err)=>{
Notify.error(err)
})
})
}
}
//输入值变化
onInputChange(e){
}
//营销系统名称
linkTo(row){
// sessionStorage.setItem('showflag',true);
// let arr=[{pagetitle:'编辑',items:[{path:'/home/key-list',name:'营销计划管理'},
// {path:'/home/key-list',name:row.title+'key列表'}
// ]}]
// sessionStorage.setItem("plan_item",JSON.stringify(row))
// sessionStorage.setItem('breaknav',JSON.stringify(arr));
// sessionStorage.setItem('linkshowname',"营销计划管理");
// sessionStorage.setItem("key_plan_id",row.id)
// sessionStorage.setItem("key_plan_status",row.status)
// this.props.history.push('/home/key-list');
}
menuItemClick(e,key,row){
if(row.status ==6 ||row.status == 0 )
{
Notify.error("该状态下的数据不允许编辑")
return
}
if(key == 1)
{
let data ={
"type":"sms"
}
planResend(row.id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("发送成功")
},(err)=>{
Notify.error(err)
})
})
}
if(key == 2)
{
let data ={
"type":"email"
}
planResend(row.id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("发送成功")
},(err)=>{
Notify.error(err)
})
})
}
if(key == 3)
{
let email = ""
let self = this;
openDialog({
closeBtn:true,
dialogId: 1, // id is used to close the dialog
title: '请输入接收邮箱',
children: <Input placeholder="请输入接收邮箱" onChange={self.emailChange}></Input>,
footer: <Button onClick={() => {
if(this.state.email=="")
{
Notify.clear();
Notify.error("接收邮箱不能为空")
return
}else{
let reg=/^[A-Za-z0-9\u4e00-\u9fa5\.]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
if(!reg.test(this.state.email)){
Notify.clear();
Notify.error("接收邮箱格式不正确")
}else{
let plan_id = row.id
let data ={
type:"email",
to: this.state.email
}
planReceive(plan_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("发送成功")
closeDialog(1)
},(err)=>{
Notify.error(err)
})
})
}
}
}}>发送</Button>,
onClose() {
console.log('outer dialog closed');
},
});
}
if(key == 4)
{
let phone = ""
let self = this
openDialog({
closeBtn:true,
dialogId: 2, // id is used to close the dialog
title: '请输入接收手机',
children: <Input placeholder="请输入接收手机号" onChange={self.phoneChange}></Input>,
footer: <Button onClick={
()=>{
if(this.state.phone=="")
{
Notify.clear();
Notify.error("接收手机号不能为空")
return
}else{
let reg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if(!reg.test(self.state.phone)){
Notify.clear()
Notify.error("接收手机号格式不正确")
}else{
let plan_id = row.id
let data ={
type:"sms",
to: this.state.phone
}
console.log(phone)
planReceive(plan_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("发送成功")
closeDialog(2)
},(err)=>{
Notify.error(err)
})
})
}
}
}
}>发送</Button>,
onClose() {
},
});
}
}
//清空
clearFn(){
this.refs.plan_list.allChecked(false)
@ -440,36 +137,6 @@ export default class acclist extends React.Component{
});
this.setState({grantTotal,receiveTotal,usageTotal,silentTotal,receive_total,usage_total,silent_total});
}
onFilter(e,prop){
this.setState({page:1})
this.setState({limit:10})
let data = {
page:1,
limit:10,
key_word:this.state.key_word
}
data[prop] = e
if(e==999)
{
delete data[prop];
}
else{
let params ={}
params[prop] = e
this.setState(params)
}
this.getPlanList(data)
console.log(data)
}
phoneChange=(e)=>
{
this.setState({"phone":e.target.value})
}
emailChange=(e)=>
{
this.setState({"email":e.target.value})
}
// 监听组件内部状态的变化:
componentDidUpdate(prevProps,prevState){
@ -477,9 +144,6 @@ export default class acclist extends React.Component{
if(prevState.search!=this.state.search &&!this.state.search){
this.iptsureFn();
}
if(prevState.status!=this.state.status){
this.iptsureFn();
}
}
iptsureFn(e){
@ -488,45 +152,15 @@ export default class acclist extends React.Component{
let data = {
page:1,
limit:10,
status:this.state.status,
key_word: this.state.search
key: this.state.search
}
this.getPlanList(data)
this.getKeyCodeList(data)
}
onPhoneChange(e){
this.setState({phone_radio:e.target.value})
}
onEmailChange(e){
this.setState({email_radio:e.target.value})
}
onEdit(e,row){
sessionStorage.setItem('showflag',true);
let editarr=[{pagetitle:'编辑',items:[{path:'/home/key-list',name:'营销计划管理'},
{path:'/home/key-list',name:'编辑:'+row.title}
]}]
sessionStorage.setItem('breakchangenav',JSON.stringify(editarr));
if(row.status == 2 || row.status == 6)
{
Notify.clear();
Notify.error("不可编辑")
return;
}
sessionStorage.setItem("plan_id",row.id)
sessionStorage.setItem("plan_status",row.status)
let link = window.location.href.replace(window.location.hash,"#/home/plan-edit");
window.open(link, "_blank")
sessionStorage.setItem('showflag',true);
let arr=[{pagetitle:'编辑',items:[{path:'/home/key-list',name:'营销计划管理'},
{path:'/home/key-list',name:'编辑:'+row.title}
]}]
sessionStorage.setItem('breaknav',JSON.stringify(arr));
sessionStorage.setItem('linkshowname',"营销计划管理");
}
onFilterClose(prop){
let data = {}
data[prop] = null;
@ -536,15 +170,21 @@ export default class acclist extends React.Component{
let params = {
page:1,
limit:10,
status:this.state.status,
key_word: this.state.search
key: this.state.search
}
this.getPlanList(params)
this.getKeyCodeList(params)
}
tabFn(e){
console.log(e)
switch(e){
}
}
render(){
const { current, pageSize } = this.state;
@ -581,13 +221,7 @@ export default class acclist extends React.Component{
type: "normal",
width:'auto'
},
{
title: '操作',
prop: 'opearo',
name: 'opearo',
type: "slot",
width:'auto',
},
];
const date = <CombinedDateRangePicker
className="zent-datepicker-demo"
@ -604,26 +238,21 @@ export default class acclist extends React.Component{
<TabPage tabs={this.state.tabList} slot={date} tabChange={this.tabFn.bind(this)}>
<div className="distable dflexj">
<div className="">
<Button onClick={this.clickFn.bind(this)}>批量作废</Button>
<Button onClick={this.clickFn.bind(this)}>批量标记已使用</Button>
<Button type="primary" onClick={this.clickFn.bind(this)}>导出excel</Button>
<Button type="primary" onClick={this.clickFn.bind(this)}>导出关联订单</Button>
</div>
{/* <Button type="info">批量操作</Button> */}
<Ipt onChange={(e)=>this.setState({search:e})} value={this.state.search} wordSearch={this.iptsureFn.bind(this)} icon="search" placeholder={"请输入营销计划名称、分销商名称查询"} countShow={false} height={'36px'} width={'260px'} onClearItem={(e)=>{
<Ipt onChange={(e)=>this.setState({search:e})} value={this.state.search} wordSearch={this.iptsureFn.bind(this)} icon="search" placeholder={"请完整输入key"} countShow={false} height={'36px'} width={'260px'} onClearItem={(e)=>{
this.setState({search:''})
let data ={
page:1,
limit:10,
}
this.getPlanList(data)
this.getKeyCodeList(data)
}} alignment={'left'}/>
</div>
<Filterbar filterList={this.state.filterList} menuList={this.state.menuList} selectFn={(e,prop)=>{this.onFilter(e,prop)}} onClose={(e)=>{this.onFilterClose(e) }} ></Filterbar>
<div>
<div className="code-table">
{this.state.selectiondata.length>0?(<Alert
type="info"
extraContent={<Button type="primary" onClick={this.clearFn.bind(this)}>清空</Button>}
@ -642,6 +271,7 @@ export default class acclist extends React.Component{
isSwitch={false}
page={this.state.page}
ref="plan_list"
isMultiple={false}
dataCount={this.state.dataCount}
pageChange={(e)=>{
this.onPageChange(e)
@ -729,15 +359,11 @@ export default class acclist extends React.Component{
return <Radio value={index}
onClick={()=>{
if(item == this.state.phone_list[this.state.phone_radio])
{
this.setState({phone_radio:-1})
}
}}
>{item}</Radio>
if(item == this.state.phone_list[this.state.phone_radio])
{
this.setState({phone_radio:-1})
}
}}>{item}</Radio>
})

View File

@ -0,0 +1,4 @@
.code-table {
border-top: 1px solid #e0e0e0;
padding-bottom: 24px;
}

View File

@ -843,7 +843,7 @@ export default class acclist extends React.Component{
<RadioGroup onChange={(e)=>{ this.onStyleChange(e)} } value={this.state.model.style} disabled={this.state.isEdit} >
<RadioButton value={1}>串码</RadioButton>
<RadioButton value={2} >链接</RadioButton>
<RadioButton value={3} >二维码</RadioButton>
<RadioButton value={4} >二维码</RadioButton>
</RadioGroup>
</FormItem>