Browse Source

提交收费自动计算

caojunjie 4 years ago
parent
commit
5e0b28e81d
1 changed files with 159 additions and 130 deletions
  1. 159 130
      src/views/finance/charge/index.vue

+ 159 - 130
src/views/finance/charge/index.vue

@@ -79,17 +79,17 @@
         >修改
         </el-button>
       </el-col>
-<!--      <el-col :span="1.5">-->
-<!--        <el-button-->
-<!--          type="danger"-->
-<!--          icon="el-icon-delete"-->
-<!--          size="mini"-->
-<!--          :disabled="multiple"-->
-<!--          @click="handleDelete"-->
-<!--          v-hasPermi="['finance:charge:remove']"-->
-<!--        >删除-->
-<!--        </el-button>-->
-<!--      </el-col>-->
+      <!--      <el-col :span="1.5">-->
+      <!--        <el-button-->
+      <!--          type="danger"-->
+      <!--          icon="el-icon-delete"-->
+      <!--          size="mini"-->
+      <!--          :disabled="multiple"-->
+      <!--          @click="handleDelete"-->
+      <!--          v-hasPermi="['finance:charge:remove']"-->
+      <!--        >删除-->
+      <!--        </el-button>-->
+      <!--      </el-col>-->
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -130,60 +130,60 @@
           <span v-else-if="scope.row.fBillstatus == '6'">审核完成</span>
         </template>
       </el-table-column>
-        <el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width">
-          <template slot-scope="scope">
-            <el-button
-              size="mini"
-              type="text"
-              icon="el-icon-view"
-              @click="check(scope.row,0)"
-              v-hasPermi="['finance:contrast:edit']"
-              v-if="scope.row.fBillstatus == 6"
-            >查看</el-button
-            >
-            <el-button
-              size="mini"
-              type="text"
-              icon="el-icon-view"
-              @click="check(scope.row,1)"
-              v-hasPermi="['finance:contrast:edit']"
-              v-if="scope.row.fBillstatus == 4 || scope.row.fBillstatus == 5"
-            >审批进度</el-button
-            >
-            <el-button
-              size="mini"
-              type="text"
-              icon="el-icon-edit"
-              @click="handleUpdate(scope.row)"
-              v-hasPermi="['finance:charge:edit']"
-              v-if="scope.row.fBillstatus <= 3"
-            >修改
-            </el-button>
-            <el-button
-              size="mini"
-              type="text"
-              icon="el-icon-delete"
-              @click="handleDelete(scope.row)"
-              v-hasPermi="['finance:charge:remove']"
-              v-if="scope.row.fBillstatus <= 3"
-            >删除
-            </el-button>
-<!--            <el-button-->
-<!--              size="mini"-->
-<!--              type="text"-->
-<!--              icon="el-icon-delete"-->
-<!--              v-if="scope.row.fBillstatus === 6"-->
-<!--            >查看-->
-<!--            </el-button>-->
-<!--            <el-button-->
-<!--              size="mini"-->
-<!--              type="text"-->
-<!--              icon="el-icon-delete"-->
-<!--              v-if="scope.row.fBillstatus > 3 && scope.row.fBillstatus < 6"-->
-<!--            >查看审批流-->
-<!--            </el-button>-->
-          </template>
-        </el-table-column>
+      <el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-view"
+            @click="check(scope.row,0)"
+            v-hasPermi="['finance:contrast:edit']"
+            v-if="scope.row.fBillstatus == 6"
+          >查看</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-view"
+            @click="check(scope.row,1)"
+            v-hasPermi="['finance:contrast:edit']"
+            v-if="scope.row.fBillstatus == 4 || scope.row.fBillstatus == 5"
+          >审批进度</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['finance:charge:edit']"
+            v-if="scope.row.fBillstatus <= 3"
+          >修改
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['finance:charge:remove']"
+            v-if="scope.row.fBillstatus <= 3"
+          >删除
+          </el-button>
+          <!--            <el-button-->
+          <!--              size="mini"-->
+          <!--              type="text"-->
+          <!--              icon="el-icon-delete"-->
+          <!--              v-if="scope.row.fBillstatus === 6"-->
+          <!--            >查看-->
+          <!--            </el-button>-->
+          <!--            <el-button-->
+          <!--              size="mini"-->
+          <!--              type="text"-->
+          <!--              icon="el-icon-delete"-->
+          <!--              v-if="scope.row.fBillstatus > 3 && scope.row.fBillstatus < 6"-->
+          <!--            >查看审批流-->
+          <!--            </el-button>-->
+        </template>
+      </el-table-column>
       <!--      <el-table-column label="单据类型" align="center" prop="fBilltype"/>-->
       <!--      <el-table-column label="制单部门" align="center" prop="fDeptid"/>-->
 
