This commit is contained in:
姜棚 2021-12-08 16:38:37 +08:00
parent 1df3b2e9a6
commit 30e9cbeca1
2 changed files with 172 additions and 69 deletions

View File

@ -428,21 +428,20 @@ export default class acclist extends React.Component{
} }
putKeyBatchDetail(id,data).then((res)=>{ putKeyBatchDetail(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{ handelResponse(res,(req,msg)=>{
Notify.success("更新key成功"); setTimeout(()=>{
// setTimeout(()=>{ window.history.back()
// window.history.back() },1000);
// },1000);
getReseller(id).then((res)=>{ // getReseller(req.reseller_id).then((res)=>{
handelResponse(res,(req,msg)=>{ // handelResponse(res,(req,msg)=>{
this.setState({phone_list:req.contact_phone}) // this.setState({phone_list:req.contact_phone})
this.setState({email_list:req.contact_email}) // this.setState({email_list:req.contact_email})
this.setState({audit_visible:true}) // this.setState({audit_visible:true})
}) // })
}) // })
},(err)=>{ },(err)=>{
Notify.error(err); Notify.error(err);

View File

@ -1,12 +1,12 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { HashRouter as Router, Route, Link } from "react-router-dom"; import { HashRouter as Router, Route, Link } from "react-router-dom";
import {Card,Sweetalert, Drawer,Button ,Tabs, Notify,DateRangePicker,ImageUpload,Select,Input,Checkbox,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu,RadioGroup,RadioButton } from 'zent'; import {Card,Sweetalert, Drawer,Button ,Tabs,Radio, Notify,DateRangePicker,ImageUpload,Select,Input,Checkbox,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu,RadioGroup,RadioButton } from 'zent';
import Ipt from "../../../components/input/main" import Ipt from "../../../components/input/main"
import Form from "../../../components/form/main" import Form from "../../../components/form/main"
import FormItem from "../../../components/form-item/main" import FormItem from "../../../components/form-item/main"
import Grid from "../../../components/gird/main.js" import Grid from "../../../components/gird/main.js"
import {addPlanStep,handelResponse,getPlanList,addKeysBatchInfo,getKeyBatchDetail,putKeyBatchDetail,uploadImg import {addPlanStep,handelResponse,getPlanList,addKeysBatchInfo,getKeyBatchDetail,putKeyBatchDetail,uploadImg,getReseller,postKeyEmail
} from "../../../assets/api.js" } from "../../../assets/api.js"
import Productform from "../product/add" import Productform from "../product/add"
import Bus from "../../../assets/eventBus.js" import Bus from "../../../assets/eventBus.js"
@ -409,59 +409,6 @@ export default class acclist extends React.Component{
} }
// let productlist = _.filter(this.state.tempdata,(item)=>{return item.checked == true})
// let sum = 0;
// _.forEach(productlist,(o)=>{
// sum += parseInt(o.quantity);
// })
// console.log("总数"+sum)
// if(sum < this.state.codeInfo.issued)
// {
// Notify.error("所选商品库存总数小于发放量")
// return
// }
// this.setState({drawerVisible:false})
// let rank = _.map(this.state.rank,(item)=>{
// return item.text
// })
// console.log(rank)
// let tableData = this.state.distdata;
// let temp = {
// title:this.state.codeInfo.code_name,
// describe:this.state.codeInfo.describe,
// begin_time:this.state.codeInfo.date_time[0],
// end_time:this.state.codeInfo.date_time[1],
// quantity:this.state.codeInfo.issued,
// range : rank.toString(),
// }
// let arr = _.map(productlist,(item)=>{
// let obj={}
// obj.product_id = item.product_id;
// obj.product_type = item.product_type;
// obj.product_name = item.product_name;
// obj.contract_price = item.contract_price;
// obj.cost_price = item.cost_price;
// obj.official_price= item.official_price;
// obj.quantity = item.quantity;
// obj.show_url = item.show_url;
// obj.describe_url = item.describe_url;
// return obj
// })
// temp.product = arr;
// let tempdata = this.state.distdata;
// tempdata.push(temp)
// this.setState({distdata:tempdata})
// let id = sessionStorage.getItem("key_plan_id")
} }
} }
onAddKey(){ onAddKey(){
@ -494,9 +441,23 @@ export default class acclist extends React.Component{
putKeyBatchDetail(id,data).then((res)=>{ putKeyBatchDetail(id,data).then((res)=>{
handelResponse(res,(req,msg)=>{ handelResponse(res,(req,msg)=>{
Notify.success("更新key成功"); Notify.success("更新key成功");
setTimeout(()=>{ // setTimeout(()=>{
window.history.back() // window.history.back()
},1000); // },1000);
getReseller(req.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)=>{ },(err)=>{
Notify.error(err) Notify.error(err)
@ -724,6 +685,84 @@ export default class acclist extends React.Component{
return isdisabled return isdisabled
} }
send(e)
{
let key_id = sessionStorage.getItem("keyBatchId")
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
}
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_-]+)+$");
if (!phoneReg.test(data.phone)) {
Notify.error("手机号格式不正确")
return;
}
if(!emailReg.test(data.email)){
Notify.error("邮箱格式不正确")
return;
}
postKeyEmail(key_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("发送成功,请在1-2分钟后查看")
this.props.history.push('/home/plan-list/');
},(err)=>{
Notify.error(err)
this.props.history.push('/home/plan-list/');
})
})
}
onReturn(){
let self = this;
Sweetalert.confirm({
type:'warning',
closeBtn:true,
title:'确认操作',
content:<p> 是否返回key列表?</p>,
onConfirm:()=>{ self.props.history.push('/home/key-list/');},
onCancel: this.onCancel,
className:'questModal',
parentComponent: this
});
}
onPhoneChange(e){
this.setState({phone_radio:e.target.value})
}
onEmailChange(e){
this.setState({email_radio:e.target.value})
}
cancel(e){
this.setState({audit_visible:false})
}
phoneChange=(e)=>
{
this.setState({"phone":e.target.value})
}
emailChange=(e)=>
{
this.setState({"email":e.target.value})
}
render(){ render(){
const Column = [ const Column = [
@ -1189,6 +1228,71 @@ export default class acclist extends React.Component{
</div> </div>
</Drawer> </Drawer>
{
this.state.audit_visible ? (
<div>
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.onReturn(e)}} />
<div className="audit-box-title">审核通过</div>
<div className="audit-box-question">是否立即发送key以及解压密码?</div>
<div className="phone-group">
<div >
接收手机号
</div>
<div className="phone-list">
<RadioGroup
value={this.state.phone_radio}
isValueEqual={this.isValueEqual}
onChange={(e)=>{this.onPhoneChange(e)}}
>
{
this.state.phone_list.map((item, index) => {
return <Radio value={index}>{item}</Radio>
})
}
</RadioGroup>
</div>
</div>
<div className="email-group">
<div >
接收邮箱
</div>
<div className="email-list">
<RadioGroup
value={this.state.email_radio}
isValueEqual={this.isValueEqual}
onChange={ (e)=>{this.onEmailChange(e)} }
>
{
this.state.email_list.map((item, index) => {
return <Radio value={index}>{item}</Radio>
})
}
</RadioGroup>
</div>
</div>
<div className="input-group">
<Input placeholder="请输入接收手机号" onChange={this.phoneChange} disabled={this.state.phone_radio > -1} ></Input>
</div>
<div className="input-group">
<Input placeholder="请输入接收邮箱" onChange={this.emailChange} disabled={this.state.email_radio > -1} ></Input>
</div>
<div className="audit-btn-group">
<Button onClick={(e)=>{this.onReturn(e)}}>取消</Button>
<Button type="primary" onClick={(e)=>{this.send(e)}} >发送</Button>
</div>
</div>
</div>
):null
}
</div> </div>
) )