From 1bb79a46b4404df1f5b00d1cd1588ea8ca3103aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com>
Date: Thu, 20 Jan 2022 11:15:25 +0800
Subject: [PATCH] =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95=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 | 206 ++++++++++++++---------
src/pages/exchangecode/add/add.less | 243 +++++++++++++++++++++++++++-
src/pages/plan/add/add.js | 27 +++-
src/pages/plan/add/edit.js | 26 ++-
src/pages/plan/add/step2.js | 108 +++++--------
5 files changed, 462 insertions(+), 148 deletions(-)
diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js
index 2b93cbe9..c8f736a0 100644
--- a/src/pages/exchangecode/add/add.js
+++ b/src/pages/exchangecode/add/add.js
@@ -222,16 +222,25 @@ export default class acclist extends React.Component{
}
return valide
}
+
importClick(){
- if(this.state.accessVerify)
- {
- this.setState({accessVerify:false})
- this.setState({excel_visible:true})
- this.setState({import_visible:false})
- }
- else{
- Notify.error("文件正在解析中请稍等")
- }
+
+ if(this.state.file_loading)
+ {
+ Notify.error("文件正在解析中请稍等")
+ }
+ else{
+ if(this.state.success_visible)
+ {
+ this.setState({accessVerify:false})
+ this.setState({excel_visible:true})
+ this.setState({import_visible:false})
+ }
+ else{
+ Notify.error("请上传正确的文件")
+ }
+
+ }
}
Cancel(){
Sweetalert.confirm({
@@ -256,7 +265,15 @@ export default class acclist extends React.Component{
onStyleChange(e){
let model2 = this.state.model;
model2.style = e.target.value;
+ model2.quantity = 0
this.setState({model:model2})
+ if(e.target.value == 1)
+ {
+ this.setState({white_visible:true})
+ }
+ else{
+ this.setState({white_visible:false})
+ }
}
onRepetitionChange(e){
@@ -763,15 +780,17 @@ export default class acclist extends React.Component{
this.setState({"email":e.target.value})
}
- initUpload(){
- this.setState({import_visible:false})
- this.setState({success_visible:false})
- this.setState({fail_visible:false})
- this.setState({file_loading:false})
- this.setState({upload_visible:false})
- this.setState({excel_visible:false})
- this.setState({accessVerify:false})
- }
+ initUpload(){
+ this.setState({import_visible:false})
+ this.setState({success_visible:false})
+ this.setState({fail_visible:false})
+ this.setState({file_loading:false})
+ this.setState({upload_visible:false})
+ this.setState({excel_visible:false})
+ this.setState({accessVerify:false})
+ }
+
+
fileChange(e){
// this.initUpload();
@@ -810,7 +829,7 @@ export default class acclist extends React.Component{
this.setState({exceldata:req.validationFailed})
this.setState({file_loading:false})
- this.setState({success_visible:false})
+ this.setState({success_visible:true})
}
else{
this.setState({file_loading:false})
@@ -832,6 +851,9 @@ export default class acclist extends React.Component{
this.setState({success_visible:false})
}
}
+
+
+
resetUpload(){
this.setState({excel_visible:false})
this.setState({import_visible:true})
@@ -847,14 +869,38 @@ export default class acclist extends React.Component{
this.setState({mobile_repeat:arr})
console.log(data)
}
- importConfirmClick(){
-
- let model = this.state.model;
- model.quantity = this.state.excel_count - this.state.error_count + this.state.mobile_repeat.length;
- this.setState({model:model})
- this.setState({accessVerify:false})
+ importConfirmClick(){
+
+ let temp = this.state.exceldata.filter(o=>o.type == "success");
+ console.log("临时",temp)
+ let mobile_repeat= _.map(temp,(o)=>{
+ return o.mobile;
+ })
+ console.log("重复的手机号",mobile_repeat)
+ this.setState({mobile_repeat:mobile_repeat})
+
+ let model = this.state.model;
+ model.quantity = this.state.excel_count - this.state.error_count + this.state.mobile_repeat.length;
+ this.setState({model:model})
+ this.setState({accessVerify:false})
+ this.setState({excel_visible:false})
+ this.setState({import_visible:false})
+
+ this.setState({import_success:true})
+ }
+ resetUpload(){
this.setState({excel_visible:false})
- this.setState({import_visible:false})
+ this.setState({import_visible:true})
+ this.setState({accessVerify:true})
+ }
+ switchChange(e,rowData){
+ if(e)
+ {
+ rowData.type = "success"
+ }
+ else{
+ rowData.type= rowData.type == "success" ? "repeat" :"error"
+ }
}
render(){
const Column = [
@@ -973,7 +1019,7 @@ export default class acclist extends React.Component{
width:'auto',
},
{
- title: '商品描述',
+ title: '商品图',
prop: 'describe_url',
name: 'describe_url',
type: "slot",
@@ -1081,10 +1127,21 @@ export default class acclist extends React.Component{
}
{
+ this.state.import_success ? () :(
+
this.state.white_visible ? () : null
+ }}>导入白名单) : null)
}
@@ -1433,7 +1490,7 @@ export default class acclist extends React.Component{
) : (
this.fileChange(e)} />
-
)
@@ -1458,7 +1515,7 @@ export default class acclist extends React.Component{
{this.setState({import_visible:false}) }} >取消
- {this.importClick(e)}} >确定导入
+ {this.importClick(e)}} style={{background:'#1890ff',color:"#FFFFFF",border:'none'}}>确定导入
@@ -1472,6 +1529,35 @@ export default class acclist extends React.Component{
}
+
+ {
+
+ this.state.audit_visible ? (
+
+
+
+
{this.setState({audit_visible:false})}} />
+ 提交审核
+
+
+ {this.onPayTypeChange(e)}} value={this.state.paytype} className="audit-obj">
+ 预付款扣除
+ 对私账户
+ 对公账户
+
+
+
+
+
+ {this.setState({audit_visible:false})}}>取消
+ {this.onAudit(e)}} >确定
+
+
+
+ ):null
+ }
+
+
{
this.state.excel_visible ? (
@@ -1508,20 +1594,18 @@ export default class acclist extends React.Component{
ComponentHandler={(com,rowData,rowIndex)=>{
if(com=="is_import")
{
- if(rowData.type == "repeat")
- {
- return
{
-
- this.allowImport(rowData)
- }}>允许导入
- }
- if(rowData.type == "success")
- {
- return
准备导入
- }
- else{
- return
-
- }
+ if(rowData.type == "success" || rowData.type =="repeat")
+ {
+
+ let checked = rowData.type == "success"
+ return
{this.switchChange(e,rowData)}}
+ />
+ }
+ else{
+ return -
+ }
}
}}
/>
@@ -1531,7 +1615,7 @@ export default class acclist extends React.Component{
{this.resetUpload() }} >重新上传
- {this.importConfirmClick(e)}} >确定导入
+ {this.importConfirmClick(e)}} style={{background:'#1890ff',color:"#FFFFFF",border:'none'}}>确定导入
@@ -1544,38 +1628,6 @@ export default class acclist extends React.Component{
}
-
-
-
-
-
-
- {
-
- this.state.audit_visible ? (
-
-
-
-
{this.setState({audit_visible:false})}} />
- 提交审核
-
-
- {this.onPayTypeChange(e)}} value={this.state.paytype} className="audit-obj">
- 预付款扣除
- 对私账户
- 对公账户
-
-
-
-
-
- {this.setState({audit_visible:false})}}>取消
- {this.onAudit(e)}} >确定
-
-
-
- ):null
- }
)
}
diff --git a/src/pages/exchangecode/add/add.less b/src/pages/exchangecode/add/add.less
index 6253f13c..bc89f244 100644
--- a/src/pages/exchangecode/add/add.less
+++ b/src/pages/exchangecode/add/add.less
@@ -20,4 +20,245 @@
color: #8a96aa;
background: #dfe8fc!important;
border: 1px solid #8a96aa!important;
- }
\ No newline at end of file
+ }
+
+
+ .import-excel
+ {
+ width: 451px;
+ height:600px;
+ 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: 18px;
+ font-weight: bold;
+ margin-left: 20px;
+ }
+
+ .closebtn{
+ width: 30%;
+
+ }
+
+ .import-close{
+ margin-left: 70px;
+ font-size: 20px;
+ font-weight: bold;
+ }
+ }
+ .step-bar{
+ width: 80%;
+ height: 60px;
+ 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;
+ font-weight: bold;
+ }
+ .step-label.active{
+ color: #000000;
+ }
+
+
+ .upload-panel1{
+ width: 80%;
+ margin: 10px auto;
+ margin-bottom: 20px;
+ .upload-label{
+ font-size: 15px;
+ font-weight: bold;
+ margin-bottom: 20px;
+ }
+ .upload-info{
+ color:#626366;
+ }
+ }
+
+ .btn-upload{
+ margin-top: 10px;
+ margin-left: 40px;
+ margin-bottom: 20px;
+ background-color:#1890ff;
+ }
+ .btn-download{
+ margin-top: 10px;
+ margin-left: 40px;
+ }
+ .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: 45px;
+ 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: 10px;
+ }
+ .upload-input{
+ opacity: 0;
+ width: 300px;
+ height: 48px;
+ position: absolute;
+ z-index: 5;
+ }
+ .file-loading{
+ font-size: 24px;
+
+ }
+ .isImport{
+ cursor: "pointer";
+ }
\ No newline at end of file
diff --git a/src/pages/plan/add/add.js b/src/pages/plan/add/add.js
index a272eb0b..cdc4a4da 100644
--- a/src/pages/plan/add/add.js
+++ b/src/pages/plan/add/add.js
@@ -36,7 +36,8 @@ export default class add extends React.Component{
reseller:"",
payment_direction:["对私账户","对公账户","预付款扣除"],
isload:false,
- is_audit:false
+ is_audit:false,
+ whiteStyle:false
}
}
@@ -117,8 +118,13 @@ export default class add extends React.Component{
let data = null
if(this.refs[this.state.keys[i]])
{
+ console.log("生成key",this.refs[this.state.keys[i]])
- console.log("key",this.state.keys[i])
+
+ console.log("key",this.refs[this.state.keys[i]])
+
+
+
data = this.refs[this.state.keys[i]].submit();
@@ -210,9 +216,22 @@ export default class add extends React.Component{
this.state.keys.push(step)
this.setState({keys:this.state.keys})
this.setState({isload:true})
+ if(this.refs[this.state.keys[0]].state.model.style == 1)
+ {
+ this.setState({whiteStyle:true})
+ }
console.log(this.state.keys)
}
-
+ onStyleChange(e){
+ console.log("状态",e.target.value)
+ if(e.target.value == 1)
+ {
+ this.setState({whiteStyle:true})
+ }
+ else{
+ this.setState({whiteStyle:false})
+ }
+ }
onPhoneChange(e){
this.setState({phone_radio:e.target.value})
}
@@ -341,7 +360,7 @@ export default class add extends React.Component{
}>
- {this.addNewkey()}} isload={this.state.isload} />
+ {this.addNewkey()}} onStyleChange={(e)=>{this.onStyleChange(e)}} isload={this.state.isload} name={index} whiteStyle={this.state.whiteStyle} />
) : null
})
diff --git a/src/pages/plan/add/edit.js b/src/pages/plan/add/edit.js
index 88eb22a2..82f9473b 100644
--- a/src/pages/plan/add/edit.js
+++ b/src/pages/plan/add/edit.js
@@ -24,6 +24,7 @@ export default class add extends React.Component{
{id:3,title:"落地页",child:[{step:1,title:"绑定落地页"}]},
],
phone_list:[],
+
email_list:[],
phone:"",
email:"",
@@ -408,6 +409,9 @@ export default class add extends React.Component{
this.setState({audit_visible:false})
let approval_id = sessionStorage.getItem("approval_id")
+
+ if(approval_id > 0)
+ {
getApprovalsStatus(approval_id).then((res)=>{
handelResponse(res,(req,msg)=>{
if(req.status == 0)
@@ -451,7 +455,27 @@ export default class add extends React.Component{
})
})
-
+ }
+ else{
+ 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)=>{
+ Notify.success("成功发起审批")
+ this.setState({audit_visible:false})
+ this.props.history.push('/home/plan-list/');
+ },(err)=>{
+ Notify.error(err)
+ })
+ })
+ }
}
diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js
index 3fb707da..1c558b9d 100644
--- a/src/pages/plan/add/step2.js
+++ b/src/pages/plan/add/step2.js
@@ -26,6 +26,8 @@ export default class acclist extends React.Component{
constructor(props){
super(props)
+
+
this.state={
model:{ //数据模型不可少
style:1,
@@ -71,10 +73,12 @@ export default class acclist extends React.Component{
excel_count:0,
success_count:0,
error_count:0,
-
+ whiteStyle:false,
import_success:false,
}
+
+
}
componentDidMount(e){
@@ -85,16 +89,18 @@ export default class acclist extends React.Component{
let input = items[1].getElementsByTagName("input")[0];
input.focus();
-
+ //除了主key批次窗口其他都禁用
+ if(this.props.name > 0)
+ {
+ this.setState({whiteStyle:true})
+ }
+
}
submit(){
let valide = false;
if(this.refs.form1.validator())
{
-
- console.log("验证成功")
-
let data = {};
data.batch_name = this.state.model.batch_name;
data.style = this.state.model.style;
@@ -120,8 +126,11 @@ export default class acclist extends React.Component{
onStyleChange(e){
+
+ this.props.onStyleChange(e)
let model2 = this.state.model;
model2.style = e.target.value;
+ model2.quantity = 0
this.setState({model:model2})
if(e.target.value == 1)
{
@@ -213,7 +222,21 @@ export default class acclist extends React.Component{
},500)
}
}
-
+
+
+ componentWillReceiveProps(nextProps) {
+
+ if(this.state.whiteStyle != nextProps.whiteStyle)
+ {
+
+ if(this.props.name > 0)
+ {
+ console.log("更改状态")
+ this.setState({whiteStyle:nextProps.whiteStyle})
+ }
+ }
+ }
+
onChangeCombinedDate(e){
let model2 = this.state.codeInfo;
model2.date_time = e;
@@ -223,7 +246,6 @@ export default class acclist extends React.Component{
this.refs.form2.validator()
}
onRankChange(e){
- console.log(e)
_.forEach(this.state.tempdata, (item) => {
item.checked = e.findIndex((checks)=>{return checks.key == item.product_id}) > -1;
})
@@ -310,6 +332,7 @@ export default class acclist extends React.Component{
}
}
addNewKey(){
+
this.props.addNewkey()
}
@@ -351,7 +374,7 @@ export default class acclist extends React.Component{
};
onDisabledRange = (date, type)=>{
- let step1 = JSON.parse (sessionStorage.getItem("step1"));
+ let step1 = JSON.parse (sessionStorage.getItem("step1"));
let isdisabled = false;
let str = moment(date).format("YYYY-MM-DD HH:mm:ss")
if( type == "start" )
@@ -456,19 +479,18 @@ export default class acclist extends React.Component{
if(file.length > 0 && file[0].status == "success")
{
- let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
- this.state.tempdata[rowIndex].describe_url =file[0].src;
- this.setState({tempdata:this.state.tempdata})
+ let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
+ this.state.tempdata[rowIndex].describe_url =file[0].src;
+ this.setState({tempdata:this.state.tempdata})
}
};
onUploadChange2(file,row){
if(file.length > 0 && file[0].status == "success")
{
- let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
-
- this.state.tempdata[rowIndex].describe_url =file[0].src;
- this.setState({tempdata:this.state.tempdata})
+ let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
+ this.state.tempdata[rowIndex].describe_url =file[0].src;
+ this.setState({tempdata:this.state.tempdata})
}
}
@@ -591,49 +613,6 @@ export default class acclist extends React.Component{
}
}
-
- // if(this.state.accessVerify)
- // {
- // this.setState({accessVerify:false})
- // this.setState({excel_visible:true})
- // this.setState({import_visible:false})
- // }
- // else{
-
-
- // Notify.error("文件正在解析中请稍等")
-
- // }
-
-
- // let my_file = this.state.myfile;
- // let formdata = new FormData()
- // formdata.append("file",my_file)
- // formdata.append("path","common_image")
- // uploadImg(formdata).then((res)=>{
- // handelResponse(res,(req,msg)=>{
- // let path = req.path
- // let data={
- // excel:path
- // }
- // getAccessVerification(data).then((res)=>{
- // handelResponse(res,(req,msg)=>{
- // console.log("excel结果")
-
- // console.log(req)
-
-
- // },(err)=>{
-
- // })
- // });
- // },(err)=>{
-
- // })
- // });
-
-
-
}
fileChange(e){
// this.initUpload();
@@ -827,7 +806,7 @@ export default class acclist extends React.Component{
width:'auto',
},
{
- title: '商品描述',
+ title: '商品图',
prop: 'describe_url',
name: 'describe_url',
type: "slot",
@@ -904,19 +883,18 @@ export default class acclist extends React.Component{
type: "slot",
}
];
-
-
+
return(
-
+