chenyuesheng преди 2 години
родител
ревизия
3626de100a
променени са 1 файла, в които са добавени 50 реда и са изтрити 20 реда
  1. 50 20
      src/views/modules/reimbursementSys/accountant/reimbursementIsNoTicketList.vue

+ 50 - 20
src/views/modules/reimbursementSys/accountant/reimbursementIsNoTicketList.vue

@@ -114,8 +114,8 @@
     <el-dialog
       title="选择绑定业务编号"
       :visible.sync="dialogVisible"
-      width="60%" >
-      <el-col :span="12" >
+      width="60%">
+      <el-col :span="12">
         <label-wrap>请选择年份:</label-wrap>
         <el-select v-model="selectedYear" filterable placeholder="请选择" @change="findSelectCodeListByYear">
           <el-option
@@ -127,9 +127,9 @@
         </el-select>
       </el-col>
 
-      <el-col :span="12" >
+      <el-col :span="12">
         <label-wrap>请选择编号:</label-wrap>
-        <el-select v-model="selectedCode" filterable placeholder="请选择">
+        <el-select v-model="selectedCode" filterable placeholder="请选择" @change="determination($event)">
           <el-option
             v-for="item in selectCode"
             :key="item.id"
@@ -160,7 +160,7 @@
   import reimbursementSelect from './reimbursementSelectDialog'
 
   export default {
-    data () {
+    data() {
       return {
         dataList: [],
         searchForm: {
@@ -179,7 +179,9 @@
         selectCode: [],
         selectedCode: '',
         selectYear: [],
-        selectedYear: ''
+        selectedYear: '',
+        reimbursementAmount: 0,
+        canReimbursementAmount: 0
       }
     },
     components: {
@@ -192,15 +194,15 @@
       SelectUserTree
     },
     ReimbursementSys: null,
-    created () {
+    created() {
       this.reimbursementSys = new ReimbursementSys()
     },
-    activated () {
+    activated() {
       this.refreshList()
     },
     methods: {
       // 获取数据列表
-      refreshList () {
+      refreshList() {
         this.loading = true
         this.reimbursementSys.findList({
           'current': this.tablePage.currentPage,
@@ -214,23 +216,23 @@
         })
       },
       // 当前页
-      currentChangeHandle ({currentPage, pageSize}) {
+      currentChangeHandle({currentPage, pageSize}) {
         this.tablePage.currentPage = currentPage
         this.tablePage.pageSize = pageSize
         this.refreshList()
       },
-      resetSearch () {
+      resetSearch() {
         this.$refs.searchForm.resetFields()
         this.$nextTick(() => {
           this.refreshList()
         })
       },
       // 修改发票信息
-      modifyInvoice (id) {
+      modifyInvoice(id) {
         this.$refs.reimbursementInvoiceModify.init('modifyInvoice', {id: id, parent: {id: '', name: ''}})
       },
       // 删除
-      delInvoice (id) {
+      delInvoice(id) {
         let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
           return item.id
         }).join(',')
@@ -251,7 +253,7 @@
           })
         })
       },
-      addBusinessInfo (id, businessCode) {
+      addBusinessInfo(id, businessCode) {
         this.$refs.reimbursementBusinessForm.init('addBusinessInfo', {
           id: '',
           businessCodeId: '',
@@ -259,38 +261,66 @@
           parent: {id: '', name: ''}
         })
       },
-      bindBusinessCode () {
+      bindBusinessCode() {
         if (this.selectedCode === '') {
           this.$message('请选择绑定编号')
           return
         }
-        this.reimbursementSys.modifyBindCode({'ids': this.bindObj, 'businessCode': this.selectedCode}).then(({data}) => {
+        this.reimbursementSys.modifyBindCode({
+          'ids': this.bindObj,
+          'businessCode': this.selectedCode,
+          'money': this.reimbursementAmount
+        }).then(({data}) => {
+          if (!data) {
+            this.$message('可报销额度不足')
+          }
           this.closeDialog()
         })
       },
-      openDialog (obj) {
+      openDialog(obj) {
         // eslint-disable-next-line eqeqeq
         this.bindObj = obj.id || obj.map(item => {
           return item.id
         }).join(',')
         this.dialogVisible = true
+        if (obj.length > 1) {
+          obj.map(item => {
+            this.reimbursementAmount += parseInt(item.reimbursementAmount)
+          })
+        } else {
+          this.reimbursementAmount = obj.reimbursementAmount
+        }
         this.reimbursementSys.findSelectYearList().then(({data}) => {
           this.selectYear = data
           this.selectedYear = this.selectYear[0]
           this.findSelectCodeListByYear()
         })
       },
-      closeDialog () {
+      closeDialog() {
         this.dialogVisible = false
         this.selectedCode = ''
         this.refreshList()
         this.bindObj = []
+        this.reimbursementAmount = 0
       },
-      findSelectCodeListByYear () {
+      findSelectCodeListByYear() {
+        this.selectedCode = ''
         this.reimbursementSys.findSelectCodeListByYear(this.selectedYear).then(({data}) => {
           this.selectCode = data
-          this.selectedCode = this.selectCode[0].businessCode
+          this.selectedCode = this.selectCode[0].id
         })
+      },
+      determination(e) {
+        console.log(e)
+        for (let i = 0; i < this.selectCode.length; i++) {
+          if (this.selectCode[i].id === e) {
+            console.log(this.selectCode[i].canReimbursementAmount)
+            console.log(this.reimbursementAmount)
+            if (parseInt(this.selectCode[i].canReimbursementAmount) < parseInt(this.reimbursementAmount)) {
+              this.$message('可报销额度不足,可报销额度为' + this.selectCode[i].canReimbursementAmount)
+            }
+          }
+        }
       }
     }