许成详 6 år sedan
förälder
incheckning
20c28e9bb8

+ 65
- 29
src/pages/system/library/borrow/appointmentList.vue Visa fil

@@ -5,16 +5,16 @@
5 5
         <div class="flex-item flex-h"></div>
6 6
         <ul style="white-space: normal;">
7 7
           <li style="margin-bottom: 15px;">
8
-            <el-input placeholder="请输入条形码" v-model="postData.BarCode"></el-input>
8
+            <el-input placeholder="请输入条形码" v-model="postData.barcode"></el-input>
9 9
           </li>
10 10
           <li style="margin-bottom: 15px;">
11
-            <el-input placeholder="请输入图书名" v-model="postData.BookName"></el-input>
11
+            <el-input placeholder="请输入图书名" v-model="postData.bookname"></el-input>
12 12
           </li>
13 13
           <li style="margin-bottom: 15px;">
14
-            <el-input placeholder="请输入用户名" v-model="postData.UserName"></el-input>
14
+            <el-input placeholder="请输入用户名" v-model="postData.customername"></el-input>
15 15
           </li>
16 16
           <li style="margin-bottom: 15px;">
17
-            <el-input placeholder="请输入手机号" v-model="postData.Tel"></el-input>
17
+            <el-input placeholder="请输入手机号" v-model="postData.customerphone"></el-input>
18 18
           </li>
19 19
           <li style="margin-bottom: 15px;">
20 20
             <el-select v-model="CaseId" placeholder="请选择案场">
@@ -34,26 +34,31 @@
34 34
     </div>
35 35
     <div class="system-table-box">
36 36
       <el-table :data="list" stripe style="width: 100%">
37
-        <el-table-column prop="GoodsName" label="案场"></el-table-column>
37
+        <el-table-column label="案场">
38
+          <template slot-scope="scope">{{returnCaseName(scope.row.CaseId)}}</template>
39
+        </el-table-column>
38 40
         <el-table-column label="图片" width="300">
39 41
           <template slot-scope="scope">
40
-            <img :src="((scope.row.Images || [])[0] || {}).ImgUrl" style="width:200px;">
42
+            <img :src="scope.row.BookImg" style="height: 150px;">
41 43
           </template>
42 44
         </el-table-column>
43
-        <el-table-column prop="BarCode" label="条形码"></el-table-column>
45
+        <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
44 46
         <el-table-column prop="BookName" label="图书名"></el-table-column>
45
-        <el-table-column prop="UserName" label="用户名"></el-table-column>
46
-        <el-table-column prop="Tel" label="手机号"></el-table-column>
47
-        <el-table-column prop="xxDate" label="预约时间"></el-table-column>
48
-        <el-table-column prop="xxDate" label="保留时间"></el-table-column>
47
+        <el-table-column prop="CustomerName" label="用户名"></el-table-column>
48
+        <el-table-column prop="CustomerPhone" label="手机号"></el-table-column>
49
+        <el-table-column label="预约时间">
50
+          <template slot-scope="scope">{{toolClass.dateFormat(scope.row.ReserveDate)}}</template>
51
+        </el-table-column>
52
+        <el-table-column label="保留时间">
53
+          <template slot-scope="scope">{{toolClass.dateFormat(scope.row.ReserveEndDate)}}</template>
54
+        </el-table-column>
49 55
         <el-table-column label="操作">
50 56
           <template slot-scope="scope">
51
-            <el-button size="mini" type="warning">取消预约</el-button>
57
+            <el-button size="mini" type="warning" @click="cancel(scope.row.BookBorrowRecordId)">取消预约</el-button>
52 58
           </template>
53 59
         </el-table-column>
54 60
       </el-table>
55 61
       <el-pagination
56
-        @size-change="handleSizeChange"
57 62
         @current-change="handleCurrentChange"
58 63
         :current-page.sync="postData.page"
59 64
         :page-size="postData.pagesize"
@@ -71,25 +76,28 @@ export default {
71 76
   name: 'borrowList',
72 77
   data () {
73 78
     return {
74
-      total: 1000,
79
+      total: 1,
75 80
       postData: {
76
-        BarCode: '',
77
-        BookName: '',
78
-        UserName: '',
79
-        Tel: '',
80
-        Status: '',
81
-        CaseId: '',
81
+        barcode: '',
82
+        bookname: '',
83
+        customername: '',
84
+        customerphone: '',
85
+        borrowstatus: '4',
86
+        caseid: '',
82 87
         page: 1,
83 88
         pagesize: 10
84 89
       },
85 90
       statusList: [{
86 91
         id: '',
87 92
         value: ''
88
-      }],
89
-      list: []
93
+      }]
90 94
     }
