From 507b01ca23c2cbae252c7a0f5215eea090caa752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Fri, 31 Dec 2021 11:09:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 77 +++++++----- src/assets/enum.js | 2 + src/pages/plan/add/add.js | 157 ++++++++++-------------- src/pages/plan/add/add.less | 234 +++++++++++++++++++++++++++++++++++- src/pages/plan/add/edit.js | 56 ++++++++- src/pages/plan/list/list.js | 2 +- 6 files changed, 399 insertions(+), 129 deletions(-) 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 ? ( -