@@ -268,7 +268,7 @@
         <el-button type="primary" size="small" @click="confirmCharge" :disabled="notChange" v-if="queryParams.fBillstatus < '4'">确认收费</el-button>
         <el-button type="success" size="small" @click="revokeCharge" v-if="queryParams.fBillstatus === '6'">撤销收费</el-button>
         <el-button type="info" size="small" @click="printing" :disabled="notChange">打印</el-button>
-<!--        <el-button type="danger" size="small" :disabled="notChange" v-show="Lander == Operator">撤销审批</el-button>-->
+        <!--        <el-button type="danger" size="small" :disabled="notChange" v-show="Lander == Operator">撤销审批</el-button>-->
         <el-button type="danger" size="small" :disabled="tablefilter" @click="approvalRevocation" v-show="queryParams.fBillstatus === '4'">撤销审批</el-button>
       </div>
       <el-table v-loading="loading" :data="increase_s" @selection-change="handleSelectionChange_s">
@@ -417,7 +417,7 @@
             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery_s">重置</el-button>
           </el-form-item>
         </el-form>
-        <el-table v-loading="loading" :data="chargeList_s" ref="chargeList" show-summary :summary-method="getSummaries"
+        <el-table v-loading="loading" :data="chargeList_s" ref="chargeList" show-summary :summary-method="getSum"
                   @selection-change="handleSelectionChange_s"
         >
           <el-table-column type="selection" width="55" align="center"/>
@@ -569,6 +569,8 @@ export default {
       showSearch: true,
       // 总条数
       total: 0,
+      totAL:0,
+      Ttime:0,
       //提单号暂存
       fMblno: '',
       // 财务数据主表格数据
@@ -690,6 +692,7 @@ export default {
         if (data.code === 200){
           this.$message.success('撤销成功');
           this.open = false
+          this.getList()
         }
       })
     },
@@ -937,28 +940,46 @@ export default {
       this.queryParameter = {
         fToCorpid: this.queryParams.fCorpid,
       }
+      this.chargeList_s = []
       // this.queryParameter.fToCorpid = this.queryParams.fCorpid
       this.innerVisible = true
     },
