|
|
@@ -0,0 +1,339 @@
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ tabsActive: 0, //tabs 选中项
|
|
|
+ sat_campaignid: "",
|
|
|
+ detail:'',
|
|
|
+ tabsList: [{
|
|
|
+ label: "详细信息",
|
|
|
+ num: 132
|
|
|
+ }, {
|
|
|
+ label: "活动线索",
|
|
|
+ num: 132
|
|
|
+ }, {
|
|
|
+ label: "操作",
|
|
|
+ num: 132
|
|
|
+ }, {
|
|
|
+ label: "跟进动态",
|
|
|
+ num: 132
|
|
|
+ }],
|
|
|
+ tabbarList: [{
|
|
|
+ icon: "icon-bianji",
|
|
|
+ label: "编辑"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-chengjiao",
|
|
|
+ label: "发布"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-jieshu",
|
|
|
+ label: "结束"
|
|
|
+ },{
|
|
|
+ icon: "icon-zhuanyi",
|
|
|
+ label: "更换负责人"
|
|
|
+ }],
|
|
|
+ oldtabbarList: [{
|
|
|
+ icon: "icon-bianji",
|
|
|
+ label: "编辑"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-chengjiao",
|
|
|
+ label: "发布"
|
|
|
+ }, {
|
|
|
+ icon: "icon-dibu-jieshu",
|
|
|
+ label: "结束"
|
|
|
+ },{
|
|
|
+ icon: "icon-zhuanyi",
|
|
|
+ label: "更换负责人"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.setData({
|
|
|
+ sat_campaignid: options.sat_campaignid
|
|
|
+ });
|
|
|
+ this.getDetail();
|
|
|
+ },
|
|
|
+ getDetail() {
|
|
|
+ console.log(111);
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "webmanage.saletool.orderclue.ordercluecampaign",
|
|
|
+ "method": "queryCampaignMain",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "nocache":true,
|
|
|
+ "sat_campaignid": this.data.sat_campaignid
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("市场活动详情", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ detail: res.data,
|
|
|
+ briefs: [{
|
|
|
+ label: "市场活动名称",
|
|
|
+ value: res.data.name
|
|
|
+ }, {
|
|
|
+ label: "活动类型",
|
|
|
+ value: res.data.type
|
|
|
+ }, {
|
|
|
+ label: "线索数",
|
|
|
+ value: res.data.ordercluecount||'0'
|
|
|
+ }, {
|
|
|
+ label: "负责人",
|
|
|
+ value: res.data.director
|
|
|
+ }, {
|
|
|
+ label: "状态",
|
|
|
+ value: res.data.status
|
|
|
+ }],
|
|
|
+ list1: [{
|
|
|
+ label: "市场活动名称",
|
|
|
+ value: res.data.name
|
|
|
+ }, {
|
|
|
+ label: "活动类型",
|
|
|
+ value: res.data.type
|
|
|
+ }, {
|
|
|
+ label: "线索数",
|
|
|
+ value: res.data.ordercluecount||'0'
|
|
|
+ }, {
|
|
|
+ label: "活动地点",
|
|
|
+ value: res.data.address
|
|
|
+ }, {
|
|
|
+ label: "状态",
|
|
|
+ value: res.data.status
|
|
|
+ }, {
|
|
|
+ label: "开始时间",
|
|
|
+ value: res.data.begdate
|
|
|
+ }, {
|
|
|
+ label: "结束时间",
|
|
|
+ value: res.data.enddate
|
|
|
+ }, {
|
|
|
+ label: "负责人",
|
|
|
+ value: res.data.director
|
|
|
+ }],
|
|
|
+ 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.changeby
|
|
|
+ }, {
|
|
|
+ label: "发布时间",
|
|
|
+ value: res.data.followdate
|
|
|
+ }, {
|
|
|
+ label: "结束人",
|
|
|
+ value: res.data.followdate
|
|
|
+ }],
|
|
|
+ tabsList: this.data.tabsList,
|
|
|
+ 'tabbarList[1].label':res.data.status == '新建' ? '发布' : '取消发布'
|
|
|
+ });
|
|
|
+ let arr = this.data.oldtabbarList
|
|
|
+ if(res.data.status == '结束') {
|
|
|
+ arr = this.data.tabbarList.filter(item => item.label == '结束')
|
|
|
+ } else if (res.data.status == '发布') {
|
|
|
+ arr = this.data.tabbarList.filter(item => item.label != '编辑')
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ tabbarList: arr
|
|
|
+ })
|
|
|
+ this.getTags();
|
|
|
+ this.getGroup();
|
|
|
+ this.partialRenewal();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //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_campaignid;
|
|
|
+ let model = '';
|
|
|
+ let name = this.data.tabsList[this.data.tabsActive].label;
|
|
|
+ switch (name) {
|
|
|
+ case "活动线索":
|
|
|
+ model = "#clue"
|
|
|
+ break;
|
|
|
+ case "操作":
|
|
|
+ model = "#hadnle"
|
|
|
+ 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/activity/addActivity?rowData=${JSON.stringify(this.data.detail)}`,
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "发布":
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认发布该市场活动?`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "classname":"webmanage.saletool.orderclue.ordercluecampaign",
|
|
|
+ method:'release',
|
|
|
+ "content": {
|
|
|
+ "sat_campaignids": [this.data.detail.sat_campaignid]
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? `已发布该活动` : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ this.getDetail()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "结束":
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认结束该市场活动?`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "classname":"webmanage.saletool.orderclue.ordercluecampaign",
|
|
|
+ method:'endcampaign',
|
|
|
+ "content": {
|
|
|
+ "sat_campaignids": [this.data.detail.sat_campaignid]
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? `已结束该活动` : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ this.getDetail()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "取消发布":
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认取消发布该市场活动?`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "classname":"webmanage.saletool.orderclue.ordercluecampaign",
|
|
|
+ method:"undercarriage",
|
|
|
+ "content": {
|
|
|
+ "sat_campaignids": [this.data.detail.sat_campaignid]
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? `已取消该活动` : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ this.getDetail()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "更换负责人":
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/packageA/group/select?data=${JSON.stringify({
|
|
|
+ ownertable:"sat_campaign",
|
|
|
+ ownerid:data.sat_campaignid,
|
|
|
+ })}&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_campaign",
|
|
|
+ ownerid: that.data.detail.sat_campaignid,
|
|
|
+ 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() {}
|
|
|
+})
|