Bläddra i källkod

调整领域顺序

xiaohaizhao 2 år sedan
förälder
incheckning
8b5b55d27f
5 ändrade filer med 1709 tillägg och 1586 borttagningar
  1. 320 289
      packageA/publicClue/addClue.js
  2. 377 371
      packageA/publicClue/detail.js
  3. 296 266
      packageA/saleClue/addClue.js
  4. 249 199
      packageA/saleClue/change.js
  5. 467 461
      packageA/saleClue/detail.js

+ 320 - 289
packageA/publicClue/addClue.js

@@ -1,298 +1,329 @@
 const _Http = getApp().globalData.http,
-    getTime = require("../../utils/getTime");
+  getTime = require("../../utils/getTime");
 
 Page({
-    data: {
-        showAll: false,
-        form: [{
-            label: "客户(企业)",
-            error: false,
-            errMsg: "",
-            type: "label",
-            value: "",
-            placeholder: "客户(企业)",
-            valueName: "enterprisename",
-            checking: "base",
-            slot: "info",
-            required: false
-        }, {
-            label: "联系人",
-            error: false,
-            errMsg: "",
-            type: "label",
-            value: "",
-            placeholder: "联系人",
-            valueName: "name",
-            checking: "base",
-            required: false
-        }, {
-            label: "手机号码",
-            error: false,
-            checking: "phone",
-            errMsg: "",
-            type: "number",
-            value: "",
-            placeholder: "手机号码",
-            valueName: "phonenumber", //绑定的字段名称
-            required: true, //必填
-        }, {
-            label: "省市县",
-            error: false,
-            errMsg: "",
-            type: "region",
-            value: "",
-            placeholder: "省市县",
-            valueName: "region",
-            checking: "base",
-            required: false
-        }, {
-            label: "详细地址",
-            error: false,
-            errMsg: "",
-            type: "label",
-            value: "",
-            placeholder: "详细地址",
-            valueName: "address",
-            checking: "base",
-            required: false
-        }, {
-            label: "项目名称",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "项目名称",
-            valueName: "projectname",
-            checking: "base",
-            required: false
-        }, {
-            label: "项目规模",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "请填写建筑面积(㎡)/吨位(t)",
-            valueName: "scale",
-            checking: "base",
-            required: false
-        }, {
-            label: "总投资额(万元)",
-            error: false,
-            errMsg: "",
-            type: "digit",
-            value: "",
-            placeholder: "请填写金额",
-            valueName: "totalinvestment",
-            checking: "base",
-            required: false
-        }, {
-            label: "造价(万元)",
-            error: false,
-            errMsg: "",
-            type: "digit",
-            value: "",
-            placeholder: "请填写金额",
-            valueName: "costofconstruction",
-            checking: "base",
-            required: false
-        }, {
-            label: "预计开工时间",
-            error: false,
-            errMsg: "",
-            type: "date",
-            fields: "month",
-            value: "",
-            placeholder: "预计开工时间",
-            valueName: "begdate_due",
-            checking: "base",
-            required: false
-        }, {
-            label: "预计完工时间",
-            error: false,
-            errMsg: "",
-            type: "date",
-            fields: "month",
-            value: "",
-            placeholder: "预计完工时间",
-            valueName: "enddate_due",
-            checking: "base",
-            required: false
-        }, {
-            label: "市场活动",
-            error: false,
-            errMsg: "",
-            type: "route",
-            url: "/packageA/select/selectActivity/index",
-            value: "",
-            params: {
-                "id": 20221101095102,
-                "content": {
-                    nocache: true,
-                    isAll: 0,
-                    "where": {
-                        'condition': '',
-                        "unend": 1
-                    }
-                }
-            },
-            query: "&radio=true",
-            placeholder: "选择市场活动",
-            valueName: "campaign_name",
-            checking: "base",
-            required: false
-        }, {
-            label: "来源",
-            error: false,
-            errMsg: "",
-            type: "label",
-            value: "",
-            placeholder: "来源",
-            valueName: "cluesource",
-            checking: "base",
-            required: false
-        }, {
-            label: "线索概括",
-            error: false,
-            errMsg: "",
-            type: "label",
-            value: "",
-            placeholder: "线索概括",
-            valueName: "notes",
-            checking: "base",
-            required: false
-        }],
+  data: {
+    showAll: false,
+    form: [{
+      label: "客户(企业)",
+      error: false,
+      errMsg: "",
+      type: "label",
+      value: "",
+      placeholder: "客户(企业)",
+      valueName: "enterprisename",
+      checking: "base",
+      slot: "info",
+      required: false
+    }, {
+      label: "联系人",
+      error: false,
+      errMsg: "",
+      type: "label",
+      value: "",
+      placeholder: "联系人",
+      valueName: "name",
+      checking: "base",
+      required: false
+    }, {
+      label: "手机号码",
+      error: false,
+      checking: "phone",
+      errMsg: "",
+      type: "number",
+      value: "",
+      placeholder: "手机号码",
+      valueName: "phonenumber", //绑定的字段名称
+      required: true, //必填
+    }, {
+      label: "省市县",
+      error: false,
+      errMsg: "",
+      type: "region",
+      value: "",
+      placeholder: "省市县",
+      valueName: "region",
+      checking: "base",
+      required: false
+    }, {
+      label: "详细地址",
+      error: false,
+      errMsg: "",
+      type: "label",
+      value: "",
+      placeholder: "详细地址",
+      valueName: "address",
+      checking: "base",
+      required: false
+    }, {
+      label: "项目名称",
+      error: false,
+      errMsg: "",
+      type: "textarea",
+      value: "",
+      placeholder: "项目名称",
+      valueName: "projectname",
+      checking: "base",
+      required: false
+    }, {
+      label: "项目规模",
+      error: false,
+      errMsg: "",
+      type: "textarea",
+      value: "",
+      placeholder: "请填写建筑面积(㎡)/吨位(t)",
+      valueName: "scale",
+      checking: "base",
+      required: false
+    }, {
+      label: "总投资额(万元)",
+      error: false,
+      errMsg: "",
+      type: "digit",
+      value: "",
+      placeholder: "请填写金额",
+      valueName: "totalinvestment",
+      checking: "base",
+      required: false
+    }, {
+      label: "造价(万元)",
+      error: false,
+      errMsg: "",
+      type: "digit",
+      value: "",
+      placeholder: "请填写金额",
+      valueName: "costofconstruction",
+      checking: "base",
+      required: false
+    }, {
+      label: "预计开工时间",
+      error: false,
+      errMsg: "",
+      type: "date",
+      fields: "month",
+      value: "",
+      placeholder: "预计开工时间",
+      valueName: "begdate_due",
+      checking: "base",
+      required: false
+    }, {
+      label: "预计完工时间",
+      error: false,
+      errMsg: "",
+      type: "date",
+      fields: "month",
+      value: "",
+      placeholder: "预计完工时间",
+      valueName: "enddate_due",
+      checking: "base",
+      required: false
+    }, {
+      label: "市场活动",
+      error: false,
+      errMsg: "",
+      type: "route",
+      url: "/packageA/select/selectActivity/index",
+      value: "",
+      params: {
+        "id": 20221101095102,
         "content": {
-            "sat_orderclueid": 0,
-            "enterprisename": "",
-            "name": "",
-            "phonenumber": "",
-            "province": "",
-            "city": "",
-            "county": "",
-            "address": "",
-            "notes": "",
-            "cluesource": "",
-            "sat_campaignid": 0, //活动id,当活动id大于0是默认业务员创建
-            "isprivate": 0 //0表示公海,1表示私域
-        },
-        disabled: true
-    },
-    onLoad(options) {
-        //市场活动进入
-        if (options.sat_campaignid) {
-            let item = this.data.form.find(item => item.label == '市场活动');
-            item.value = [options.name, [options.sat_campaignid]];
-            item.disabled = true;
-            this.data.content.sat_campaignid = options.sat_campaignid;
-            this.setData({
-                form: this.data.form
-            })
-        }
-        //编辑进入
-        if (options.rowData) {
-            // wx.setNavigationBarTitle({
-            //   title: 'title',
-            // })
-            let data = JSON.parse(options.rowData);
-            this.setData({
-                disabled: false,
-                form: this.data.form.map(v => {
-                    if (v.valueName != 'region') {
-                        if (v.valueName == 'campaign_name') {
-                            console.log(data[v.valueName])
-                            v.value = data[v.valueName] ? [data[v.valueName],
-                                [data.sat_campaignid]
-                            ] : ""
-                        } else {
-                            v.value = data[v.valueName];
-                        }
-                    } else {
-                        v.value = data.province ? [data.province, data.city, data.county] : []
-                    }
-                    return v
-                }),
-                'form[0].value': data.enterprisename_customer,
-                'content.sat_orderclueid': data.sat_orderclueid,
-                'content.sat_campaignid': data.sat_campaignid
-            })
+          nocache: true,
+          isAll: 0,
+          "where": {
+            'condition': '',
+            "unend": 1
+          }
         }
+      },
+      query: "&radio=true",
+      placeholder: "选择市场活动",
+      valueName: "campaign_name",
+      checking: "base",
+      required: false
+    }, {
+      label: "领域",
+      error: false,
+      errMsg: "",
+      type: "selector",
+      range: [],
+      rangeKey: "tradefield",
+      rangeIndex: "",
+      value: "",
+      placeholder: "领域",
+      valueName: "tradefield",
+      required: true, //必填
+    }, {
+      label: "来源",
+      error: false,
+      errMsg: "",
+      type: "label",
+      value: "",
+      placeholder: "来源",
+      valueName: "cluesource",
+      checking: "base",
+      required: false
+    }, {
+      label: "线索概括",
+      error: false,
+      errMsg: "",
+      type: "label",
+      value: "",
+      placeholder: "线索概括",
+      valueName: "notes",
+      checking: "base",
+      required: false
+    }],
+    "content": {
+      "sat_orderclueid": 0,
+      "enterprisename": "",
+      "name": "",
+      "phonenumber": "",
+      "province": "",
+      "city": "",
+      "county": "",
+      "address": "",
+      "notes": "",
+      "cluesource": "",
+      "sat_campaignid": 0, //活动id,当活动id大于0是默认业务员创建
+      "isprivate": 0 //0表示公海,1表示私域
     },
-    introduce({
-        detail
-    }) {
-        let item = detail;
-        this.setData({
-            [`form[0].value`]: item.companyName,
-            [`form[4].value`]: item.address,
-            [`form[3].value`]: [item.regProvince, item.regCity, item.regArea],
-        })
-    },
-    queryClient() {
-        let data = this.selectComponent("#Form").query();
-        if (data.enterprisename == '') {
-            wx.showToast({
-                title: `您还未填写企业名称`,
-                icon: "none"
-            });
-        } else {
-            this.setData({
-                form: this.selectComponent("#Form").data.form,
-            })
-            this.selectComponent("#Info").queryClient(data.enterprisename)
+    disabled: true
+  },
+  onLoad(options) {
+    //市场活动进入
+    if (options.sat_campaignid) {
+      let item = this.data.form.find(item => item.label == '市场活动');
+      item.value = [options.name, [options.sat_campaignid]];
+      item.disabled = true;
+      this.data.content.sat_campaignid = options.sat_campaignid;
+      this.setData({
+        form: this.data.form
+      })
+    }
+    //编辑进入
+    if (options.rowData) {
+      // wx.setNavigationBarTitle({
+      //   title: 'title',
+      // })
+      let data = JSON.parse(options.rowData);
+      this.setData({
+        disabled: false,
+        form: this.data.form.map(v => {
+          if (v.valueName != 'region') {
+            if (v.valueName == 'campaign_name') {
+              console.log(data[v.valueName])
+              v.value = data[v.valueName] ? [data[v.valueName],
+                [data.sat_campaignid]
+              ] : ""
+            } else {
+              v.value = data[v.valueName];
+            }
+          } else {
+            v.value = data.province ? [data.province, data.city, data.county] : []
+          }
+          return v
+        }),
+        'form[0].value': data.enterprisename_customer,
+        'content.sat_orderclueid': data.sat_orderclueid,
+        'content.sat_campaignid': data.sat_campaignid
+      })
+    }
+
+    /* 获取领域 */
+    _Http.basic({
+      "id": 20221223141802,
+      "content": {
+        "pageNumber": 1,
+        "pageSize": 99999,
+        "where": {
+          "condition": ""
         }
-    },
-    submit() {
-        let content = {
-            ...this.data.content,
-            ...this.selectComponent("#Form").submit()
-        };
-        console.log(content)
-        content.sat_campaignid = content.campaign_name ? content.campaign_name[1][0] : 0;
-        content.city = content.region[1] || "";
-        content.county = content.region[2] || "";
-        content.province = content.region[0] || "";
-        delete(content.region)
-        delete(content.campaign_name)
-        _Http.basic({
-            "id": "20221205162402",
-            content
-        }).then(res => {
-            console.log("添加线索", res)
-            wx.showToast({
-                title: res.msg != '成功' ? res.msg : '保存成功',
-                icon: "none"
-            })
-            if (res.msg != '成功') return;
-            setTimeout(() => {
-                wx.navigateBack();
-                getCurrentPages().forEach(v => {
-                    console.log(v, '路径');
-                    if (v.__route__ == 'packageA/publicClue/detail') {
-                        v.getDetail();
-                    } else if (v.__route__ == 'packageA/publicClue/index') {
-                        v.getList(true);
-                    } else if (v.__route__ == 'packageA/activity/detail') {
-                        v.getDetail()
-                        v.selectComponent('#Clue').getList(this.data.content.sat_campaignid, true)
-                    }
-                })
-            }, 300)
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
-        this.setData({
-            showAll: detail
-        })
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
+      }
+    }).then(res => {
+      console.log("获取领域", res)
+      let item = this.data.form.find(v => v.label == '领域');
+      item.range = res.msg == '成功' ? res.data : [];
+      this.setData({
+        form: this.data.form
+      })
+    })
+  },
+  introduce({
+    detail
+  }) {
+    let item = detail;
+    this.setData({
+      [`form[0].value`]: item.companyName,
+      [`form[4].value`]: item.address,
+      [`form[3].value`]: [item.regProvince, item.regCity, item.regArea],
+    })
+  },
+  queryClient() {
+    let data = this.selectComponent("#Form").query();
+    if (data.enterprisename == '') {
+      wx.showToast({
+        title: `您还未填写企业名称`,
+        icon: "none"
+      });
+    } else {
+      this.setData({
+        form: this.selectComponent("#Form").data.form,
+      })
+      this.selectComponent("#Info").queryClient(data.enterprisename)
     }
+  },
+  submit() {
+    let content = {
+      ...this.data.content,
+      ...this.selectComponent("#Form").submit()
+    };
+    console.log(content)
+    content.sat_campaignid = content.campaign_name ? content.campaign_name[1][0] : 0;
+    content.city = content.region[1] || "";
+    content.county = content.region[2] || "";
+    content.province = content.region[0] || "";
+    delete(content.region)
+    delete(content.campaign_name)
+    _Http.basic({
+      "id": "20221205162402",
+      content
+    }).then(res => {
+      console.log("添加线索", res)
+      wx.showToast({
+        title: res.msg != '成功' ? res.msg : '保存成功',
+        icon: "none"
+      })
+      if (res.msg != '成功') return;
+      setTimeout(() => {
+        wx.navigateBack();
+        getCurrentPages().forEach(v => {
+          console.log(v, '路径');
+          if (v.__route__ == 'packageA/publicClue/detail') {
+            v.getDetail();
+          } else if (v.__route__ == 'packageA/publicClue/index') {
+            v.getList(true);
+          } else if (v.__route__ == 'packageA/activity/detail') {
+            v.getDetail()
+            v.selectComponent('#Clue').getList(this.data.content.sat_campaignid, true)
+          }
+        })
+      }, 300)
+    })
+  },
+  // 是否显示全部
+  onChange({
+    detail
+  }) {
+    this.setData({
+      showAll: detail
+    })
+  },
+  /* 表单必填项是否完成 */
+  onConfirm({
+    detail
+  }) {
+    this.setData({
+      disabled: detail
+    })
+  }
 })

+ 377 - 371
packageA/publicClue/detail.js

@@ -1,391 +1,397 @@
 const _Http = getApp().globalData.http;
 Page({
-    data: {
-        isLeader: false, //是否为负责人
-        tabsActive: 0, //tabs 选中项
-        sat_orderclueid: "",
-        detail: '',
-        tabsList: [{
-            label: "详细信息",
-            icon: "icon-tabxiangxixinxi1"
+  data: {
+    isLeader: false, //是否为负责人
+    tabsActive: 0, //tabs 选中项
+    sat_orderclueid: "",
+    detail: '',
+    tabsList: [{
+      label: "详细信息",
+      icon: "icon-tabxiangxixinxi1"
+    }, {
+      label: "跟进记录",
+      icon: "icon-tabgenjinjilu"
+    }, {
+      label: "操作",
+      icon: "icon-tabcaozuojilu1"
+    }, {
+      label: "跟进动态",
+      icon: "icon-tabgenjinjilu"
+    }, {
+      label: "任务",
+      icon: "icon-tabrenwu"
+    }, {
+      label: "附件",
+      icon: "icon-tabfujian1"
+    }],
+    tabbarList: [{
+      icon: "icon-bianji",
+      label: "编辑"
+    }, {
+      icon: "icon-zhuanyi",
+      label: "分配"
+    }, {
+      icon: "icon-dibu-jieshu",
+      label: "删除"
+    }],
+  },
+  onLoad(options) {
+    this.setData({
+      sat_orderclueid: options.sat_orderclueid,
+      isAdmin: wx.getStorageSync('auth').wCustomer.options.some(v => v == "admin"), //是否具有管理权限
+    });
+    this.getDetail();
+  },
+  getDetail() {
+    _Http.basic({
+      "classname": "webmanage.saletool.orderclue.publicclue.PublicClue",
+      "method": "selectDetail",
+      "version": 1,
+      "content": {
+        "nocache": true,
+        "sat_orderclueid": this.data.sat_orderclueid
+      },
+    }).then(res => {
+      console.log("线索详情", res)
+      if (res.msg != '成功') return wx.showToast({
+        title: res.msg,
+        icon: "none"
+      });
+
+      this.setData({
+        isLeader: res.data.createuserid == wx.getStorageSync('userMsg').userid,
+        detail: res.data,
+        briefs: [{
+            label: "联系人",
+            value: res.data.name
+          }, {
+            label: "手机号",
+            value: res.data.phonenumber
+          }, {
+            label: "市场活动",
+            value: res.data.campaign_name
+          }, {
+            label: "领域",
+            value: res.data.tradefield
+          }, {
+            label: '负责人',
+            value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
+          },
+          {
+            label: '分配状态',
+            value: res.data.allocationstatus
+          },
+          {
+            label: '跟进状态',
+            value: res.data.status
+          },
+          {
+            label: '跟进次数',
+            value: res.data.followcount || '0'
+          },
+        ],
+        list1: [{
+          label: "客户(企业)",
+          value: res.data.enterprisename_customer
+        }, {
+          label: "联系人",
+          value: res.data.name
+        }, {
+          label: "手机号码",
+          value: res.data.phonenumber
+        }, {
+          label: "省市县",
+          value: res.data.province ? res.data.province + res.data.city + res.data.county : ''
+        }, {
+          label: "地址",
+          value: res.data.address
+        }, {
+          label: "项目名称",
+          value: res.data.projectname
+        }, {
+          label: "项目规模",
+          value: res.data.scale
+        }, {
+          label: "总投资额(万元)",
+          value: res.data.totalinvestment
+        }, {
+          label: "造价(万元)",
+          value: res.data.costofconstruction
+        }, {
+          label: "预计开工时间",
+          value: res.data.begdate_due
+        }, {
+          label: "预计完工时间",
+          value: res.data.enddate_due
+        }, {
+          label: "市场活动",
+          value: res.data.campaign_name
         }, {
-            label: "跟进记录",
-            icon: "icon-tabgenjinjilu"
+          label: "领域",
+          value: res.data.tradefield
         }, {
-            label: "操作",
-            icon: "icon-tabcaozuojilu1"
+          label: "来源",
+          value: res.data.cluesource
         }, {
-            label: "跟进动态",
-            icon: "icon-tabgenjinjilu"
+          label: "线索概括",
+          value: res.data.notes
         }, {
-            label: "任务",
-            icon: "icon-tabrenwu"
+          label: '所属业务员',
+          value: res.data.salename
         }, {
-            label: "附件",
-            icon: "icon-tabfujian1"
+          label: '负责人',
+          value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
+        }, {
+          label: '分配状态',
+          value: res.data.allocationstatus
+        }, {
+          label: '跟进状态',
+          value: res.data.status
         }],
-        tabbarList: [{
-            icon: "icon-bianji",
-            label: "编辑"
+        list2: [{
+          label: "创建人",
+          value: res.data.createBy
+        }, {
+          label: "创建时间",
+          value: res.data.createDate
+        }, {
+          label: "分配人",
+          value: res.data.assignedBy
+        }, {
+          label: "分配时间",
+          value: res.data.assignedDate
+        }, {
+          label: "分配人",
+          value: res.data.assignedBy
+        }, {
+          label: "分配时间",
+          value: res.data.assignedDate
+        }, {
+          label: "最近跟进人",
+          value: res.data.followBy
+        }, {
+          label: "最近跟进时间",
+          value: res.data.followDate
+        }, {
+          label: "最近编辑人",
+          value: res.data.editBy
+        }, {
+          label: "最近编辑时间",
+          value: res.data.editDate
         }, {
-            icon: "icon-zhuanyi",
-            label: "分配"
+          label: "无效原因",
+          value: res.data.invalidreason
         }, {
-            icon: "icon-dibu-jieshu",
-            label: "删除"
+          label: "作废原因",
+          value: res.data.deletereason
+        }, {
+          label: "跟进次数",
+          value: res.data.followcount
         }],
-    },
-    onLoad(options) {
-        this.setData({
-            sat_orderclueid: options.sat_orderclueid,
-            isAdmin: wx.getStorageSync('auth').wCustomer.options.some(v => v == "admin"), //是否具有管理权限
-        });
-        this.getDetail();
-    },
-    getDetail() {
-        _Http.basic({
-            "classname": "webmanage.saletool.orderclue.publicclue.PublicClue",
-            "method": "selectDetail",
-            "version": 1,
-            "content": {
-                "nocache": true,
-                "sat_orderclueid": this.data.sat_orderclueid
-            },
-        }).then(res => {
-            console.log("线索详情", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
+        tabsList: this.data.tabsList,
+      });
+      /* {
+          label: "转移人",
+          value: res.data.changeBy
+      }, {
+          label: "最近转移时间",
+          value: res.data.changeDate
+      } */
+      var arr = this.data.tabbarList
+      if (res.data.status != '待跟进') {
+        arr = arr.filter(item => {
+          return item.label != '编辑' && item.label != '撤回'
+        })
+      }
+      /* 更新列表中状态 */
+      let page = getCurrentPages().find(v => v.__route__ == 'packageA/publicClue/index');
+      if (page) {
+        let index = page.data.list.findIndex(v => v.sat_orderclueid == res.data.sat_orderclueid);
+        if (index != -1) page.setData({
+          [`list[${index}].status`]: res.data.status
+        })
+      }
+      this.setData({
+        tabbarList: arr
+      })
+      this.getTags();
+      this.partialRenewal();
+    })
+  },
+  //tabs 切换
+  tabsChange({
+    detail
+  }) {
+    this.setData({
+      tabsActive: detail
+    });
+    this.partialRenewal();
+  },
+  //更新标签
+  getTags() {
+    this.selectComponent("#Tags").getTags();
+  },
+  //局部数据更新 tabs
+  partialRenewal(init = false) {
+    let id = this.data.detail.sat_orderclueid;
+    let model = '';
+    let name = this.data.tabsList[this.data.tabsActive].label;
+    switch (name) {
+      case "任务":
+        model = "#Work"
+        break;
+      case "跟进记录":
+        model = "#follow"
+        break;
+      case "操作":
+        model = "#Record"
+        break;
+      case "跟进动态":
+        model = "#Trace"
+        break;
+      case "附件":
+        model = "#Files"
+        break;
+    };
+    if (model) {
+      // 确定好模块ID total = null 是第一次加载 加载数据
+      // init是新增或修改需要清数据
+      let Component = this.selectComponent(model);
+      const {
+        total,
+        pageNumber,
+        pageTotal
+      } = Component.data.content;
+      if (total == null || init) {
+        Component.getList(id, init);
+      } else if (pageNumber <= pageTotal) {
+        Component.getList(id, false);
+      } else {
+        //用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据
+      }
+    }
+  },
+  onReachBottom() {
+    this.partialRenewal();
+  },
+  //详情按钮回调
+  tabbarOnClick({
+    detail
+  }) {
+    let data = this.data.detail,
+      that = this;
+    switch (detail.label) {
+      case "编辑":
+        wx.navigateTo({
+          url: `/packageA/publicClue/addClue?rowData=${JSON.stringify(this.data.detail)}`,
+        })
+        break;
+      case "分配":
+        wx.navigateTo({
+          url: `/packageA/publicClue/distribution?data=${JSON.stringify(this.data.detail)}`,
+        })
+        break;
+      case "删除":
+        wx.showModal({
+          title: '提示',
+          content: `是否确认删除该线索?`,
+          complete: ({
+            confirm
+          }) => {
+            if (confirm) _Http.basic({
+              "id": 20221101100502,
+              "content": {
+                "sat_orderclueids": [this.data.detail.sat_orderclueid]
+              }
+            }).then(res => {
+              wx.showToast({
+                title: res.msg == '成功' ? `操作成功` : res.msg,
                 icon: "none"
-            });
-
-            this.setData({
-                isLeader: res.data.createuserid == wx.getStorageSync('userMsg').userid,
-                detail: res.data,
-                briefs: [{
-                        label: "联系人",
-                        value: res.data.name
-                    }, {
-                        label: "手机号",
-                        value: res.data.phonenumber
-                    }, {
-                        label: "市场活动",
-                        value: res.data.campaign_name
-                    }, {
-                        label: '负责人',
-                        value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
-                    },
-                    {
-                        label: '分配状态',
-                        value: res.data.allocationstatus
-                    },
-                    {
-                        label: '跟进状态',
-                        value: res.data.status
-                    },
-                    {
-                        label: '跟进次数',
-                        value: res.data.followcount || '0'
-                    },
-                ],
-                list1: [{
-                    label: "客户(企业)",
-                    value: res.data.enterprisename_customer
-                }, {
-                    label: "联系人",
-                    value: res.data.name
-                }, {
-                    label: "手机号码",
-                    value: res.data.phonenumber
-                }, {
-                    label: "省市县",
-                    value: res.data.province ? res.data.province + res.data.city + res.data.county : ''
-                }, {
-                    label: "地址",
-                    value: res.data.address
-                }, {
-                    label: "项目名称",
-                    value: res.data.projectname
-                }, {
-                    label: "项目规模",
-                    value: res.data.scale
-                }, {
-                    label: "总投资额(万元)",
-                    value: res.data.totalinvestment
-                }, {
-                    label: "造价(万元)",
-                    value: res.data.costofconstruction
-                }, {
-                    label: "预计开工时间",
-                    value: res.data.begdate_due
-                }, {
-                    label: "预计完工时间",
-                    value: res.data.enddate_due
-                }, {
-                    label: "市场活动",
-                    value: res.data.campaign_name
-                }, {
-                    label: "来源",
-                    value: res.data.cluesource
-                }, {
-                    label: "线索概括",
-                    value: res.data.notes
-                }, {
-                    label: '所属业务员',
-                    value: res.data.salename
-                }, {
-                    label: '负责人',
-                    value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
-                }, {
-                    label: '分配状态',
-                    value: res.data.allocationstatus
-                }, {
-                    label: '跟进状态',
-                    value: res.data.status
-                }],
-                list2: [{
-                    label: "创建人",
-                    value: res.data.createBy
-                }, {
-                    label: "创建时间",
-                    value: res.data.createDate
-                }, {
-                    label: "分配人",
-                    value: res.data.assignedBy
-                }, {
-                    label: "分配时间",
-                    value: res.data.assignedDate
-                }, {
-                    label: "分配人",
-                    value: res.data.assignedBy
-                }, {
-                    label: "分配时间",
-                    value: res.data.assignedDate
-                }, {
-                    label: "最近跟进人",
-                    value: res.data.followBy
-                }, {
-                    label: "最近跟进时间",
-                    value: res.data.followDate
-                }, {
-                    label: "最近编辑人",
-                    value: res.data.editBy
-                }, {
-                    label: "最近编辑时间",
-                    value: res.data.editDate
-                }, {
-                    label: "无效原因",
-                    value: res.data.invalidreason
-                }, {
-                    label: "作废原因",
-                    value: res.data.deletereason
-                }, {
-                    label: "跟进次数",
-                    value: res.data.followcount
-                }],
-                tabsList: this.data.tabsList,
-            });
-            /* {
-                label: "转移人",
-                value: res.data.changeBy
-            }, {
-                label: "最近转移时间",
-                value: res.data.changeDate
-            } */
-            var arr = this.data.tabbarList
-            if (res.data.status != '待跟进') {
-                arr = arr.filter(item => {
-                    return item.label != '编辑' && item.label != '撤回'
-                })
-            }
-            /* 更新列表中状态 */
-            let page = getCurrentPages().find(v => v.__route__ == 'packageA/publicClue/index');
-            if (page) {
-                let index = page.data.list.findIndex(v => v.sat_orderclueid == res.data.sat_orderclueid);
-                if (index != -1) page.setData({
-                    [`list[${index}].status`]: res.data.status
+              });
+              setTimeout(() => {
+                wx.navigateBack()
+                getCurrentPages().forEach(v => {
+                  if (v.__route__ == "packageA/publicClue/index") {
+                    v.getList(true)
+                  }
                 })
-            }
-            this.setData({
-                tabbarList: arr
+              }, 300)
+
             })
-            this.getTags();
-            this.partialRenewal();
+          }
         })
-    },
-    //tabs 切换
-    tabsChange({
-        detail
-    }) {
-        this.setData({
-            tabsActive: detail
-        });
-        this.partialRenewal();
-    },
-    //更新标签
-    getTags() {
-        this.selectComponent("#Tags").getTags();
-    },
-    //局部数据更新 tabs
-    partialRenewal(init = false) {
-        let id = this.data.detail.sat_orderclueid;
-        let model = '';
-        let name = this.data.tabsList[this.data.tabsActive].label;
-        switch (name) {
-            case "任务":
-                model = "#Work"
-                break;
-            case "跟进记录":
-                model = "#follow"
-                break;
-            case "操作":
-                model = "#Record"
-                break;
-            case "跟进动态":
-                model = "#Trace"
-                break;
-            case "附件":
-                model = "#Files"
-                break;
-        };
-        if (model) {
-            // 确定好模块ID total = null 是第一次加载 加载数据
-            // init是新增或修改需要清数据
-            let Component = this.selectComponent(model);
-            const {
-                total,
-                pageNumber,
-                pageTotal
-            } = Component.data.content;
-            if (total == null || init) {
-                Component.getList(id, init);
-            } else if (pageNumber <= pageTotal) {
-                Component.getList(id, false);
-            } else {
-                //用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据
-            }
-        }
-    },
-    onReachBottom() {
-        this.partialRenewal();
-    },
-    //详情按钮回调
-    tabbarOnClick({
-        detail
-    }) {
-        let data = this.data.detail,
-            that = this;
-        switch (detail.label) {
-            case "编辑":
-                wx.navigateTo({
-                    url: `/packageA/publicClue/addClue?rowData=${JSON.stringify(this.data.detail)}`,
-                })
-                break;
-            case "分配":
-                wx.navigateTo({
-                    url: `/packageA/publicClue/distribution?data=${JSON.stringify(this.data.detail)}`,
-                })
-                break;
-            case "删除":
-                wx.showModal({
-                    title: '提示',
-                    content: `是否确认删除该线索?`,
-                    complete: ({
-                        confirm
-                    }) => {
-                        if (confirm) _Http.basic({
-                            "id": 20221101100502,
-                            "content": {
-                                "sat_orderclueids": [this.data.detail.sat_orderclueid]
-                            }
-                        }).then(res => {
-                            wx.showToast({
-                                title: res.msg == '成功' ? `操作成功` : res.msg,
-                                icon: "none"
-                            });
-                            setTimeout(() => {
-                                wx.navigateBack()
-                                getCurrentPages().forEach(v => {
-                                    if (v.__route__ == "packageA/publicClue/index") {
-                                        v.getList(true)
-                                    }
-                                })
-                            }, 300)
-
-                        })
-                    }
-                })
-                break;
-            case "撤回":
-                wx.showModal({
-                    title: '提示',
-                    content: `是否确认撤回该线索?`,
-                    complete: ({
-                        confirm
-                    }) => {
-                        if (confirm) _Http.basic({
-                            classname: "webmanage.saletool.orderclue.publicclue.PublicClue",
-                            method: "revoke",
-                            "content": {
-                                "sat_orderclueid": this.data.detail.sat_orderclueid
-                            }
-                        }).then(res => {
-                            setTimeout(() => {
-                                wx.showToast({
-                                    title: res.msg == '成功' ? `操作成功` : res.msg,
-                                    icon: "none"
-                                });
-                            }, 1000)
-                            if (res.msg == '成功') this.getDetail()
-                        })
-                    }
-                })
-                break;
-            case "更换负责人":
-                wx.navigateTo({
-                    url: `/pages/group/select?data=${JSON.stringify({
+        break;
+      case "撤回":
+        wx.showModal({
+          title: '提示',
+          content: `是否确认撤回该线索?`,
+          complete: ({
+            confirm
+          }) => {
+            if (confirm) _Http.basic({
+              classname: "webmanage.saletool.orderclue.publicclue.PublicClue",
+              method: "revoke",
+              "content": {
+                "sat_orderclueid": this.data.detail.sat_orderclueid
+              }
+            }).then(res => {
+              setTimeout(() => {
+                wx.showToast({
+                  title: res.msg == '成功' ? `操作成功` : res.msg,
+                  icon: "none"
+                });
+              }, 1000)
+              if (res.msg == '成功') this.getDetail()
+            })
+          }
+        })
+        break;
+      case "更换负责人":
+        wx.navigateTo({
+          url: `/pages/group/select?data=${JSON.stringify({
                              ownertable:"sat_orderclue",
                              ownerid:data.sat_orderclueid,
                         })}&radio=true&principal=true`,
-                })
-                break;
-        }
-    },
-    /* 更换负责人 */
-    handelSubmit(arr) {
-        const that = this;
-        wx.showModal({
-            title: '提示',
-            content: '是否确认更换负责人',
-            complete: ({
-                confirm
-            }) => {
-                if (confirm) _Http.basic({
-                    "id": 20220930103701,
-                    "content": {
-                        ownertable: "sat_orderclue",
-                        ownerid: that.data.detail.sat_orderclueid,
-                        userid: arr[0]
-                    }
-                }).then(res => {
-                    console.log("更换负责人", res)
-                    if (res.msg != '成功') return wx.showToast({
-                        title: res.data,
-                        icon: "none"
-                    });
-                    wx.showToast({
-                        title: '更换成功!',
-                        icon: "none"
-                    });
-                    setTimeout(() => {
-                        that.getDetail();
-                        wx.navigateBack();
-                        /*  getCurrentPages().forEach(v => {
-                             if (['packageA/project/index'].includes(v.__route__)) v.getList(true)
-                         }) */
-                    }, 300)
-                })
-            }
         })
-    },
-    onShareAppMessage() {}
+        break;
+    }
+  },
+  /* 更换负责人 */
+  handelSubmit(arr) {
+    const that = this;
+    wx.showModal({
+      title: '提示',
+      content: '是否确认更换负责人',
+      complete: ({
+        confirm
+      }) => {
+        if (confirm) _Http.basic({
+          "id": 20220930103701,
+          "content": {
+            ownertable: "sat_orderclue",
+            ownerid: that.data.detail.sat_orderclueid,
+            userid: arr[0]
+          }
+        }).then(res => {
+          console.log("更换负责人", res)
+          if (res.msg != '成功') return wx.showToast({
+            title: res.data,
+            icon: "none"
+          });
+          wx.showToast({
+            title: '更换成功!',
+            icon: "none"
+          });
+          setTimeout(() => {
+            that.getDetail();
+            wx.navigateBack();
+            /*  getCurrentPages().forEach(v => {
+                 if (['packageA/project/index'].includes(v.__route__)) v.getList(true)
+             }) */
+          }, 300)
+        })
+      }
+    })
+  },
+  onShareAppMessage() {}
 })

+ 296 - 266
packageA/saleClue/addClue.js

@@ -1,276 +1,306 @@
 const _Http = getApp().globalData.http,
-    getTime = require("../../utils/getTime");
+  getTime = require("../../utils/getTime");
 
 Page({
-    data: {
-        showAll: false,
-        form: [{
-                label: "客户(企业)",
-                error: false,
-                errMsg: "",
-                type: "label",
-                value: "",
-                placeholder: "客户(企业)",
-                valueName: "enterprisename",
-                checking: "base",
-                slot: "info",
-                required: false
-            }, {
-                label: "联系人",
-                error: false,
-                errMsg: "",
-                type: "label",
-                value: "",
-                placeholder: "联系人",
-                valueName: "name",
-                checking: "base",
-                required: false
-            }, {
-                label: "手机号码",
-                error: false,
-                checking: "phone",
-                errMsg: "",
-                type: "number",
-                value: "",
-                placeholder: "手机号码",
-                valueName: "phonenumber", //绑定的字段名称
-                required: true, //必填
-            }, {
-                label: "省市县",
-                error: false,
-                errMsg: "",
-                type: "region",
-                value: "",
-                placeholder: "省市县",
-                valueName: "region",
-                checking: "base",
-                required: false
-            }, {
-                label: "详细地址",
-                error: false,
-                errMsg: "",
-                type: "label",
-                value: "",
-                placeholder: "详细地址",
-                valueName: "address",
-                checking: "base",
-                required: false
-            }, {
-                label: "项目名称",
-                error: false,
-                errMsg: "",
-                type: "textarea",
-                value: "",
-                placeholder: "项目名称",
-                valueName: "projectname",
-                checking: "base",
-                required: false
-            }, {
-                label: "项目规模",
-                error: false,
-                errMsg: "",
-                type: "textarea",
-                value: "",
-                placeholder: "请填写建筑面积(㎡)/吨位(t)",
-                valueName: "scale",
-                checking: "base",
-                required: false
-            }, {
-                label: "总投资额(万元)",
-                error: false,
-                errMsg: "",
-                type: "digit",
-                value: "",
-                placeholder: "请填写金额",
-                valueName: "totalinvestment",
-                checking: "base",
-                required: false
-            }, {
-                label: "造价(万元)",
-                error: false,
-                errMsg: "",
-                type: "digit",
-                value: "",
-                placeholder: "请填写金额",
-                valueName: "costofconstruction",
-                checking: "base",
-                required: false
-            }, {
-                label: "预计开工时间",
-                error: false,
-                errMsg: "",
-                type: "date",
-                fields: "month",
-                value: "",
-                placeholder: "预计开工时间",
-                valueName: "begdate_due",
-                checking: "base",
-                required: false
-            }, {
-                label: "预计完工时间",
-                error: false,
-                errMsg: "",
-                type: "date",
-                fields: "month",
-                value: "",
-                placeholder: "预计完工时间",
-                valueName: "enddate_due",
-                checking: "base",
-                required: false
-            },
-            {
-                label: "市场活动",
-                error: false,
-                errMsg: "",
-                type: "route",
-                url: "/packageA/select/selectActivity/index",
-                value: "",
-                params: {
-                    "id": 20221101095102,
-                    "content": {
-                        nocache: true,
-                        isAll: 0,
-                        "where": {
-                            'condition': '',
-                            "unend": 1
-                        }
-                    }
-                },
-                query: "&radio=true",
-                placeholder: "选择市场活动",
-                valueName: "campaign_name",
-                checking: "base",
-                required: false
-            }, {
-                label: "来源",
-                error: false,
-                errMsg: "",
-                type: "label",
-                value: "",
-                placeholder: "来源",
-                valueName: "cluesource",
-                checking: "base",
-                required: false
-            }, {
-                label: "线索概括",
-                error: false,
-                errMsg: "",
-                type: "label",
-                value: "",
-                placeholder: "线索概括",
-                valueName: "notes",
-                checking: "base",
-                required: false
+  data: {
+    showAll: false,
+    form: [{
+        label: "客户(企业)",
+        error: false,
+        errMsg: "",
+        type: "label",
+        value: "",
+        placeholder: "客户(企业)",
+        valueName: "enterprisename",
+        checking: "base",
+        slot: "info",
+        required: false
+      }, {
+        label: "联系人",
+        error: false,
+        errMsg: "",
+        type: "label",
+        value: "",
+        placeholder: "联系人",
+        valueName: "name",
+        checking: "base",
+        required: false
+      }, {
+        label: "手机号码",
+        error: false,
+        checking: "phone",
+        errMsg: "",
+        type: "number",
+        value: "",
+        placeholder: "手机号码",
+        valueName: "phonenumber", //绑定的字段名称
+        required: true, //必填
+      }, {
+        label: "省市县",
+        error: false,
+        errMsg: "",
+        type: "region",
+        value: "",
+        placeholder: "省市县",
+        valueName: "region",
+        checking: "base",
+        required: false
+      }, {
+        label: "详细地址",
+        error: false,
+        errMsg: "",
+        type: "label",
+        value: "",
+        placeholder: "详细地址",
+        valueName: "address",
+        checking: "base",
+        required: false
+      }, {
+        label: "项目名称",
+        error: false,
+        errMsg: "",
+        type: "textarea",
+        value: "",
+        placeholder: "项目名称",
+        valueName: "projectname",
+        checking: "base",
+        required: false
+      }, {
+        label: "项目规模",
+        error: false,
+        errMsg: "",
+        type: "textarea",
+        value: "",
+        placeholder: "请填写建筑面积(㎡)/吨位(t)",
+        valueName: "scale",
+        checking: "base",
+        required: false
+      }, {
+        label: "总投资额(万元)",
+        error: false,
+        errMsg: "",
+        type: "digit",
+        value: "",
+        placeholder: "请填写金额",
+        valueName: "totalinvestment",
+        checking: "base",
+        required: false
+      }, {
+        label: "造价(万元)",
+        error: false,
+        errMsg: "",
+        type: "digit",
+        value: "",
+        placeholder: "请填写金额",
+        valueName: "costofconstruction",
+        checking: "base",
+        required: false
+      }, {
+        label: "预计开工时间",
+        error: false,
+        errMsg: "",
+        type: "date",
+        fields: "month",
+        value: "",
+        placeholder: "预计开工时间",
+        valueName: "begdate_due",
+        checking: "base",
+        required: false
+      }, {
+        label: "预计完工时间",
+        error: false,
+        errMsg: "",
+        type: "date",
+        fields: "month",
+        value: "",
+        placeholder: "预计完工时间",
+        valueName: "enddate_due",
+        checking: "base",
+        required: false
+      },
+      {
+        label: "市场活动",
+        error: false,
+        errMsg: "",
+        type: "route",
+        url: "/packageA/select/selectActivity/index",
+        value: "",
+        params: {
+          "id": 20221101095102,
+          "content": {
+            nocache: true,
+            isAll: 0,
+            "where": {
+              'condition': '',
+              "unend": 1
             }
-        ],
-        "content": {
-            "sat_orderclueid": 0,
-            "sat_orderclueid": 0, //活动id,当活动id大于0是默认业务员创建
-            "isprivate": 1 //0表示公海,1表示私域
+          }
         },
-        disabled: true
+        query: "&radio=true",
+        placeholder: "选择市场活动",
+        valueName: "campaign_name",
+        checking: "base",
+        required: false
+      }, {
+        label: "领域",
+        error: false,
+        errMsg: "",
+        type: "selector",
+        range: [],
+        rangeKey: "tradefield",
+        rangeIndex: "",
+        value: "",
+        placeholder: "领域",
+        valueName: "tradefield",
+        required: true, //必填
+      }, {
+        label: "来源",
+        error: false,
+        errMsg: "",
+        type: "label",
+        value: "",
+        placeholder: "来源",
+        valueName: "cluesource",
+        checking: "base",
+        required: false
+      }, {
+        label: "线索概括",
+        error: false,
+        errMsg: "",
+        type: "label",
+        value: "",
+        placeholder: "线索概括",
+        valueName: "notes",
+        checking: "base",
+        required: false
+      }
+    ],
+    "content": {
+      "sat_orderclueid": 0,
+      "sat_orderclueid": 0, //活动id,当活动id大于0是默认业务员创建
+      "isprivate": 1 //0表示公海,1表示私域
     },
-    onLoad(options) {
-        if (options.sat_orderclueid) this.data.content.sat_orderclueid = options.sat_orderclueid;
-        if (options.rowData) {
-            let data = JSON.parse(options.rowData);
-            this.setData({
-                form: this.data.form.map(v => {
-                    if (v.valueName != 'region') {
-                        if (v.valueName == 'campaign_name') {
-                            v.value = data[v.valueName] ? [data[v.valueName],
-                                [data.sat_campaignid]
-                            ] : ""
-                        } else {
-                            v.value = data[v.valueName] || "";
-                        }
-                    } else {
-                        v.value = data.province ? [data.province, data.city, data.county] : []
-                    }
-                    return v
-                }),
-                'form[0].value': data.enterprisename_customer || data.enterprisename || "",
-                'content.sat_orderclueid': data.sat_orderclueid || 0,
-                'content.sa_customersid': data.sa_customersid || 0,
-                'content.sat_campaignid': data.sat_campaignid || 0
-            })
-            this.selectComponent("#Form").confirm();
-        }
-    },
-    introduce({
-        detail
-    }) {
-        let item = detail;
-        this.setData({
-            [`form[0].value`]: item.companyName,
-            [`form[4].value`]: item.address,
-            [`form[3].value`]: [item.regProvince, item.regCity, item.regArea],
-        })
-    },
-    queryClient() {
-        let data = this.selectComponent("#Form").query();
-        if (data.enterprisename == '') {
-            wx.showToast({
-                title: `您还未填写企业名称`,
-                icon: "none"
-            });
-        } else {
-            this.setData({
-                form: this.selectComponent("#Form").data.form,
-            })
-            this.selectComponent("#Info").queryClient(data.enterprisename)
+    disabled: true
+  },
+  onLoad(options) {
+    if (options.sat_orderclueid) this.data.content.sat_orderclueid = options.sat_orderclueid;
+    if (options.rowData) {
+      let data = JSON.parse(options.rowData);
+      this.setData({
+        form: this.data.form.map(v => {
+          if (v.valueName != 'region') {
+            if (v.valueName == 'campaign_name') {
+              v.value = data[v.valueName] ? [data[v.valueName],
+                [data.sat_campaignid]
+              ] : ""
+            } else {
+              v.value = data[v.valueName] || "";
+            }
+          } else {
+            v.value = data.province ? [data.province, data.city, data.county] : []
+          }
+          return v
+        }),
+        'form[0].value': data.enterprisename_customer || data.enterprisename || "",
+        'content.sat_orderclueid': data.sat_orderclueid || 0,
+        'content.sa_customersid': data.sa_customersid || 0,
+        'content.sat_campaignid': data.sat_campaignid || 0
+      })
+      this.selectComponent("#Form").confirm();
+    }
+    /* 获取领域 */
+    _Http.basic({
+      "id": 20221223141802,
+      "content": {
+        "pageNumber": 1,
+        "pageSize": 99999,
+        "where": {
+          "condition": ""
         }
-    },
-    submit() {
-        let content = {
-            ...this.data.content,
-            ...this.selectComponent("#Form").submit()
-        };
-        content.sat_campaignid = content.campaign_name ? content.campaign_name[1][0] : 0;
-        content.city = content.region[1] || "";
-        content.county = content.region[2] || "";
-        content.province = content.region[0] || "";
-        delete(content.region)
-        delete(content.campaign_name)
-        _Http.basic({
-            "id": "20221205162402",
-            content
-        }).then(res => {
-            console.log("添加线索", res)
-            wx.showToast({
-                title: res.msg != '成功' ? res.msg : '保存成功',
-                icon: "none"
-            })
-            if (res.msg != '成功') return;
-            setTimeout(() => {
-                wx.navigateBack();
-                getCurrentPages().forEach(v => {
-                    if (v.__route__ == 'packageA/saleClue/detail') {
-                        v.getDetail();
-                    } else if (v.__route__ == 'packageA/saleClue/index') {
-                        v.getList(true);
+      }
+    }).then(res => {
+      console.log("获取领域", res)
+      let item = this.data.form.find(v => v.label == '领域');
+      item.range = res.msg == '成功' ? res.data : [];
+      this.setData({
+        form: this.data.form
+      })
+    })
+  },
+  introduce({
+    detail
+  }) {
+    let item = detail;
+    this.setData({
+      [`form[0].value`]: item.companyName,
+      [`form[4].value`]: item.address,
+      [`form[3].value`]: [item.regProvince, item.regCity, item.regArea],
+    })
+  },
+  queryClient() {
+    let data = this.selectComponent("#Form").query();
+    if (data.enterprisename == '') {
+      wx.showToast({
+        title: `您还未填写企业名称`,
+        icon: "none"
+      });
+    } else {
+      this.setData({
+        form: this.selectComponent("#Form").data.form,
+      })
+      this.selectComponent("#Info").queryClient(data.enterprisename)
+    }
+  },
+  submit() {
+    let content = {
+      ...this.data.content,
+      ...this.selectComponent("#Form").submit()
+    };
+    content.sat_campaignid = content.campaign_name ? content.campaign_name[1][0] : 0;
+    content.city = content.region[1] || "";
+    content.county = content.region[2] || "";
+    content.province = content.region[0] || "";
+    delete(content.region)
+    delete(content.campaign_name)
+    _Http.basic({
+      "id": "20221205162402",
+      content
+    }).then(res => {
+      console.log("添加线索", res)
+      wx.showToast({
+        title: res.msg != '成功' ? res.msg : '保存成功',
+        icon: "none"
+      })
+      if (res.msg != '成功') return;
+      setTimeout(() => {
+        wx.navigateBack();
+        getCurrentPages().forEach(v => {
+          if (v.__route__ == 'packageA/saleClue/detail') {
+            v.getDetail();
+          } else if (v.__route__ == 'packageA/saleClue/index') {
+            v.getList(true);
 
-                    } else if (['packageA/setclient/detail', 'packageA/publicCustomer/detail'].includes(v.__route__)) {
-                        v.selectComponent("#Clue").getList(this.data.content.sa_customersid, true)
-                    }
-                })
-            }, 300)
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
-        this.setData({
-            showAll: detail
+          } else if (['packageA/setclient/detail', 'packageA/publicCustomer/detail'].includes(v.__route__)) {
+            v.selectComponent("#Clue").getList(this.data.content.sa_customersid, true)
+          }
         })
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
-    }
+      }, 300)
+    })
+  },
+  // 是否显示全部
+  onChange({
+    detail
+  }) {
+    this.setData({
+      showAll: detail
+    })
+  },
+  /* 表单必填项是否完成 */
+  onConfirm({
+    detail
+  }) {
+    this.setData({
+      disabled: detail
+    })
+  }
 })

+ 249 - 199
packageA/saleClue/change.js

@@ -1,207 +1,257 @@
 const _Http = getApp().globalData.http,
-    getTime = require("../../utils/getTime");
+  getTime = require("../../utils/getTime");
 
 Page({
-    data: {
-        showAll: false,
-        form: [{
-                label: "项目名称",
-                error: false,
-                errMsg: "",
-                type: "textarea",
-                value: "",
-                placeholder: "项目名称",
-                valueName: "projectname",
-                checking: "base",
-                required: true
-            }, {
-                label: "项目类型",
-                error: false,
-                errMsg: "",
-                type: "option",
-                optionNmae: "projecttype",
-                optionType: "radio", //复选   radio 单选
-                value: "",
-                placeholder: "选择类型",
-                valueName: "projecttype",
-                checking: "base",
-                required: true
-            }, {
-                label: "项目等级",
-                error: false,
-                errMsg: "",
-                type: "option",
-                optionNmae: "projectgrade",
-                optionType: "radio", //复选   radio 单选
-                value: "",
-                placeholder: "选择项目等级",
-                valueName: "grade",
-                checking: "base",
-                required: false
-            }, {
-                label: "省市县",
-                error: false,
-                errMsg: "",
-                type: "region",
-                value: [],
-                placeholder: "省/市/县",
-                valueName: "region",
-                required: true
-            }, {
-                label: "详细地址",
-                error: false,
-                errMsg: "",
-                type: "textarea",
-                value: "",
-                placeholder: "详细地址",
-                valueName: "address",
-                checking: "base",
-                required: false
-            }, {
-                label: "项目规模",
-                error: false,
-                errMsg: "",
-                type: "textarea",
-                value: "",
-                placeholder: "请填写建筑面积(㎡)/吨位(t)",
-                valueName: "scale",
-                checking: "base",
-                required: false
-            }, {
-                label: "项目预算(万元)",
-                error: false,
-                errMsg: "",
-                type: "digit",
-                value: "",
-                placeholder: "请填写金额",
-                valueName: "budgetary",
-                checking: "base",
-                required: false
-            }, {
-                label: "总投资额(万元)",
-                error: false,
-                errMsg: "",
-                type: "digit",
-                value: "",
-                placeholder: "请填写金额",
-                valueName: "totalinvestment",
-                checking: "base",
-                required: false
-            }, {
-                label: "造价(万元)",
-                error: false,
-                errMsg: "",
-                type: "digit",
-                value: "",
-                placeholder: "请填写金额",
-                valueName: "costofconstruction",
-                checking: "base",
-                required: false
-            }, {
-                label: "预计开工时间",
-                error: false,
-                errMsg: "",
-                type: "date",
-                fields: "month",
-                value: "",
-                placeholder: "预计开工时间",
-                valueName: "begdate_due",
-                checking: "base",
-                required: false
-            }, {
-                label: "预计完工时间",
-                error: false,
-                errMsg: "",
-                type: "date",
-                fields: "month",
-                value: "",
-                placeholder: "预计完工时间",
-                valueName: "enddate_due",
-                checking: "base",
-                required: false
-            },
-            {
-                label: "预计签约时间",
-                error: false,
-                errMsg: "",
-                type: "date",
-                fields: "month",
-                value: "",
-                placeholder: "预计签约时间",
-                valueName: "signdate_due",
-                checking: "base",
-                required: false
-            }
-        ],
-        "content": {
-            "sat_orderclueid": ""
+  data: {
+    showAll: false,
+    form: [{
+        label: "项目名称",
+        error: false,
+        errMsg: "",
+        type: "textarea",
+        value: "",
+        placeholder: "项目名称",
+        valueName: "projectname",
+        checking: "base",
+        required: true
+      }, {
+        label: "项目类型",
+        error: false,
+        errMsg: "",
+        type: "option",
+        optionNmae: "projecttype",
+        optionType: "radio", //复选   radio 单选
+        value: "",
+        placeholder: "选择类型",
+        valueName: "projecttype",
+        checking: "base",
+        required: true
+      }, {
+        label: "项目等级",
+        error: false,
+        errMsg: "",
+        type: "option",
+        optionNmae: "projectgrade",
+        optionType: "radio", //复选   radio 单选
+        value: "",
+        placeholder: "选择项目等级",
+        valueName: "grade",
+        checking: "base",
+        required: false
+      }, {
+        label: "省市县",
+        error: false,
+        errMsg: "",
+        type: "region",
+        value: [],
+        placeholder: "省/市/县",
+        valueName: "region",
+        required: true
+      }, {
+        label: "详细地址",
+        error: false,
+        errMsg: "",
+        type: "textarea",
+        value: "",
+        placeholder: "详细地址",
+        valueName: "address",
+        checking: "base",
+        required: false
+      }, {
+        label: "项目规模",
+        error: false,
+        errMsg: "",
+        type: "textarea",
+        value: "",
+        placeholder: "请填写建筑面积(㎡)/吨位(t)",
+        valueName: "scale",
+        checking: "base",
+        required: false
+      }, {
+        label: "项目预算(万元)",
+        error: false,
+        errMsg: "",
+        type: "digit",
+        value: "",
+        placeholder: "请填写金额",
+        valueName: "budgetary",
+        checking: "base",
+        required: false
+      }, {
+        label: "总投资额(万元)",
+        error: false,
+        errMsg: "",
+        type: "digit",
+        value: "",
+        placeholder: "请填写金额",
+        valueName: "totalinvestment",
+        checking: "base",
+        required: false
+      }, {
+        label: "造价(万元)",
+        error: false,
+        errMsg: "",
+        type: "digit",
+        value: "",
+        placeholder: "请填写金额",
+        valueName: "costofconstruction",
+        checking: "base",
+        required: false
+      }, {
+        label: "预计开工时间",
+        error: false,
+        errMsg: "",
+        type: "date",
+        fields: "month",
+        value: "",
+        placeholder: "预计开工时间",
+        valueName: "begdate_due",
+        checking: "base",
+        required: false
+      }, {
+        label: "预计完工时间",
+        error: false,
+        errMsg: "",
+        type: "date",
+        fields: "month",
+        value: "",
+        placeholder: "预计完工时间",
+        valueName: "enddate_due",
+        checking: "base",
+        required: false
+      },
+      {
+        label: "预计签约时间",
+        error: false,
+        errMsg: "",
+        type: "date",
+        fields: "month",
+        value: "",
+        placeholder: "预计签约时间",
+        valueName: "signdate_due",
+        checking: "base",
+        required: false
+      }, {
+        label: "领域",
+        error: false,
+        errMsg: "",
+        type: "selector",
+        range: [],
+        rangeKey: "tradefield",
+        rangeIndex: "",
+        value: "",
+        placeholder: "领域",
+        valueName: "tradefield",
+        required: true, //必填
+      }, {
+        label: "品牌",
+        error: false,
+        errMsg: "",
+        type: "route",
+        url: "/packageA/select/brand/select",
+        params: {
+          "id": 20220924163702,
+          "content": {
+            nochace: true,
+          }
         },
-        disabled: true
+        query: "&radio=true",
+        value: "",
+        placeholder: "选择品牌",
+        valueName: "sa_brandid",
+        checking: "base",
+        required: false
+      }
+    ],
+    "content": {
+      "sat_orderclueid": ""
     },
-    onLoad(options) {
-        let data = JSON.parse(options.rowData);
-        this.setData({
-            form: this.data.form.map(v => {
-                if (v.valueName != 'region') {
-                    if (v.valueName == 'campaign_name') {
-                        v.value = [data[v.valueName],
-                            [data.sat_campaignid]
-                        ]
-                    } else {
-                        v.value = data[v.valueName];
-                    }
-                } else {
-                    v.value = data.province ? [data.province, data.city, data.county] : []
-                }
-                return v
-            }),
-            'content.sat_orderclueid': data.sat_orderclueid,
-            'content.sat_campaignid': data.sat_campaignid
-        });
-    },
-    submit() {
-        let content = {
-            ...this.data.content,
-            ...this.selectComponent("#Form").submit()
-        };
-        _Http.basic({
-            "id": "20221124154902",
-            content
-        }).then(res => {
-            console.log("转化", res)
-            wx.showToast({
-                title: res.msg != '成功' ? res.msg : '转化成功',
-                icon: "none"
-            })
-            if (res.msg != '成功') return;
-            setTimeout(() => {
-                wx.navigateBack()
-                getCurrentPages().forEach(item => {
-                    console.log(item);
-                    if (item.__route__ == 'packageA/saleClue/detail') {
-                        item.getDetail()
-                    }
-                })
-                wx.navigateTo({
-                    url: `/packageA/project/detail?sa_projectid=${res.data.sa_projectid}`,
-                })
-            }, 300)
-        })
-    },
-    // 是否显示全部
-    onChange({
-        detail
-    }) {
-        this.setData({
-            showAll: detail
+    disabled: true
+  },
+  onLoad(options) {
+    let data = JSON.parse(options.rowData);
+    data.sa_brandid = ""
+    this.setData({
+      form: this.data.form.map(v => {
+        if (v.valueName != 'region') {
+          if (v.valueName == 'campaign_name') {
+            v.value = [data[v.valueName],
+              [data.sat_campaignid]
+            ]
+          } else {
+            v.value = data[v.valueName];
+          }
+        } else {
+          v.value = data.province ? [data.province, data.city, data.county] : []
+        }
+        return v
+      }),
+      'content.sat_orderclueid': data.sat_orderclueid,
+      'content.sat_campaignid': data.sat_campaignid
+    });
+    /* 获取领域 */
+    _Http.basic({
+      "id": 20221223141802,
+      "content": {
+        "pageNumber": 1,
+        "pageSize": 99999,
+        "where": {
+          "condition": ""
+        }
+      }
+    }).then(res => {
+      console.log("获取领域", res)
+      let item = this.data.form.find(v => v.label == '领域');
+      item.range = res.msg == '成功' ? res.data : [];
+      this.setData({
+        form: this.data.form
+      })
+    })
+  },
+  submit() {
+    let content = {
+      ...this.data.content,
+      ...this.selectComponent("#Form").submit()
+    };
+    content.sa_brandid = content.sa_brandid ? content.sa_brandid[1][0] : 0;
+    _Http.basic({
+      "id": "20221124154902",
+      content
+    }).then(res => {
+      console.log("转化", res)
+      wx.showToast({
+        title: res.msg != '成功' ? res.msg : '转化成功',
+        icon: "none"
+      })
+      if (res.msg != '成功') return;
+      setTimeout(() => {
+        wx.navigateBack()
+        getCurrentPages().forEach(item => {
+          console.log(item);
+          if (item.__route__ == 'packageA/saleClue/detail') {
+            item.getDetail()
+          }
         })
-    },
-    /* 表单必填项是否完成 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
+        wx.navigateTo({
+          url: `/packageA/project/detail?id=${res.data.sa_projectid}`,
         })
-    }
+      }, 300)
+    })
+  },
+  // 是否显示全部
+  onChange({
+    detail
+  }) {
+    this.setData({
+      showAll: detail
+    })
+  },
+  /* 表单必填项是否完成 */
+  onConfirm({
+    detail
+  }) {
+    this.setData({
+      disabled: detail
+    })
+  }
 })

+ 467 - 461
packageA/saleClue/detail.js

@@ -1,485 +1,491 @@
 const _Http = getApp().globalData.http,
-    currency = require("../../utils/currency"),
-    CNY = value => currency(value, {
-        symbol: "¥",
-        precision: 2
-    }).format();
+  currency = require("../../utils/currency"),
+  CNY = value => currency(value, {
+    symbol: "¥",
+    precision: 2
+  }).format();
 Page({
-    data: {
-        isLeader: false, //是否为负责人
-        tabsActive: 0, //tabs 选中项
-        sat_orderclueid: "",
-        deletereasonShow: false,
-        deletereason: "",
-        invalidreasonShow: false,
-        invalidreason: "",
-        detail: '',
-        tabsList: [{
-            label: "详细信息",
-            icon: "icon-tabxiangxixinxi1"
+  data: {
+    isLeader: false, //是否为负责人
+    tabsActive: 0, //tabs 选中项
+    sat_orderclueid: "",
+    deletereasonShow: false,
+    deletereason: "",
+    invalidreasonShow: false,
+    invalidreason: "",
+    detail: '',
+    tabsList: [{
+      label: "详细信息",
+      icon: "icon-tabxiangxixinxi1"
+    }, {
+      label: "跟进记录",
+      icon: "icon-tabgenjinjilu",
+      model: "#follow"
+    }, {
+      label: "操作",
+      icon: "icon-tabcaozuojilu1",
+      model: "#Record"
+    }, {
+      label: "跟进动态",
+      icon: "icon-tabgenjinjilu",
+      model: "#Trace"
+    }, {
+      label: "任务",
+      icon: "icon-tabrenwu",
+      model: "#Work"
+    }],
+    tabbarList: [],
+  },
+  onLoad(options) {
+    this.setData({
+      sat_orderclueid: options.sat_orderclueid,
+      isAdmin: wx.getStorageSync('auth').wCustomer.options.some(v => v == "admin"), //是否具有管理权限
+    });
+    this.getDetail();
+  },
+  getDetail() {
+    _Http.basic({
+      "classname": "saletool.orderclue.web.orderclue",
+      "method": "selectDetail",
+      "version": 1,
+      "content": {
+        "nocache": true,
+        "sat_orderclueid": this.data.sat_orderclueid
+      },
+    }).then(res => {
+      console.log("线索详情", res)
+      if (res.msg != '成功') return wx.showToast({
+        title: res.data,
+        icon: "none"
+      });
+      this.setData({
+        detail: res.data,
+        briefs: [{
+            label: "联系人",
+            value: res.data.name
+          }, {
+            label: "手机号",
+            value: res.data.phonenumber
+          }, {
+            label: "市场活动",
+            value: res.data.campaign_name
+          }, {
+            label: "领域",
+            value: res.data.tradefield
+          }, {
+            label: '负责人',
+            value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
+          },
+          {
+            label: '分配状态',
+            value: res.data.allocationstatus
+          },
+          {
+            label: '跟进状态',
+            value: res.data.status
+          },
+          {
+            label: '跟进次数',
+            value: res.data.followcount || '0'
+          },
+        ],
+        list1: [{
+          label: "客户(企业)",
+          value: res.data.enterprisename_customer
         }, {
-            label: "跟进记录",
-            icon: "icon-tabgenjinjilu",
-            model: "#follow"
+          label: "联系人",
+          value: res.data.name
         }, {
-            label: "操作",
-            icon: "icon-tabcaozuojilu1",
-            model: "#Record"
+          label: "手机号码",
+          value: res.data.phonenumber
         }, {
-            label: "跟进动态",
-            icon: "icon-tabgenjinjilu",
-            model: "#Trace"
+          label: "省市县",
+          value: res.data.province ? res.data.province + res.data.city + res.data.county : ''
         }, {
-            label: "任务",
-            icon: "icon-tabrenwu",
-            model: "#Work"
+          label: "地址",
+          value: res.data.address
+        }, {
+          label: "项目名称",
+          value: res.data.projectname
+        }, {
+          label: "项目规模",
+          value: res.data.scale
+        }, {
+          label: "总投资额(万元)",
+          value: CNY(res.data.totalinvestment)
+        }, {
+          label: "造价(万元)",
+          value: CNY(res.data.costofconstruction)
+        }, {
+          label: "预计开工时间",
+          value: res.data.begdate_due
+        }, {
+          label: "预计完工时间",
+          value: res.data.enddate_due
+        }, {
+          label: "市场活动",
+          value: res.data.campaign_name
+        }, {
+          label: "领域",
+          value: res.data.tradefield
+        }, {
+          label: "来源",
+          value: res.data.cluesource
+        }, {
+          label: "线索概括",
+          value: res.data.notes
+        }, {
+          label: '负责人',
+          value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
+        }, {
+          label: '分配状态',
+          value: res.data.allocationstatus
+        }, {
+          label: '跟进状态',
+          value: res.data.status
         }],
-        tabbarList: [],
-    },
-    onLoad(options) {
-        this.setData({
-            sat_orderclueid: options.sat_orderclueid,
-            isAdmin: wx.getStorageSync('auth').wCustomer.options.some(v => v == "admin"), //是否具有管理权限
-        });
-        this.getDetail();
-    },
-    getDetail() {
-        _Http.basic({
-            "classname": "saletool.orderclue.web.orderclue",
-            "method": "selectDetail",
-            "version": 1,
-            "content": {
-                "nocache": true,
-                "sat_orderclueid": this.data.sat_orderclueid
-            },
-        }).then(res => {
-            console.log("线索详情", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            });
-            this.setData({
-                detail: res.data,
-                briefs: [{
-                        label: "联系人",
-                        value: res.data.name
-                    }, {
-                        label: "手机号",
-                        value: res.data.phonenumber
-                    }, {
-                        label: "市场活动",
-                        value: res.data.campaign_name
-                    }, {
-                        label: '负责人',
-                        value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
-                    },
-                    {
-                        label: '分配状态',
-                        value: res.data.allocationstatus
-                    },
-                    {
-                        label: '跟进状态',
-                        value: res.data.status
-                    },
-                    {
-                        label: '跟进次数',
-                        value: res.data.followcount || '0'
-                    },
-                ],
-                list1: [{
-                    label: "客户(企业)",
-                    value: res.data.enterprisename_customer
-                }, {
-                    label: "联系人",
-                    value: res.data.name
-                }, {
-                    label: "手机号码",
-                    value: res.data.phonenumber
-                }, {
-                    label: "省市县",
-                    value: res.data.province ? res.data.province + res.data.city + res.data.county : ''
-                }, {
-                    label: "地址",
-                    value: res.data.address
-                }, {
-                    label: "项目名称",
-                    value: res.data.projectname
-                }, {
-                    label: "项目规模",
-                    value: res.data.scale
-                }, {
-                    label: "总投资额(万元)",
-                    value: CNY(res.data.totalinvestment)
-                }, {
-                    label: "造价(万元)",
-                    value: CNY(res.data.costofconstruction)
-                }, {
-                    label: "预计开工时间",
-                    value: res.data.begdate_due
-                }, {
-                    label: "预计完工时间",
-                    value: res.data.enddate_due
-                }, {
-                    label: "市场活动",
-                    value: res.data.campaign_name
-                }, {
-                    label: "来源",
-                    value: res.data.cluesource
-                }, {
-                    label: "线索概括",
-                    value: res.data.notes
-                }, {
-                    label: '负责人',
-                    value: res.data.leader && res.data.leader.length > 0 ? res.data.leader[0].name : ''
-                }, {
-                    label: '分配状态',
-                    value: res.data.allocationstatus
-                }, {
-                    label: '跟进状态',
-                    value: res.data.status
-                }],
-                list2: [{
-                    label: "创建人",
-                    value: res.data.createBy
-                }, {
-                    label: "创建时间",
-                    value: res.data.createDate
-                }, {
-                    label: "分配人",
-                    value: res.data.assignedBy
-                }, {
-                    label: "分配时间",
-                    value: res.data.assignedDate
-                }, {
-                    label: "分配人",
-                    value: res.data.assignedBy
-                }, {
-                    label: "分配时间",
-                    value: res.data.assignedDate
-                }, {
-                    label: "最近跟进人",
-                    value: res.data.followBy
-                }, {
-                    label: "最近跟进时间",
-                    value: res.data.followDate
-                }, {
-                    label: "最近编辑人",
-                    value: res.data.editBy
-                }, {
-                    label: "最近编辑时间",
-                    value: res.data.editDate
-                }, {
-                    label: "无效原因",
-                    value: res.data.invalidreason
-                }, {
-                    label: "作废原因",
-                    value: res.data.deletereason
-                }, {
-                    label: "跟进次数",
-                    value: res.data.followcount
-                }, {
-                    label: "转手次数",
-                    value: res.data.leader[0].leadernum
-                }]
-            });
-            /* 更新列表中状态 */
-            let page = getCurrentPages().find(v => v.__route__ == 'packageA/saleClue/index');
-            if (page) {
-                let index = page.data.list.findIndex(v => v.sat_orderclueid == res.data.sat_orderclueid);
-                console.log("列表中位置", index)
-                if (index != -1) page.setData({
-                    [`list[${index}].status`]: res.data.status
-                })
-            }
-            this.getTags();
-            this.getGroup();
-            this.partialRenewal();
-            if (res.data.leader.some(some => some.userid == wx.getStorageSync('userMsg').userid)) {
-                this.setTabbarList(true, res)
-            } else {
-                getApp().agentOrNot("sat_orderclue", this.data.sat_orderclueid).then(({
-                    data
-                }) => this.setTabbarList(data == 1, res))
-            }
-        })
-
-    },
-
-    /**
-     * 设置tabbar选项
-     * @param {*} isLeader 是否为负责人或代理人
-     * @param {object} res 
-     */
-    setTabbarList(isLeader, res) {
-        let tabbarList = [{
-            icon: "icon-genjin",
-            label: "跟进"
-        }];
-        if (this.data.isAdmin || isLeader) tabbarList = tabbarList.concat([{
-            icon: "icon-bianji",
-            label: "编辑"
+        list2: [{
+          label: "创建人",
+          value: res.data.createBy
+        }, {
+          label: "创建时间",
+          value: res.data.createDate
+        }, {
+          label: "分配人",
+          value: res.data.assignedBy
+        }, {
+          label: "分配时间",
+          value: res.data.assignedDate
+        }, {
+          label: "分配人",
+          value: res.data.assignedBy
+        }, {
+          label: "分配时间",
+          value: res.data.assignedDate
+        }, {
+          label: "最近跟进人",
+          value: res.data.followBy
+        }, {
+          label: "最近跟进时间",
+          value: res.data.followDate
+        }, {
+          label: "最近编辑人",
+          value: res.data.editBy
+        }, {
+          label: "最近编辑时间",
+          value: res.data.editDate
         }, {
-            icon: "icon-dibu-zhuanhuan",
-            label: "转化项目"
+          label: "无效原因",
+          value: res.data.invalidreason
         }, {
-            icon: "icon-dibu-zhuanhuan",
-            label: "转化客户"
+          label: "作废原因",
+          value: res.data.deletereason
         }, {
-            icon: "icon-zhuanyi",
-            label: "更换负责人"
+          label: "跟进次数",
+          value: res.data.followcount
         }, {
-            icon: "icon-dibu-jieshu",
-            label: "作废"
-        }]);
+          label: "转手次数",
+          value: res.data.leader[0].leadernum
+        }]
+      });
+      /* 更新列表中状态 */
+      let page = getCurrentPages().find(v => v.__route__ == 'packageA/saleClue/index');
+      if (page) {
+        let index = page.data.list.findIndex(v => v.sat_orderclueid == res.data.sat_orderclueid);
+        console.log("列表中位置", index)
+        if (index != -1) page.setData({
+          [`list[${index}].status`]: res.data.status
+        })
+      }
+      this.getTags();
+      this.getGroup();
+      this.partialRenewal();
+      if (res.data.leader.some(some => some.userid == wx.getStorageSync('userMsg').userid)) {
+        this.setTabbarList(true, res)
+      } else {
+        getApp().agentOrNot("sat_orderclue", this.data.sat_orderclueid).then(({
+          data
+        }) => this.setTabbarList(data == 1, res))
+      }
+    })
 
-        if (isLeader) {
-            tabbarList.push({
-                icon: "icon-dibu-wuxiao",
-                label: "无效"
-            })
-            if (res.data.isprivate == 0) tabbarList.push({
-                icon: "icon-dibu-tuihui",
-                label: "退回"
-            })
-        }
-        if (res.data.status == '已转化') {
-            tabbarList = tabbarList.filter(item => {
-                return item.label == '编辑' || item.label == '跟进' || item.label == '转化客户' || item.label == '转化项目'
+  },
+
+  /**
+   * 设置tabbar选项
+   * @param {*} isLeader 是否为负责人或代理人
+   * @param {object} res 
+   */
+  setTabbarList(isLeader, res) {
+    let tabbarList = [{
+      icon: "icon-genjin",
+      label: "跟进"
+    }];
+    if (this.data.isAdmin || isLeader) tabbarList = tabbarList.concat([{
+      icon: "icon-bianji",
+      label: "编辑"
+    }, {
+      icon: "icon-dibu-zhuanhuan",
+      label: "转化项目"
+    }, {
+      icon: "icon-dibu-zhuanhuan",
+      label: "转化客户"
+    }, {
+      icon: "icon-zhuanyi",
+      label: "更换负责人"
+    }, {
+      icon: "icon-dibu-jieshu",
+      label: "作废"
+    }]);
+
+    if (isLeader) {
+      tabbarList.push({
+        icon: "icon-dibu-wuxiao",
+        label: "无效"
+      })
+      if (res.data.isprivate == 0) tabbarList.push({
+        icon: "icon-dibu-tuihui",
+        label: "退回"
+      })
+    }
+    if (res.data.status == '已转化') {
+      tabbarList = tabbarList.filter(item => {
+        return item.label == '编辑' || item.label == '跟进' || item.label == '转化客户' || item.label == '转化项目'
+      })
+      if (res.data.isproject == 1) {
+        let i = tabbarList.findIndex(item => item.label == '转化项目')
+        tabbarList.splice(i, 1)
+        console.log('触发项目');
+      }
+      if (res.data.iscustomer == 1) {
+        let i = tabbarList.findIndex(item => item.label == '转化客户')
+        tabbarList.splice(i, 1)
+        console.log('触发客户');
+      }
+    }
+    if (res.data.status != '待跟进' && res.data.status != '跟进中' && res.data.status != '已转化') tabbarList = [];
+    this.setData({
+      tabbarList,
+      isLeader
+    })
+  },
+  //tabs 切换
+  tabsChange({
+    detail
+  }) {
+    this.setData({
+      tabsActive: detail
+    });
+    this.partialRenewal();
+  },
+  //更新标签
+  getTags() {
+    this.selectComponent("#Tags").getTags();
+  },
+  //更新团队成员
+  getGroup() {
+    this.selectComponent("#Group").getList();
+  },
+  //局部数据更新 tabs
+  partialRenewal(init = false) {
+    let model = this.data.tabsList[this.data.tabsActive].model;
+    if (model) {
+      let Component = this.selectComponent(model),
+        {
+          total,
+          pageNumber,
+          pageTotal
+        } = Component.data.content,
+        id = this.data.sat_orderclueid;
+      if (total == null || init) {
+        Component.getList(id, init);
+      } else if (pageNumber < pageTotal) {
+        Component.getList(id, false);
+      }
+    }
+  },
+  onReachBottom() {
+    this.partialRenewal();
+  },
+  //详情按钮回调
+  tabbarOnClick({
+    detail
+  }) {
+    let data = this.data.detail,
+      that = this;
+    switch (detail.label) {
+      case "编辑":
+        wx.navigateTo({
+          url: `/packageA/saleClue/addClue?rowData=${JSON.stringify(this.data.detail)}`,
+        })
+        break;
+      case "作废":
+        that.setData({
+          deletereasonShow: true
+        })
+        break;
+      case "无效":
+        that.setData({
+          invalidreasonShow: true
+        })
+        break;
+      case "退回":
+        wx.showModal({
+          title: '提示',
+          content: `是否退回该线索,确定后无法撤销!`,
+          complete: ({
+            confirm
+          }) => {
+            if (confirm) _Http.basic({
+              "id": 20221207160802,
+              "content": {
+                sat_orderclueid: data.sat_orderclueid
+              }
+            }).then(res => {
+              wx.showToast({
+                title: res.msg == '成功' ? `退回成功` : res.msg,
+                icon: "none"
+              });
+              setTimeout(() => {
+                let page = getCurrentPages().find(v => v.__route__ == 'packageA/saleClue/index');
+                if (page) page.getList(true)
+                wx.navigateBack();
+              }, 500)
             })
-            if (res.data.isproject == 1) {
-                let i = tabbarList.findIndex(item => item.label == '转化项目')
-                tabbarList.splice(i, 1)
-                console.log('触发项目');
-            }
-            if (res.data.iscustomer == 1) {
-                let i = tabbarList.findIndex(item => item.label == '转化客户')
-                tabbarList.splice(i, 1)
-                console.log('触发客户');
-            }
-        }
-        if (res.data.status != '待跟进' && res.data.status != '跟进中' && res.data.status != '已转化') tabbarList = [];
-        this.setData({
-            tabbarList,
-            isLeader
+          }
         })
-    },
-    //tabs 切换
-    tabsChange({
-        detail
-    }) {
-        this.setData({
-            tabsActive: detail
-        });
-        this.partialRenewal();
-    },
-    //更新标签
-    getTags() {
-        this.selectComponent("#Tags").getTags();
-    },
-    //更新团队成员
-    getGroup() {
-        this.selectComponent("#Group").getList();
-    },
-    //局部数据更新 tabs
-    partialRenewal(init = false) {
-        let model = this.data.tabsList[this.data.tabsActive].model;
-        if (model) {
-            let Component = this.selectComponent(model),
-                {
-                    total,
-                    pageNumber,
-                    pageTotal
-                } = Component.data.content,
-                id = this.data.sat_orderclueid;
-            if (total == null || init) {
-                Component.getList(id, init);
-            } else if (pageNumber < pageTotal) {
-                Component.getList(id, false);
-            }
-        }
-    },
-    onReachBottom() {
-        this.partialRenewal();
-    },
-    //详情按钮回调
-    tabbarOnClick({
-        detail
-    }) {
-        let data = this.data.detail,
-            that = this;
-        switch (detail.label) {
-            case "编辑":
-                wx.navigateTo({
-                    url: `/packageA/saleClue/addClue?rowData=${JSON.stringify(this.data.detail)}`,
-                })
-                break;
-            case "作废":
-                that.setData({
-                    deletereasonShow: true
-                })
-                break;
-            case "无效":
-                that.setData({
-                    invalidreasonShow: true
-                })
-                break;
-            case "退回":
-                wx.showModal({
-                    title: '提示',
-                    content: `是否退回该线索,确定后无法撤销!`,
-                    complete: ({
-                        confirm
-                    }) => {
-                        if (confirm) _Http.basic({
-                            "id": 20221207160802,
-                            "content": {
-                                sat_orderclueid: data.sat_orderclueid
-                            }
-                        }).then(res => {
-                            wx.showToast({
-                                title: res.msg == '成功' ? `退回成功` : res.msg,
-                                icon: "none"
-                            });
-                            setTimeout(() => {
-                                let page = getCurrentPages().find(v => v.__route__ == 'packageA/saleClue/index');
-                                if (page) page.getList(true)
-                                wx.navigateBack();
-                            }, 500)
-                        })
-                    }
-                })
-                break;
-            case "转化项目":
-                wx.navigateTo({
-                    url: `/packageA/saleClue/change?rowData=${JSON.stringify(this.data.detail)}`,
-                })
-                break;
-            case "转化客户":
-                wx.navigateTo({
-                    url: `/packageA/saleClue/translate?data=${JSON.stringify(this.data.detail)}`,
-                })
-                break;
-            case "跟进":
-                wx.navigateTo({
-                    url: `/packageA/saleClue/addFollow?sat_orderclueid=` + this.data.detail.sat_orderclueid
-                })
-                break;
-            case "更换负责人":
-                wx.navigateTo({
-                    url: `/pages/group/select?data=${JSON.stringify({
+        break;
+      case "转化项目":
+        wx.navigateTo({
+          url: `/packageA/saleClue/change?rowData=${JSON.stringify(this.data.detail)}`,
+        })
+        break;
+      case "转化客户":
+        wx.navigateTo({
+          url: `/packageA/saleClue/translate?data=${JSON.stringify(this.data.detail)}`,
+        })
+        break;
+      case "跟进":
+        wx.navigateTo({
+          url: `/packageA/saleClue/addFollow?sat_orderclueid=` + this.data.detail.sat_orderclueid
+        })
+        break;
+      case "更换负责人":
+        wx.navigateTo({
+          url: `/pages/group/select?data=${JSON.stringify({
                              ownertable:"sat_orderclue",
                              ownerid:data.sat_orderclueid,
                         })}&radio=true&principal=true`,
-                })
-                break;
-        }
-    },
-    /* 更换负责人 */
-    handelSubmit(arr) {
-        const that = this;
-        wx.showModal({
-            title: '提示',
-            content: '是否确认更换负责人',
-            complete: ({
-                confirm
-            }) => {
-                if (confirm) _Http.basic({
-                    "id": 20220930103701,
-                    "content": {
-                        ownertable: "sat_orderclue",
-                        ownerid: that.data.detail.sat_orderclueid,
-                        userid: arr[0]
-                    }
-                }).then(res => {
-                    console.log("更换负责人", res)
-                    if (res.msg != '成功') return wx.showToast({
-                        title: res.data,
-                        icon: "none"
-                    });
-                    wx.showToast({
-                        title: '更换成功!',
-                        icon: "none"
-                    });
-                    setTimeout(() => {
-                        that.getDetail();
-                        wx.navigateBack();
-                        /*  getCurrentPages().forEach(v => {
-                             if (['packageA/project/index'].includes(v.__route__)) v.getList(true)
-                         }) */
-                    }, 300)
-                })
-            }
-        })
-    },
-    onShareAppMessage() {},
-    /* 完成情况说明输入 */
-    areaInput(e) {
-        this.setData({
-            [e.currentTarget.dataset.name]: e.detail.value
-        })
-    },
-    /* 确认无效 */
-    invalidItem() {
-        let that = this;
-        _Http.basic({
-            id: "20221208100602",
-            "content": {
-                "sat_orderclueid": this.data.detail.sat_orderclueid,
-                sat_ordercluefollowuplogid: 0,
-                "content": this.data.invalidreason,
-                "followupmode": "",
-                "logtype": "无效",
-                "competitor": ""
-            }
-        }).then(res => {
-            console.log("无效", res)
-            wx.showToast({
-                title: res.msg == '成功' ? `操作成功` : res.msg,
-                icon: "none",
-                mask: true
-            });
-            if (res.msg == '成功') setTimeout(() => {
-                this.getDetail();
-                this.selectComponent("#follow").getList(that.data.detail.sat_orderclueid, true)
-                this.onCancel()
-                this.setData({
-                    invalidreason: ""
-                })
-            }, 300)
         })
-    },
-    deleteItem() {
-        let that = this;
-        _Http.basic({
-            "id": 20221123193702,
-            "content": {
-                "sat_orderclueids": [this.data.detail.sat_orderclueid],
-                deletereason: this.data.deletereason
-            }
+        break;
+    }
+  },
+  /* 更换负责人 */
+  handelSubmit(arr) {
+    const that = this;
+    wx.showModal({
+      title: '提示',
+      content: '是否确认更换负责人',
+      complete: ({
+        confirm
+      }) => {
+        if (confirm) _Http.basic({
+          "id": 20220930103701,
+          "content": {
+            ownertable: "sat_orderclue",
+            ownerid: that.data.detail.sat_orderclueid,
+            userid: arr[0]
+          }
         }).then(res => {
-            wx.showToast({
-                title: res.msg == '成功' ? `操作成功` : res.msg,
-                icon: "none"
-            });
-            this.onCancel();
-            this.setData({
-                deletereason: ""
-            })
+          console.log("更换负责人", res)
+          if (res.msg != '成功') return wx.showToast({
+            title: res.data,
+            icon: "none"
+          });
+          wx.showToast({
+            title: '更换成功!',
+            icon: "none"
+          });
+          setTimeout(() => {
             that.getDetail();
-            setTimeout(() => {
-                let pages = getCurrentPages(),
-                    page = pages[pages.length - 2];
-                if (page.getList) page.setData({
-                    list: page.data.list.filter(v => v.sat_orderclueid != that.data.detail.sat_orderclueid),
-                    "content.total": page.data.content.total - 1,
-                })
-            }, 300)
+            wx.navigateBack();
+            /*  getCurrentPages().forEach(v => {
+                 if (['packageA/project/index'].includes(v.__route__)) v.getList(true)
+             }) */
+          }, 300)
         })
-    },
-    onCancel() {
+      }
+    })
+  },
+  onShareAppMessage() {},
+  /* 完成情况说明输入 */
+  areaInput(e) {
+    this.setData({
+      [e.currentTarget.dataset.name]: e.detail.value
+    })
+  },
+  /* 确认无效 */
+  invalidItem() {
+    let that = this;
+    _Http.basic({
+      id: "20221208100602",
+      "content": {
+        "sat_orderclueid": this.data.detail.sat_orderclueid,
+        sat_ordercluefollowuplogid: 0,
+        "content": this.data.invalidreason,
+        "followupmode": "",
+        "logtype": "无效",
+        "competitor": ""
+      }
+    }).then(res => {
+      console.log("无效", res)
+      wx.showToast({
+        title: res.msg == '成功' ? `操作成功` : res.msg,
+        icon: "none",
+        mask: true
+      });
+      if (res.msg == '成功') setTimeout(() => {
+        this.getDetail();
+        this.selectComponent("#follow").getList(that.data.detail.sat_orderclueid, true)
+        this.onCancel()
         this.setData({
-            deletereasonShow: false,
-            invalidreasonShow: false,
+          invalidreason: ""
         })
-    }
+      }, 300)
+    })
+  },
+  deleteItem() {
+    let that = this;
+    _Http.basic({
+      "id": 20221123193702,
+      "content": {
+        "sat_orderclueids": [this.data.detail.sat_orderclueid],
+        deletereason: this.data.deletereason
+      }
+    }).then(res => {
+      wx.showToast({
+        title: res.msg == '成功' ? `操作成功` : res.msg,
+        icon: "none"
+      });
+      this.onCancel();
+      this.setData({
+        deletereason: ""
+      })
+      that.getDetail();
+      setTimeout(() => {
+        let pages = getCurrentPages(),
+          page = pages[pages.length - 2];
+        if (page.getList) page.setData({
+          list: page.data.list.filter(v => v.sat_orderclueid != that.data.detail.sat_orderclueid),
+          "content.total": page.data.content.total - 1,
+        })
+      }, 300)
+    })
+  },
+  onCancel() {
+    this.setData({
+      deletereasonShow: false,
+      invalidreasonShow: false,
+    })
+  }
 })