From 30e9cbeca1806692a6253b3007f0ed93e5ef2710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Wed, 8 Dec 2021 16:38:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangecode/add/add.js | 21 ++- src/pages/plan/key/edit.js | 220 ++++++++++++++++++++++-------- 2 files changed, 172 insertions(+), 69 deletions(-) diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js index 15d91aed..07e671eb 100644 --- a/src/pages/exchangecode/add/add.js +++ b/src/pages/exchangecode/add/add.js @@ -428,21 +428,20 @@ 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)=>{ + // 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}) + // this.setState({phone_list:req.contact_phone}) + // this.setState({email_list:req.contact_email}) + // this.setState({audit_visible:true}) - }) - }) + // }) + // }) },(err)=>{ Notify.error(err); diff --git a/src/pages/plan/key/edit.js b/src/pages/plan/key/edit.js index 305dbc3d..ffcaf32a 100644 --- a/src/pages/plan/key/edit.js +++ b/src/pages/plan/key/edit.js @@ -1,12 +1,12 @@ import ReactDOM from 'react-dom'; import React, { Component } from 'react'; 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 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,getReseller,postKeyEmail } from "../../../assets/api.js" import Productform from "../product/add" 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(){ @@ -494,9 +441,23 @@ 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(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.error(err) @@ -724,6 +685,84 @@ export default class acclist extends React.Component{ 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:

是否返回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 = [ @@ -1189,6 +1228,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 + + } )