更新商品

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

View File

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

View File

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

View File

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