Browse Source

竞争对手修改

zhaoxiaohai 3 years ago
parent
commit
053e112819

+ 1 - 1
packageA/offers/detail.js

@@ -60,7 +60,7 @@ Page({
                 })
             }
             let tabbarList = this.data.tabbarList,
-                isLeader = true;
+                isLeader = res.data.createuserid == wx.getStorageSync('userMsg').userid;
 
             if (this.data.isAdmin) tabbarList = [{
                 icon: "icon-guanlian-fuzhi",

+ 181 - 6
packageA/opponent/add.js

@@ -1,8 +1,12 @@
-const _Http = getApp().globalData.http;
-
+let _Http = getApp().globalData.http,
+    count = null;
 Page({
     data: {
         showAll: false,
+        queryShow: false,
+        repetitionShow: false,
+        repetitionList: [],
+        isSubmit: false,
         form: [{
             label: "企业名称",
             error: false,
@@ -12,6 +16,7 @@ Page({
             placeholder: "企业全称",
             valueName: "enterprisename",
             checking: "base",
+            slot: "info",
             required: true
         }, {
             label: "品牌名称",
@@ -80,6 +85,81 @@ Page({
             })
         }
     },
+    /* 引入 */
+    introduce(e) {
+        let {
+            item
+        } = e.currentTarget.dataset,
+            that = this;
+        wx.showModal({
+            title: '提示',
+            content: `是否确定引入“${item.companyName}”信息`,
+            complete: (res) => {
+                if (res.confirm) {
+                    that.setData({
+                        [`form[0].value`]: item.companyName,
+                        queryShow: false,
+                        queryList: null
+                    })
+                }
+            }
+        })
+    },
+    /* 工商查询 */
+    queryClient(e) {
+        let data = this.selectComponent("#Form").query();
+        this.setData({
+            form: this.data.form.map(v => {
+                v.value = data[v.valueName];
+                return v
+            }),
+        })
+        console.log(this.data.form)
+        if (data.enterprisename == '') return wx.showToast({
+            title: `您还未填写企业名称`,
+            icon: "none"
+        });
+        _Http.basic({
+            id: 20221208103601,
+            content: {
+                pageNumber: 1,
+                pageTotal: 1,
+                pageSize: 5,
+                keyword: data.enterprisename,
+            }
+        }).then(res => {
+            console.log("工商查询", res)
+            if (!res.data[0]) return wx.showToast({
+                title: '未查询到相关企业!',
+                icon: "none"
+            });
+            this.setData({
+                queryList: res.data,
+                queryShow: true
+            })
+        })
+    },
+    onClose() {
+        this.setData({
+            queryShow: false
+        })
+    },
+    repClose() {
+        if (this.data.isSubmit) {
+            let that = this;
+            wx.showModal({
+                title: '提示',
+                content: `是否继续创建`,
+                complete: (res) => {
+                    if (res.confirm) that.handleSubmit(true);
+                }
+            })
+        }
+        this.setData({
+            repetitionShow: false,
+            isSubmit: false
+        })
+    },
     /* 表单必填项是否完成 */
     onConfirm({
         detail
@@ -96,7 +176,91 @@ Page({
             showAll: detail
         })
     },
-    submit() {
+    /* 查询是否重复 */
+    async queryRepetition(e) {
+        let {
+            enterprisename
+        } = this.selectComponent("#Form").query();
+        if (enterprisename == '') return wx.showToast({
+            title: `您还未填写企业名称`,
+            icon: "none"
+        });
+        let res = await this.handleQueryRepetition({
+            sa_customersid: 0,
+            enterprisename,
+            taxno: "",
+            address: ""
+        });
+        console.log("查询重复", res)
+        if (res.msg != '成功') return wx.showToast({
+            title: res.msg,
+            icon: "none"
+        });
+        this.setData({
+            countDown: 6
+        });
+        count = setInterval(() => {
+            let countDown = this.data.countDown;
+            if (countDown == 0) {
+                clearInterval(count);
+                this.setData({
+                    countDown: ""
+                })
+            } else {
+                countDown--;
+                this.setData({
+                    countDown
+                })
+            }
+        }, 1000)
+        if (res.total == 0) {
+            wx.showToast({
+                title: '未查询到疑似重复的客户信息',
+                icon: "none"
+            })
+        } else {
+            wx.showToast({
+                title: `查询到${res.total}条疑似重复客户信息`,
+                icon: "none"
+            })
+            this.setData({
+                repetitionShow: true,
+                repetitionList: res.data
+            })
+        }
+    },
+    /* 处理查重 */
+    handleQueryRepetition(content) {
+        return _Http.basic({
+            "id": 20221208172002,
+            content
+        })
+    },
+    async submit() {
+        let data = this.selectComponent("#Form").submit();
+        let query = await this.handleQueryRepetition({
+            sa_customersid: 0,
+            enterprisename: data.enterprisename,
+            taxno: "",
+            address: ""
+        });
+
+        if (query.total != 0) {
+            wx.showToast({
+                title: `查询到${query.total}条疑似重复信息`,
+                icon: "none"
+            })
+            this.setData({
+                repetitionShow: true,
+                repetitionList: query.data,
+                isSubmit: true
+            })
+        } else {
+            this.handleSubmit();
+        }
+
+    },
+    handleSubmit(tag = false) {
         let content = {
             ...this.data.content,
             ...this.selectComponent("#Form").submit()
@@ -114,18 +278,29 @@ Page({
                 title: '保存成功',
                 icon: "none"
             })
+            //绑定疑似重复标签
+            if (tag) _Http.basic({
+                "id": 20220929090901,
+                "content": {
+                    "ownertable": "sa_competitor",
+                    "ownerid": res.data.sa_competitorid,
+                    "datatag": ["疑似重复"]
+                }
+            })
             setTimeout(() => {
                 let pages = getCurrentPages(),
                     page = pages[pages.length - 2];
                 if (page.__route__ == 'packageA/opponent/index') {
-                    wx.navigateBack();
                     page.getList(true);
+                    wx.redirectTo({
+                        url: './detail?id=' + res.data.sa_competitorid,
+                    })
                 } else if (page.__route__ == 'packageA/opponent/detail') {
                     wx.navigateBack();
                     page.getDetail();
                 }
-            }, 300)
+            }, tag ? 500 : 300)
 
         })
-    },
+    }
 })

+ 3 - 1
packageA/opponent/add.json

@@ -1,4 +1,6 @@
 {
-    "usingComponents": {},
+    "usingComponents": {
+        "information": "../setclient/modules/information/index"
+    },
     "navigationBarTitleText": "设置对手"
 }

+ 55 - 0
packageA/opponent/add.scss

@@ -20,4 +20,59 @@
         color: #FFFFFF;
         margin-right: 30rpx;
     }
+
+    .query {
+        border: 1rpx solid #CCCCCC !important;
+        background-color: #fff !important;
+        color: #666666 !important;
+    }
+}
+
+
+.popup {
+    .title {
+        position: sticky;
+        height: 80rpx;
+        line-height: 80rpx;
+        width: 100%;
+        text-align: center;
+        border-bottom: 1rpx solid #ddd;
+        font-weight: 600;
+        color: #333;
+        top: 0;
+        background-color: #fff;
+
+        .icon {
+            position: absolute;
+            right: 28rpx;
+            top: 22rpx;
+            color: #999;
+        }
+    }
+
+    .enterprise {
+        width: 100%;
+        box-sizing: border-box;
+        padding-left: 30rpx;
+        padding-right: 10rpx;
+        padding-bottom: 10rpx;
+        border-bottom: 1rpx solid #ddd;
+        margin-top: 10rpx;
+
+        &_title {
+            line-height: 40rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Bold, PingFang SC;
+            font-weight: bold;
+            color: #333333;
+        }
+
+        .exp {
+            line-height: 34rpx;
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #666666;
+            margin-top: 8rpx;
+        }
+    }
 }

+ 36 - 2
packageA/opponent/add.wxml

@@ -1,6 +1,40 @@
 <Yl_Headline title='基本信息' type='switch' switchLabel='仅显示必填信息' switch='{{showAll}}' bind:callBack='onChange' />
-<Yl_field id='Form' form='{{form}}' showAll='{{!showAll}}' bind:onConfirm='onConfirm' />
+<Yl_field id='Form' form='{{form}}' showAll='{{!showAll}}' bind:onConfirm='onConfirm'>
+    <view slot='info'>
+        <information catchtap='queryClient' />
+    </view>
+</Yl_field>
 <view style="height: 100rpx;" />
+
 <view class="new-footer">
+    <van-button custom-class='new-submit query' disabled='{{countDown}}' bindclick='queryRepetition'>{{countDown?countDown+'S':"查重"}}</van-button>
     <van-button custom-class='new-submit' disabled='{{disabled}}' bindclick='submit'>提交</van-button>
-</view>
+</view>
+
+<!-- 工商查询 -->
+<van-popup show="{{ queryShow }}" custom-class='popup' round position="bottom" custom-style="height: 100%;" bind:close="onClose">
+    <view class="title">
+        工商查询
+        <van-icon custom-class='icon' size='40rpx' name="cross" bindtap="onClose" />
+    </view>
+    <navigator url="#" class="enterprise" wx:for="{{queryList}}" wx:key="item.ocid" data-item="{{item}}" bindtap="introduce">
+        <view class="enterprise_title">{{item.companyName}}</view>
+        <view class="exp">法人:{{item.legalPerson}} <text style="margin-left: 20rpx;">状态:{{item.bizStatus}}</text></view>
+        <view class="exp">税号:{{item.taxNum}}</view>
+        <!-- <view class="exp">地区:{{item.regProvince + item.regCity+item.regArea}}</view> -->
+        <view class="exp">地址:{{item.address}}</view>
+    </navigator>
+</van-popup>
+
+<!-- 查重 -->
+<van-popup show="{{ repetitionShow }}" custom-class='popup' round position="bottom" custom-style="height: 100%;" bind:close="repClose">
+    <view class="title">
+        查重
+        <van-icon custom-class='icon' size='40rpx' name="cross" bindtap="repClose" />
+    </view>
+    <navigator url="#" class="enterprise" wx:for="{{repetitionList}}" wx:key="item.sys_enterpriseid">
+        <view class="enterprise_title">{{item.enterprisename}}</view>
+        <view class="exp">税号:{{item.taxno}}</view>
+        <view class="exp">地址:{{item.address}}</view>
+    </navigator>
+</van-popup>

+ 2 - 2
packageA/opponent/detail.js

@@ -12,7 +12,7 @@ Page({
             label: "详细信息",
             num: 132
         }, {
-            label: "项目商机",
+            label: "参与项目",
             num: 132
         }, {
             label: "跟进动态",
@@ -153,7 +153,7 @@ Page({
         let model = '';
         let name = this.data.tabsList[this.data.tabsActive].label;
         switch (name) {
-            case "项目商机":
+            case "参与项目":
                 model = "#Project"
                 break;
             case "跟进动态":

+ 1 - 1
packageA/opponent/detail.wxml

@@ -19,7 +19,7 @@
 <!-- 功能 -->
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
     <Preview slot='详细信息' list1='{{list1}}' list2='{{list2}}' />
-    <Project slot='项目商机' id='Project' />
+    <Project slot='参与项目' id='Project' />
     <Trace slot='跟进动态' id='Trace' ownertable='sa_competitor' ownerid='{{detail.sa_competitorid}}' />
     <Record slot='操作记录' id="Record" ownertable='sa_competitor' ownerid='{{detail.sa_competitorid}}' />
     <Files slot='附件' id="Files" ownertable='sa_competitor' ownerid='{{detail.sa_competitorid}}' />

+ 8 - 4
packageA/opponent/index.js

@@ -33,10 +33,6 @@ Page({
         },
         filter: {
             show: false,
-            type: ['普通报价', '项目报价'], //状态项
-            typeActive: "",
-            status: ['新建', '提交', '审核'], //状态项
-            statusActive: "",
             startdate: "",
             enddate: ""
         }
@@ -109,6 +105,14 @@ Page({
     onReady() {
         this.setListHeight();
     },
+    /* 筛选日期范围 */
+    changeDate(e) {
+        const name = e.currentTarget.dataset.name,
+            value = e.detail.value;
+        this.setData({
+            [`filter.${name}`]: value
+        })
+    },
     setListHeight() {
         getHeight.getHeight('.total', this).then(res => {
             if (this.data.listHeight != res)