兑换码审批流程

This commit is contained in:
姜棚 2022-01-04 18:23:24 +08:00
parent 77696d8874
commit 102c5de273
2 changed files with 125 additions and 17 deletions

View File

@ -5,7 +5,7 @@ import Form from "../../../components/form/main"
import FormItem from "../../../components/form-item/main" import FormItem from "../../../components/form-item/main"
import {Card,Radio,Icon, Drawer, Select,Button,ImageUpload ,DateRangePicker,onUpload,Sweetalert,RadioButton,RadioGroup,Notify,Input,CombinedDateRangePicker} from "zent" import {Card,Radio,Icon, Drawer, Select,Button,ImageUpload ,DateRangePicker,onUpload,Sweetalert,RadioButton,RadioGroup,Notify,Input,CombinedDateRangePicker} from "zent"
import Bus from "../../../assets/eventBus.js" import Bus from "../../../assets/eventBus.js"
import {getApprovalsStatus,getApprovalsInfo,terminateApprovals,getProductInfoSelect,handelResponse,uploadImg,getCodeProduct,putCodeProduct,getCodesDetail,putCodes,putCodesBatch} from "../../../assets/api.js" import {getApprovalsStatus,getReseller,getApprovalsInfo,terminateApprovals,getProductInfoSelect,handelResponse,uploadImg,getCodeProduct,putCodeProduct,getCodesDetail,putCodes,putCodesBatch} from "../../../assets/api.js"
import _ from "lodash"; import _ from "lodash";
import Productform from "../product/add" import Productform from "../product/add"
import "./edit.less" import "./edit.less"
@ -44,6 +44,8 @@ export default class exchangedit extends React.Component{
isload:false, isload:false,
tempdata:[], tempdata:[],
oldProduct:[], oldProduct:[],
deleteProduct:[], //审批删除的商品
new_product:[],
cur_product:null, cur_product:null,
productOption:[], productOption:[],
rankoptions:[], rankoptions:[],
@ -73,27 +75,50 @@ export default class exchangedit extends React.Component{
getApprovalsInfo(approval_id).then(res=>{ getApprovalsInfo(approval_id).then(res=>{
handelResponse(res,(req,msg)=>{ handelResponse(res,(req,msg)=>{
let resller_obj = {
id:req.reseller_id,
name:req.reseller_name,
company_name:req.company_name,
receive_email:req.receive_email
}
this.setState({reseller:resller_obj})
let codeInfo={ let codeInfo={
code_name:req.title, code_name:req.title,
issued:req.quantity, issued:req.quantity,
stock:req.stock, stock:req.stock,
describe:req.describe, describe:req.describe,
date_time:[req.begin_time,req.end_time], date_time:[req.begin_time,req.end_time],
range:req.code_batch_stock range:req.update_product
} }
if(req.new_product.length > 0)
{
codeInfo.range = codeInfo.range.concat(req.new_product);
}
let new_ids = _.map(req.new_product,(o)=>{
return o.product_id;
})
this.setState({new_product:new_ids})
this.setState({codeInfo:codeInfo}) this.setState({codeInfo:codeInfo})
this.setState({isload:true}); this.setState({isload:true});
let table = _.map(req.code_batch_stock,(res)=>{ let table = _.map(codeInfo.range,(res)=>{
res.checked = true; res.checked = true;
return res return res
}); });
this.setState({tempdata:req.code_batch_stock })
this.setState({deleteProduct:req.delete_product})
this.setState({tempdata:codeInfo.range})
let arr = []; let arr = [];
_.map(req.code_batch_stock,(res)=>{ _.map(codeInfo.range,(res)=>{
let obj = {}; let obj = {};
obj.key = res.product_id; obj.key = res.product_id;
obj.text= res.product_name; obj.text= res.product_name;
@ -122,6 +147,22 @@ export default class exchangedit extends React.Component{
date_time:[req.begin_time,req.end_time], date_time:[req.begin_time,req.end_time],
range:req.code_batch_stock range:req.code_batch_stock
} }
console.log(111)
console.log("计划任务的分销商id")
console.log(req.plan.reseller_id)
//获取分销商
getReseller(req.plan.reseller_id).then((res)=>{
handelResponse(res,(req,msg)=>{
console.log("获取分销商",req)
req.receive_email = req.contact_email[0]
this.setState({reseller:req})
this.setState({phone_list:req.contact_phone})
this.setState({email_list:req.contact_email})
})
})
this.setState({codeInfo:codeInfo}) this.setState({codeInfo:codeInfo})
this.setState({isload:true}); this.setState({isload:true});
@ -185,10 +226,10 @@ export default class exchangedit extends React.Component{
let range = [] let range = []
_.map(this.state.rank,(o)=>{ _.map(this.state.rank,(o)=>{
if(this.state.oldProduct.indexOf(o.key) < 0) // if(this.state.oldProduct.indexOf(o.key) < 0)
{ // {
range.push(o.text) ; range.push(o.text) ;
} // }
}) })
console.log("范围",this.state.rank) console.log("范围",this.state.rank)
console.log("旧商品",this.state.oldProduct) console.log("旧商品",this.state.oldProduct)
@ -227,11 +268,75 @@ export default class exchangedit extends React.Component{
let deleteProduct= _.differenceWith(this.state.oldProduct, updateIds, _.isEqual); let deleteProduct= _.differenceWith(this.state.oldProduct, updateIds, _.isEqual);
console.log("分销商",this.state.reseller)
// _.filter(deleteProduct,(item)=>{
// this.state.new_product.indexOf(item)
// })
deleteProduct = deleteProduct.filter((item)=>{return this.state.new_product.indexOf(item) < 0})
console.log(this.state.new_product)
if(this.state.deleteProduct.length > 0)
{
deleteProduct = deleteProduct.concat(this.state.deleteProduct).map(Number)
}
console.log("新增商品",addProduct)
console.log(deleteProduct)
let temp = addProduct.filter((item)=>{
return deleteProduct.indexOf(item.product_id) > -1
})
let tempIds = _.map(temp,(item)=>{
return item.product_id
})
if(temp.length > 0)
{
addProduct = addProduct.filter((item)=>{
return tempIds.indexOf(item.product_id) < 0
})
console.log("新增",addProduct)
let updateAdd =_.filter(addProduct,(item)=>{
return deleteProduct.indexOf(item.product_id) > -1
})
updateProduct = updateProduct.concat(updateAdd);
}
updateIds = _.map(updateProduct,(o)=>{
return o.product_id;
})
deleteProduct = _.filter(deleteProduct,(o)=>{
return updateIds.indexOf(o) < 0
})
let data ={ let data ={
"reseller_id":"15", "reseller_id":this.state.reseller.id,
"reseller_name":"熊大的分销商", "reseller_name":this.state.reseller.name,
"company_name":"数字世界", "company_name":this.state.reseller.company_name,
"receive_email":"2371536879@qq.com", "receive_email":this.state.reseller.receive_email,
"payment_direction":this.state.payment_direction[this.state.paytype - 1], "payment_direction":this.state.payment_direction[this.state.paytype - 1],
"title": this.state.codeInfo.code_name, "title": this.state.codeInfo.code_name,
"range": range, "range": range,
@ -267,6 +372,7 @@ export default class exchangedit extends React.Component{
submit(){ submit(){
if(this.refs.code_info.validator() && this.refs.code_rule.validator() ) if(this.refs.code_info.validator() && this.refs.code_rule.validator() )
{ {
if(this.state.uploading ) if(this.state.uploading )
@ -275,14 +381,13 @@ export default class exchangedit extends React.Component{
Notify.error("还有图片上传中,不可提交") Notify.error("还有图片上传中,不可提交")
return return
} }
this.setState({audit_visible:true}) this.setState({audit_visible:true})
} }
} }
onConfirm(){ onConfirm(){
let approval_id = sessionStorage.getItem("approval_id") let approval_id = sessionStorage.getItem("approval_id")
this.setState({audit_visible:false})
if(approval_id <= 0) if(approval_id <= 0)
{ {
this.submitCodeData(); this.submitCodeData();
@ -356,8 +461,6 @@ export default class exchangedit extends React.Component{
{ {
this.setState({drawerVisible2:false}) this.setState({drawerVisible2:false})
setTimeout(()=>{ setTimeout(()=>{
console.log("获取到商品456456")
console.log(sessionStorage.getItem("productData"));
let data = JSON.parse(sessionStorage.getItem("productData")); let data = JSON.parse(sessionStorage.getItem("productData"));
@ -567,6 +670,7 @@ export default class exchangedit extends React.Component{
{ {
clearInterval(timer_c) clearInterval(timer_c)
this.setState({approvalLoading:false}) this.setState({approvalLoading:false})
Notify.success("撤销成功,请重新提交审核")
} }
let time = this.state.timer - 1; let time = this.state.timer - 1;
this.setState({timer:time}) this.setState({timer:time})
@ -911,7 +1015,7 @@ export default class exchangedit extends React.Component{
<Icon type="close" className="audit-close" onClick={(e)=>{this.setState({approvalLoading:false})}} /> <Icon type="close" className="audit-close" onClick={(e)=>{this.setState({approvalLoading:false})}} />
<div className="audit-box-title">撤销审批中</div> <div className="audit-box-title">撤销审批中</div>
<div className="audit-box-txt"> <div className="audit-box-txt">
正在发起撤销...,请等待{this.state.timer} 正在发起撤销...,请等待 <span style={{color:"red"}}> {this.state.timer}</span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -781,6 +781,10 @@ export default class acclist extends React.Component{
} }
return isdisabled return isdisabled
} }
onPayTypeChange(e){
console.log("渠道类型",e.target.value)
this.setState({paytype:e.target.value})
}
render(){ render(){