zhaoxiaohai il y a 3 ans
Parent
commit
0d6482f6cf

+ 50 - 21
packageA/project/addAndEdit.js

@@ -3,6 +3,9 @@ let _Http = getApp().globalData.http,
 
 Page({
     data: {
+        repetitionShow: false,
+        repetitionList: [],
+        isSubmit: false,
         "sa_projectid": 0,
         showAll: false,
         form: [{
@@ -189,8 +192,28 @@ Page({
                 title: `查询到${res.total}条疑似重复项目信息`,
                 icon: "none"
             })
+            this.setData({
+                repetitionShow: true,
+                repetitionList: res.data
+            })
         }
     },
+    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
+        })
+    },
     /* 处理查重 */
     handleQueryRepetition(content) {
         return _Http.basic({
@@ -200,29 +223,34 @@ Page({
     },
     async submit() {
         let data = this.selectComponent("#Form").submit();
-        if (data.region.length != 0) {
-            data.province = data.region[0]
-            data.city = data.region[1]
-            data.county = data.region[2]
-        };
-        delete(data.region);
-
         let query = await this.handleQueryRepetition({
             sa_projectid: this.data.sa_projectid,
             projectname: data.projectname,
             address: data.address
         });
-        if (query.total != 0) await new Promise((resolve, reject) => {
-            wx.showModal({
-                title: '提示',
-                content: `查询到${query.total}条疑似重复项目信息 是否确认继续新建`,
-                complete: (res) => {
-                    if (res.cancel) reject()
-                    if (res.confirm) resolve(true);
-                }
-            })
-        })
 
+        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 data = this.selectComponent("#Form").submit();
+        if (data.region.length != 0) {
+            data.province = data.region[0]
+            data.city = data.region[1]
+            data.county = data.region[2]
+        };
+        delete(data.region);
         _Http.basic({
             "id": 20221020144202,
             "content": {
@@ -230,7 +258,7 @@ Page({
                 ...data
             }
         }).then(res => {
-            console.log("新建客户", res)
+            console.log("新建项目", res)
             if (res.msg != '成功') return wx.showToast({
                 title: res.msg,
                 icon: "none"
@@ -241,7 +269,7 @@ Page({
             })
 
             //绑定疑似重复标签
-            if (query.total != 0) _Http.basic({
+            if (tag) _Http.basic({
                 "id": 20220929090901,
                 "content": {
                     "ownertable": "sa_project",
@@ -273,7 +301,8 @@ Page({
                         url: '/packageA/project/detail?sa_projectid=' + res.data.sa_projectid,
                     })
                 }
-            }, query.total != 0 ? 300 : 500)
+            }, tag ? 500 : 300)
         })
-    },
+    }
+
 })

+ 49 - 0
packageA/project/addAndEdit.scss

@@ -26,4 +26,53 @@
         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;
+        }
+    }
 }

+ 15 - 1
packageA/project/addAndEdit.wxml

@@ -4,4 +4,18 @@
 <view class="new-footer" style="padding-bottom: 12rpx;">
     <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="{{ 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.sa_projectid">
+        <view class="enterprise_title">{{item.projectname}}</view>
+        <view class="exp">创建人:{{item.name}}</view>
+        <view class="exp">地址:{{item.address}}</view>
+    </navigator>
+</van-popup>

+ 0 - 2
packageA/publicCustomer/addAndEditor.js

@@ -3,7 +3,6 @@ let _Http = getApp().globalData.http,
 
 Page({
     data: {
-        queryShow: false,
         queryShow: false,
         repetitionShow: false,
         repetitionList: [],
@@ -345,7 +344,6 @@ Page({
     async submit() {
         let data = this.selectComponent("#Form").submit();
 
-
         let query = await this.handleQueryRepetition({
             sa_customersid: this.data.content.sa_customersid,
             enterprisename: data.enterprisename,