Kaynağa Gözat

【修改】更改为同步请求

howie 2 yıl önce
ebeveyn
işleme
97dccbcfbb

+ 18 - 44
src/views/sales_policy/components/AddPolicy.vue

@@ -615,12 +615,10 @@ export default {
     this.searchForm.code = this.comCode;
   },
   created() {
-    this.getCommonApi();
     // console.log(this.$store.code);
-
-    if (this.$parent.isFlag) {
-      // this.handletwoList()
-    }
+    // if (this.$parent.isFlag) {
+    //    this.handletwoList()
+    // }
   },
   methods: {
     ...mapMutations("sales", ["initData"]),
@@ -681,22 +679,20 @@ export default {
         this.getK3List();
       }
     },
-    getCommonApi() {
+   async  getCommonApi() {
       // this.getK3List();
       // 非返利钱包
-      getNoRebateWalletList({ walletName: "" }).then((res) => {
-        this.NoRebateWalletList = res.data;
-        console.log(this.NoRebateWalletList, "kkkk");
-      });
-      getWalletRebateList({
+       const noRebateWalletData =  await  getNoRebateWalletList({ walletName: "" })
+        this.NoRebateWalletList = noRebateWalletData.data;
+
+     const walletRebateData  = await getWalletRebateList({
         pageNum: 1,
         pageSize: -2,
         name: "",
         status: true,
-      }).then((res) => {
-        this.rebateList = res.data.records;
-        console.log(this.rebateList, "fanlie");
-      });
+      })
+      this.rebateList = walletRebateData.data.records;
+
       const params = {
         pageNum: 1,
         pageSize: -1,
@@ -704,34 +700,11 @@ export default {
         saleName: "",
         status: "",
       };
+
       // 获取销售类型列表
-      getTypeList(params).then((res) => {
-        this.typeList = res.data.records;
-        console.log(this.typeList, "xioahsou");
-      });
-      // this.handletwoList()
-      // const params = {
-      //   pageNum: 1,
-      //   pageSize: 10,
-      //   saleCode: "",
-      //   saleName: "",
-      //   status: "",
-      // };
-      // const walletParams = {
-      //   pageNum: 1,
-      //   pageSize: 10,
-      //   mainName: "",
-      //   saleTypeCode: "",
-      //   saleTypeName: "",
-      //   status: "",
-      // };
-      // // 获取钱包列表
-      // getWalletList(walletParams).then((res) => {
-      //   this.walletList = res.data.records;
-      // });
-      // getDictList({ sysDictEnum: "PRODUCT_TYPE" }).then((res) => {
-      //   this.dictList = res.data;
-      // });
+      const  typeData = await getTypeList(params)
+        this.typeList = typeData.data.records;
+
     },
     handleSalesType(e, row) {
       const item = this.typeList.filter((k) => {
@@ -815,9 +788,10 @@ export default {
         });
       }
     },
-    getList() {
+   async getList() {
+      await this.getCommonApi();
       if (this.$parent.isFlag) {
-        this.handletwoList();
+       await  this.handletwoList();
       }
     },
     // 更改每页数量

+ 28 - 51
src/views/sales_policy/components/editPolicy.vue

@@ -604,13 +604,12 @@ export default {
   },
 
   created() {
-    this.getCommonApi()
 
     // console.log(this.$store.code);
 
-    if (this.$parent.isFlag) {
-      // this.handletwoList()
-    }
+    // if (this.$parent.isFlag) {
+    //   // this.handletwoList()
+    // }
 
   },
   methods: {
@@ -685,56 +684,33 @@ export default {
         this.getK3List()
       }
     },
-    getCommonApi() {
-      // this.getK3List()
+    async  getCommonApi() {
+      // this.getK3List();
       // 非返利钱包
-      getNoRebateWalletList({ walletName: '' }).then((res) => {
-        this.NoRebateWalletList = res.data
-        console.log(this.NoRebateWalletList, 'kkkk')
-      })
-      getWalletRebateList({
+       const noRebateWalletData =  await  getNoRebateWalletList({ walletName: "" })
+        this.NoRebateWalletList = noRebateWalletData.data;
+
+     const walletRebateData  = await getWalletRebateList({
         pageNum: 1,
         pageSize: -2,
-        name: '',
-        status: true
-      }).then(res => {
-        this.rebateList = res.data.records
-        console.log(this.rebateList, 'fanlie')
+        name: "",
+        status: true,
       })
+      this.rebateList = walletRebateData.data.records;
+
       const params = {
         pageNum: 1,
         pageSize: -1,
-        saleCode: '',
-        saleName: '',
-        status: ''
-      }
+        saleCode: "",
+        saleName: "",
+        status: "",
+      };
+
       // 获取销售类型列表
-      getTypeList(params).then((res) => {
-        this.typeList = res.data.records
-      })
-      // this.handletwoList()
-      // const params = {
-      //   pageNum: 1,
-      //   pageSize: 10,
-      //   saleCode: "",
-      //   saleName: "",
-      //   status: "",
-      // };
-      // const walletParams = {
-      //   pageNum: 1,
-      //   pageSize: 10,
-      //   mainName: "",
-      //   saleTypeCode: "",
-      //   saleTypeName: "",
-      //   status: "",
-      // };
-      // // 获取钱包列表
-      // getWalletList(walletParams).then((res) => {
-      //   this.walletList = res.data.records;
-      // });
-      // getDictList({ sysDictEnum: "PRODUCT_TYPE" }).then((res) => {
-      //   this.dictList = res.data;
-      // });
+      const  typeData =  await getTypeList(params)
+
+        this.typeList = typeData.data.records;
+
     },
     handleSalesType(e, row) {
       const item = this.typeList.filter((k) => {
@@ -816,8 +792,9 @@ export default {
         })
       }
     },
-    getList() {
-      getPolicyDetail({ policyId: this.$parent.id }).then((res) => {
+   async getList() {
+      await  this.getCommonApi()
+     await  getPolicyDetail({ policyId: this.$parent.id }).then( async(res) => {
         this.detail = res.data
         this.searchForm = {
           code: this.detail.code,
@@ -838,12 +815,12 @@ export default {
             }
           ]
         }
-        this.handletwoList()
+       await  this.handletwoList()
         // 获取条件政策
-        this.handleSubmitCon()
+       await  this.handleSubmitCon()
       })
       if (this.$parent.isFlag) {
-        this.handletwoList()
+       await  this.handletwoList()
       }
     },