-    getSummaries(param) {
-      const { columns, data } = param
-      const sums = []
+    getSum(param){
+      const {columns,data} = param;
+      const sums = [];
       columns.forEach((column, index) => {
-        const values = data.map(item => Number(item[column.property]))
-        if (!values.every(value => isNaN(value))) {
-          sums[index] = values.reduce((prev, curr) => {
-            const value = Number(curr)
-            if (!isNaN(value)) {
-              return prev + curr
-            } else {
-              return prev
-            }
-          }, 0)
-          sums[0] = '合计'
-          sums[3] = ''
+        sums[0] = '合计'
+        sums[10] = this.totAL.toFixed(2)
+        sums[9] = this.Ttime.toFixed(2)
+      });
+      return sums;
+    },
+    // 导入多选框
+    handleSelectionChange_s(selection) {
+      this.totAL = 0
+      this.Ttime = 0
+      this.selection = selection
+      console.log(selection)
+      if(this.selection.length == 0){
+        for (let item in this.chargeList_s){
+          this.totAL += Number(this.chargeList_s[item].fAmt)
+          this.Ttime += Number(this.chargeList_s[item].fAmtdr)
         }
-      })
-      return sums
+      }else {
+        for (let index in selection){
+          this.totAL += Number(selection[index].fAmt)
+          this.Ttime += Number(selection[index].fAmtdr)
+        }
+      }
+      // this.getSummaries()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      console.log(selection)
+      this.totAL = 0
+      this.ids = selection.map(item => item.fId)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
     },
     imgChangeI(row) {
       if (row.fAmt && Number(row.fAmt) > Number(row.fAmtdr)) {
@@ -966,19 +987,31 @@ export default {
         this.state_s = true
       }
       console.log('数据:' + JSON.stringify(this.selection))
-      // this.$refs.chargeList.clearSelection()
+      if (this.selection.length !== 0){
+        this.totAL = 0
+        this.Ttime = 0
+        for (let item in this.selection){
+          this.totAL += Number(this.selection[item].fAmt)
+          this.Ttime += Number(this.selection[item].fAmtdr)
+        }
+      }else {
+        this.totAL = 0
+        this.Ttime = 0
+        for (let item in this.chargeList_s){
+          this.totAL += Number(this.chargeList_s[item].fAmt)
+          this.Ttime += Number(this.chargeList_s[item].fAmtdr)
+        }
+      }
     },
     //确认导入
     confirmImport() {
       this.hide = true
       console.log(this.state_s)
       for (let item in this.selection) {
-        this.pass.fAmtcr = Number(this.pass.fAmtcr)
-        this.pass.fAmtdr = Number(this.pass.fAmtdr)
-        this.pass.fAmtcr += Number(this.selection[item].fAmt)
-        this.pass.fAmtdr += Number(this.selection[item].fAmtdr)
-        console.log(this.pass.fAmtcr)
-        console.log(this.pass.fAmtdr)
+        this.pass.fAmtcr = Number(this.pass.fAmtcr).toFixed(2)
+        this.pass.fAmtdr = Number(this.pass.fAmtdr).toFixed(2)
+        this.pass.fAmtcr += Number(this.selection[item].fAmt).toFixed(2)
+        this.pass.fAmtdr += Number(this.selection[item].fAmtdr).toFixed(2)
       }
       if (this.state_s == true) {
         if (this.selection.length == '0') {
@@ -1009,7 +1042,6 @@ export default {
           } else {
             this.pass.fName = this.nothing[0] + '...'
           }
-
           this.increase_s = this.increase_s.concat(this.selection)
           this.queryParams.tMblno = this.pass.fMblno //提单号
           this.queryParams.fCtrlcorpid = this.pass.fName
@@ -1035,16 +1067,16 @@ export default {
     },
     /** 查询财务数据主列表 */
     getList() {
-        this.loading = true
-        this.getDicts('approval_process').then((response) => {
-          this.options = response.data
-        })
-        listCharge(this.tableFilter).then(response => {
-          console.log(response)
-          this.chargeList = response.rows
-          this.total = response.total
-          this.loading = false
-        })
+      this.loading = true
+      this.getDicts('approval_process').then((response) => {
+        this.options = response.data
+      })
+      listCharge(this.tableFilter).then(response => {
+        console.log(response)
+        this.chargeList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
     },
     // 取消按钮
     cancel() {
@@ -1079,7 +1111,6 @@ export default {
     handleQuery() {
       this.queryParams.pageNum = 1
       this.getList()
-      console.log(this.tableFilter)
     },
     /** 导入搜索 */
     importSearch() {
@@ -1091,7 +1122,11 @@ export default {
         this.rules = {}
         search(this.queryParameter).then(response => {
           this.chargeList_s = response.rows
-          this.$message.success('查询成功');
+          this.$message.success('查询成功1');
+          for (let item in this.chargeList_s){
+            this.totAL += Number(this.chargeList_s[item].fAmt)
+            this.Ttime += Number(this.chargeList_s[item].fAmtdr)
+          }
         })
       }else {
         this.rules = {
@@ -1107,7 +1142,13 @@ export default {
             if (valid) {
               search(this.queryParameter).then(response => {
                 this.chargeList_s = response.rows
-                this.$message.success('查询成功');
+                this.$message.success('查询成功2');
+                this.totAL = 0
+                this.Ttime = 0
+                for (let item in this.chargeList_s){
+                  this.totAL += Number(this.chargeList_s[item].fAmt)
+                  this.Ttime += Number(this.chargeList_s[item].fAmtdr)
+                }
               })
             }
           })
@@ -1131,18 +1172,18 @@ export default {
     resetQuery() {
       this.tableFilter = {
         pageNum: 1,
-          pageSize: 10,
-          fBillno: null,
-          fCtrlcorpid: null,
-          fCorpid: null,
-          tMblno: null,
-          fAmtdr: null,
-          fAmtcr: null,
-          fBilltype: null,
-          fBillstatus: null,
-          fRemarks: null,
-          fAccbilldate: null,
-          fDeptid: null
+        pageSize: 10,
+        fBillno: null,
+        fCtrlcorpid: null,
+        fCorpid: null,
+        tMblno: null,
+        fAmtdr: null,
+        fAmtcr: null,
+        fBilltype: null,
+        fBillstatus: null,
+        fRemarks: null,
+        fAccbilldate: null,
+        fDeptid: null
       }
       this.handleQuery()
     },
@@ -1170,17 +1211,6 @@ export default {
         this.fWbuOptions = response.rows
       })
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.fId)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
-    },
-    // 导入多选框
-    handleSelectionChange_s(selection) {
-      console.log(selection)
-      this.selection = selection
-    },
     /** 新增按钮操作 */
     handleAdd() {
       this.notChange = false
@@ -1211,7 +1241,7 @@ export default {
         fAccbilldate: null,
         fDeptid: null
       }
-        this.resetForm('queryParams')
+      this.resetForm('queryParams')
       this.open = true
       this.title = '添加财务数据主'
     },
@@ -1341,7 +1371,6 @@ export default {
         console.log(this.increase_s[item])
         this.queryParams.fAmtcr += this.increase_s[item].fAmt
         this.queryParams.fAmtdr += this.increase_s[item].fAmtdr
-
       }
       console.log(this.queryParams.fAmtdr)
       console.log(this.queryParams.fAmtcr)