修复 商品列表数据 丢失问题以及优化代码
This commit is contained in:
parent
e8d9b6312e
commit
ff02de0c98
|
@ -30,7 +30,6 @@ import {
|
|||
uploadImg,
|
||||
getReseller,
|
||||
getAccessVerification,
|
||||
keyApproval,
|
||||
getProductInfoSelect
|
||||
} from '../../../assets/api.js'
|
||||
import Productform from '../product/add'
|
||||
|
@ -152,12 +151,13 @@ export default class acclist extends React.Component {
|
|||
this.setState({ pagetitle: '复制key' })
|
||||
getReseller(req.reseller_id).then((res) => {
|
||||
handelResponse(res, (req, msg) => {
|
||||
this.setState({ reseller: req })
|
||||
this.setState({
|
||||
direct_reseller_id: req.direct_reseller_id
|
||||
email_list: req.contact_email,
|
||||
phone_list: req.contact_phone,
|
||||
direct_reseller_id: req.direct_reseller_id,
|
||||
reseller: req
|
||||
})
|
||||
this.setState({ phone_list: req.contact_phone })
|
||||
this.setState({ email_list: req.contact_email })
|
||||
this.getProductFunction(req.direct_reseller_id)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -259,13 +259,13 @@ export default class acclist extends React.Component {
|
|||
|
||||
getReseller(id).then((res) => {
|
||||
handelResponse(res, (req, msg) => {
|
||||
this.setState({ reseller: req })
|
||||
|
||||
this.setState({ phone_list: req.contact_phone })
|
||||
this.setState({ email_list: req.contact_email })
|
||||
this.setState({
|
||||
direct_reseller_id: req.direct_reseller_id
|
||||
reseller: req,
|
||||
direct_reseller_id: req.direct_reseller_id,
|
||||
email_list: req.contact_email,
|
||||
phone_list: req.contact_phone
|
||||
})
|
||||
this.getProductFunction(req.direct_reseller_id)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -287,6 +287,16 @@ export default class acclist extends React.Component {
|
|||
this.setState({ paytype: e.target.value })
|
||||
}
|
||||
|
||||
/* 获取商品列表 */
|
||||
getProductFunction(id) {
|
||||
if (sessionStorage.getItem('productsList')) return
|
||||
getProductInfoSelect({ reseller_id: id }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
sessionStorage.setItem('productsList', JSON.stringify(res.data.data))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async submit() {
|
||||
let valide = false
|
||||
if (this.refs.form1.validator()) {
|
||||
|
@ -421,26 +431,19 @@ export default class acclist extends React.Component {
|
|||
} else {
|
||||
this.setState({ product_title: '新增立减金', newGoldLoading: true })
|
||||
}
|
||||
let param = {
|
||||
reseller_id: direct_reseller_ids
|
||||
}
|
||||
try {
|
||||
getProductInfoSelect(param).then((res) => {
|
||||
if (res.code === 200) {
|
||||
sessionStorage.setItem('productsList', JSON.stringify(res.data.data))
|
||||
this.setState({ productData: null })
|
||||
this.setState({ drawerVisible2: true })
|
||||
}
|
||||
if (type === 'addProduct') {
|
||||
this.setState({
|
||||
newGoodsBtnLoading: false
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
newGoldLoading: false
|
||||
})
|
||||
}
|
||||
})
|
||||
this.setState({ productData: null })
|
||||
this.setState({ drawerVisible2: true })
|
||||
|
||||
if (type === 'addProduct') {
|
||||
this.setState({
|
||||
newGoodsBtnLoading: false
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
newGoldLoading: false
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
if (type === 'addProduct') {
|
||||
this.setState({
|
||||
|
|
|
@ -132,6 +132,7 @@ export default class acclist extends React.Component {
|
|||
direct_reseller_id: req.direct_reseller_id
|
||||
})
|
||||
|
||||
if (sessionStorage.getItem('productsList')) return
|
||||
/* 请求商品数据 */
|
||||
getProductInfoSelect({
|
||||
reseller_id: req.direct_reseller_id
|
||||
|
|
Loading…
Reference in New Issue