From 35b5baad0d61a708ced4ecf41699ef7df0d610cd Mon Sep 17 00:00:00 2001 From: zhangds Date: Tue, 19 Apr 2022 11:20:53 +0800 Subject: [PATCH] =?UTF-8?q?1)=20=E4=BF=AE=E5=A4=8D=E8=90=A5=E9=94=80?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=88=86=E9=A1=B5=E8=BF=87=E6=BB=A4=E5=8F=82?= =?UTF-8?q?=E6=95=B0=202=EF=BC=89=20=E4=BF=AE=E5=A4=8D=E5=85=91=E6=8D=A2?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=80=81=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E9=80=89=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangecode/product/add copy.js | 1 - src/pages/exchangecode/product/add.js | 4 +++- src/pages/plan/list/list.js | 26 +++++++++++++++------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/pages/exchangecode/product/add copy.js b/src/pages/exchangecode/product/add copy.js index 62c0e8c5..a2e5c92e 100644 --- a/src/pages/exchangecode/product/add copy.js +++ b/src/pages/exchangecode/product/add copy.js @@ -124,7 +124,6 @@ export default class adduserinfo extends React.Component { } this.getProductInfo(); } - //获取直连天下商品映射信息 getProductInfo() { let productList = sessionStorage.getItem("productsList"); diff --git a/src/pages/exchangecode/product/add.js b/src/pages/exchangecode/product/add.js index b4363833..d398025d 100644 --- a/src/pages/exchangecode/product/add.js +++ b/src/pages/exchangecode/product/add.js @@ -160,6 +160,7 @@ export default class adduserinfo extends React.Component { }); this.setState({ productOption: arr }); + console.log("this.state.model.product_id =>", this.state.model.product_id); if (this.state.model.product_id) { let cur_product = arr.find((item) => { return item.key == this.state.model.product_id; @@ -168,7 +169,8 @@ export default class adduserinfo extends React.Component { console.log("cur_product ==>2", cur_product); console.log("arr ==>", arr); - if (cur_product.in) { + + if (cur_product && cur_product.in) { this.setState({ isSelectGoods: true }); } } diff --git a/src/pages/plan/list/list.js b/src/pages/plan/list/list.js index 36a85fb6..3ec3526b 100644 --- a/src/pages/plan/list/list.js +++ b/src/pages/plan/list/list.js @@ -78,7 +78,7 @@ export default class acclist extends React.Component { email: "", email_radio: -1, phone_radio: -1, - search: "", + key_word: "", audit_visible: false, cur_item: null, @@ -170,7 +170,10 @@ export default class acclist extends React.Component { }); } onCountChange(e) { - this.setState({ page: 1, limit: e }); + this.setState({ + page: 1, + limit: e, + }); setTimeout(() => { this.getpageFn(); }, 200); @@ -182,6 +185,9 @@ export default class acclist extends React.Component { status: this.state.status, key_word: this.state.key_word, }; + if (data.key_word === "") { + delete data.key_word; + } this.getPlanList(data); } @@ -432,7 +438,11 @@ export default class acclist extends React.Component { // 监听组件内部状态的变化: componentDidUpdate(prevProps, prevState) { // 参数分别为改变之前的数据状态对象 - if (prevState.search != this.state.search && !this.state.search) { + + if ( + prevState.key_word != this.state.key_word && + prevState.status != this.state.status + ) { this.iptsureFn(); } } @@ -444,7 +454,7 @@ export default class acclist extends React.Component { page: 1, limit: 10, status: this.state.status, - key_word: this.state.search, + key_word: this.state.key_word, }; this.getPlanList(data); } @@ -504,7 +514,7 @@ export default class acclist extends React.Component { let params = { page: 1, limit: 10, - key_word: this.state.search, + key_word: this.state.key_word, }; this.getPlanList(params); } @@ -634,8 +644,8 @@ export default class acclist extends React.Component { {/* */} this.setState({ search: e })} - value={this.state.search} + onChange={(e) => this.setState({ key_word: e })} + value={this.state.key_word} wordSearch={this.iptsureFn.bind(this)} icon="search" placeholder={"请输入营销计划名称、分销商名称查询"} @@ -643,7 +653,7 @@ export default class acclist extends React.Component { height={"36px"} width={"260px"} onClearItem={(e) => { - this.setState({ search: "" }); + this.setState({ key_word: "" }); let data = { page: 1, limit: 10,