xiaohaizhao 3 месяцев назад
Родитель
Сommit
3406ee37ea

+ 4 - 2
salesPanel/personTarget/GK/index.js

@@ -37,7 +37,8 @@ Component({
             where: {}
         },
         areaList: [],
-        active: ""
+        active: "",
+        init: false
     },
     methods: {
         async getList(init = false) {
@@ -96,7 +97,8 @@ Component({
                     detail[key + "saleamount"] = CNY(detail[key + "saleamount"])
                 })
                 this.setData({
-                    detail
+                    detail,
+                    init: true
                 })
                 this.selectComponent("#Filtrate").onCancel()
 

+ 19 - 0
salesPanel/personTarget/index.js

@@ -31,4 +31,23 @@ Page({
             Component.getList(true);
         }
     },
+    changeData({
+        detail
+    }) {
+        let Component = null,
+            Component1 = null;
+        if (this.data.tabsActive == 1) {
+            Component = this.selectComponent("#target")
+            Component1 = this.selectComponent("#productType")
+        } else {
+            Component = this.selectComponent("#productType")
+            Component1 = this.selectComponent("#target")
+        }
+        Component1.selectComponent("#organization").setData({
+            ...Component.selectComponent("#organization").data
+        })
+        Component1.setData({
+            content: detail
+        })
+    }
 })

+ 4 - 3
salesPanel/personTarget/index.wxml

@@ -1,6 +1,7 @@
 <view style="height: 10rpx;" />
-<Yl_FunTabs id='Yl_FunTabs' safety='{{false}}' list='{{tabsList}}' mode='buts' active='{{tabsActive}}' bind:onChenge="tabsChange">
+<Yl_FunTabs id='Yl_FunTabs' safety='{{false}}' list='{{tabsList}}' mode='buts' active='{{tabsActive}}'
+    bind:onChenge="tabsChange">
     <GK slot='概况' id='GK' />
-    <target slot='人员' id='target' />
-    <productType slot='产品类别' id='productType' />
+    <target slot='人员' id='target' bind:changeContent='changeData' />
+    <productType slot='产品类别' id='productType' bind:changeContent='changeData' />
 </Yl_FunTabs>

+ 18 - 24
salesPanel/personTarget/productType/index.js

