diff --git a/src/assets/api.js b/src/assets/api.js index 1f19f8c1..15838c18 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -304,60 +304,60 @@ export const addPlanStep = (id, params) => { let str = id ? "/"+id :"" if(str) { - return req('put', baseurl + "/plan/step" + str, params) + return req('put',"http://192.168.6.165:8080" + "/plan/step" + str, params) } - return req('post', baseurl + "/plan/step" + str, params) + return req('post', "http://192.168.6.165:8080" + "/plan/step" + str, params) } //获取营销计划草稿信息 export const getDraftInfo = (id, params) => { - return req('get', baseurl + "/plan/draft/" + id, params) + return req('get', "http://192.168.6.165:8080" + "/plan/draft/" + id, params) } //启用停用 营销计划 export const startOrStopPlan = (id, params) => { - return req('put', baseurl + "/plan/status/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/plan/status/" + id, params) } //创建key批次信息 export const addKeysBatchInfo = (id, params) => { - return req('post', baseurl + "/plan/" + id + "/keys", params) + return req('post', "http://192.168.6.165:8080" + "/plan/" + id + "/keys", params) } //编辑修改 export const putPlanStep = (id, params) => { - return req('put', baseurl + "/plan/edit/"+id,params) + return req('put', "http://192.168.6.165:8080" + "/plan/edit/"+id,params) } //获取key批次信息 export const getKeysBatchInfo = (id, params) => { - return req('get', baseurl + "/keys", params) + return req('get', "http://192.168.6.165:8080" + "/keys", params) } //启用停用key批次信息 export const startOrStopKeybatch = (id, params) => { - return req('put', baseurl + "/keys/status/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/keys/status/" + id, params) } //获取key批次详细信息 export const getKeyBatchDetail = (id, params) => { - return req('get', baseurl + "/keys/" + id, params) + return req('get', "http://192.168.6.165:8080" + "/keys/" + id, params) } //更新key批次详细信息 export const putKeyBatchDetail = (id, params) => { - return req('put', baseurl + "/keys/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/keys/" + id, params) } //发送key批次压缩包和压缩包密码 export const planSend = (id, params) => { - return req('put', baseurl + "/plan/send/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/plan/send/" + id, params) } //是否已经发送过邮件 export const planIsSend = (id) => { - return req('get', baseurl + "/plan/is_send/" + id) + return req('get', "http://192.168.6.165:8080" + "/plan/is_send/" + id) } @@ -366,39 +366,39 @@ export const planIsSend = (id) => { //重新修改手机号邮箱 export const planReceive = (id, params) => { - return req('put', baseurl + "/plan/receive/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/plan/receive/" + id, params) } //重新发送key批次压缩包和压缩包密码 export const planResend = (id, params) => { - return req('put', baseurl + "/plan/resend/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/plan/resend/" + id, params) } export const keysIsSend = (id, params) => { - return req('get', baseurl + "/keys/is_send/" + id, params) + return req('get', "http://192.168.6.165:8080" + "/keys/is_send/" + id, params) } //作废key批次 export const cancelKey = (id, params) => { - return req('put', baseurl + "/keys/cancel/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/keys/cancel/" + id, params) } //发送密钥邮件 export const postKeyEmail = (id, params) => { - return req('put', baseurl + "/keys/send/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/keys/send/" + id, params) } //修改密钥邮件 export const putKeyEmail = (id, params) => { - return req('put', baseurl + "/keys/receive/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/keys/receive/" + id, params) } export const resKeyEmail = (id, params) => { - return req('put', baseurl + "/keys/resend/" + id, params) + return req('put', "http://192.168.6.165:8080" + "/keys/resend/" + id, params) } @@ -406,17 +406,17 @@ export const resKeyEmail = (id, params) => { // 兑换码管理 //兑换码管理列表 export const getCodesList = (params) => { - return getData('get', baseurl + "/codes", params) + return getData('get', "http://192.168.6.165:8080" + "/codes", params) } //获取兑换码明细 export const getCodesDetail = (id) => { - return req('get', baseurl + "/codes/"+id) + return req('get', "http://192.168.6.165:8080" + "/codes/"+id) } //修改兑换码批次 export const putCodesBatch = (id,params) => { - return req('put', baseurl + "/codes/edit/"+id,params) + return req('put', "http://192.168.6.165:8080" + "/codes/edit/"+id,params) } @@ -425,45 +425,45 @@ export const putCodesBatch = (id,params) => { //更新兑换码 export const putCodes = (id,params) => { - return req('put', baseurl + "/codes/"+id,params) + return req('put', "http://192.168.6.165:8080" + "/codes/"+id,params) } //作废本批次兑换码 export const delCode = (id) => { - return req('delete', baseurl + "/codes/discard/"+id) + return req('delete', "http://192.168.6.165:8080" + "/codes/discard/"+id) } //作废本批次兑换码 export const putCodeStatus = (id,params) => { - return req('put', baseurl + "/codes/status/"+id,params) + return req('put', "http://192.168.6.165:8080" + "/codes/status/"+id,params) } //兑换码商品列表 export const getCodeProductList = (params) => { - return req('get', baseurl + "/codes/products",params) + return req('get', "http://192.168.6.165:8080" + "/codes/products",params) } //删除商品库存信息 export const delCodeProduct = (batch_id,id) => { - return req('delete', baseurl + "/codes/products/"+batch_id+"/"+id) + return req('delete', "http://192.168.6.165:8080" + "/codes/products/"+batch_id+"/"+id) } //更新单个商品信息 export const putCodeProduct = (batch_id,id,params) => { - return req('put', baseurl + "/codes/products/"+batch_id+"/"+id,params) + return req('put', "http://192.168.6.165:8080" + "/codes/products/"+batch_id+"/"+id,params) } //获取商品库存明细 export const getCodeProduct = (batch_id,id) => { - return req('get', baseurl + "/codes/products/"+batch_id+"/"+id) + return req('get', "http://192.168.6.165:8080" + "/codes/products/"+batch_id+"/"+id) } // //蓝色兄弟映射商品 export const getProductInfoSelect = (params) => { - return req('get', baseurl + "/product/market/products",params) + return req('get', "http://192.168.6.165:8080" + "/product/market/products",params) } // 上传 @@ -840,6 +840,23 @@ export const getkeyDetailList= (id,data) => { } +//提交审核 +export const approvals= (id,data) => { + return req('post', "http://192.168.6.165:8080" + "/plan/"+id+"/approvals",data) +} + + +export const getApprovalsInfo= (id,data) => { + return req('get', "http://192.168.6.165:8080" + "/approvals/"+id+"/market_approval_data",data) +} + + +export const terminateApprovals= (id,data) => { + return req('get', "http://192.168.6.165:8080" + "/approvals/"+id+"/terminate",data) +} + + + diff --git a/src/assets/enum.js b/src/assets/enum.js index cd991906..6b0b1303 100644 --- a/src/assets/enum.js +++ b/src/assets/enum.js @@ -44,6 +44,7 @@ const menu={ case 4:return '进行中';break; case 5:return '暂停中';break; case 6:return '已完结';break; + case 7:return '审批驳回';break; } }, planStatusBg(params) { @@ -54,6 +55,7 @@ const menu={ case 4:return '#55aaff';break; case 5:return '#55ff7f';break; case 6:return '#e64c00';break; + case 7:return '#b6bcb8';break; } }, keyStatusBg(params) { diff --git a/src/pages/plan/add/add.js b/src/pages/plan/add/add.js index 6998339e..d04e701f 100644 --- a/src/pages/plan/add/add.js +++ b/src/pages/plan/add/add.js @@ -7,7 +7,7 @@ import Step1 from "./step1.js" import Step2 from "./step2.js" import Step3 from "./step3.js" import _ from "lodash"; -import {addPlanStep,handelResponse,getReseller,planSend} from "../../../assets/api.js" +import {addPlanStep,handelResponse,getReseller,planSend,approvals} from "../../../assets/api.js" export default class add extends React.Component{ constructor(props){ @@ -31,7 +31,10 @@ export default class add extends React.Component{ phone_radio:-1, audit_visible:false, card_visible:false, - step1:null + step1:null, + paytype:1, + reseller:"", + payment_direction:["对私账户","对公账户","预付款扣除"] } } @@ -39,8 +42,6 @@ export default class add extends React.Component{ this.refs.step1.submit(); } onReturn(){ - - let self = this; Sweetalert.confirm({ type:'warning', @@ -53,16 +54,43 @@ export default class add extends React.Component{ parentComponent: this }); - - } componentDidMount(e){ sessionStorage.setItem("plan_id","") - } + } + onConfirm(e){ + + let plan_id = sessionStorage.getItem("plan_id") + + let data = + { + "reseller_id":this.state.reseller.id, + "reseller_name":this.state.reseller.name, + "company_name":this.state.reseller.company_name, + "receive_email":this.state.email_list[0], + "payment_direction":this.state.payment_direction[this.state.paytype - 1], + } + + approvals(plan_id,data).then((res)=>{ + handelResponse(res,(req,msg)=>{ + this.setState({audit_visible:false}) + Notify.success("成功发起审批") + this.props.history.push('/home/plan-list/'); + },(err)=>{ + Notify.error(err) + }) + }) + + + } + onPayTypeChange(e){ + console.log("渠道类型",e.target.value) + this.setState({paytype:e.target.value}) + } async onNextStep(){ if(this.state.curstep >= 1) @@ -151,10 +179,11 @@ export default class add extends React.Component{ getReseller(id).then((res)=>{ handelResponse(res,(req,msg)=>{ - - + console.log("分销商数据") + console.log(req) + this.setState({reseller:req}) 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}) }) @@ -182,11 +211,9 @@ export default class add extends React.Component{ } onPhoneChange(e){ - console.log("电话改变",e) this.setState({phone_radio:e.target.value}) } onEmailChange(e){ - console.log("邮箱改变",e) this.setState({email_radio:e.target.value}) } cancel(e){ @@ -218,20 +245,16 @@ export default class add extends React.Component{ } let phoneReg = new RegExp("^[1][3,4,5,6,7,8,9][0-9]{9}$"); - // let emailReg = new RegExp( "\w+@\w+\.\w+(\.\w+){0,1}"); - + + + if (!phoneReg.test(data.phone)) { Notify.error("手机号格式不正确") return; } - // if(!emailReg.test(data.email)){ - - // Notify.error("邮箱格式不正确") - // return; - - // } + planSend(plan_id,data).then((res)=>{ @@ -356,85 +379,27 @@ export default class add extends React.Component{ { this.state.audit_visible ? ( -
+
-
- {this.onReturn(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.onReturn(e)}} /> +
提交审核
+
+ + {this.onPayTypeChange(e)}} value={this.state.paytype} className="audit-obj"> + 对私账户 + 对公账户 + 预付款扣除 + + +
+
+ + +
+
):null - }
diff --git a/src/pages/plan/add/add.less b/src/pages/plan/add/add.less index a11e8202..ad9fd2ac 100644 --- a/src/pages/plan/add/add.less +++ b/src/pages/plan/add/add.less @@ -253,4 +253,236 @@ } // .zent-datepicker-trigger{ // width: 280px !important; -// } \ No newline at end of file +// } + +.key_number{ + width: 90%; + display: flex; +} + + + +//导入模板 + +.import-excel +{ + width: 431px; + height:560px; + background-color: #FFFFFF; + border-radius: 5px; + box-shadow: 0 0 10px #DEE2E5; + position: fixed; + top: 50%; + margin-top: -280px; + left: 50%; + margin-left: -215px; + z-index: 100; + .import-header{ + width: 100%; + height: 48px; + display: flex; + align-items: center; + .import-title{ + width: 70%; + font-size: 14px; + font-weight: bold; + margin-left: 20px; + } + + .closebtn{ + width: 30%; + + } + + .import-close{ + margin-left: 70px; + font-size: 20px; + font-weight: bold; + } + } + .step-bar{ + width: 75%; + height: 80px; + margin: 10px auto; + display: flex; + justify-content: center; + } + .step-code{ + width: 24px; + height: 24px; + border-radius: 50%; + border: 1px solid #e8e8e8; + display: flex; + align-items: center; + justify-content: center; + color: #e8e8e8; + + } + .step-code.active + { + background-color: #1890ff; + } + + .step-group{ + width: 150px; + height: 50px; + display: flex; + align-items: center; + } + .step-center{ + width: 60px; + height: 50px; + display: flex; + align-items: center; + margin-right: 40px; + } + .step-line{ + width: 50px; + height: 1px; + background-color:#e8e8e8; + + } + .step-line.active{ + background-color: #1890ff; + } + + .step-label{ + color: #8d8d8d; + font-size: 14px; + margin-left: 10px; + } + .step-label.active{ + color: #000000; + } + + + .upload-panel1{ + width: 85%; + margin: 10px auto; + margin-bottom: 20px; + .upload-label{ + font-size: 16px; + font-weight: bold; + margin-bottom: 30px; + } + .upload-info{ + color:#626366; + } + } + + .btn-upload{ + margin-top: 10px; + margin-left: 50px; + margin-bottom: 20px; + } + .btn-download{ + margin-top: 10px; + margin-left: 30px; + } + .foot-bar + { + width: 100%; + height: 50px; + position: absolute; + bottom: 20px; + .btn-group{ + width: 240px; + margin-left: 160px; + } + button{ + width: 100px; + } + } + + .upload-msgbar{ + width: 82%; + background-color: #f5f5f5; + margin: 0 auto; + min-height: 40px; + border-radius: 5px; + + display: flex; + .execel-name{ + width: 75%; + display: flex; + min-height: 40px; + + align-items: center; + .excel-txt{ + font-size: 12px; + margin-left: 10px; + } + .doc-flag{ + font-size: 20px; + margin-left: 5px; + } + + + } + + .file-tag{ + width: 25%; + font-size: 12px; + display: flex; + align-items: center; + color: #1890ff; + + .upload-flag{ + font-size: 20px; + margin-left: 5px; + color: #1890ff; + margin-right: 3px; + } + } + + + } + .file-tip{ + margin-left: 35px; + margin-top: 10px; + margin-bottom: 50px; + } + .error{ + color: #e83f2e; + } + .success{ + color: #98d673; + } + + .error-icon{ + color: #e83f2e; + font-size: 18px; + margin-right: 10px; + } + .success-icon{ + color: #98d673; + font-size: 18px; + margin-right: 10px; + } + .file-upload-tip{ + color: #000000; + font-size: 14px; + font-weight: bold; + margin-left: 40px; + margin-top: 20px; + } + .file-errmsg{ + color: #000000; + font-size: 14px; + margin-left: 40px; + margin-top: 40px; + } + + .gridpanel{ + width: 90%; + height: 400px; + margin: 0 auto; + margin-top: 50px; + } + + +} +.audit-obj{ + margin-left: 30px; + margin-bottom: 30px; + } \ No newline at end of file diff --git a/src/pages/plan/add/edit.js b/src/pages/plan/add/edit.js index d161bd06..41b44b5a 100644 --- a/src/pages/plan/add/edit.js +++ b/src/pages/plan/add/edit.js @@ -7,7 +7,7 @@ import Step1 from "./step1.js" import Step2 from "./step2.js" import Step3 from "./step3.js" import _ from "lodash"; -import {addPlanStep,handelResponse,getReseller,planSend,getDraftInfo,putPlanStep,uploadImg} from "../../../assets/api.js" +import {addPlanStep,handelResponse,getReseller,planSend,getDraftInfo,putPlanStep,uploadImg,getApprovalsInfo} from "../../../assets/api.js" export default class add extends React.Component{ constructor(props){ @@ -69,6 +69,60 @@ export default class add extends React.Component{ this.setState({disabled:true}) } let plan_id = sessionStorage.getItem("plan_id") + let approval_id = sessionStorage.getItem("approval_id") + + //获取审批接口的编辑信息 + if(plan_status == 2 || plan_status == 7) + { + getApprovalsInfo(approval_id).then((res)=>{ + handelResponse(res,(req,msg)=>{ + console.log("当前营销计划编辑信息") + console.log(req) + + if(req.info) + { + this.refs.step1.edit(req.info) + } + if(req.keys.length > 0 && this.state.disabled ==false) + { + + this.setState({curstep:2}) + + for(let i = 0;i < req.keys.length;i++) + { + this.addNewkey() + } + + // this.setState({keys:req.keys}) + + setTimeout(()=>{ + for(let i = 0;i < this.state.keys.length;i++) + { + this.refs["step2-"+i].edit(req.keys[i]) + } + },500) + + } + else{ + this.addNewkey() + } + + },(err)=>{ + Notify.error(err) + }) + }) + + + + + + } + + + + + + //获取草稿信息 getDraftInfo(plan_id).then((res)=>{ handelResponse(res,(req,msg)=>{ console.log("当前营销计划编辑") diff --git a/src/pages/plan/list/list.js b/src/pages/plan/list/list.js index 7ac95974..e15f377a 100644 --- a/src/pages/plan/list/list.js +++ b/src/pages/plan/list/list.js @@ -24,7 +24,7 @@ export default class acclist extends React.Component{ 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:"已完结"}]}, + 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:"已完结"},{id:7,name:"审批驳回"}]}, ], tableHeight:500, menuList:[{id:0,name:"状态",check:false}],