lex-xin 4 роки тому
батько
коміт
f1a646cdd0
2 змінених файлів з 81 додано та 16 видалено
  1. 16 1
      src/views/chargeManager/api.js
  2. 65 15
      src/views/chargeManager/three.vue

+ 16 - 1
src/views/chargeManager/api.js

@@ -28,6 +28,21 @@ export function updateTypeRoute(data) {
   return request({
     url: api + '/paymentConfig/updateTypeRoute',
     method: 'post',
-    data
+    headers: {
+      'content-type': 'application/x-www-form-urlencoded'
+    },
+    data: qs.stringify(data)
+  })
+}
+
+// 删除按费用类型配置
+export function delTypeRoute(data) {
+  return request({
+    url: api + '/paymentConfig/delTypeRoute',
+    method: 'post',
+    headers: {
+      'content-type': 'application/x-www-form-urlencoded'
+    },
+    data: qs.stringify(data)
   })
 }

+ 65 - 15
src/views/chargeManager/three.vue

@@ -6,6 +6,15 @@
       <div class="tableWrap">
         <el-table :data="tableList" :header-cell-style="{background:'#EDEEF0',color:'#444'}">
           <el-table-column align="center" prop="organName" label="分部"></el-table-column>
+          <el-table-column align="center" label="收费方式">
+            <template slot-scope="scope">
+              <div v-if="scope.row.typeRouteScale && scope.row.typeRouteScale.length > 0">
+                <p v-for="(item, index) in scope.row.typeRouteScale" :key="index">
+                  {{ getOrganToStr(item.organId) }}--{{ getTypes(item.feeType) }}
+                </p>
+              </div>
+            </template>
+          </el-table-column>
 
           <el-table-column align="center" width="250px" label="操作">
             <template slot-scope="scope">
@@ -75,7 +84,7 @@
                 clearable
               >
                 <el-option
-                  v-for="(item, index) in calcBranchList"
+                  v-for="(item, index) in branchList"
                   :key="index"
                   :label="item.label"
                   :value="item.value"
@@ -98,7 +107,7 @@ import pagination from "@/components/Pagination/index";
 import {
   paymentConfigQueryPage
 } from "@/api/systemManage";
-import { getPaymentConfigs, addTypeRoute, updateTypeRoute } from "./api";
+import { getPaymentConfigs, addTypeRoute, updateTypeRoute, delTypeRoute } from "./api";
 import { branchQueryPage } from "@/api/specialSetting";
 import cleanDeep from 'clean-deep'
 export default {
@@ -149,13 +158,8 @@ export default {
       this.$refs[formName].validate(valid => {
         let params = JSON.parse(JSON.stringify(this.form));
         if (valid) {
-          console.log(params)
           params.typeRouteScale = JSON.stringify(params.typeRouteScale)
           if (this.formActionTitle == "create") {
-            // if (params.id) {
-            //   // 判断有没有Id,如果有则删除
-            //   delete params.id;
-            // }
             addTypeRoute(params).then(res => {
               this.messageTips("添加", res);
             });
@@ -169,6 +173,22 @@ export default {
         }
       });
     },
+    getOrganToStr(id) {
+      let name = null
+      this.calcBranchList.forEach(item => {
+        if(item.value == id) {
+          name = item.label
+        }
+      })
+      return name
+    },
+    getTypes(type) {
+      let template = {
+        'SERVICE': '服务收入',
+        'SELL': '销售收入'
+      }
+      return template[type]
+    },
     messageTips(title, res) {
       if (res.code == 200) {
         this.$message.success(title + "成功");
@@ -180,7 +200,17 @@ export default {
     },
     onChange() {
       let form = this.form
-      console.log(form)
+      let tempInfo = {}
+      this.calcBranchList.forEach(item => {
+        if(item.value == form.id) {
+          tempInfo = item
+        }
+      })
+
+      if(!tempInfo.value) {
+        return
+      }
+      this.getRoleList(tempInfo.payType)
     },
     getList() {
       let params = {
@@ -190,6 +220,11 @@ export default {
       params.page = this.pageInfo.page;
       paymentConfigQueryPage(params).then(res => {
         if (res.code == 200 && res.data) {
+          res.data.rows.forEach(item => {
+            if(item.typeRouteScale) {
+              item.typeRouteScale = JSON.parse(item.typeRouteScale)
+            }
+          })
           this.tableList = res.data.rows;
           this.pageInfo.total = res.data.total;
         }
@@ -198,11 +233,25 @@ export default {
     async getRoleList(val) {
       await getPaymentConfigs(cleanDeep({ payType: val })).then(res => {
         if (res.code == 200 && res.data) {
+          if(val) {
+            this.branchList = []
+          } else {
+            this.calcBranchList = []
+          }
           res.data.forEach(item => {
-            this.calcBranchList.push({
-              label: item.organName,
-              value: item.id
-            });
+            if(val) {
+               this.branchList.push({
+                label: item.organName,
+                value: item.id,
+                payType: item.payType
+              });
+            } else {
+              this.calcBranchList.push({
+                label: item.organName,
+                value: item.id,
+                payType: item.payType
+              });
+            }
           });
         }
       });
@@ -212,11 +261,11 @@ export default {
       this.chargeStatus = true;
       // 修改的时候
       if (type == "update") {
+        this.getRoleList(data.payType)
         this.$nextTick(() => {
-          console.log(data)
           this.form = {
             id: data.id,
-            typeRouteScale: data.typeRouteScale ? JSON.parse(data.typeRouteScale) : []
+            typeRouteScale: data.typeRouteScale ? data.typeRouteScale : []
           }
         })
       }
@@ -230,13 +279,14 @@ export default {
         type: "warning"
       })
         .then(() => {
-          paymentConfigDel({ id: row.id }).then(res => {
+          delTypeRoute({ id: row.id }).then(res => {
             this.messageTips("删除", res);
           });
         })
         .catch();
     },
     onFormClose(formName) {
+      this.branchList = []
       this.$refs[formName].resetFields();
     }
   }