Browse Source

客户 公海客户 添加项目商机

zhaoxiaohai 3 years ago
parent
commit
5b4d9a69b3

+ 36 - 1
packageA/opponent/modules/list/index.js

@@ -1,9 +1,44 @@
+let _Http = getApp().globalData.http;
 Component({
     properties: {
         list: Array,
-        detele: Boolean
+        detele: Boolean,
+        edit: Boolean
     },
     options: {
         addGlobalClass: true
+    },
+    methods: {
+        handleItem(e) {
+            let {
+                item
+            } = e.currentTarget.dataset;
+            console.log(item)
+            wx.showModal({
+                title: '提示',
+                content: item.important ? `是否设置${item.enterprisename}为主要威胁?` : `是否取消设置${item.enterprisename}为主要威胁?`,
+                complete: (res) => {
+                    if (res.confirm) {
+                        item.important = item.important == 0 ? 1 : 0;
+                        _Http.basic({
+                            id: "20221019165802",
+                            content: item
+                        }).then(res => {
+                            wx.showToast({
+                                title: res.msg == '成功' ? "设置成功" : res.msg,
+                                icon: "none"
+                            });
+                            let page = getCurrentPages()[getCurrentPages().length - 1].selectComponent("#Opponent");
+                            if (page) {
+                                let i = page.data.list.findIndex(v => v.sa_competitorid == item.sa_competitorid);
+                                if (i != -1) page.setData({
+                                    [`list[${i}]`]: item
+                                });
+                            }
+                        })
+                    }
+                }
+            })
+        }
     }
 })

+ 26 - 1
packageA/opponent/modules/list/index.scss

@@ -80,10 +80,35 @@
             flex-shrink: 0;
         }
     }
+
+    .editor {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        width: 100%;
+        height: 80rpx;
+    
+        .icon-but {
+            padding-right: 30rpx;
+    
+            navigator {
+                display: inline-block;
+                width: 60rpx;
+                height: 60rpx;
+                line-height: 60rpx;
+                text-align: center;
+                margin-left: 30rpx;
+                width: 32px;
+                color: #707070;
+            }
+        }
+        margin-bottom: 15rpx;
+    }
 }
 
 .line-1 {
     overflow: hidden;
     white-space: nowrap;
     text-overflow: ellipsis;
-}
+}
+

+ 7 - 0
packageA/opponent/modules/list/index.wxml

@@ -6,6 +6,7 @@
         <view class="mian">
             <view class="label line-1">{{item.enterprisename}}</view>
             <view class="tag-box">
+                <van-tag custom-class='tag' wx:if="{{item.important == 1 && edit}}" wx:for-item='tag' color='#FA8C16' text-color='#fff' round>主要威胁</van-tag>
                 <van-tag custom-class='tag' wx:if="{{item.type}}" wx:for-item='tag' color='#FA8C16' text-color='#fff' round>{{item.type}}</van-tag>
                 <van-tag custom-class='tag' wx:for="{{item.tags.systemtag}}" wx:for-item='tag' color='#FA8C16' text-color='#fff' round>{{tag}}</van-tag>
                 <van-tag custom-class='tag' wx:for="{{item.tags.datatag}}" wx:for-item='tag' color='#FAAB16' text-color='#fff' round>{{tag}}</van-tag>
@@ -15,6 +16,12 @@
             <van-icon name="arrow" />
         </view>
     </navigator>
+    <view class="editor" wx:if="{{edit}}">
+        <view />
+        <view class="icon-but">
+            <navigator url="#" style="width: 230rpx; font-size: 26rpx;text-align: right;" data-item="{{item}}" bindtap="handleItem">{{item.important==0?'设置为主要威胁':'取消主要威胁'}}</navigator>
+        </view>
+    </view>
 </view>
 
 <My_empty wx:if="{{!list.length}}" />

+ 1 - 1
packageA/project/modules/opponent/index.wxml

@@ -8,4 +8,4 @@
         </navigator>
     </view>
 </view>
-<List list='{{list}}' detele />
+<List list='{{list}}' edit detele />

+ 6 - 0
packageA/publicCustomer/detail.js

