diff --git a/src/pages/home/home.js b/src/pages/home/home.js
index 1fb2c183..7c8c535a 100644
--- a/src/pages/home/home.js
+++ b/src/pages/home/home.js
@@ -51,7 +51,7 @@ import planedit from "../plan/add/edit"
import keylist from "../plan/key/list"
import keyorderlist from "../plan/keyorder/keyorder"
import keyedit from "../plan/key/edit.js"
-
+import keydetail from "../plan/key/detail/list.js"
@@ -369,6 +369,7 @@ export default class App extends Component {
+
diff --git a/src/pages/plan/key/detail/list.js b/src/pages/plan/key/detail/list.js
new file mode 100644
index 00000000..c4126ce6
--- /dev/null
+++ b/src/pages/plan/key/detail/list.js
@@ -0,0 +1,804 @@
+import ReactDOM from 'react-dom';
+import React, { Component } from 'react';
+import { HashRouter as Router, Route, Link } from "react-router-dom";
+import { Button,Alert } from 'zent';
+import "./list.less"
+import {Input,openDialog,closeDialog,RadioGroup,CombinedDateRangePicker,Radio ,Notify,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu,Sweetalert } from 'zent';
+import Ipt from "../../../../components/input/main"
+import Grid from "../../../../components/gird/main.js"
+import TabPage from "../../../../components/tabPage/main.js"
+import Filterbar from "../../../../components/filterbar/main.js"
+import {planIsSend,getPlanList,handelResponse,startOrStopPlan,getAllEnum,resKeyEmail,planSend,planResend,planReceive,getReseller} from "../../../../assets/api.js"
+import _ from "lodash";
+import menu from "../../../../assets/enum.js"
+import common from "../../../../assets/comm.js"
+const PAGE_SIZE_OPTIONS = [10, 20, 30];
+
+
+export default class acclist extends React.Component{
+ constructor(props){
+ super(props)
+ this.state={
+ dataCount:0,
+ page:1,
+ limit:10,
+ tabList:[{title:"营销计划列表"}],
+ distdata:[{title:'士大夫大师傅'}],
+ filterList:[{id:0,label:"状态", prop:"status", menuList:[{id:999,name:"全部"},{id:0,name:"创建中"},{id:2,name:"审核中"},{id:3,name:"待生效"},{id:4,name:"进行中"},{id:5,name:"暂停中"},{id:6,name:"已完结"}]},
+ ],
+ tableHeight:500,
+ menuList:[{id:0,name:"状态",check:false}],
+ phone_list:[],
+ email_list:[],
+ phone:"",
+ email:"",
+ email_radio:-1,
+ phone_radio:-1,
+ search:"",
+ audit_visible:false,
+
+ cur_item:null,
+ selectiondata:[],
+ plan_id:0,
+ grantTotal:0,
+ receiveTotal:0,
+ usageTotal:0,
+ silentTotal:0,
+ receive_total:0,
+ usage_total:0,
+ silent_total:0
+
+ }
+ }
+ 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});
+ setTimeout(()=>{
+ this.getpageFn();
+ },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,
+ limit:10
+ }
+ this.getPlanList(data);
+ }
+ componentWillMount(){
+ this.setState({tableHeight:window.innerHeight-430});
+ }
+
+ getPlanList(data){
+
+ let queryParams = _.omitBy(data, (value) => {
+ return _.isNaN(value) || _.isNil(value)
+ })
+
+ getPlanList(queryParams).then((res)=>{
+ handelResponse(res,(req,msg)=>{
+ this.setState({distdata:req.data})
+ this.setState({dataCount:req.total})
+ },(err)=>{
+ console.log(err)
+ })
+ })
+ }
+ onCountChange(e){
+ this.setState({page:1,limit:e})
+ setTimeout(()=>{
+ this.getpageFn();
+ },0);
+ }
+ getpageFn(){
+ let data = {
+ page:this.state.page,
+ limit:this.state.limit,
+ status:this.state.status,
+ key_word:this.state.key_word
+ }
+ this.getPlanList(data);
+ }
+
+
+ //切换siwtch
+ onSwitchChange(status,row){
+ let self = this;
+ Sweetalert.confirm({
+ type:'warning',
+ closeBtn:true,
+ title:'确认操作',
+ content:
是否改变{row.open==1?'关闭':'开启'}[{row.title}] 的状态?
,
+ 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: ,
+ footer: {
+ 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)
+ })
+ })
+ }
+ }
+ }}>发送 ,
+ 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: ,
+ footer: {
+ 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)
+ })
+ })
+
+
+
+ }
+ }
+ }
+
+ }>发送 ,
+ onClose() {
+ },
+ });
+ }
+ }
+ //清空
+ clearFn(){
+ this.refs.plan_list.allChecked(false)
+ this.setState({'selectiondata':[]})
+ }
+ //选中表格的选框
+ selection(selection){
+ this.setState({selectiondata:selection});
+ let grantTotal=0;
+ let receiveTotal=0;
+ let usageTotal=0;
+ let silentTotal=0;
+ let receive_total=0;
+ let usage_total=0;
+ let silent_total=0;
+ selection.forEach(item=>{
+ grantTotal+=Number(item.grant);
+ receiveTotal+=Number(item.receive);
+ usageTotal+=Number(item.usage);
+ silentTotal+=Number(item.silent);
+ receive_total+=Number(item.receive_total);
+ usage_total+=Number(item.usage_total);
+ silent_total+=Number(item.silent_total);
+ });
+ 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] = null
+ 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){
+ // 参数分别为改变之前的数据状态对象
+ if(prevState.search!=this.state.search &&!this.state.search){
+ this.iptsureFn();
+ }
+ if(prevState.status!=this.state.status){
+ this.iptsureFn();
+ }
+ }
+
+ iptsureFn(e){
+ this.setState({page:1})
+ this.setState({limit:10})
+ let data = {
+ page:1,
+ limit:10,
+ status:this.state.status,
+ key_word: this.state.search
+ }
+ this.getPlanList(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;
+
+ this.setState(data)
+
+ let params = {
+ page:1,
+ limit:10,
+ status:this.state.status,
+ key_word: this.state.search
+ }
+ this.getPlanList(params)
+
+ }
+
+
+ render(){
+ const { current, pageSize } = this.state;
+ const Column = [
+ {
+ title: 'key码',
+ name: 'key',
+ prop:'key',
+ type: "slot",
+ width:'auto',
+ },{
+ title: '归属营销计划',
+ width:'auto',
+ type: "normal",
+ prop:'switch'
+ }, {
+ title: '状态',
+ prop:'reseller_name',
+ name: 'reseller_name',
+ width:'auto',
+ type: "normal",
+ }, {
+ title: '剩余条数',
+ name: 'status',
+ prop:'status',
+ type: "slot",
+ width:'auto'
+ },
+ {
+ title: '更新时间',
+ name: 'creator_name',
+ prop:'creator_name',
+ type: "normal",
+ width:'auto'
+ },
+ {
+ title: '操作',
+ prop: 'opearo',
+ name: 'opearo',
+ type: "slot",
+ width:'auto',
+ },
+ ];
+ const date =
+ return(
+
+
+
+
+
+
+
+ 批量作废
+ 批量标记已使用
+ 导出excel
+ 导出关联订单
+
+
+ {/*
批量操作 */}
+
this.setState({search:e})} value={this.state.search} wordSearch={this.iptsureFn.bind(this)} icon="search" placeholder={"请输入营销计划名称、分销商名称查询"} countShow={false} height={'36px'} width={'260px'} onClearItem={(e)=>{
+ this.setState({search:''})
+ let data ={
+ page:1,
+ limit:10,
+
+ }
+ this.getPlanList(data)
+
+ }} alignment={'left'}/>
+
+ {this.onFilter(e,prop)}} onClose={(e)=>{this.onFilterClose(e) }} >
+
+ {this.state.selectiondata.length>0?(
清空}
+ >
+ 已选择{this.state.selectiondata.length} 发放key总数:{this.state.grantTotal},领取key总数:{this.state.receiveTotal},已使用总数:{this.state.usageTotal},沉默总数:{this.state.silentTotal},领取总价(预估):{this.state.receive_total.toFixed(4)},
+ 已使用总价(预估):{this.state.usage_total.toFixed(4)},
+ 沉默总价(预估):{this.state.silent_total.toFixed(4)}
+ ):null
+ }
+
{
+ this.onPageChange(e)
+ }}
+ countChange={
+ (e)=>{
+ this.onCountChange(e)
+ }
+ }
+ checkChange ={this.selection.bind(this)}
+ ComponentHandler={(com,rowData)=>{
+ if(com == "key")
+ {
+ let str = common.translateStar(rowData,4,7)
+ return {str}
+ }
+
+ if(com == "dates")
+ {
+ return {rowData.begin_time} 至 {rowData.end_time}
+ }
+
+ if(com == "title")
+ {
+ return {this.linkTo(rowData)} }>{rowData.title}
+ }
+ if(com == "switch")
+ {
+ return {this.onSwitchChange(e,rowData)}}> ;
+ }
+ if(com == "status")
+ {
+
+ return {rowData.status_text}
+ }
+ if(com == "opearo")
+ {
+ let str =
+ {this.onEdit(e,rowData)} } >详情
+
+
+ {
+ }}> 更多
+
+
+ this.menuItemClick(e,key,rowData)} >
+ 标记成已使用
+ 作废
+ 日志
+
+
+
+
+
+ return str
+ }
+ }}
+ />
+
+
+ {
+
+ this.state.audit_visible ? (
+
+
+
+
+
+
{this.cancel(e)}} />
+ 发送
+ 是否立即发送key以及解压密码?
+
+
+ 接收手机号
+
+
+ {this.onPhoneChange(e)}}
+ >
+ {
+
+ this.state.phone_list.map((item, index) => {
+
+ return {
+
+ if(item == this.state.phone_list[this.state.phone_radio])
+ {
+ this.setState({phone_radio:-1})
+ }
+
+ }}
+
+ >{item}
+
+ })
+
+ }
+
+
+
+
+
+ 接收邮箱
+
+
+ {this.onEmailChange(e)} }
+ >
+ {
+ this.state.email_list.map((item, index) => {
+
+ return {
+
+ if(item == this.state.email_list[this.state.email_radio])
+ {
+ this.setState({email_radio:-1})
+ }
+
+ }}
+
+ >{item}
+
+ })
+ }
+
+
+
+
+ -1} >
+
+
+ -1} >
+
+
+
+ {this.cancel(e)}}>取消
+ {this.send(e)}} >发送
+
+
+
+ ):null
+
+ }
+
+
+
+
+
+
+
+
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/src/pages/plan/key/detail/list.less b/src/pages/plan/key/detail/list.less
new file mode 100644
index 00000000..e69de29b