Переглянути джерело

重复门店经销商维护

zhujindu 9 місяців тому
батько
коміт
7484e12b00
2 змінених файлів з 49 додано та 33 видалено
  1. 9 0
      src/api/store.js
  2. 40 33
      src/views/storeManagement/storeAdd.vue

+ 9 - 0
src/api/store.js

@@ -18,3 +18,12 @@ export function addStoreChainContact(data) {
     data,
   });
 }
+
+// 新增门店前校验门店是否重复接口
+export function checkStoreBeforeAdd(data) {
+  return request({
+    url: 'mobile/store/checkStoreBeforeAdd',
+    method: 'post',
+    data,
+  });
+}

+ 40 - 33
src/views/storeManagement/storeAdd.vue

@@ -714,7 +714,7 @@ import txmapimg1 from '@/assets/txmap1.svg';
 import txmapimg2 from '@/assets/txmap2.svg';
 import txmapimg3 from '@/assets/marker_blue.png';
 import { getPosition, getTicketFun } from '@/utils/TXApiFun';
-import { listChainsByCategory } from '@/api/store';
+import { listChainsByCategory, checkStoreBeforeAdd } from '@/api/store';
 import store from '@/store';
 export default {
   name: 'storeAdd',
@@ -1847,18 +1847,40 @@ export default {
         this.verifyStoreType(this.fromValue.storeCategory) &&
         this.verifyStoreType(this.fromValue.storeCategory).type == 'fxd'
       ) {
-        this.toastLoading().clear();
-        this.$dialog
-          .confirm({
-            title: '系统提示',
-            message: `该门店类型为<span style="color:red">同城分销店</span>,<br/>首笔订单最低金额:<span style="color:red">1000元</span>`,
-            confirmButtonText: '去下单',
-            cancelButtonText: '修改门店信息',
-          })
-          .then(() => {
-            this.toastLoading(0, '上传中...', true);
-            this.addStoreFun();
-          });
+        // 门店重复判断
+        checkStoreBeforeAdd(this.fromValue).then((res) => {
+          this.toastLoading().clear();
+          // type	1=不重复;2=重复不让修改;3=重复可扩展
+          // store type=3时有值
+          if (res.data.type == 3) {
+            this.$dialog
+              .confirm({
+                title: '门店已存在',
+                message: res.data.message,
+                confirmButtonText: '维护',
+                cancelButtonText: '取消',
+              })
+              .then(() => {
+                // 重复门店增加经销商
+                this.$router.push({
+                  path: '/chainMaintain',
+                  query: { id: res.data.store.id },
+                });
+              });
+          } else if (res.data.type == 2 || res.data.type == 1) {
+            this.$dialog
+              .confirm({
+                title: '系统提示',
+                message: `该门店类型为<span style="color:red">同城分销店</span>,<br/>首笔订单最低金额:<span style="color:red">1000元</span>`,
+                confirmButtonText: '去下单',
+                cancelButtonText: '修改门店信息',
+              })
+              .then(() => {
+                this.toastLoading(0, '上传中...', true);
+                this.addStoreFun();
+              });
+          }
+        });
       } else {
         this.addStoreFun();
       }
@@ -1945,26 +1967,11 @@ export default {
             });
           }
         } else {
-          // 门店重复判断
-          this.$dialog
-            .confirm({
-              title: '门店已存在',
-              message: `res.message`,
-              confirmButtonText: '维护',
-              cancelButtonText: '取消',
-            })
-            .then(() => {
-              // 重复门店增加经销商
-              this.$router.push({
-                path: '/chainMaintain',
-                query: { id: 'res.id' },
-              });
-            });
-          // this.$dialog.alert({
-          //   title: '系统提示',
-          //   message: res.msg,
-          //   messageAlign: 'left',
-          // });
+          this.$dialog.alert({
+            title: '系统提示',
+            message: res.msg,
+            messageAlign: 'left',
+          });
         }
       });
     },