diff --git a/pages/customer/addCard/index.js b/pages/customer/addCard/index.js index b3c38c8..ee06997 100644 --- a/pages/customer/addCard/index.js +++ b/pages/customer/addCard/index.js @@ -271,13 +271,13 @@ Page({ icon: 'none' }) } - else if (that.data.of_id == '' ) { + else if (that.data.sources.length>0&&that.data.of_id == '' ) { wx.showToast({ title: '请选择线索来源', icon: 'none' }) } - else if (that.data.sources[that.data.of1Index].list.length>0&&that.data.of2_id == '' ) { + else if (that.data.sources.length>0&&that.data.sources[that.data.of1Index].list.length>0&&that.data.of2_id == '' ) { wx.showToast({ title: '请选择'+that.data.sources[that.data.of1Index].name+'类型', icon: 'none' @@ -320,7 +320,9 @@ Page({ // if(this.data.b_s_id != ''){ // params['b_s_id'] = this.data.b_s_id; // } - params['of_id'] = this.data.of_id; + if(this.data.of_id != ''){ + params['of_id'] = this.data.of_id; + } if(this.data.of2_id != ''){ params['of2_id'] = this.data.of2_id; } @@ -395,12 +397,12 @@ Page({ params['status'] = this.data.status; _.apiQuery.getAppCustomersOffline_sources(params).then(res => { let of1Arr = [] - res.data.forEach(item => { + res.data.sources.forEach(item => { of1Arr.push(item.name) }) this.setData({ of1Arr, - sources:res.data + sources:res.data.sources }) }); }, diff --git a/pages/customer/addCard/index.wxml b/pages/customer/addCard/index.wxml index 6149402..d185760 100644 --- a/pages/customer/addCard/index.wxml +++ b/pages/customer/addCard/index.wxml @@ -72,26 +72,28 @@ --> - - 线索来源 - - - 请选择 - {{of1Arr[of1Index]}} - - + + + 线索来源 + + + 请选择 + {{of1Arr[of1Index]}} + + + - - - {{sources[of1Index].name}} - - - 请选择 - {{of2Arr[of2Index]}} - - + + {{sources[of1Index].name}} + + + 请选择 + {{of2Arr[of2Index]}} + + + - + 预计购车时间 diff --git a/pages/customer/editCard/index.js b/pages/customer/editCard/index.js index a16bcb3..b91b756 100644 --- a/pages/customer/editCard/index.js +++ b/pages/customer/editCard/index.js @@ -338,13 +338,13 @@ Page({ icon: 'none' }) } - else if (that.data.of_id == '' ) { + else if (that.data.sources.length>0&&that.data.of_id == '' ) { wx.showToast({ title: '请选择线索来源', icon: 'none' }) } - else if (that.data.sources[that.data.of1Index].list.length>0&&that.data.of2_id == '' ) { + else if (that.data.sources.length>0&&that.data.sources[that.data.of1Index].list.length>0&&that.data.of2_id == '' ) { wx.showToast({ title: '请选择'+that.data.sources[that.data.of1Index].name+'类型', icon: 'none' @@ -454,15 +454,15 @@ Page({ getAppCustomersOffline_sources(){ _.apiQuery.getAppCustomersOffline_sources().then(res => { let of1Arr = [] - res.data.forEach(item => { + res.data.sources.forEach(item => { of1Arr.push(item.name) }) this.setData({ of1Arr, - sources:res.data + sources:res.data.sources }) if(this.data.of_id != ''){ - res.data.forEach((item,index) => { + res.data.sources.forEach((item,index) => { if(item.id == this.data.of_id){ this.setData({ of1Index:index, @@ -471,7 +471,7 @@ Page({ }) if(this.data.of2Index != ''){ let of2Arr = [] - res.data[this.data.of1Index].list.forEach((item,index) => { + res.data.sources[this.data.of1Index].list.forEach((item,index) => { of2Arr.push(item.name) if(item.id == this.data.of2_id){ this.setData({ diff --git a/pages/customer/editCard/index.wxml b/pages/customer/editCard/index.wxml index c010887..ad68408 100644 --- a/pages/customer/editCard/index.wxml +++ b/pages/customer/editCard/index.wxml @@ -53,26 +53,28 @@ --> - - 线索来源 - - - 请选择 - {{of1Arr[of1Index]}} - - + + + 线索来源 + + + 请选择 + {{of1Arr[of1Index]}} + + + - - - {{sources[of1Index].name}} - - - 请选择 - {{of2Arr[of2Index]}} - - + + {{sources[of1Index].name}} + + + 请选择 + {{of2Arr[of2Index]}} + + + - + diff --git a/pages/customer/index.js b/pages/customer/index.js index 233a3d0..1a80a43 100644 --- a/pages/customer/index.js +++ b/pages/customer/index.js @@ -601,12 +601,12 @@ Page({ getAppCustomersOffline_sources(){ _.apiQuery.getAppCustomersOffline_sources().then(res => { let of1Arr = [] - res.data.forEach(item => { + res.data.sources.forEach(item => { of1Arr.push(item.name) }) this.setData({ of1Arr, - sources:res.data + sources:res.data.sources }) }); }, diff --git a/pages/customer/index.wxml b/pages/customer/index.wxml index 57d40d1..70d2762 100644 --- a/pages/customer/index.wxml +++ b/pages/customer/index.wxml @@ -211,26 +211,28 @@ --> - - 客户来源 - - - 请选择 - {{of1Arr[of1Index]}} - - + + + 客户来源 + + + 请选择 + {{of1Arr[of1Index]}} + + + - - - {{sources[of1Index].name}} - - - 请选择 - {{of2Arr[of2Index]}} - - + + {{sources[of1Index].name}} + + + 请选择 + {{of2Arr[of2Index]}} + + + - +