更新商品

This commit is contained in:
姜棚 2022-01-25 15:10:56 +08:00
parent 191fa2da54
commit e3cf56cd5a
4 changed files with 44 additions and 26 deletions

View File

@ -12,6 +12,7 @@ import "./goodedit.less"
import Swiper from 'swiper/dist/js/swiper.js'
import 'swiper/dist/css/swiper.min.css'
var mySwiper = null;
var timer = null
export default class adduserinfo extends React.Component{
constructor(props){
@ -423,6 +424,9 @@ componentDidMount() {
autoplay : 3000,
})
clearTimeout(timer);
timer = setTimeout(()=>{
if(arr.length > this.state.productpic.length)
{
//新增
@ -500,6 +504,8 @@ componentDidMount() {
}
this.setState({productpic:temp_arr})
}
},500)
};
onUploadChange2(files){
if(files.length > 0 )

View File

@ -11,7 +11,8 @@ import Bus from "../../../assets/eventBus.js"
import {getProductInfoSelect,handelResponse,uploadImg} from "../../../assets/api.js"
import _ from "lodash";
var mySwiper = null;
var mySwiper = null;
var timer = null
export default class adduserinfo extends React.Component{
constructor(props){
@ -318,10 +319,12 @@ export default class adduserinfo extends React.Component{
}
};
onUploadChange1(files,e){
let arr =_.map(files,(o)=>{
return o.name
})
console.log("删除",files)
if(mySwiper !==0)
{
@ -334,8 +337,9 @@ export default class adduserinfo extends React.Component{
paginationClickable:true,
autoplay : 3000,
})
console.log("保留的数据",arr)
console.log("保留的数据",this.state.productpic)
clearTimeout(timer);
timer = setTimeout(()=>{
if(arr.length > this.state.productpic.length)
{
//新增
@ -407,6 +411,9 @@ export default class adduserinfo extends React.Component{
}
this.setState({productpic:temp_arr})
}
},500)
};
onUploadError = (type, data) => {
if (type === 'overMaxAmount') {
@ -559,7 +566,14 @@ export default class adduserinfo extends React.Component{
onError={this.onUploadError}
defaultFileList={this.state.model.describe_url }
multiple
onUpload={this.onUpload}
onUpload={
this.onUpload
}
onChange={(e)=>{this.onUploadChange1(e)}}
/>

View File

@ -74,8 +74,8 @@ export default class acclist extends React.Component{
}
componentDidMount(e){
let batch_id=sessionStorage.getItem("keybatch_id")
let reseller_id =sessionStorage.getItem("key_reseller_id")
let batch_id = sessionStorage.getItem("keybatch_id")
let reseller_id = sessionStorage.getItem("key_reseller_id")
let approval_id = sessionStorage.getItem("approval_id")
//编辑
if(batch_id > 0)
@ -83,8 +83,6 @@ export default class acclist extends React.Component{
getReseller(reseller_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})
@ -92,18 +90,24 @@ export default class acclist extends React.Component{
})
})
this.setState({isEdit:true})
getKeyBatchDetail(batch_id).then((res)=>{
handelResponse(res,(req,msg)=>{
console.log("和编辑",req)
if(req.status == 7)
{
this.setState({isCancel:true})
}
if(req.status == 1)
{
this.setState({isEdit:false})
}
else{
this.setState({isEdit:true})
}
this.setState({pagetitle:"编辑key"})
req.code_batch = req.code_batch ? req.code_batch : []
let temp = [];
@ -298,10 +302,6 @@ export default class acclist extends React.Component{
Notify.success("保存成功")
this.setState({drawerVisible2:false})
setTimeout(()=>{
let data = JSON.parse(sessionStorage.getItem("productData"));
@ -450,19 +450,13 @@ export default class acclist extends React.Component{
return obj
})
temp.product = arr;
console.log("dasdas",temp)
if(this.state.rowIndex > -1)
{
console.log("编辑")
this.state.distdata[this.state.rowIndex] = temp;
this.setState({distdata:this.state.distdata})
console.log(this.state.distdata)
}
else{
console.log("新增")
let tempdata = this.state.distdata;
tempdata.push(temp)
this.setState({distdata:tempdata})

View File

@ -10,7 +10,7 @@ import {getProductInfoSelect,handelResponse,uploadImg} from "../../../assets/api
import _ from "lodash";
import Swiper from 'swiper/dist/js/swiper.js'
import 'swiper/dist/css/swiper.min.css'
var timer = null
var mySwiper = 0;
export default class adduserinfo extends React.Component{
constructor(props){
@ -377,6 +377,10 @@ export default class adduserinfo extends React.Component{
paginationClickable:true,
autoplay : 3000,
})
clearTimeout(timer);
timer = setTimeout(()=>{
if(arr.length > this.state.productpic.length)
{
//新增
@ -452,7 +456,7 @@ export default class adduserinfo extends React.Component{
// }
},500)
};