Ver Fonte

Finish Hotfix-32

chen há 3 anos atrás
pai
commit
2366777e2d

+ 165 - 78
src/views/basic_data/dealer/dealer_stock.vue

@@ -247,7 +247,17 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="一级区域" prop="oneParentId">
+        <el-form-item label="区域" prop="region">
+          <el-cascader
+            ref="locationCascader"
+            v-model="addForm.region"
+            class="selectStyle"
+            :options="options"
+            :props="props"
+            clearable
+          ></el-cascader>
+        </el-form-item>
+        <!-- <el-form-item label="一级区域" prop="oneParentId">
           <el-select
             class="selectStyle"
             v-model="addForm.oneParentId"
@@ -297,7 +307,7 @@
             >
             </el-option>
           </el-select>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="对应业务员" prop="serviceId">
           <el-select
             class="selectStyle"
@@ -337,11 +347,35 @@ import {
   getWalletCustomerList,
 } from "@/api/basic_data/dealer";
 import { getDealerList } from "@/api/basic_data/dealer";
+import { getDepartmentList } from "@/api/setting";
 import { downloadFiles, handleImport } from "@/utils/util";
 
 export default {
   data() {
     return {
+      props: {
+        checkStrictly: true,
+        value: "adminWebsitId",
+        label: "name",
+
+        // expandTrigger: "hover",
+        // lazy: true,
+        // lazyLoad(node, resolve) {
+        //   console.log(node);
+        //   const { value } = node;
+        //   setTimeout(async () => {
+        //     let res = await getAdminWebsitByparent({
+        //       parentId: value,
+        //     });
+        //     let aaa = res.data.map((v) => {
+        //       return { value: v.adminWebsitId, label: v.name };
+        //     });
+
+        //     resolve(aaa);
+        //   }, 0);
+        // },
+      },
+      options: [],
       importFileList: [],
       isDisabled: true,
       title: "",
@@ -350,23 +384,25 @@ export default {
         customerId: "",
         customerName: "",
         customerNumber: "",
-        oneParentId: "",
-        twoParentId: "",
-        threeParentId: "",
+        region: [],
+        // oneParentId: "",
+        // twoParentId: "",
+        // threeParentId: "",
         serviceId: "",
         customerWalletId: "",
       },
       mainId: null,
       rules: {
         customerId: [
-          { required: true, message: "请选择经销商名称", trigger: "blur" },
+          { required: true, message: "请选择经销商名称", trigger: "change" },
         ],
         customerWalletId: [
-          { required: true, message: "请选择经销商钱包", trigger: "blur" },
-        ],
-        oneParentId: [
-          { required: true, message: "请选择一级区域", trigger: "blur" },
+          { required: true, message: "请选择经销商钱包", trigger: "change" },
         ],
+        region: [{ required: true, message: "请选择区域", trigger: "change" }],
+        // oneParentId: [
+        //   { required: true, message: "请选择一级区域", trigger: "blur" },
+        // ],
         // twoParentId: [
         //   { required: true, message: "请选择二级区域", trigger: "blur" },
         // ],
@@ -374,7 +410,7 @@ export default {
         //   { required: true, message: "请选择三级区域", trigger: "blur" },
         // ],
         serviceId: [
-          { required: true, message: "请选择业务员", trigger: "blur" },
+          { required: true, message: "请选择业务员", trigger: "change" },
         ],
       },
 
@@ -390,16 +426,17 @@ export default {
       dealerList: [],
       // selectList: [],
       walletList: [], //产品大类列表
-      oneList: [], //一级区域数据
-      twoList: [], //二级区域数据
-      threeList: [], //三级区域数据
+      // oneList: [], //一级区域数据
+      // twoList: [], //二级区域数据
+      // threeList: [], //三级区域数据
       userList: [], //业务员
       ids: [],
       rowID: null, //编辑ID
     };
   },
   async created() {
-    this.getAdminWebsit(1);
+    this.getTree();
+    // this.getAdminWebsit(1);
     this.getList({ pageNum: 1, pageSize: 10 });
     this.getDealerDataList({ pageNum: 1, pageSize: -1 });
     this.getUserList(1);
@@ -407,11 +444,16 @@ export default {
   },
   computed: {},
   watch: {
+    "addForm.region": function (newValue) {
+      // console.log(newValue, 888);
+      if (newValue) {
+        this.getUserList(newValue[newValue.length - 1]);
+      }
+    },
     "addForm.customerId": async function (newValue) {
       if (newValue) {
         // this.addForm.customerWalletId = "";
         const res = this.dealerList.filter((i) => i.id == newValue);
-
         this.addForm.customerName = res[0].name;
         this.addForm.customerNumber = res[0].number;
         let res2 = await getWalletCustomerList({
@@ -421,30 +463,30 @@ export default {
         this.walletList = res2.data;
       }
     },
-    "addForm.oneParentId": async function (newValue) {
-      if (newValue) {
-        let res = await getAdminWebsitByparent({
-          parentId: newValue,
-          // mainId: this.mainId,
-        });
-        this.twoList = res.data;
-      }
-    },
-    "addForm.twoParentId": async function (newValue) {
-      if (newValue) {
-        let res = await getAdminWebsitByparent({
-          parentId: newValue,
-          // mainId: this.mainId,
-        });
-        this.getUserList(newValue);
-        this.threeList = res.data;
-      }
-    },
-    "addForm.threeParentId": async function (newValue) {
-      if (newValue) {
-        this.getUserList(newValue);
-      }
-    },
+    // "addForm.oneParentId": async function (newValue) {
+    //   if (newValue) {
+    //     let res = await getAdminWebsitByparent({
+    //       parentId: newValue,
+    //       // mainId: this.mainId,
+    //     });
+    //     this.twoList = res.data;
+    //   }
+    // },
+    // "addForm.twoParentId": async function (newValue) {
+    //   if (newValue) {
+    //     let res = await getAdminWebsitByparent({
+    //       parentId: newValue,
+    //       // mainId: this.mainId,
+    //     });
+    //     this.getUserList(newValue);
+    //     this.threeList = res.data;
+    //   }
+    // },
+    // "addForm.threeParentId": async function (newValue) {
+    //   if (newValue) {
+    //     this.getUserList(newValue);
+    //   }
+    // },
   },
   methods: {
     // 导入
@@ -484,28 +526,34 @@ export default {
     async changeFn(v) {
       this.addForm.customerWalletId = "";
     },
-    async changeOneFn(v) {
-      this.addForm.twoParentId = "";
-      this.addForm.threeParentId = "";
-      this.addForm.serviceId = "";
-    },
-    async changeTwoFn(v) {
-      this.addForm.threeParentId = "";
-      this.addForm.serviceId = "";
-    },
-    async changeThreeFn(v) {
-      this.addForm.serviceId = "";
-    },
+    // async changeOneFn(v) {
+    //   this.addForm.twoParentId = "";
+    //   this.addForm.threeParentId = "";
+    //   this.addForm.serviceId = "";
+    // },
+    // async changeTwoFn(v) {
+    //   this.addForm.threeParentId = "";
+    //   this.addForm.serviceId = "";
+    // },
+    // async changeThreeFn(v) {
+    //   this.addForm.serviceId = "";
+    // },
     async editFn(id) {
       this.title = "经销商业务关系管理 ";
       this.rowID = id;
       let res = await getCustomerPtDetail({ id });
-      console.log(res);
+      // console.log(res);
+
       this.addForm.customerId = res.data.customerId;
       this.addForm.customerWalletId = res.data.customerWalletId;
-      this.addForm.oneParentId = res.data.adminWebsitId1;
-      this.addForm.twoParentId = res.data.adminWebsitId2;
-      this.addForm.threeParentId = res.data.adminWebsitId3;
+      // this.addForm.oneParentId = res.data.adminWebsitId1;
+      // this.addForm.twoParentId = res.data.adminWebsitId2;
+      // this.addForm.threeParentId = res.data.adminWebsitId3;
+      this.addForm.region = [
+        res.data.adminWebsitId1,
+        res.data.adminWebsitId2,
+        res.data.adminWebsitId3,
+      ];
       this.addForm.serviceId = res.data.serviceId;
 
       this.dialogForm = true;
@@ -518,16 +566,36 @@ export default {
         isCustomer: 0,
         adminWebsitId: v,
       });
+      if (res.data.records.length == 0) {
+        this.addForm.serviceId = "";
+      }
       this.userList = res.data.records;
     },
-    //根据父级查询部门
-    async getAdminWebsit(data) {
-      let res = await getAdminWebsitByparent({
-        parentId: data,
-        // mainId: this.mainId,
+    // 获取部门列表
+    getTree() {
+      getDepartmentList().then((res) => {
+        // console.log(res, 8888);
+
+        this.options = res.data[0].children;
       });
-      this.oneList = res.data;
     },
+    // //根据父级查询部门
+    // async getAdminWebsit(data) {
+    //   let res = await getAdminWebsitByparent({
+    //     parentId: data,
+    //     // mainId: this.mainId,
+    //   });
+    //   let arr = res.data.map((v) => {
+    //     return {
+    //       value: v.adminWebsitId,
+    //       label: v.name,
+    //     };
+    //   });
+
+    //   // this.options = arr;
+
+    //   this.oneList = res.data;
+    // },
     // //获取产品品类数据
     // async getCategoryList() {
     //   let res = await getProductCategoryList();
@@ -566,7 +634,7 @@ export default {
       this.$message.success("删除成功");
       this.ids = [];
     },
-    addFn() {
+    async addFn() {
       this.title = "经销商业务关系管理";
 
       this.dialogForm = true;
@@ -580,8 +648,8 @@ export default {
       let data3 = this.userList.filter((v) => {
         return v.adminUserId == this.addForm.serviceId;
       });
-      console.log(data3);
-      console.log(data2, 22222);
+      // console.log(data3);
+      // console.log(data2, 22222);
 
       let value = {
         customerId: this.addForm.customerId,
@@ -602,33 +670,52 @@ export default {
         await getDealerStockAdd(value);
         this.$message.success("添加成功");
       }
+      if (this.$refs.locationCascader) {
+        this.$refs.locationCascader.$refs.panel.activePath = [];
+        this.$refs.locationCascader.$refs.panel.calculateCheckedNodePaths();
+      }
       this.addForm.customerId = "";
       this.addForm.customerNumber = "";
       this.addForm.customerName = "";
       this.addForm.customerWalletId = "";
-      this.addForm.oneParentId = "";
-      this.addForm.twoParentId = "";
-      this.addForm.threeParentId = "";
+      this.addForm.region = [];
+      // this.addForm.oneParentId = "";
+      // this.addForm.twoParentId = "";
+      // this.addForm.threeParentId = "";
       this.addForm.serviceId = "";
-      this.userList = [];
-      this.twoList = [];
-      this.threeList = [];
+      // this.userList = [];
+      // this.twoList = [];
+      // this.threeList = [];
+      this.walletList = [];
+      this.$nextTick(() => {
+        this.$refs["addForm"].clearValidate();
+      });
       this.getList({ pageNum: 1, pageSize: 10 });
       this.dialogForm = false;
     },
     //取消
     async cancelFn() {
-      await this.$refs.addForm.clearValidate();
+      if (this.$refs.locationCascader) {
+        this.$refs.locationCascader.$refs.panel.activePath = [];
+        this.$refs.locationCascader.$refs.panel.calculateCheckedNodePaths();
+      }
+
       this.addForm.customerId = "";
       this.addForm.customerNumber = "";
       this.addForm.customerWalletId = "";
-      this.addForm.oneParentId = "";
-      this.addForm.twoParentId = "";
-      this.addForm.threeParentId = "";
+      this.addForm.region = [];
+      // this.addForm.oneParentId = "";
+      // this.addForm.twoParentId = "";
+      // this.addForm.threeParentId = "";
       this.addForm.serviceId = "";
-      this.userList = [];
-      this.twoList = [];
-      this.threeList = [];
+      // this.userList = [];
+      // this.twoList = [];
+      // this.threeList = [];
+      this.walletList = [];
+
+      this.$nextTick(() => {
+        this.$refs["addForm"].clearValidate();
+      });
       this.dialogForm = false;
     },
     //获取经销商数据

+ 28 - 4
src/views/finance/standbook_list.vue

@@ -1,6 +1,10 @@
 <template>
   <div class="app-container">
-    <span>台账</span>
+    <div class="sty" v-if="isShow">
+      <el-page-header @back="goBack"> </el-page-header>
+    </div>
+
+    <span v-else>台账</span>
     <el-divider></el-divider>
     <!-- <el-radio-group v-model="mainId" size="">
       <el-radio-button
@@ -535,6 +539,7 @@ import {
 export default {
   data() {
     return {
+      isShow: false,
       amountList: {},
       customerList: [],
       currentPage: 1, // 当前页码
@@ -616,7 +621,7 @@ export default {
       ) {
         //只有是从A进到B页面才执行
         // 将要执行的逻辑
-
+        vm.isShow = true;
         vm.isDisabled = true;
         vm.searchForm.customerId = vm.$route.query.customerId;
         vm.changeFn(vm.$route.query.customerId);
@@ -633,6 +638,7 @@ export default {
           customerNumber: vm.$route.query.customerNumber,
         });
       } else if (vm.isCustomer) {
+        vm.isShow = false;
         vm.isDisabled = true;
         vm.searchForm.customerId = vm.$store.state.user.customerId;
         vm.changeFn(vm.$store.state.user.customerId);
@@ -647,6 +653,7 @@ export default {
           ...vm.isCustomerList,
         });
       } else {
+        vm.isShow = false;
         vm.searchForm.customerId = "";
         vm.isDisabled = false;
         vm.getDataList({
@@ -705,6 +712,10 @@ export default {
     // this.getDataDict();
   },
   methods: {
+    goBack() {
+      this.$router.go(-1);
+      this.$store.dispatch("tagsView/delView", this.$route);
+    },
     //
     computedFn(data, i, sums, index) {
       let map1 = data.map((v) => {
@@ -868,8 +879,20 @@ export default {
     //获取汇总总数
     async getAmountList(data) {
       let res = await getAmountCount(data);
-
-      this.amountList = res.data;
+      if (res.data) {
+        this.amountList = res.data;
+      } else {
+        this.amountList = {
+          inCount: 0,
+          orderCOunt: 0,
+          orderDate: 0,
+          otherCount: 0,
+          outCount: 0,
+          payCount: 0,
+          preCount: 0,
+          projectCount: 0,
+        };
+      }
     },
     //改变经销商
     async changeFn(v) {
@@ -1066,6 +1089,7 @@ export default {
       //   pageNum: 1,
       //   type: v,
       // });
+
       this.resetFn();
       this.pageSize = 10;
       this.currentPage = 1;

+ 2 - 1
src/views/finance/wallet.vue

@@ -375,7 +375,8 @@ export default {
     },
     //返回
     goBack() {
-      this.$router.push("/finance/details/balance_sum");
+      this.$router.go(-1);
+      this.$store.dispatch("tagsView/delView", this.$route);
     },
     //取消
     async cancelFn() {