商品编辑

This commit is contained in:
姜棚 2022-01-14 16:23:09 +08:00
parent 9ff0fb6e08
commit 0409d726f9
2 changed files with 66 additions and 93 deletions

View File

@ -121,7 +121,6 @@ export default class exchangedit extends React.Component{
codeInfo.stock = req.stock; codeInfo.stock = req.stock;
this.setState({oldTable:req.code_batch_stock}) this.setState({oldTable:req.code_batch_stock})
console.log("老数据",this.state.oldTable)
let deleteArr = [] let deleteArr = []
@ -131,17 +130,9 @@ export default class exchangedit extends React.Component{
deleteData.checked = false; deleteData.checked = false;
deleteArr.push(deleteData) deleteArr.push(deleteData)
} }
console.log("删除数组",deleteArr)
this.setState({codeInfo:codeInfo}) this.setState({codeInfo:codeInfo})
this.setState({isload:true}); this.setState({isload:true});
codeInfo.range = codeInfo.range.concat(deleteArr) codeInfo.range = codeInfo.range.concat(deleteArr)
let table = _.map(codeInfo.range,(res)=>{ let table = _.map(codeInfo.range,(res)=>{
let obj = req.code_batch_stock.find(o=>o.product_id == res.product_id); let obj = req.code_batch_stock.find(o=>o.product_id == res.product_id);
@ -196,20 +187,6 @@ export default class exchangedit extends React.Component{
}).catch(err=>{ }).catch(err=>{
}); });
},(err)=>{ },(err)=>{
}) })
@ -231,7 +208,6 @@ export default class exchangedit extends React.Component{
//获取分销商 //获取分销商
getReseller(req.plan.reseller_id).then((res)=>{ getReseller(req.plan.reseller_id).then((res)=>{
handelResponse(res,(req,msg)=>{ handelResponse(res,(req,msg)=>{
console.log("获取分销商",req)
req.receive_email = req.contact_email[0] req.receive_email = req.contact_email[0]
this.setState({reseller:req}) this.setState({reseller:req})
this.setState({phone_list:req.contact_phone}) this.setState({phone_list:req.contact_phone})
@ -306,8 +282,6 @@ export default class exchangedit extends React.Component{
range.push(o.text) ; range.push(o.text) ;
// } // }
}) })
console.log("范围",this.state.rank)
console.log("旧商品",this.state.oldProduct)
let selectData = this.refs.tempdata.getSelectData(); let selectData = this.refs.tempdata.getSelectData();
let addProduct = selectData.filter((o)=>{ let addProduct = selectData.filter((o)=>{
@ -320,9 +294,7 @@ export default class exchangedit extends React.Component{
if(this.state.oldProduct.indexOf(o.product_id) > -1) if(this.state.oldProduct.indexOf(o.product_id) > -1)
{ {
updateIds.push(o.product_id)
updateIds.push(o.product_id)
let _object = {} let _object = {}
_object.contract_price= o.contract_price; _object.contract_price= o.contract_price;
_object.cost_price= o.cost_price; _object.cost_price= o.cost_price;
@ -337,8 +309,6 @@ export default class exchangedit extends React.Component{
_object.map_product_name = o.map_product_name _object.map_product_name = o.map_product_name
updateProduct.push(_object) updateProduct.push(_object)
} }
}); });
@ -351,10 +321,6 @@ export default class exchangedit extends React.Component{
deleteProduct = deleteProduct.concat(this.state.deleteProduct).map(Number) deleteProduct = deleteProduct.concat(this.state.deleteProduct).map(Number)
} }
console.log("新增商品",addProduct)
console.log(deleteProduct)
let temp = addProduct.filter((item)=>{ let temp = addProduct.filter((item)=>{
return deleteProduct.indexOf(item.product_id) > -1 return deleteProduct.indexOf(item.product_id) > -1
}) })
@ -511,12 +477,6 @@ export default class exchangedit extends React.Component{
}) })
} }
} }
} }
@ -538,8 +498,6 @@ export default class exchangedit extends React.Component{
} }
onTypeChange(e){ onTypeChange(e){
console.log(e)
let model2 = this.state.model; let model2 = this.state.model;
model2.type = e.target.value; model2.type = e.target.value;
this.setState({model:model2}) this.setState({model:model2})
@ -767,7 +725,7 @@ export default class exchangedit extends React.Component{
if( type == "end" ) if( type == "end" )
{ {
isdisabled = moment(str).isAfter(this.state.codeInfo.date_time[1]) isdisabled = moment(str).isAfter(this.state.codeInfo.date_time[1])
} }
return isdisabled return isdisabled
} }
@ -779,17 +737,11 @@ export default class exchangedit extends React.Component{
handelResponse(res,(req,msg)=>{ handelResponse(res,(req,msg)=>{
this.setState({approvalLoading:true}) this.setState({approvalLoading:true})
let timer_c = setInterval(()=>{ let timer_c = setInterval(()=>{
console.log(this.state.timer)
if(this.state.timer <= 0) if(this.state.timer <= 0)
{ {
clearInterval(timer_c) clearInterval(timer_c)
this.setState({approvalLoading:false}) this.setState({approvalLoading:false})
Notify.success("撤销成功,请重新提交审核") Notify.success("撤销成功,请重新提交审核")
} }
let time = this.state.timer - 1; let time = this.state.timer - 1;
this.setState({timer:time}) this.setState({timer:time})
@ -799,7 +751,15 @@ export default class exchangedit extends React.Component{
}) })
}) })
} }
productEditShow(rowData){
this.setState({drawerVisible2:true})
this.setState({productData:rowData})
}
render(){ render(){
@ -883,19 +843,19 @@ export default class exchangedit extends React.Component{
width:'auto', width:'auto',
}, },
{ {
title: '商品展示', title: '操作',
prop: 'show_url', prop: 'edit',
name: 'show_url', name: 'edit',
type: "slot",
width:'auto',
},
{
title: '商品描述',
prop: 'describe_url',
name: 'describe_url',
type: "slot", type: "slot",
width:'auto', width:'auto',
}, },
// {
// title: '商品图',
// prop: 'describe_url',
// name: 'describe_url',
// type: "slot",
// width:'auto',
// },
]; ];
@ -1016,36 +976,45 @@ export default class exchangedit extends React.Component{
} }
if(com =="contract_price" ) if(com =="contract_price" )
{ {
return <Input width={100} placeholder="请输入合同价" value={rowData.contract_price} onChange={(e)=>{this.onPriceChange(e,rowData)}} /> return <Input width={100} placeholder="请输入合同价" v
alue={rowData.contract_price} onChange={(e)=>{this.onPriceChange(e,rowData)}} />
} }
if(com == "show_url") if(com == "edit")
{ {
return <ImageUpload return <a className="grid-link" onClick={(e)=>{
style={{width:"30px",height:"30px"}} this.productEditShow(rowData)
className="td-image-upload-demo"
maxSize={5 * 1024 * 1024} }} >编辑</a>
maxAmount={1}
onChange={(e)=>{this.onUploadChange1(e,rowData)}}
onUpload={this.onUpload}
defaultFileList={[{'src':rowData.show_url}]}
value={rowData.show_url}
/>
} }
if(com == "describe_url") // if(com == "show_url")
{ // {
return <ImageUpload // return <ImageUpload
style={{width:"30px",height:"30px"}} // style={{width:"30px",height:"30px"}}
className="td-image-upload-demo" // className="td-image-upload-demo"
maxSize={5 * 1024 * 1024} // maxSize={5 * 1024 * 1024}
maxAmount={1} // maxAmount={1}
onChange={(e)=>{this.onUploadChange2(e,rowData)}} // onChange={(e)=>{this.onUploadChange1(e,rowData)}}
onUpload={this.onUpload} // onUpload={this.onUpload}
defaultFileList={ rowData.describe_url ? [{'src':rowData.describe_url}] : null} // defaultFileList={[{'src':rowData.show_url}]}
value={rowData.describe_url} // value={rowData.show_url}
/> // />
} // }
// if(com == "describe_url")
// {
// return <ImageUpload
// style={{width:"30px",height:"30px"}}
// className="td-image-upload-demo"
// maxSize={5 * 1024 * 1024}
// maxAmount={1}
// onChange={(e)=>{this.onUploadChange2(e,rowData)}}
// onUpload={this.onUpload}
// defaultFileList={ rowData.describe_url ? [{'src':rowData.describe_url}] : null}
// value={rowData.describe_url}
// />
// }
}} }}
@ -1056,8 +1025,8 @@ export default class exchangedit extends React.Component{
</Card> </Card>
</div> </div>
<Drawer <Drawer
className="draw" className="draw"
width={"60%"} width={"60%"}
title={"新建商品"} title={"新建商品"}
footer={ footer={
<div style={{ textAlign: 'center' }}> <div style={{ textAlign: 'center' }}>
@ -1119,7 +1088,7 @@ export default class exchangedit extends React.Component{
</div> </div>
<div className="audit-btn-group"> <div className="audit-btn-group">
<Button onClick={(e)=>{this.setState({recall_visible:false})}}>取消</Button> <Button onClick={(e)=>{this.setState({recall_visible:false})}}>取消</Button>
<Button type="primary" onClick={(e)=>{this.onReCall(e)}} >确定</Button> <Button type="primary" onClick={(e)=>{this.onReCall(e)}} >确定</Button>
</div> </div>
</div> </div>

View File

@ -39,16 +39,20 @@ export default class adduserinfo extends React.Component{
componentWillMount(e){ componentDidMount(e){
//获取商品信息 //获取商品信息
this.getProductInfo() this.getProductInfo()
let model_temp = this.props.data;
let model = this.state.model;
model_temp.product_id = model.product_id;
console.log("属性数组",)
} }
//获取直连天下商品映射信息 //获取直连天下商品映射信息
getProductInfo(){ getProductInfo(){