@@ -7,7 +7,9 @@ const _Http = getApp().globalData.http,
 
 Component({
     properties: {
-
+        changeContent: {
+            type: Function
+        }
     },
     options: {
         addGlobalClass: true
@@ -28,28 +30,18 @@ Component({
             "userid": 0,
             "sa_customersid": 0,
             "sa_agentsid": 0,
-            where: {}
+            where: {},
+            areaname: "",
+            userName: "",
+            init: false
         },
-        areaList: [],
-        active: "",
         details: {},
         showFiltrate: false,
-        areaname: "",
-        userName: ""
     },
     methods: {
         async getList(init = false) {
             if (init) this.getData()
         },
-        changeArea({
-            detail
-        }) {
-            this.setData({
-                active: detail,
-                "content.sa_saleareaid": this.data.areaList.find(v => v.areaname == detail).sa_saleareaid
-            });
-            this.getData();
-        },
         async getData() {
             let content = this.data.content;
             if (content.sa_saleareaid == 0) {
@@ -58,7 +50,7 @@ Component({
                     if (res.sa_saleareaid) {
                         this.data.content.sa_saleareaid = res.sa_saleareaid
                         this.setData({
-                            areaname: res.areaname
+                            "content.areaname": res.areaname
                         })
                     }
                 })
@@ -89,9 +81,11 @@ Component({
 
                 this.setData({
                     tabs,
-                    details
+                    details,
+                    init: true
                 })
-                this.selectComponent("#Filtrate").onCancel()
+                this.triggerEvent("changeContent", content)
+
             })
         },
         changeDate({
@@ -180,8 +174,8 @@ Component({
                         this.data.content.sa_saleareaid = res.sa_saleareaid
                         this.data.content.userid = ''
                         this.setData({
-                            areaname: res.areaname,
-                            userName: ""
+                            "content.areaname": res.areaname,
+                            "content.userName": ""
                         })
                         this.getData()
                     }
@@ -193,15 +187,15 @@ Component({
                     this.data.content.sa_saleareaid = dep.sa_saleareaid;
                     this.data.content.userid = res.userid;
                     this.setData({
-                        areaname: dep.areaname,
-                        userName: res.name
+                        "content.areaname": dep.areaname,
+                        "content.userName": res.name
                     })
                 } else {
                     this.data.content.sa_saleareaid = res.sa_saleareaid
                     this.data.content.userid = 0
                     this.setData({
-                        areaname: res.areaname,
-                        userName: ''
+                        "content.areaname": res.areaname,
+                        "content.userName": ''
                     })
                 }
                 this.getData()

+ 2 - 3
salesPanel/personTarget/productType/index.wxml

@@ -1,9 +1,8 @@
 <view style="height: 10rpx;"></view>
 <view bind:tap="openFiltrate">
-	<headOptionBox iconName='icon-bumen' title='营销区域' showText="{{areaname}}" placeholder='请选择营销区域' />
-	<headOptionBox iconName='icon-a-biaoqianlanwode' showText="{{userName}}" title='业务员' placeholder='请选择业务员' />
+	<headOptionBox iconName='icon-bumen' title='营销区域' showText="{{content.areaname}}" placeholder='请选择营销区域' />
+	<headOptionBox iconName='icon-a-biaoqianlanwode' showText="{{content.userName}}" title='业务员' placeholder='请选择业务员' />
 </view>
-<filtrate id='Filtrate' iconName='icon-bumen' wx:if='{{areaList.length}}' list='{{areaList}}' type="{{active}}" title='营销区域' bind:onChange='changeArea' />
 <viewDate iconName='icon-shijian1' type='sameYear' fields='year' value='{{content.year}}' startMonth="{{content.month_start}}" endMonth="{{content.month_end}}" title='时间范围' bind:onChange='changeDate' />
 <view style="height: 20rpx;"></view>
 

+ 17 - 13
salesPanel/personTarget/target/index.js

@@ -7,7 +7,9 @@ const _Http = getApp().globalData.http,
 
 Component({
     properties: {
-
+        changeContent: {
+            type: Function
+        }
     },
     options: {
         addGlobalClass: true
@@ -25,12 +27,13 @@ Component({
             "userid": 0,
             "sa_customersid": 0,
             "sa_agentsid": 0,
-            where: {}
+            where: {},
+            areaname: "",
+            userName: ""
         },
         detail: {},
         showFiltrate: false,
-        areaname: "",
-        userName: ""
+        init: false
     },
     methods: {
         async getList(init = false) {
@@ -44,7 +47,7 @@ Component({
                     if (res.sa_saleareaid) {
                         this.data.content.sa_saleareaid = res.sa_saleareaid
                         this.setData({
-                            areaname: res.areaname
+                            "content.areaname": res.areaname
                         })
                     }
                 })
@@ -63,9 +66,10 @@ Component({
                 item.m_saleamount = CNY(item.m_saleamount)
                 item.m_targetamount = CNY(item.m_targetamount)
                 this.setData({
-                    detail: item
+                    detail: item,
+                    init: true
                 })
-                console.log(this.data.detail)
+                this.triggerEvent("changeContent", content)
             })
         },
         changeDate({
@@ -98,8 +102,8 @@ Component({
                         this.data.content.sa_saleareaid = res.sa_saleareaid
                         this.data.content.userid = ''
                         this.setData({
-                            areaname: res.areaname,
-                            userName: ""
+                            "content.areaname": res.areaname,
+                            "content.userName": ""
                         })
                         this.getData()
                     }
@@ -111,15 +115,15 @@ Component({
                     this.data.content.sa_saleareaid = dep.sa_saleareaid;
                     this.data.content.userid = res.userid;
                     this.setData({
-                        areaname: dep.areaname,
-                        userName: res.name
+                        "content.areaname": dep.areaname,
+                        "content.userName": res.name
                     })
                 } else {
                     this.data.content.sa_saleareaid = res.sa_saleareaid
                     this.data.content.userid = 0
                     this.setData({
-                        areaname: res.areaname,
-                        userName: ''
+                        "content.areaname": res.areaname,
+                        "content.userName": ''
                     })
                 }
                 this.getData()

+ 2 - 2
salesPanel/personTarget/target/index.wxml

@@ -1,7 +1,7 @@
 <view style="height: 10rpx;"></view>
 <view bind:tap="openFiltrate">
-	<headOptionBox iconName='icon-bumen' title='营销区域' showText="{{areaname}}" placeholder='请选择营销区域' />
-	<headOptionBox iconName='icon-a-biaoqianlanwode' showText="{{userName}}" title='业务员' placeholder='请选择业务员' />
+	<headOptionBox iconName='icon-bumen' title='营销区域' showText="{{content.areaname}}" placeholder='请选择营销区域' />
+	<headOptionBox iconName='icon-a-biaoqianlanwode' showText="{{content.userName}}" title='业务员' placeholder='请选择业务员' />
 </view>
 <viewDate iconName='icon-shijian1' type='sameYear' fields='year' value='{{content.year}}' startMonth="{{content.month_start}}" endMonth="{{content.month_end}}" title='时间范围' bind:onChange='changeDate' />
 <view style="height: 20rpx;"></view>