91 95
   },
92 96
   created () {
97
+    this.getBorrowList({ ...this.postData }).then((res) => {
98
+      this.page = res.page
99
+      this.total = res.pagenum
100
+    })
93 101
   },
94 102
   computed: {
95 103
     ...mapState({
@@ -98,26 +106,54 @@ export default {
98 106
       orgid: x => x.app.user.OrgId
99 107
     }),
100 108
     ...mapLibSate({
109
+      list: x => x.borrow.list
101 110
     }),
102 111
     CaseId: {
103 112
       get () {
104
-        return this.postData.CaseId || this.defaultCaseId
113
+        return this.postData.caseid || this.defaultCaseId
105 114
       },
106 115
       set (val) {
107
-        this.postData.CaseId = val
116
+        this.postData.caseid = val
108 117
       }
109 118
     }
110 119
   },
111 120
   methods: {
112
-    ...mapLibActions([]),
113
-    search () {
114
-
121
+    ...mapLibActions(['getBorrowList', 'cancelBorrow']),
122
+    cancel (id) {
123
+      this.$confirm('确认取消预约?', '提示', {
124
+        confirmButtonText: '确定',
125
+        cancelButtonText: '取消',
126
+        type: 'warning'
127
+      }).then(() => {
128
+        this.cancelBorrow(id).then(() => {
129
+          this.getBorrowList({ ...this.postData }).then((res) => {
130
+            this.page = res.page
131
+            this.total = res.pagenum
132
+          })
133
+        })
134
+      })
115 135
     },
116
-    handleSizeChange (val) {
117
-      console.log(`每页 ${val} 条`)
136
+    search () {
137
+      this.page = 1
138
+      this.getBorrowList({ ...this.postData }).then((res) => {
139
+        this.page = res.page
140
+        this.total = res.pagenum
141
+      })
118 142
     },
119 143
     handleCurrentChange (val) {
144
+      this.postData.page = val
145
+      this.getBorrowList({ ...this.postData }).then((res) => {
146
+        this.page = res.page
147
+        this.total = res.pagenum
148
+      })
120 149
     },
150
+    returnCaseName (id) {
151
+      var name = ''
152
+      this.cases.map((item) => {
153
+        if (item.CaseId === id) name = item.CaseName
154
+      })
155
+      return name
156
+    }
121 157
   }
122 158
 }
123 159
 </script>

+ 59
- 14
src/pages/system/library/borrow/borrowList.vue Visa fil

@@ -11,10 +11,10 @@
11 11
             <el-input placeholder="请输入图书名" v-model="postData.bookname"></el-input>
12 12
           </li>
13 13
           <li style="margin-bottom: 15px;">
14
-            <el-input placeholder="请输入借阅人" v-model="postData.borrowername"></el-input>
14
+            <el-input placeholder="请输入借阅人" v-model="postData.customername"></el-input>
15 15
           </li>
16 16
           <li style="margin-bottom: 15px;">
17
-            <el-input placeholder="请输入手机号" v-model="postData.tel"></el-input>
17
+            <el-input placeholder="请输入手机号" v-model="postData.customerphone"></el-input>
18 18
           </li>
19 19
           <li style="margin-bottom: 15px;">
20 20
             <el-select v-model="CaseId" placeholder="请选择案场">
@@ -44,20 +44,30 @@
44 44
     </div>
45 45
     <div class="system-table-box">
46 46
       <el-table :data="list" stripe style="width: 100%">
47
-        <el-table-column prop="GoodsName" label="案场"></el-table-column>
47
+        <el-table-column label="案场">
48
+          <template slot-scope="scope">{{returnCaseName(scope.row.CaseId)}}</template>
49
+        </el-table-column>
48 50
         <el-table-column label="图片" width="300">
49 51
           <template slot-scope="scope">
50
-            <img :src="((scope.row.Images || [])[0] || {}).ImgUrl" style="width:200px;">
52
+            <img :src="scope.row.BookImg" style="height: 150px;">
51 53
           </template>
52 54
         </el-table-column>
53
-        <el-table-column prop="BarCode" label="条形码"></el-table-column>
55
+        <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
54 56
         <el-table-column prop="BookName" label="图书名"></el-table-column>
55
-        <el-table-column prop="BorrowerName" label="借阅人"></el-table-column>
56
-        <el-table-column prop="Tel" label="手机号"></el-table-column>
57
-        <el-table-column prop="CreateDate" label="借阅时间"></el-table-column>
58
-        <el-table-column prop="xxDate" label="规定归还时间"></el-table-column>
59
-        <el-table-column prop="xxDate" label="实际归还时间"></el-table-column>
60
-        <el-table-column prop="Status" label="状态"></el-table-column>
57
+        <el-table-column prop="CustomerName" label="借阅人"></el-table-column>
58
+        <el-table-column prop="CustomerPhone" label="手机号"></el-table-column>
59
+        <el-table-column label="借阅时间">
60
+          <template slot-scope="scope">{{toolClass.dateFormat(scope.row.BorrowDate)}}</template>
61
+        </el-table-column>
62
+        <el-table-column label="规定归还时间">
63
+          <template slot-scope="scope">{{toolClass.dateFormat(scope.row.EndDate)}}</template>
64
+        </el-table-column>
65
+        <el-table-column label="实际归还时间">
66
+          <template slot-scope="scope">{{toolClass.dateFormat(scope.row.ReturnDate)}}</template>
67
+        </el-table-column>
68
+        <el-table-column label="状态">
69
+          <template slot-scope="scope">{{returnStatus(scope.row.BorrowStatus)}}</template>
70
+        </el-table-column>
61 71
       </el-table>
62 72
       <el-pagination
63 73
         @current-change="handleCurrentChange"
@@ -77,12 +87,12 @@ export default {
77 87
   name: 'borrowList',
78 88
   data () {
79 89
     return {
80
-      total: 1000,
90
+      total: 1,
81 91
       postData: {
82 92
         barcode: '',
83 93
         bookname: '',
84
-        borrowername: '',
85
-        tel: '',
94
+        customername: '',
95
+        customerphone: '',
86 96
         borrowstatus: '',
87 97
         caseid: '',
88 98
         page: 1,
@@ -91,6 +101,27 @@ export default {
91 101
       statusList: [{
92 102
         id: '',
93 103
         value: ''
104
+      }, {
105
+        id: '0',
106
+        value: '延期'
107
+      }, {
108
+        id: '1',
109
+        value: '借阅中'
110
+      }, {
111
+        id: '2',
112
+        value: '已归还'
113
+      }, {
114
+        id: '3',
115
+        value: '逾期归还'
116
+      }, {
117
+        id: '4',
118
+        value: '预约中'
119
+      }, {
120
+        id: '5',
121
+        value: '过期'
122
+      }, {
123
+        id: '6',
124
+        value: '取消'
94 125
       }]
95 126
     }
96 127
   },
@@ -134,6 +165,20 @@ export default {
134 165
         this.total = res.pagenum
135 166
       })
136 167
     },
168
+    returnCaseName (id) {
169
+      var name = ''
170
+      this.cases.map((item) => {
171
+        if (item.CaseId === id) name = item.CaseName
172
+      })
173
+      return name
174
+    },
175
+    returnStatus (id) {
176
+      var status = ''
177
+      this.statusList.map((item) => {
178
+        if (item.id === id) status = item.value
179
+      })
180
+      return status
181
+    }
137 182
   }
138 183
 }
139 184
 </script>

+ 10
- 0
src/store/library/index.js Visa fil

@@ -99,6 +99,16 @@ export default {
99 99
     }
100 100
   },
101 101
   actions: {
102
+    cancelBorrow ({ commit }, payload) { // 取消预约
103
+      return new Promise((resolve, reject) => {
104
+        ajax(api.borrow.cancelBorrow.url, {
105
+          method: api.borrow.cancelBorrow.method,
106
+          urlData: { id: payload }
107
+        }).then(res => {
108
+          resolve(res)
109
+        }).catch(({ message }) => reject(message))
110
+      })
111
+    },
102 112
     getBorrowList ({ commit }, payload) { // 获取借阅记录
103 113
       return new Promise((resolve, reject) => {
104 114
         ajax(api.borrow.getBorrowList.url, {

+ 5
- 1
src/util/api.js Visa fil

@@ -952,7 +952,11 @@ const $api = {
952 952
     getBorrowList: {
953 953
       method: 'get',
954 954
       url: `${baseUrl}${common}/book/record`
955
-    },    
955
+    },
956
+    cancelBorrow: {
957
+      method: 'put',
958
+      url: `${baseUrl}${common}/book/cancel/:id`
959
+    }
956 960
   },
957 961
   bookType: {
958 962
     list: {