|
|
@@ -0,0 +1,388 @@
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ tabsActive: 0, //tabs 选中项
|
|
|
+ sat_orderclueid: "",
|
|
|
+ detail:'',
|
|
|
+ sheetTitle:'',
|
|
|
+ tabsList: [{
|
|
|
+ label: "详细信息",
|
|
|
+ num: 132
|
|
|
+ }, {
|
|
|
+ label: "跟进记录",
|
|
|
+ num: 132
|
|
|
+ }, {
|
|
|
+ label: "操作",
|
|
|
+ num: 132
|
|
|
+ }, {
|
|
|
+ label: "跟进动态",
|
|
|
+ num: 132
|
|
|
+ }],
|
|
|
+ tabbarList: [{
|
|
|
+ icon: "icon-bianji",
|
|
|
+ label: "编辑"
|
|
|
+ }, {
|
|
|
+ icon: "icon-genjin",
|
|
|
+ label: "跟进"
|
|
|
+ }, {
|
|
|
+ icon: "icon-genjin",
|
|
|
+ label: "无效"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-zhuanhuan",
|
|
|
+ label: "转化"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-zhuanhuan",
|
|
|
+ label: "转移"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-jieshu",
|
|
|
+ label: "作废"
|
|
|
+ }],
|
|
|
+ oldtabbarList: [{
|
|
|
+ icon: "icon-bianji",
|
|
|
+ label: "编辑"
|
|
|
+ }, {
|
|
|
+ icon: "icon-genjin",
|
|
|
+ label: "跟进"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-wuxiao",
|
|
|
+ label: "无效"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-zhuanhuan",
|
|
|
+ label: "转化"
|
|
|
+ }, {
|
|
|
+ icon: "icon-zhuanyi",
|
|
|
+ label: "更换负责人"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-jieshu",
|
|
|
+ label: "作废"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ sat_orderclueid: options.sat_orderclueid
|
|
|
+ });
|
|
|
+ this.getDetail();
|
|
|
+ },
|
|
|
+ getDetail() {
|
|
|
+ console.log(111);
|
|
|
+ _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.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ console.log(res.data.createBy);
|
|
|
+ this.setData({
|
|
|
+ detail: res.data,
|
|
|
+ briefs: [ {
|
|
|
+ label: "联系人",
|
|
|
+ value: res.data.name
|
|
|
+ }, {
|
|
|
+ label: "手机号",
|
|
|
+ value: res.data.phonenumber
|
|
|
+ }, {
|
|
|
+ label: "来源",
|
|
|
+ value: res.data.cluesource
|
|
|
+ }, {
|
|
|
+ label:'负责人',
|
|
|
+ value:res.data.leader ? res.data.leader[0].name : ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'分配状态',
|
|
|
+ value:res.data.allocationstatus
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'跟进状态',
|
|
|
+ value:res.data.status
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'跟进次数',
|
|
|
+ value:res.data.followcount||'0'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'转化次数',
|
|
|
+ value:res.data.changecount
|
|
|
+ }],
|
|
|
+ list1: [{
|
|
|
+ label: "联系人",
|
|
|
+ value: res.data.name
|
|
|
+ }, {
|
|
|
+ label: "手机号",
|
|
|
+ value: res.data.phonenumber
|
|
|
+ }, {
|
|
|
+ label: "来源",
|
|
|
+ value: res.data.cluesource
|
|
|
+ }, {
|
|
|
+ label:'负责人',
|
|
|
+ value:res.data.leader ? res.data.leader[0].name : ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'分配状态',
|
|
|
+ value:res.data.allocationstatus
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'跟进状态',
|
|
|
+ value:res.data.status
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'跟进次数',
|
|
|
+ value:res.data.followcount||'0'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'转化次数',
|
|
|
+ value:res.data.changecount
|
|
|
+ }],
|
|
|
+ list2: [{
|
|
|
+ label: "创建人",
|
|
|
+ value: res.data.createBy
|
|
|
+ }, {
|
|
|
+ label: "创建时间",
|
|
|
+ value: res.data.createDate
|
|
|
+ }, {
|
|
|
+ label: "分配人",
|
|
|
+ value: res.data.assignedBy
|
|
|
+ }, {
|
|
|
+ label: "最近跟进人",
|
|
|
+ value: res.data.followBy
|
|
|
+ }, {
|
|
|
+ label: "转移人",
|
|
|
+ value: res.data.changeBy
|
|
|
+ }, {
|
|
|
+ label: "最近编辑人",
|
|
|
+ value: res.data.editBy
|
|
|
+ }, {
|
|
|
+ label: "创建时间",
|
|
|
+ value: res.data.createDate
|
|
|
+ }, {
|
|
|
+ label: "分配时间",
|
|
|
+ value: res.data.assignedDate
|
|
|
+ }, {
|
|
|
+ label: "最近跟进时间",
|
|
|
+ value: res.data.followDate
|
|
|
+ }, {
|
|
|
+ label: "最近转移时间",
|
|
|
+ value: res.data.changeDate
|
|
|
+ }, {
|
|
|
+ label: "最近编辑时间",
|
|
|
+ value: res.data.editDate
|
|
|
+ }],
|
|
|
+ tabsList: this.data.tabsList,
|
|
|
+ });
|
|
|
+ let arr = this.data.oldtabbarList
|
|
|
+ if (res.data.status != '待跟进' && res.data.status != '跟进中') {
|
|
|
+ arr = []
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ tabbarList: arr
|
|
|
+ })
|
|
|
+ this.getTags();
|
|
|
+ this.getGroup();
|
|
|
+ this.partialRenewal();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /*跟进提交*/
|
|
|
+ endFollow ({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ sheetTitle:''
|
|
|
+ })
|
|
|
+ this.getDetail()
|
|
|
+ this.selectComponent('#follow').getFollowDetail()
|
|
|
+ },
|
|
|
+ //tabs 切换
|
|
|
+ tabsChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ tabsActive: detail
|
|
|
+ });
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ //更新标签
|
|
|
+ getTags() {
|
|
|
+ this.selectComponent("#Tags").getTags();
|
|
|
+ },
|
|
|
+ //更新团队成员
|
|
|
+ getGroup() {
|
|
|
+ this.selectComponent("#Group").getList();
|
|
|
+ },
|
|
|
+ //局部数据更新 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 = "#follow"
|
|
|
+ break;
|
|
|
+ case "操作":
|
|
|
+ model = "#Record"
|
|
|
+ break;
|
|
|
+ case "跟进动态":
|
|
|
+ model = "#Trace"
|
|
|
+ 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;
|
|
|
+ switch (detail.label) {
|
|
|
+ case "编辑":
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/packageA/saleClue/addClue?rowData=${JSON.stringify(this.data.detail)}`,
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "作废":
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认作废该线索?`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "id":20221123193702,
|
|
|
+ "content": {
|
|
|
+ "sat_orderclueids": [this.data.detail.sat_orderclueid]
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? `已作废该线索` : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ wx.navigateBack()
|
|
|
+ getCurrentPages().forEach(v => {
|
|
|
+ if(v.__route__=="packageA/saleClue/index") {
|
|
|
+ v.getList(true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "无效":
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否设置该线索为"无效"状态,确定后无法撤销!`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "classname": "saletool.orderclue.web.orderclue",
|
|
|
+ "method": "addFollowUpLog",
|
|
|
+ "content": {
|
|
|
+ "sat_orderclueid":this.data.detail.sat_orderclueid,
|
|
|
+ "content": "",
|
|
|
+ "followupmode": "",
|
|
|
+ "logtype": "无效",
|
|
|
+ "competitor": ""
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? `已无效该线索` : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ wx.navigateBack()
|
|
|
+ getCurrentPages().forEach(v => {
|
|
|
+ if(v.__route__=="packageA/saleClue/index") {
|
|
|
+ v.getList(true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "转化":
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/packageA/saleClue/change?rowData=${JSON.stringify(this.data.detail)}`,
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "跟进":
|
|
|
+ this.selectComponent("#followAction").updateTime();
|
|
|
+ this.setData({
|
|
|
+ sheetTitle: '跟进'
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "更换负责人":
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/packageA/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() {}
|
|
|
+})
|