zhaoxiaohai 3 年 前
コミット
b1efeddb51

+ 14 - 1
packageA/project/addAndEdit.js

@@ -106,7 +106,7 @@ Page({
             let data = JSON.parse(options.data);
             this.setData({
                 disabled: false,
-                sa_projectid: data.sa_customersid,
+                sa_projectid: data.sa_projectid,
                 form: this.data.form.map(v => {
                     if (v.valueName != 'region') {
                         v.value = data[v.valueName];
@@ -162,6 +162,19 @@ Page({
                 wx.navigateBack()
                 getCurrentPages().forEach(v => {
                     if (v.getList) v.getList(true);
+                    if (['packageA/project/index', 'packageA/project/search'].includes(v.__route__)) {
+                        if (this.data.sa_projectid == 0) {
+                            v.data.list.push(res.data)
+                        } else {
+                            let i = v.data.list.findIndex(value => value.sa_projectid == this.data.sa_projectid);
+                            if (i != -1) v.data.list[i] = res.data;
+                        }
+                        v.setData({
+                            list: v.data.list
+                        })
+                    } else if (v.__route__ == 'packageA/project/detail') {
+                        v.getDetail();
+                    }
                 })
                 if (this.data.sa_projectid == 0) {
                     wx.navigateTo({

+ 114 - 2
packageA/project/detail.js

@@ -1,7 +1,7 @@
 const _Http = getApp().globalData.http;
 Page({
     data: {
-        tabsActive: 3, //tabs 选中项
+        tabsActive: 0, //tabs 选中项
         sa_projectid: "",
         tabsList: [{
             label: "详细信息",
@@ -19,6 +19,22 @@ Page({
             label: "联系人",
             num: 132
         }],
+        tabbarList: [{
+            icon: "icon-genjin",
+            label: "报备"
+        }, {
+            icon: "icon-genjin",
+            label: "跟进"
+        }, {
+            icon: "icon-bianji",
+            label: "编辑"
+        }, {
+            icon: "icon-zhuanyi",
+            label: "更换负责人"
+        }, {
+            icon: "icon-shanchu",
+            label: "作废"
+        }],
     },
     onLoad(options) {
         this.setData({
@@ -142,7 +158,7 @@ Page({
             })
             //更新列表赢率
             getCurrentPages().forEach(v => {
-                if (v.getList) {
+                if (v.__route__ == 'packageA/project/index') {
                     let i = v.data.list.findIndex(e => e.sa_projectid == this.data.sa_projectid);
                     if (i != -1) v.setData({
                         [`list[${i}].winrate`]: parseFloat(res.data.winrate.substring(0, res.data.winrate.length - 1))
@@ -186,6 +202,9 @@ Page({
             case "关联客户":
                 model = "#Treaty"
                 break;
+            case "联系人":
+                model = "#Contacts"
+                break;
         };
         if (model) {
             // 确定好模块ID total = null 是第一次加载 加载数据
@@ -208,6 +227,99 @@ Page({
     onReachBottom() {
         this.partialRenewal();
     },
+    //详情按钮回调
+    tabbarOnClick({
+        detail
+    }) {
+        let data = this.data.detail;
+        switch (detail.label) {
+            case "跟进":
+                wx.navigateTo({
+                    url: `/packageA/setclient/modules/trace/add/index?ownertable=sa_project&ownerid=${data.sa_projectid}`,
+                })
+                break;
+            case "编辑":
+                wx.navigateTo({
+                    url: `/packageA/project/addAndEdit?data=${JSON.stringify(data)}`,
+                })
+                break;
+            case "作废":
+                wx.navigateTo({
+                    url: `/packageA/project/delete?id=${this.data.detail.sa_projectid}`,
+                })
+                break;
+            case "更换负责人":
+                wx.navigateTo({
+                    url: `/packageA/group/select?data=${JSON.stringify({
+                             ownertable:"sa_project",
+                             ownerid:data.sa_projectid,
+                        })}&radio=true&principal=true`,
+                })
+                break;
+            case "报备":
+                console.log(detail)
+                _Http.basic({
+                    "id": 20221114163402,
+                    "content": {
+                        "sa_projectid": data.sa_projectid,
+                        "tag": "报备中"
+                    }
+                }).then(res => {
+                    if (res.msg != '成功') return wx.showToast({
+                        title: res.data,
+                        icon: "none"
+                    });
+                    this.getTags();
+                    setTimeout(() => {
+                        wx.showToast({
+                            title: '已提交报备!',
+                            icon: "none"
+                        })
+                    }, 200)
+                })
+                break;
+            default:
+                console.log(detail)
+                break;
+        }
+    },
+    /* 更换负责人 */
+    handelSubmit(arr) {
+        const that = this;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认更换负责人',
+            complete: ({
+                confirm
+            }) => {
+                if (confirm) _Http.basic({
+                    "id": 20220930103701,
+                    "content": {
+                        ownertable: "sa_project",
+                        ownerid: that.data.detail.sa_projectid,
+                        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();
+                        getCurrentPages().forEach(v => {
+                            if (['packageA/project/index'].includes(v.__route__)) v.getList(true)
+                        })
+                        wx.navigateBack();
+                    }, 300)
+                })
+            }
+        })
+    },
     onShareAppMessage() {
 
     }

+ 4 - 1
packageA/project/detail.wxml

@@ -15,4 +15,7 @@
     <Treaty slot='关联客户' id='Treaty' />
     <Contacts slot='联系人' id='Contacts' />
     <view style="height: 140rpx;" />
-</Yl_FunTabs>
+</Yl_FunTabs>
+
+<!-- 底部 -->
+<Yl_Tabbar list='{{tabbarList}}' bind:callback="tabbarOnClick" />

+ 1 - 0
packageA/project/index.js

@@ -43,6 +43,7 @@ Page({
             }
         ],
         content: {
+            nocache: true,
             "type": 0,
             "pageNumber": 1,
             "pageSize": 20,

+ 2 - 1
packageA/project/modules/task/index.js

@@ -30,7 +30,8 @@ Component({
                 });
                 const list = res.data.map(v => {
                         v.finish = v.work.filter(e => e.finished == 1).length;
-                        v.progress = v.finish / v.work.length * 100;
+
+                        v.progress = v.finish == 0 ? 0 : v.finish / v.work.length * 100;
                         return v
                     }),
                     active = res.data.findIndex(v => v.active == 1);

+ 4 - 0
packageA/project/search.js

@@ -53,6 +53,10 @@ Page({
                 title: res.data,
                 icon: "none"
             })
+            res.data = res.data.map(v => {
+                v.winrate = parseFloat(v.winrate.substring(0, v.winrate.length - 1));
+                return v
+            })
             this.setData({
                 'content.pageNumber': res.pageNumber + 1,
                 'content.pageTotal': res.pageTotal,