谢杰标 2 роки тому
батько
коміт
b2e5340d00
1 змінених файлів з 31 додано та 24 видалено
  1. 31 24
      pages2/order/confirm_pay.vue

+ 31 - 24
pages2/order/confirm_pay.vue

@@ -198,17 +198,40 @@ export default {
           }
         });
     },
-    async postOrder() {
-      let list = this.shoppingCartList;
+    // 二建 && 七大员 需要先完善信息
+    async checkNeedInfo() {
       let keys = [];
-      for (let i = 0; i < list.length; i++) {
-        let item = list[i];
+      this.shoppingCartList.forEach((item) => {
         if (item.erJianErZao) {
           keys.push("realname", "idCard");
         }
         if (item.jjShiGongYuan) {
           keys.push("sex", "companyName", "eduLevel");
         }
+      });
+      if (keys.length) {
+        if (!this.userInfo) await this.getUserInfo();
+        if (keys.some((key) => !this.userInfo[key])) {
+          uni.showModal({
+            title: "提示",
+            content: "请先完善个人信息!",
+            success: (res) => {
+              if (res.confirm) {
+                this.$navTo.togo("/pages2/verify/info_fill", {
+                  keys: Array.from(new Set(keys)).toString(),
+                });
+              }
+            },
+          });
+          return false;
+        }
+      }
+      return true;
+    },
+    async postOrder() {
+      let list = this.shoppingCartList;
+      for (let i = 0; i < list.length; i++) {
+        let item = list[i];
         if (item.goodsType == 1) {
           if (item.templateType == "class") {
             delete item.gradObj.goodsList;
@@ -233,25 +256,6 @@ export default {
           item.distributionCode = this.options.distributionCode;
         }
       }
-      // 二建 && 七大员 需要先完善信息
-      if (keys.length) {
-        if (!this.userInfo) await this.getUserInfo();
-        if (keys.some((key) => !this.userInfo[key])) {
-          this.btnNo = false;
-          uni.showModal({
-            title: "提示",
-            content: "请先完善个人信息!",
-            success: (res) => {
-              if (res.confirm) {
-                this.$navTo.togo("/pages2/verify/info_fill", {
-                  keys: keys.toString(),
-                });
-              }
-            },
-          });
-          return;
-        }
-      }
       let data = { goodsList: list };
       // 邀请码
       if (this.sac) {
@@ -445,7 +449,10 @@ export default {
         }
       });
     },
-    pay() {
+    async pay() {
+      if (!(await this.checkNeedInfo())) {
+        return;
+      }
       let self = this;
       this.btnNo = true;
       // #ifdef MP-WEIXIN