@@ -12,6 +12,9 @@ Page({
         }, {
             label: "线索",
             num: 132
+        }, {
+            label: "项目商机",
+            num: 132
         }, {
             label: "跟进动态",
             num: 132
@@ -352,6 +355,9 @@ Page({
             case "跟进动态":
                 model = "#Trace"
                 break;
+            case "项目商机":
+                model = "#Project"
+                break;
             case "线索":
                 id = this.data.detail.sa_customersid;
                 model = "#Clue"

+ 2 - 1
packageA/publicCustomer/detail.json

@@ -8,7 +8,8 @@
         "Financing": "../setclient/modules/financing/index",
         "Offers": "../setclient/modules/offers/index",
         "Clue": "../setclient/modules/clue/index",
-        "Work": "/packageA/public/work/index"
+        "Work": "/packageA/public/work/index",
+        "Project": "/packageA/setclient/modules/project/index"
     },
     "navigationBarTitleText": "客户详情"
 }

+ 1 - 0
packageA/publicCustomer/detail.wxml

@@ -21,6 +21,7 @@
     <Trace slot='跟进动态' id='Trace' ownertable='sa_customers' ownerid='{{detail.sa_customersid}}' />
     <Preview slot='详细信息' list1='{{list1}}' list2='{{list2}}' />
     <Work slot='任务' id='Work' ownertable='sa_customers' ownerid='{{detail.sa_customersid}}' disabled="{{isAdmin||isLeader}}" />
+    <Project slot='项目商机' id="Project" />
     <Clue slot='线索' id='Clue' disabled="{{per.query(options,'clue')||isAdmin||isLeader}}" />
     <Address slot='客户地址' id='Address' disabled="{{per.query(options,'address')||isAdmin||isLeader}}" />
     <Contacts slot='联系人' id='Contacts' disabled="{{per.query(options,'contact')||isAdmin||isLeader}}" />

+ 6 - 1
packageA/setclient/detail.js

@@ -15,6 +15,9 @@ Page({
         }, {
             label: "线索",
             num: 132
+        }, {
+            label: "项目商机",
+            num: 132
         }, {
             label: "客户地址",
             num: 132
@@ -397,6 +400,9 @@ Page({
             case "跟进动态":
                 model = "#Trace"
                 break;
+            case "项目商机":
+                model = "#Project"
+                break;
             case "线索":
                 id = this.data.detail.sa_customersid;
                 model = "#Clue"
@@ -433,7 +439,6 @@ Page({
                 Component.getList(id, false);
             } else {
                 //用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据
-
             }
         }
     },

+ 2 - 1
packageA/setclient/detail.json

@@ -8,7 +8,8 @@
         "Financing": "./modules/financing/index",
         "Offers": "./modules/offers/index",
         "Clue": "./modules/clue/index",
-        "Work": "/packageA/public/work/index"
+        "Work": "/packageA/public/work/index",
+        "Project": "./modules/project/index"
     },
     "navigationBarTitleText": "客户详情"
 }

+ 1 - 0
packageA/setclient/detail.wxml

@@ -23,6 +23,7 @@
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
     <Trace slot='跟进动态' id='Trace' ownertable='sa_customers' ownerid='{{detail.sa_customersid}}' />
     <Work slot='任务' id='Work' ownertable='sa_customers' ownerid='{{detail.sa_customersid}}' disabled="{{isAdmin||isLeader}}" />
+    <Project slot='项目商机' id="Project" />
     <Preview slot='详细信息' list1='{{list1}}' list2='{{list2}}' />
     <Clue slot='线索' id='Clue' disabled="{{false}}" />
     <!-- {{per.query(options,'clue')||isAdmin||isLeader}} -->

+ 45 - 0
packageA/setclient/modules/project/index.js

@@ -0,0 +1,45 @@
+const _Http = getApp().globalData.http;
+Component({
+    properties: {
+        disabled: Boolean
+    },
+    data: {
+        list: [],
+        sys_enterpriseid: "",
+        "content": {
+            "nocache": true,
+            "pageNumber": 1,
+            "pageTotal": 1,
+            "total": null,
+            "type": 1,
+            "where": {
+                "condition": ""
+            }
+        }
+    },
+    methods: {
+        getList(id, init) {
+            let content = this.data.content;
+            content.sys_enterpriseid = id;
+            if (init) content.pageNumber = 1
+            _Http.basic({
+                "id": "20221018102003",
+                content
+            }).then(res => {
+                console.log("项目商机", res)
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                })
+                this.setData({
+                    list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                    "content.pageNumber": res.pageNumber + 1,
+                    "content.pageSize": res.pageSize,
+                    "content.pageTotal": res.pageTotal,
+                    "content.total": res.total,
+                    sys_enterpriseid: id
+                });
+            })
+        }
+    }
+})

+ 6 - 0
packageA/setclient/modules/project/index.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "List": "../../../project/modules/list/index"
+    }
+}

+ 1 - 0
packageA/setclient/modules/project/index.scss

@@ -0,0 +1 @@
+@import "../address/head.scss";

+ 14 - 0
packageA/setclient/modules/project/index.wxml

@@ -0,0 +1,14 @@
+<view class="head">
+    <view class="count">
+        总共{{content.total}}个
+    </view>
+    <view class="expand">
+        <!-- <navigator url="#" class="but" bindtap="toSearch">
+            <van-icon name="search" />
+        </navigator> -->
+        <navigator url="#" wx:if="{{disabled}}" class="but" bindtap="addOffers">
+            <van-icon name="plus" />
+        </navigator>
+    </view>
+</view>
+<List list='{{list}}' />

+ 1 - 1
packageA/target/addProject.js

@@ -31,7 +31,7 @@ Page({
                 loading: false
             });
             if (res.msg != '成功') return wx.showToast({
-                title: res.data,
+                title: res.msg,
                 icon: "none"
             });
             this.setData({