zjxpcyc 6 gadus atpakaļ
vecāks
revīzija
c7a6429cbd

+ 31
- 6
src/pages/system/library/borrow/bookreturn.vue Parādīt failu

@@ -37,10 +37,14 @@
37 37
         <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
38 38
         <el-table-column prop="BookName" label="书名"></el-table-column>
39 39
         <el-table-column prop="BookTypeName" label="分类"></el-table-column>
40
-        <el-table-column prop="ReturnDate" label="规定归还日期"></el-table-column>
40
+        <el-table-column label="规定归还日期">
41
+          <template slot-scope="scope">
42
+            <span>{{toolClass.dateFormat(scope.row.EndDate)}}</span>
43
+          </template>
44
+        </el-table-column>
41 45
         <el-table-column label="逾期天数">
42 46
           <template slot-scope="scope">
43
-            <span>{{ diffToday(scope.row.ReturnDate) }}</span>
47
+            <span>{{ diffToday(scope.row.EndDate) }}</span>
44 48
           </template>
45 49
         </el-table-column>
46 50
         <el-table-column fixed="right" label="操作" width="150">
@@ -51,7 +55,7 @@
51 55
       </el-table>
52 56
 
53 57
       <div :style="{ paddingTop: '40px' }">
54
-        <el-button @click="$router.back()">取消</el-button>
58
+        <el-button @click="cancel()">取消</el-button>
55 59
       </div>
56 60
     </div>
57 61
   </div>
@@ -85,7 +89,8 @@ export default {
85 89
     ...mapActions({
86 90
       getBorrowHistory: 'getBorrowHistory',
87 91
       getList: 'getReturnList',
88
-      returnBook: 'returnBook'
92
+      returnBook: 'returnBook',
93
+      getUserReturn: 'getUserReturn'
89 94
     }),
90 95
 
91 96
     nextStep() {
@@ -109,8 +114,21 @@ export default {
109 114
             type: 'error'
110 115
           })
111 116
         })
117
+      this.getList()
112 118
     },
119
+    getList () {
120
+      this.getUserReturn({ customerInfo: this.customerInfo, page: 1, pagesize: 1000 })
121
+        .then(() => {
113 122
 
123
+        })
124
+        .catch(err => {
125
+          this.$message({
126
+            showClose: true,
127
+            message: err,
128
+            type: 'error'
129
+          })
130
+        })
131
+    },
114 132
     isBookReturn(book) {
115 133
       this.$confirm('确定归还此书?', '提示', {
116 134
         confirmButtonText: '确定',
@@ -118,13 +136,16 @@ export default {
118 136
         type: 'warning'
119 137
       })
120 138
         .then(() => {
121
-          this.returnBook(book)
139
+          this.returnBook({
140
+            borrowIds: book.BookBorrowRecordId,
141
+          })
122 142
             .then(() => {
123 143
               this.$message({
124 144
                 showClose: true,
125 145
                 message: '归还成功',
126 146
                 type: 'success'
127 147
               })
148
+              this.getList()
128 149
             })
129 150
             .catch(err => {
130 151
               this.$message({
@@ -139,8 +160,12 @@ export default {
139 160
 
140 161
     diffToday(dt) {
141 162
       const days =
142
-        (new window.Date().getTime() - dt.getTime()) / (1000 * 60 * 60 * 24)
163
+        (new window.Date().getTime() - (new Date(dt)).getTime()) / (1000 * 60 * 60 * 24)
143 164
       return days <= 0 ? 0 : days
165
+    },
166
+    cancel() {
167
+      this.customerInfo = ''
168
+      this.active = 0
144 169
     }
145 170
   }
146 171
 }

+ 27
- 0
src/store/library/index.js Parādīt failu

@@ -140,6 +140,9 @@ export default {
140 140
         state.stock.pagenum = 0
141 141
       }
142 142
     },
143
+    setUserReturn (state, payload = {}) {
144
+      state.bookReturn = payload
145
+    }
143 146
   },
144 147
   actions: {
145 148
     cancelBorrow ({ commit }, payload) { // 取消预约
@@ -332,5 +335,29 @@ export default {
332 335
           .catch(({ message }) => reject(message))
333 336
       })
334 337
     },
338
+    getUserReturn ({ commit }, payload) {
339
+      return new Promise((resolve, reject) => {
340
+        ajax({
341
+          ...api.book.getUserReturn,
342
+          urlData: { ...payload },
343
+          queryData: payload,
344
+        }).then((res) => {
345
+          commit('setUserReturn', res)
346
+          resolve(res)
347
+        })
348
+          .catch(({ message }) => reject(message))
349
+      })
350
+    },
351
+    returnBook ({ commit }, payload) {
352
+      return new Promise((resolve, reject) => {
353
+        ajax({
354
+          ...api.book.returnBook,
355
+          urlData: { ...payload },
356
+        }).then((res) => {
357
+          resolve(res)
358
+        })
359
+          .catch(({ message }) => reject(message))
360
+      })
361
+    }
335 362
   },
336 363
 }

+ 8
- 0
src/util/api.js Parādīt failu

@@ -1021,6 +1021,14 @@ const $api = {
1021 1021
       method: 'post',
1022 1022
       url: `${baseUrl}${common}/book/change`
1023 1023
     },
1024
+    getUserReturn: {
1025
+      method: 'get',
1026
+      url: `${baseUrl}${common}/book/return/:customerInfo`
1027
+    },
1028
+    returnBook: {
1029
+      method: 'post',
1030
+      url: `${baseUrl}${common}/book/return/:borrowIds`
1031
+    },
1024 1032
   },
1025 1033
 }
1026 1034
 export default $api