商品编辑

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;
this.setState({oldTable:req.code_batch_stock})
console.log("老数据",this.state.oldTable)
let deleteArr = []
@ -131,17 +130,9 @@ export default class exchangedit extends React.Component{
deleteData.checked = false;
deleteArr.push(deleteData)
}
console.log("删除数组",deleteArr)
this.setState({codeInfo:codeInfo})
this.setState({isload:true});
codeInfo.range = codeInfo.range.concat(deleteArr)
let table = _.map(codeInfo.range,(res)=>{
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=>{
});
},(err)=>{
})
@ -231,7 +208,6 @@ export default class exchangedit extends React.Component{
//获取分销商
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})
@ -306,8 +282,6 @@ export default class exchangedit extends React.Component{
range.push(o.text) ;
// }
})
console.log("范围",this.state.rank)
console.log("旧商品",this.state.oldProduct)
let selectData = this.refs.tempdata.getSelectData();
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)
{
updateIds.push(o.product_id)
updateIds.push(o.product_id)
let _object = {}
_object.contract_price= o.contract_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
updateProduct.push(_object)
}
});
@ -351,10 +321,6 @@ export default class exchangedit extends React.Component{
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
})
@ -511,12 +477,6 @@ export default class exchangedit extends React.Component{
})
}
}
}
@ -538,8 +498,6 @@ export default class exchangedit extends React.Component{
}
onTypeChange(e){
console.log(e)
let model2 = this.state.model;
model2.type = e.target.value;
this.setState({model:model2})
@ -767,7 +725,7 @@ export default class exchangedit extends React.Component{
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
}
@ -779,17 +737,11 @@ export default class exchangedit extends React.Component{
handelResponse(res,(req,msg)=>{
this.setState({approvalLoading:true})
let timer_c = setInterval(()=>{
console.log(this.state.timer)
if(this.state.timer <= 0)
{
clearInterval(timer_c)
this.setState({approvalLoading:false})
Notify.success("撤销成功,请重新提交审核")
}
let time = this.state.timer - 1;
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(){
@ -883,19 +843,19 @@ export default class exchangedit extends React.Component{
width:'auto',
},
{
title: '商品展示',
prop: 'show_url',
name: 'show_url',
type: "slot",
width:'auto',
},
{
title: '商品描述',
prop: 'describe_url',
name: 'describe_url',
title: '操作',
prop: 'edit',
name: 'edit',
type: "slot",
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" )
{
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
style={{width:"30px",height:"30px"}}
className="td-image-upload-demo"
maxSize={5 * 1024 * 1024}
maxAmount={1}
onChange={(e)=>{this.onUploadChange1(e,rowData)}}
onUpload={this.onUpload}
defaultFileList={[{'src':rowData.show_url}]}
value={rowData.show_url}
/>
return <a className="grid-link" onClick={(e)=>{
this.productEditShow(rowData)
}} >编辑</a>
}
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}
/>
}
// if(com == "show_url")
// {
// return <ImageUpload
// style={{width:"30px",height:"30px"}}
// className="td-image-upload-demo"
// maxSize={5 * 1024 * 1024}
// maxAmount={1}
// onChange={(e)=>{this.onUploadChange1(e,rowData)}}
// onUpload={this.onUpload}
// defaultFileList={[{'src':rowData.show_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>
</div>
<Drawer
className="draw"
width={"60%"}
className="draw"
width={"60%"}
title={"新建商品"}
footer={
<div style={{ textAlign: 'center' }}>
@ -1119,7 +1088,7 @@ export default class exchangedit extends React.Component{
</div>
<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>
</div>
</div>

View File

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