zjxpcyc 6 vuotta sitten
vanhempi
commit
c7a6429cbd

+ 31
- 6
src/pages/system/library/borrow/bookreturn.vue Näytä tiedosto

37
         <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
37
         <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
38
         <el-table-column prop="BookName" label="书名"></el-table-column>
38
         <el-table-column prop="BookName" label="书名"></el-table-column>
39
         <el-table-column prop="BookTypeName" label="分类"></el-table-column>
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
         <el-table-column label="逾期天数">
45
         <el-table-column label="逾期天数">
42
           <template slot-scope="scope">
46
           <template slot-scope="scope">
43
-            <span>{{ diffToday(scope.row.ReturnDate) }}</span>
47
+            <span>{{ diffToday(scope.row.EndDate) }}</span>
44
           </template>
48
           </template>
45
         </el-table-column>
49
         </el-table-column>
46
         <el-table-column fixed="right" label="操作" width="150">
50
         <el-table-column fixed="right" label="操作" width="150">
51
       </el-table>
55
       </el-table>
52
 
56
 
53
       <div :style="{ paddingTop: '40px' }">
57
       <div :style="{ paddingTop: '40px' }">
54
-        <el-button @click="$router.back()">取消</el-button>
58
+        <el-button @click="cancel()">取消</el-button>
55
       </div>
59
       </div>
56
     </div>
60
     </div>
57
   </div>
61
   </div>
85
     ...mapActions({
89
     ...mapActions({
86
       getBorrowHistory: 'getBorrowHistory',
90
       getBorrowHistory: 'getBorrowHistory',
87
       getList: 'getReturnList',
91
       getList: 'getReturnList',
88
-      returnBook: 'returnBook'
92
+      returnBook: 'returnBook',
93
+      getUserReturn: 'getUserReturn'
89
     }),
94
     }),
90
 
95
 
91
     nextStep() {
96
     nextStep() {
109
             type: 'error'
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
     isBookReturn(book) {
132
     isBookReturn(book) {
115
       this.$confirm('确定归还此书?', '提示', {
133
       this.$confirm('确定归还此书?', '提示', {
116
         confirmButtonText: '确定',
134
         confirmButtonText: '确定',
118
         type: 'warning'
136
         type: 'warning'
119
       })
137
       })
120
         .then(() => {
138
         .then(() => {
121
-          this.returnBook(book)
139
+          this.returnBook({
140
+            borrowIds: book.BookBorrowRecordId,
141
+          })
122
             .then(() => {
142
             .then(() => {
123
               this.$message({
143
               this.$message({
124
                 showClose: true,
144
                 showClose: true,
125
                 message: '归还成功',
145
                 message: '归还成功',
126
                 type: 'success'
146
                 type: 'success'
127
               })
147
               })
148
+              this.getList()
128
             })
149
             })
129
             .catch(err => {
150
             .catch(err => {
130
               this.$message({
151
               this.$message({
139
 
160
 
140
     diffToday(dt) {
161
     diffToday(dt) {
141
       const days =
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
       return days <= 0 ? 0 : days
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 Näytä tiedosto

140
         state.stock.pagenum = 0
140
         state.stock.pagenum = 0
141
       }
141
       }
142
     },
142
     },
143
+    setUserReturn (state, payload = {}) {
144
+      state.bookReturn = payload
145
+    }
143
   },
146
   },
144
   actions: {
147
   actions: {
145
     cancelBorrow ({ commit }, payload) { // 取消预约
148
     cancelBorrow ({ commit }, payload) { // 取消预约
332
           .catch(({ message }) => reject(message))
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 Näytä tiedosto

1021
       method: 'post',
1021
       method: 'post',
1022
       url: `${baseUrl}${common}/book/change`
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
 export default $api
1034
 export default $api