zhaoxiaohai 3 rokov pred
rodič
commit
0d5425a214
1 zmenil súbory, kde vykonal 49 pridanie a 15 odobranie
  1. 49 15
      pages/threadedTree/modules/insert/insert.js

+ 49 - 15
pages/threadedTree/modules/insert/insert.js

@@ -3,31 +3,60 @@ const deleteMark = require("../../../../utils/deleteMark"),
 let count = null;
 Component({
     properties: {
-        endInsert: {
-            type: Function
+        endInsert: Function,
+        type: String,
+        content: {
+            type: Object,
+            value: {
+                "sat_orderclueid": 0,
+                "name": "",
+                "phonenumber": "",
+                "province": "",
+                "city": "",
+                "county": "",
+                "address": "",
+                "notes": "",
+                "cluesource": ""
+            },
         }
     },
     data: {
         region: ['', '', ''], //省市县选择
-        "content": {
-            "sat_orderclueid": 0,
-            "name": "",
-            "phonenumber": "",
-            "province": "",
-            "city": "",
-            "county": "",
-            "address": "",
-            "notes": "",
-            "cluesource": ""
-        },
         disabled: true,
         loading: false
     },
+    lifetimes: {
+        ready: function () {
+            this.isDisabled();
+        }
+    },
     methods: {
+        initData() {
+            let content = this.data.content;
+            for (let i in content) {
+                if (content[i] == '-') content[i] = ""
+            };
+            this.setData({
+                content
+            })
+        },
         /* 提交 */
         submit() {
             if (this.data.disabled || this.data.loading) return;
             if (!deleteMark.CheckPhoneNumber(this.data.content.phonenumber)) return;
+            const that = this;
+            if (this.data.type == '新建线索') return this.handleEdit();
+            wx.showModal({
+                title: "提示",
+                content: "是否确认本次修改",
+                success: ({
+                    confirm
+                }) => {
+                    if (confirm) that.handleEdit();
+                }
+            })
+        },
+        handleEdit() {
             this.setData({
                 loading: true
             });
@@ -43,7 +72,12 @@ Component({
                     title: res.data,
                     icon: "none"
                 });
-                this.triggerEvent("endInsert");
+                wx.showToast({
+                    title: '保存成功!',
+                })
+                setTimeout(() => {
+                    this.triggerEvent("endInsert");
+                }, 300);
             })
         },
         /* 输入框输入内容 */
@@ -70,7 +104,7 @@ Component({
                 this.setData({
                     disabled: !(phonenumber && province && cluesource)
                 })
-            }, 1000);
+            }, 500);
         },
         /* 省市县选择器 */
         bindRegionChange: function (e) {