diff --git a/src/components/pagination/main.js b/src/components/pagination/main.js index 507860e6..6c57c34f 100644 --- a/src/components/pagination/main.js +++ b/src/components/pagination/main.js @@ -86,7 +86,16 @@ import _ from "lodash"; if(e=="…") { - return; + // let curpage = this.state.page + 2; + // let page_num =Math.ceil(this.state.dataCount / this.state.count); + // if(curpage > page_num) + // { + // curpage = page_num; + // } + // this.setState({page:curpage}) + // this.props.pageFn(curpage); + // this.props.onJumpPage(curpage) + return } this.setState({page:e}) @@ -156,7 +165,7 @@ import _ from "lodash"; } - let btns = this.getPageArr(btnPages,this.state.page,8) + let btns = this.getPageArr(btnPages,this.state.page,3) return (
diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js index a157a5a8..15d91aed 100644 --- a/src/pages/exchangecode/add/add.js +++ b/src/pages/exchangecode/add/add.js @@ -1,20 +1,25 @@ import ReactDOM from 'react-dom'; import React, { Component } from 'react'; import { HashRouter as Router, Route, Link } from "react-router-dom"; -import {Card,Sweetalert,DateRangePicker,ImageUpload, Drawer,Button ,Tabs, Notify,CombinedDateRangePicker,Select,Input,Checkbox,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu,RadioGroup,RadioButton } from 'zent'; +import {Card,Sweetalert,DateRangePicker,ImageUpload, Drawer,Button,Radio ,Tabs, Notify,CombinedDateRangePicker,Select,Input,Checkbox,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu,RadioGroup,RadioButton } from 'zent'; import Ipt from "../../../components/input/main" import Form from "../../../components/form/main" import FormItem from "../../../components/form-item/main" import Grid from "../../../components/gird/main.js" -import {addPlanStep,handelResponse,getPlanList,addKeysBatchInfo,getKeyBatchDetail,putKeyBatchDetail,uploadImg +import {addPlanStep,handelResponse,getPlanList,addKeysBatchInfo,getKeyBatchDetail,putKeyBatchDetail,uploadImg,postKeyEmail,getReseller } from "../../../assets/api.js" import Productform from "../product/add" import Bus from "../../../assets/eventBus.js" import _ from "lodash"; import "./add.less" import moment from "moment" +import { isSameDay, addDays, parse } from 'date-fns'; const TabPanel = Tabs.TabPanel; +const initArray = targetNum => { + return Array.from({ length: targetNum }, (_, index) => index); +}; + export default class acclist extends React.Component{ constructor(props){ super(props) @@ -61,6 +66,11 @@ export default class acclist extends React.Component{ endtime:"", rowIndex:-1, uploading:false, + audit_visible:false, + phone_list:[], + email_list:[], + email_radio:-1, + phone_radio:-1 } } @@ -78,7 +88,7 @@ export default class acclist extends React.Component{ console.log("和编辑",req) this.setState({pagetitle:"编辑key"}) let model = { - batch_name:req.batch_name, + batch_name:req.batch_name, style: req.style, quantity:req.quantity, allow_repetition:req.allow_repetition, @@ -114,8 +124,6 @@ export default class acclist extends React.Component{ if(plan_item) { plan_item = JSON.parse(plan_item) - console.log("计划认为") - console.log(plan_item) let model = this.state.model; model.title = plan_item.title; @@ -219,7 +227,7 @@ export default class acclist extends React.Component{ break; } this.setState({drawerVisible:false}) - this.state.codeInfo={ //数据模型不可少 + this.state.codeInfo={ //数据模型不可少 code_name:"", issued:'',//发放总量 describe:'', @@ -421,9 +429,21 @@ export default class acclist extends React.Component{ putKeyBatchDetail(id,data).then((res)=>{ handelResponse(res,(req,msg)=>{ Notify.success("更新key成功"); - setTimeout(()=>{ - window.history.back() - },1000); + // setTimeout(()=>{ + // window.history.back() + // },1000); + + getReseller(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); }) @@ -453,11 +473,23 @@ export default class acclist extends React.Component{ addKeysBatchInfo(id,data).then((res)=>{ handelResponse(res,(req,msg)=>{ Notify.success("创建key成功"); - setTimeout(()=>{ - window.history.back() - },1000); + sessionStorage.setItem("keyBatchId",req.key_batch_id) + 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)=>{ - Notify.success(err); + Notify.error(err); }) }) @@ -475,16 +507,23 @@ export default class acclist extends React.Component{ } - onDisabledCombinedDate = (val)=>{ - console.log(this.state.begintime) - console.log(this.state.endtime) - let str = moment(val).format("YYYY-MM-DD HH:mm:ss") - let now = moment(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss") - - let isBetween = moment(str).isBetween(now,this.state.endtime,null,'(]'); - return !isBetween + onDisabledRange = (date, type)=>{ + let step1 = JSON.parse (sessionStorage.getItem("step1")); + let isdisabled = false; + let str = moment(date).format("YYYY-MM-DD HH:mm:ss") + if( type == "start" ) + { + isdisabled = moment(str).isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time) + } + + if( type == "end" ) + { + isdisabled = moment(str).add(1, 'days').isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time) + } + return isdisabled } + rowItemClick(row,rowIndex){ @@ -619,9 +658,101 @@ export default class acclist extends React.Component{ this.state.tempdata[rowIndex].contract_price = value; this.setState({tempdata:this.state.tempdata}) } - + onDisabledTime= (date, type) => { + + const min = new Date(); + const hour = min.getHours(); + const minute = min.getMinutes(); + const second = min.getSeconds(); + const isSame = isSameDay(date, min); + + + return isSame ? { + disabledHours: () => initArray(hour), + disabledMinutes: hourValue => + hourValue === hour ? initArray(minute) : [], + disabledSeconds: (hourValue, minuteValue) => + hourValue === hour && minuteValue === minute + ? initArray(second) + : [], + } + : {}; + }; + + 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:

是否返回key列表?

, + 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(){ const Column = [ { @@ -1088,8 +1219,71 @@ export default class acclist extends React.Component{
+ { + this.state.audit_visible ? ( +
+
+
+ {this.onReturn(e)}} /> +
审核通过
+
是否立即发送key以及解压密码?
+
+
+ 接收手机号 +
+
+ {this.onPhoneChange(e)}} + > + { + + this.state.phone_list.map((item, index) => { + + return {item} + + }) + + } + +
+
+
+
+ 接收邮箱 +
+
+ {this.onEmailChange(e)} } + > + { + this.state.email_list.map((item, index) => { + + return {item} + + }) + } + +
+
+
+ -1} > +
+
+ -1} > +
+
+ + +
+
+
+ ):null - + }
) } diff --git a/src/pages/exchangecode/commodity/goodedit.js b/src/pages/exchangecode/commodity/goodedit.js index 7fea27a7..886713aa 100644 --- a/src/pages/exchangecode/commodity/goodedit.js +++ b/src/pages/exchangecode/commodity/goodedit.js @@ -193,11 +193,8 @@ export default class adduserinfo extends React.Component{ } this.setState({model:model2}) - console.log(cur_product) } onTypeChange(e){ - console.log(e) - let model2 = this.state.model; model2.type = e.target.value; this.setState({model:model2}) diff --git a/src/pages/plan/add/add.js b/src/pages/plan/add/add.js index a3c0a048..dab939b4 100644 --- a/src/pages/plan/add/add.js +++ b/src/pages/plan/add/add.js @@ -203,10 +203,7 @@ export default class add extends React.Component{ let emailReg = new RegExp( "^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"); - // let data ={ - // phone: this.state.phone_radio ? this.state.phone_list[this.state.phone_radio] : this.state.phone , - // email: this.state.email_radio ? this.state.email_list[this.state.email_radio] : this.state.email - // } + if (!phoneReg.test(data.phone)) { diff --git a/src/pages/plan/add/add.less b/src/pages/plan/add/add.less index 3b3bddf7..a11e8202 100644 --- a/src/pages/plan/add/add.less +++ b/src/pages/plan/add/add.less @@ -154,7 +154,7 @@ } .audit-box{ - width: 400px; + width: 420px; height: auto; background-color: #FFFFFF; box-shadow: 0 0 1px #ACCADD; @@ -192,7 +192,8 @@ margin-left: 50px; font-size: 12px; font-weight: bold; - margin-bottom: 10px; + margin-bottom: 10px; + padding-right: 20px; } .email-list{ margin-top: 10px; @@ -205,7 +206,7 @@ align-items: center; justify-content: flex-end; height: 60px; - padding-right: 30px; + padding-right: 40px; } } diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 0b4f7dd1..fe0e7c94 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -339,7 +339,7 @@ export default class acclist extends React.Component{ if( type == "end" ) { - isdisabled = moment(str).isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time) + isdisabled = moment(str).add(1, 'days').isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time) } return isdisabled } diff --git a/src/pages/plan/key/list.js b/src/pages/plan/key/list.js index 37ef7868..471236a7 100644 --- a/src/pages/plan/key/list.js +++ b/src/pages/plan/key/list.js @@ -661,7 +661,7 @@ onChangeCombinedDate(e){ this.menuItemClick(e,key,rowData)} style={{width:"400px"}}> - 再次发送密码 + 再次发送key密码 再次发送key 修改接收邮箱发送 diff --git a/src/pages/plan/list/list.js b/src/pages/plan/list/list.js index f6c14716..403f24c3 100644 --- a/src/pages/plan/list/list.js +++ b/src/pages/plan/list/list.js @@ -67,12 +67,10 @@ export default class acclist extends React.Component{ 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 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 ={ @@ -355,7 +353,7 @@ export default class acclist extends React.Component{ Notify.error("接收邮箱不能为空") return }else{ - let reg=/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/; + 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("接收邮箱格式不正确")