|
|
@@ -1,396 +1,407 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
- data: {
|
|
|
- loading: true,
|
|
|
- isLeader: false, //是否为负责人
|
|
|
- tabsActive: 1, //tabs 选中项
|
|
|
- sa_agentsid: 0,
|
|
|
- sColors: getApp().globalData.sColors,
|
|
|
- deletereasonShow: false,
|
|
|
- deletereason: "",
|
|
|
- },
|
|
|
- onLoad(options) {
|
|
|
- const appAuth = wx.getStorageSync('auth').wdealerMag;
|
|
|
- this.setData({
|
|
|
- sa_agentsid: options.id,
|
|
|
- appAuth
|
|
|
- })
|
|
|
- this.getDetail();
|
|
|
- getApp().globalData.Language.getLanguagePackage(this, '经销商详情');
|
|
|
- },
|
|
|
+ data: {
|
|
|
+ loading: true,
|
|
|
+ isLeader: false, //是否为负责人
|
|
|
+ tabsActive: 1, //tabs 选中项
|
|
|
+ sa_agentsid: 0,
|
|
|
+ sColors: getApp().globalData.sColors,
|
|
|
+ deletereasonShow: false,
|
|
|
+ deletereason: "",
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ const appAuth = wx.getStorageSync('auth').wdealerMag;
|
|
|
+ this.setData({
|
|
|
+ sa_agentsid: options.id,
|
|
|
+ appAuth
|
|
|
+ })
|
|
|
+ this.getDetail();
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this, '经销商详情');
|
|
|
+ },
|
|
|
|
|
|
- /* 获取详情 */
|
|
|
- getDetail() {
|
|
|
- /* 基本信息 */
|
|
|
- _Http.basic({
|
|
|
- classname: "webmanage.sale.agents.agents",
|
|
|
- method: "query_agentMain",
|
|
|
- "content": {
|
|
|
- sa_agentsid: this.data.sa_agentsid
|
|
|
- },
|
|
|
- }).then(res => {
|
|
|
- console.log("详情", res)
|
|
|
- if (res.code != '1') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- this.setPreview(res);
|
|
|
- this.setData({
|
|
|
- loading: false,
|
|
|
- detail: res.data,
|
|
|
- })
|
|
|
- //获取标签
|
|
|
- if (this.data.appAuth.isdatatag) this.getTags();
|
|
|
- if (this.data.appAuth.isdatateam) this.getGroup()
|
|
|
- this.setTabbar();
|
|
|
- this.partialRenewal();
|
|
|
- });
|
|
|
- },
|
|
|
- areaInput(e) {
|
|
|
- this.setData({
|
|
|
- deletereason: e.detail.value
|
|
|
- })
|
|
|
- },
|
|
|
- onCancel() {
|
|
|
- this.setData({
|
|
|
- deletereasonShow: false,
|
|
|
- })
|
|
|
- },
|
|
|
- deleteItem() {
|
|
|
- _Http.basic({
|
|
|
- id: 20221011145003,
|
|
|
- content: {
|
|
|
- deletereason: this.data.deletereason,
|
|
|
- sa_agentsids: [this.data.sa_agentsid],
|
|
|
- datastatus: '1'
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("作废", res)
|
|
|
+ /* 获取详情 */
|
|
|
+ getDetail() {
|
|
|
+ /* 基本信息 */
|
|
|
+ _Http.basic({
|
|
|
+ classname: "webmanage.sale.agents.agents",
|
|
|
+ method: "query_agentMain",
|
|
|
+ "content": {
|
|
|
+ sa_agentsid: this.data.sa_agentsid
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("详情", res)
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setPreview(res);
|
|
|
+ this.setData({
|
|
|
+ loading: false,
|
|
|
+ detail: res.data,
|
|
|
+ })
|
|
|
+ //获取标签
|
|
|
+ if (this.data.appAuth.isdatatag) this.getTags();
|
|
|
+ if (this.data.appAuth.isdatateam) this.getGroup()
|
|
|
+ this.setTabbar();
|
|
|
+ this.partialRenewal();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ areaInput(e) {
|
|
|
+ this.setData({
|
|
|
+ deletereason: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onCancel() {
|
|
|
+ this.setData({
|
|
|
+ deletereasonShow: false,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deleteItem() {
|
|
|
+ _Http.basic({
|
|
|
+ id: 20221011145003,
|
|
|
+ content: {
|
|
|
+ deletereason: this.data.deletereason,
|
|
|
+ sa_agentsids: [this.data.sa_agentsid],
|
|
|
+ datastatus: '1'
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("作废", res)
|
|
|
|
|
|
- wx.showToast({
|
|
|
- title: res.code == 1 ? '作废成功' : res.msg,
|
|
|
- icon: "none",
|
|
|
- mask: res.code == 1
|
|
|
- })
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code == 1 ? '作废成功' : res.msg,
|
|
|
+ icon: "none",
|
|
|
+ mask: res.code == 1
|
|
|
+ })
|
|
|
|
|
|
- if (res.code == 1) setTimeout(() => {
|
|
|
- wx.navigateBack()
|
|
|
- }, 300)
|
|
|
+ if (res.code == 1) setTimeout(() => {
|
|
|
+ wx.navigateBack()
|
|
|
+ }, 300)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setPreview(res) {
|
|
|
+ /* 摘要信息 */
|
|
|
+ let briefs = [{
|
|
|
+ label: "经销商编号",
|
|
|
+ value: res.data.agentnum
|
|
|
+ }, {
|
|
|
+ label: "erp编号",
|
|
|
+ value: res.data.erpagentnum
|
|
|
+ }, {
|
|
|
+ label: "经销商类型",
|
|
|
+ value: res.data.type
|
|
|
+ }, {
|
|
|
+ label: "合作类型",
|
|
|
+ value: res.data.cooperatetype
|
|
|
+ }, {
|
|
|
+ label: "业务员",
|
|
|
+ value: res.data.salernames
|
|
|
+ }, {
|
|
|
+ label: "营销区域",
|
|
|
+ value: res.data.areanames
|
|
|
+ }, {
|
|
|
+ label: "总经理",
|
|
|
+ value: res.data.gmname
|
|
|
+ }, {
|
|
|
+ label: "总经理电话",
|
|
|
+ value: res.data.gmphonenumber
|
|
|
+ }, {
|
|
|
+ label: "详细地址",
|
|
|
+ value: res.data.address
|
|
|
+ }, {
|
|
|
+ label: "上级企业",
|
|
|
+ value: res.data.parent_enterprisename
|
|
|
+ }, {
|
|
|
+ label: "备注",
|
|
|
+ value: res.data.remarks
|
|
|
+ }];
|
|
|
+ /* 基本信息 */
|
|
|
+ let list1 = [{
|
|
|
+ label: "经销商名称",
|
|
|
+ value: res.data.enterprisename
|
|
|
+ }, {
|
|
|
+ label: "经销商编号",
|
|
|
+ value: res.data.agentnum
|
|
|
+ }, {
|
|
|
+ label: "erp编号",
|
|
|
+ value: res.data.erpagentnum
|
|
|
+ }, {
|
|
|
+ label: "合作类型",
|
|
|
+ value: res.data.cooperatetype
|
|
|
+ }, {
|
|
|
+ label: "公司规模",
|
|
|
+ value: res.data.scale
|
|
|
+ }, {
|
|
|
+ label: "主营产品/年营业额",
|
|
|
+ value: res.data.mainproducts
|
|
|
+ }, {
|
|
|
+ label: "总经理",
|
|
|
+ value: res.data.gmname
|
|
|
+ }, {
|
|
|
+ label: "总经理电话",
|
|
|
+ value: res.data.gmphonenumber
|
|
|
+ }, {
|
|
|
+ label: "省市县",
|
|
|
+ value: res.data.province + res.data.city + res.data.county
|
|
|
+ }, {
|
|
|
+ label: "详细地址",
|
|
|
+ value: res.data.address
|
|
|
+ }, {
|
|
|
+ label: "上级企业",
|
|
|
+ value: res.data.parent_enterprisename
|
|
|
+ }, {
|
|
|
+ label: "业务员",
|
|
|
+ value: res.data.salernames
|
|
|
+ }, {
|
|
|
+ label: "营销区域",
|
|
|
+ value: res.data.areanames
|
|
|
+ }, {
|
|
|
+ label: "状态",
|
|
|
+ value: res.data.status
|
|
|
+ }];
|
|
|
+ /* 系统信息 */
|
|
|
+ let list2 = [{
|
|
|
+ label: "创建人",
|
|
|
+ value: res.data.createby
|
|
|
+ }, {
|
|
|
+ label: "创建时间",
|
|
|
+ value: res.data.createdate
|
|
|
+ }, {
|
|
|
+ label: "最近编辑人",
|
|
|
+ value: res.data.changeby
|
|
|
+ }, {
|
|
|
+ label: "最近编辑时间",
|
|
|
+ value: res.data.changedate
|
|
|
+ }, {
|
|
|
+ label: "作废原因",
|
|
|
+ value: res.data.deletereason
|
|
|
+ }];
|
|
|
+ this.setData({
|
|
|
+ briefs,
|
|
|
+ list1,
|
|
|
+ list2
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //详情按钮回调
|
|
|
+ tabbarOnClick({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ let data = this.data.detail,
|
|
|
+ that = this;
|
|
|
+ switch (detail.label) {
|
|
|
+ case "编辑":
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/prsx/dealer/insert?data=${JSON.stringify(data)}`,
|
|
|
})
|
|
|
- },
|
|
|
- setPreview(res) {
|
|
|
- /* 摘要信息 */
|
|
|
- let briefs = [{
|
|
|
- label: "经销商编号",
|
|
|
- value: res.data.agentnum
|
|
|
- }, {
|
|
|
- label: "erp编号",
|
|
|
- value: res.data.erpagentnum
|
|
|
- }, {
|
|
|
- label: "经销商类型",
|
|
|
- value: res.data.type
|
|
|
- }, {
|
|
|
- label: "合作类型",
|
|
|
- value: res.data.cooperatetype
|
|
|
- }, {
|
|
|
- label: "业务员",
|
|
|
- value: res.data.salernames
|
|
|
- }, {
|
|
|
- label: "营销区域",
|
|
|
- value: res.data.areanames
|
|
|
- }, {
|
|
|
- label: "总经理",
|
|
|
- value: res.data.gmname
|
|
|
- }, {
|
|
|
- label: "总经理电话",
|
|
|
- value: res.data.gmphonenumber
|
|
|
- }, {
|
|
|
- label: "详细地址",
|
|
|
- value: res.data.address
|
|
|
- }, {
|
|
|
- label: "上级企业",
|
|
|
- value: res.data.parent_enterprisename
|
|
|
- }, {
|
|
|
- label: "备注",
|
|
|
- value: res.data.remarks
|
|
|
- }];
|
|
|
- /* 基本信息 */
|
|
|
- let list1 = [{
|
|
|
- label: "经销商名称",
|
|
|
- value: res.data.enterprisename
|
|
|
- }, {
|
|
|
- label: "经销商编号",
|
|
|
- value: res.data.agentnum
|
|
|
- }, {
|
|
|
- label: "erp编号",
|
|
|
- value: res.data.erpagentnum
|
|
|
- }, {
|
|
|
- label: "合作类型",
|
|
|
- value: res.data.cooperatetype
|
|
|
- }, {
|
|
|
- label: "公司规模",
|
|
|
- value: res.data.scale
|
|
|
- }, {
|
|
|
- label: "主营产品/年营业额",
|
|
|
- value: res.data.mainproducts
|
|
|
- }, {
|
|
|
- label: "总经理",
|
|
|
- value: res.data.gmname
|
|
|
- }, {
|
|
|
- label: "总经理电话",
|
|
|
- value: res.data.gmphonenumber
|
|
|
- }, {
|
|
|
- label: "省市县",
|
|
|
- value: res.data.province + res.data.city + res.data.county
|
|
|
- }, {
|
|
|
- label: "详细地址",
|
|
|
- value: res.data.address
|
|
|
- }, {
|
|
|
- label: "上级企业",
|
|
|
- value: res.data.parent_enterprisename
|
|
|
- }, {
|
|
|
- label: "业务员",
|
|
|
- value: res.data.salernames
|
|
|
- }, {
|
|
|
- label: "营销区域",
|
|
|
- value: res.data.areanames
|
|
|
- }, {
|
|
|
- label: "状态",
|
|
|
- value: res.data.status
|
|
|
- }];
|
|
|
- /* 系统信息 */
|
|
|
- let list2 = [{
|
|
|
- label: "创建人",
|
|
|
- value: res.data.createby
|
|
|
- }, {
|
|
|
- label: "创建时间",
|
|
|
- value: res.data.createdate
|
|
|
- }, {
|
|
|
- label: "最近编辑人",
|
|
|
- value: res.data.changeby
|
|
|
- }, {
|
|
|
- label: "最近编辑时间",
|
|
|
- value: res.data.changedate
|
|
|
- }, {
|
|
|
- label: "作废原因",
|
|
|
- value: res.data.deletereason
|
|
|
- }];
|
|
|
- this.setData({
|
|
|
- briefs,
|
|
|
- list1,
|
|
|
- list2
|
|
|
- });
|
|
|
- },
|
|
|
- //详情按钮回调
|
|
|
- tabbarOnClick({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- let data = this.data.detail,
|
|
|
- that = this;
|
|
|
- switch (detail.label) {
|
|
|
- case "编辑":
|
|
|
- wx.navigateTo({
|
|
|
- url: `/prsx/dealer/insert?data=${JSON.stringify(data)}`,
|
|
|
- })
|
|
|
- break;
|
|
|
- case "启用":
|
|
|
- wx.showModal({
|
|
|
- content: "是否确定启用该经销商?",
|
|
|
- complete: ({
|
|
|
- confirm
|
|
|
- }) => {
|
|
|
- if (confirm) _Http.basic({
|
|
|
- "content": {
|
|
|
- "sa_agentsids": [data.sa_agentsid],
|
|
|
- "status": "启用"
|
|
|
- },
|
|
|
- "id": "20230212101703",
|
|
|
- }).then(res => {
|
|
|
- console.log("启用经销商", res)
|
|
|
- wx.showToast({
|
|
|
- title: res.code == 1 ? '启用成功' : res.msg,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- if (res.code == 1) that.getDetail()
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- break;
|
|
|
- case "禁用":
|
|
|
- wx.showModal({
|
|
|
- content: "是否确定禁用该经销商?",
|
|
|
- complete: ({
|
|
|
- confirm
|
|
|
- }) => {
|
|
|
- if (confirm) _Http.basic({
|
|
|
- "content": {
|
|
|
- "sa_agentsids": [data.sa_agentsid],
|
|
|
- "status": "禁用"
|
|
|
- },
|
|
|
- "id": "20230212101703",
|
|
|
- }).then(res => {
|
|
|
- console.log("启用经销商", res)
|
|
|
- wx.showToast({
|
|
|
- title: res.code == 1 ? '禁用成功' : res.msg,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- if (res.code == 1) that.getDetail()
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- break;
|
|
|
- case "作废":
|
|
|
- that.setData({
|
|
|
- deletereasonShow: true
|
|
|
- })
|
|
|
- break;
|
|
|
- case "跟进":
|
|
|
- that.selectComponent("#Trace").toAdd()
|
|
|
- break;
|
|
|
- default:
|
|
|
- console.log(detail)
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
- /* 底部功能 */
|
|
|
- async setTabbar() {
|
|
|
- let detail = this.data.detail,
|
|
|
- isAdmin = wx.getStorageSync("userMsg").usertype == 0,
|
|
|
- isLeader = false,
|
|
|
- editdataleader = isLeader ? 1 : 0,
|
|
|
- tabbarList = [],
|
|
|
- appAuth = this.data.appAuth,
|
|
|
- tabsList = [{
|
|
|
- label: "详细信息",
|
|
|
- icon: "icon-tabxiangxixinxi1"
|
|
|
- }, {
|
|
|
- label: "合同",
|
|
|
- icon: "icon-tabhetong",
|
|
|
- model: "#Contract"
|
|
|
- }, {
|
|
|
- label: "地址管理",
|
|
|
- icon: "icon-tabdizhi",
|
|
|
- model: "#Address"
|
|
|
- }];
|
|
|
- if (!isLeader) {
|
|
|
- let res = await getApp().agentOrNot("sa_agents", this.data.sa_agentsid),
|
|
|
- data = res.code == '1' ? res.data : {
|
|
|
- editable: 0,
|
|
|
- editdataleader: 0
|
|
|
- }
|
|
|
- if (appAuth.isdatateam) isLeader = this.selectComponent("#Group").data.editable == 1;
|
|
|
- if (!isLeader) isLeader = data.editable == 1;
|
|
|
- editdataleader = data.editdataleader;
|
|
|
- }
|
|
|
- if (appAuth.isdatafollowup) {
|
|
|
- tabsList.unshift({
|
|
|
- label: "跟进动态",
|
|
|
- icon: "icon-tabgenjinjilu",
|
|
|
- model: "#Trace"
|
|
|
+ break;
|
|
|
+ case "启用":
|
|
|
+ wx.showModal({
|
|
|
+ content: "是否确定启用该经销商?",
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_agentsids": [data.sa_agentsid],
|
|
|
+ "status": "启用"
|
|
|
+ },
|
|
|
+ "id": "20230212101703",
|
|
|
+ }).then(res => {
|
|
|
+ console.log("启用经销商", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code == 1 ? '启用成功' : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ if (res.code == 1) that.getDetail()
|
|
|
})
|
|
|
- tabbarList.push({
|
|
|
- icon: "color-genjin",
|
|
|
- label: "跟进"
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (isAdmin || isLeader || appAuth.update) tabbarList.push({
|
|
|
- icon: "color-bianji",
|
|
|
- label: "编辑"
|
|
|
- })
|
|
|
- if (isAdmin || isLeader || appAuth.startorstop) tabbarList.push({
|
|
|
- icon: "icon-qiyong",
|
|
|
- label: detail.status == '启用' ? '禁用' : '启用'
|
|
|
+ }
|
|
|
})
|
|
|
- if ((isAdmin || isLeader || appAuth.delete) && detail.status == '禁用') tabbarList.push({
|
|
|
- icon: "icon-shanchu",
|
|
|
- label: "作废"
|
|
|
+ break;
|
|
|
+ case "禁用":
|
|
|
+ wx.showModal({
|
|
|
+ content: "是否确定禁用该经销商?",
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_agentsids": [data.sa_agentsid],
|
|
|
+ "status": "禁用"
|
|
|
+ },
|
|
|
+ "id": "20230212101703",
|
|
|
+ }).then(res => {
|
|
|
+ console.log("启用经销商", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code == 1 ? '禁用成功' : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ if (res.code == 1) that.getDetail()
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
-
|
|
|
- tabsList = tabsList.concat([{
|
|
|
- label: "附件",
|
|
|
- icon: "icon-tabfujian1",
|
|
|
- model: "#Files"
|
|
|
- }, {
|
|
|
- label: "操作",
|
|
|
- icon: "icon-tabcaozuojilu1",
|
|
|
- model: "#Record"
|
|
|
- }])
|
|
|
- if (this.data.appAuth.options.find(v => v == 'viewRepetition')) tabbarList.push({
|
|
|
- icon: "icon-a-shouyejingangquhehuoren",
|
|
|
- label: "查看重复"
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- tabbarList,
|
|
|
- isLeader,
|
|
|
- tabsList
|
|
|
+ break;
|
|
|
+ case "作废":
|
|
|
+ that.setData({
|
|
|
+ deletereasonShow: true
|
|
|
})
|
|
|
- },
|
|
|
- //tabs 切换
|
|
|
- tabsChange({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- this.setData({
|
|
|
- tabsActive: detail
|
|
|
- });
|
|
|
- this.partialRenewal();
|
|
|
- },
|
|
|
- //局部数据更新 tabs
|
|
|
- partialRenewal(init = false) {
|
|
|
- try {
|
|
|
- let model = this.data.tabsList[this.data.tabsActive].model;
|
|
|
- if (model) {
|
|
|
- let Component = this.selectComponent(model),
|
|
|
- {
|
|
|
- total,
|
|
|
- pageNumber,
|
|
|
- pageTotal
|
|
|
- } = Component.data.content,
|
|
|
- id = model == "#Address" ? this.data.detail.sys_enterpriseid : this.data.detail.sa_agentsid;
|
|
|
- if (model == "#Files") init = true;
|
|
|
- if (total == null || init) {
|
|
|
- Component.getList(id, init);
|
|
|
- } else if (pageNumber <= pageTotal) {
|
|
|
- Component.getList(id, false);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
+ break;
|
|
|
+ case "跟进":
|
|
|
+ that.selectComponent("#Trace").toAdd()
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ console.log(detail)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 底部功能 */
|
|
|
+ async setTabbar() {
|
|
|
+ let detail = this.data.detail,
|
|
|
+ isAdmin = wx.getStorageSync("userMsg").usertype == 0,
|
|
|
+ isLeader = false,
|
|
|
+ editdataleader = isLeader ? 1 : 0,
|
|
|
+ tabbarList = [],
|
|
|
+ appAuth = this.data.appAuth,
|
|
|
+ tabsList = [{
|
|
|
+ label: "详细信息",
|
|
|
+ icon: "icon-tabxiangxixinxi1"
|
|
|
+ }, {
|
|
|
+ label: "授权业务员",
|
|
|
+ icon: "icon-shouquanyewuyuan",
|
|
|
+ model: "#Salesperson"
|
|
|
+ }, {
|
|
|
+ label: "科室",
|
|
|
+ icon: "icon-keshi",
|
|
|
+ model: "#Department"
|
|
|
+ }, {
|
|
|
+ label: "医院",
|
|
|
+ icon: "icon-jingxiaoshang",
|
|
|
+ model: "#Hospital"
|
|
|
+ }, {
|
|
|
+ label: "合同",
|
|
|
+ icon: "icon-tabhetong",
|
|
|
+ model: "#Contract"
|
|
|
+ }, {
|
|
|
+ label: "地址管理",
|
|
|
+ icon: "icon-tabdizhi",
|
|
|
+ model: "#Address"
|
|
|
+ }];
|
|
|
+ if (!isLeader) {
|
|
|
+ let res = await getApp().agentOrNot("sa_agents", this.data.sa_agentsid),
|
|
|
+ data = res.code == '1' ? res.data : {
|
|
|
+ editable: 0,
|
|
|
+ editdataleader: 0
|
|
|
+ }
|
|
|
+ if (appAuth.isdatateam) isLeader = this.selectComponent("#Group").data.editable == 1;
|
|
|
+ if (!isLeader) isLeader = data.editable == 1;
|
|
|
+ editdataleader = data.editdataleader;
|
|
|
+ }
|
|
|
+ if (appAuth.isdatafollowup) {
|
|
|
+ tabsList.unshift({
|
|
|
+ label: "跟进动态",
|
|
|
+ icon: "icon-tabgenjinjilu",
|
|
|
+ model: "#Trace"
|
|
|
+ })
|
|
|
+ tabbarList.push({
|
|
|
+ icon: "color-genjin",
|
|
|
+ label: "跟进"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (isAdmin || isLeader || appAuth.update) tabbarList.push({
|
|
|
+ icon: "color-bianji",
|
|
|
+ label: "编辑"
|
|
|
+ })
|
|
|
+ if (isAdmin || isLeader || appAuth.startorstop) tabbarList.push({
|
|
|
+ icon: "icon-qiyong",
|
|
|
+ label: detail.status == '启用' ? '禁用' : '启用'
|
|
|
+ })
|
|
|
+ if ((isAdmin || isLeader || appAuth.delete) && detail.status == '禁用') tabbarList.push({
|
|
|
+ icon: "icon-shanchu",
|
|
|
+ label: "作废"
|
|
|
+ })
|
|
|
|
|
|
+ tabsList = tabsList.concat([{
|
|
|
+ label: "附件",
|
|
|
+ icon: "icon-tabfujian1",
|
|
|
+ model: "#Files"
|
|
|
+ }, {
|
|
|
+ label: "操作",
|
|
|
+ icon: "icon-tabcaozuojilu1",
|
|
|
+ model: "#Record"
|
|
|
+ }])
|
|
|
+ if (this.data.appAuth.options.find(v => v == 'viewRepetition')) tabbarList.push({
|
|
|
+ icon: "icon-a-shouyejingangquhehuoren",
|
|
|
+ label: "查看重复"
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ tabbarList,
|
|
|
+ isLeader,
|
|
|
+ tabsList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //tabs 切换
|
|
|
+ tabsChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ tabsActive: detail
|
|
|
+ });
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ //局部数据更新 tabs
|
|
|
+ partialRenewal(init = false) {
|
|
|
+ try {
|
|
|
+ let model = this.data.tabsList[this.data.tabsActive].model;
|
|
|
+ if (model) {
|
|
|
+ let Component = this.selectComponent(model),
|
|
|
+ {
|
|
|
+ total,
|
|
|
+ pageNumber,
|
|
|
+ pageTotal
|
|
|
+ } = Component.data.content,
|
|
|
+ id = model == "#Address" ? this.data.detail.sys_enterpriseid : this.data.detail.sa_agentsid;
|
|
|
+ if (model == "#Files") init = true;
|
|
|
+ if (total == null || init) {
|
|
|
+ Component.getList(id, init);
|
|
|
+ } else if (pageNumber <= pageTotal) {
|
|
|
+ Component.getList(id, false);
|
|
|
}
|
|
|
- },
|
|
|
- //更新标签
|
|
|
- getTags() {
|
|
|
- this.selectComponent("#Tags").getTags()
|
|
|
- },
|
|
|
- //更新团队成员
|
|
|
- getGroup() {
|
|
|
- this.selectComponent("#Group").getList().then(this.setTabbarList)
|
|
|
- },
|
|
|
- onReachBottom() {
|
|
|
- this.partialRenewal();
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- getCurrentPages().forEach(page => {
|
|
|
- if (page.__route__ == 'prsx/dealer/index') {
|
|
|
- let content = JSON.parse(JSON.stringify(page.data.content));
|
|
|
- content.pageSize = (content.pageNumber - 1) * content.pageSize;
|
|
|
- content.pageNumber = 1;
|
|
|
- _Http.basic({
|
|
|
- id: '20221011144903',
|
|
|
- content
|
|
|
- }).then(res => {
|
|
|
- console.log("更新列表", res);
|
|
|
- if (res.code == '1') {
|
|
|
- page.setData({
|
|
|
- list: res.data,
|
|
|
- "content.total": res.total
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- let page1 = page.selectComponent("#Dealer");
|
|
|
- if (page1) page1.getList("", true)
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+
|
|
|
}
|
|
|
+ },
|
|
|
+ //更新标签
|
|
|
+ getTags() {
|
|
|
+ this.selectComponent("#Tags").getTags()
|
|
|
+ },
|
|
|
+ //更新团队成员
|
|
|
+ getGroup() {
|
|
|
+ this.selectComponent("#Group").getList().then(this.setTabbarList)
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ this.partialRenewal();
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ getCurrentPages().forEach(page => {
|
|
|
+ if (page.__route__ == 'prsx/dealer/index') {
|
|
|
+ let content = JSON.parse(JSON.stringify(page.data.content));
|
|
|
+ content.pageSize = (content.pageNumber - 1) * content.pageSize;
|
|
|
+ content.pageNumber = 1;
|
|
|
+ _Http.basic({
|
|
|
+ id: '20221011144903',
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("更新列表", res);
|
|
|
+ if (res.code == '1') {
|
|
|
+ page.setData({
|
|
|
+ list: res.data,
|
|
|
+ "content.total": res.total
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let page1 = page.selectComponent("#Dealer");
|
|
|
+ if (page1) page1.getList("", true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|