index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <el-col :span="24">
  5. <div class="cell">
  6. <div class="cell-title">
  7. <div class="title-left">
  8. <div class="title">台账管理</div>
  9. </div>
  10. </div>
  11. <div class="cell-body">
  12. <div class="controls">
  13. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  14. <el-form-item label="所属乡镇">
  15. <el-select v-model="formInline.id" clearable placeholder="请选择">
  16. <el-option v-for="item in formInline.options" :key="item.id" :label="item.hotelTownship" :value="item.id">
  17. </el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="订单金额">
  21. <el-input placeholder="请输入金额" v-model="formInline.amount1" clearable style="width: 118px;">
  22. </el-input>
  23. -
  24. <el-input placeholder="请输入金额" v-model="formInline.amount2" clearable style="width: 118px;">
  25. </el-input>
  26. </el-form-item>
  27. <el-form-item label="退房时间">
  28. <el-date-picker v-model="formInline.search_datatime" type="daterange" align="right" start-placeholder="开始日期"
  29. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item label="">
  33. <el-input v-model="formInline.keyword" style="width: 200px;" prefix-icon="el-icon-search" clearable
  34. placeholder="请输入关键字"></el-input>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button type="primary" class="btn-search" @click="btn_search">查询</el-button>
  38. </el-form-item>
  39. </el-form>
  40. <el-button type="primary" icon="el-icon-download" class="export" @click="exportExcel">导出订单</el-button>
  41. </div>
  42. <el-table :data="tableData" height="510" style="width: 100%" :cell-style="cell_style" v-loading="loading"
  43. :header-cell-style="header_cell_style">
  44. <el-table-column type="expand" width="50">
  45. <template slot-scope="props">
  46. <el-form label-position="left" inline class="demo-table-expand">
  47. <!-- <el-form-item label="所属乡镇">
  48. <span>{{ props.row.hotelHposition }}</span>
  49. </el-form-item>
  50. <el-form-item label="民宿名称">
  51. <span>{{ props.row.hotelName }}</span>
  52. </el-form-item>
  53. <el-form-item label="订单号">
  54. <span>{{ props.row.orderNum }}</span>
  55. </el-form-item>
  56. <el-form-item label="订单金额(元)">
  57. <span>{{ props.row.houseTotalPrice }}</span>
  58. </el-form-item>
  59. <el-form-item label="退房时间">
  60. <span>{{ props.row.checkOutTime }}</span>
  61. </el-form-item> -->
  62. <el-form-item label="民宿联系人">
  63. <span>{{ props.row.hotelPerson }}</span>
  64. </el-form-item>
  65. <el-form-item label="民宿联系电话">
  66. <span>{{ props.row.hotelPhone }}</span>
  67. </el-form-item>
  68. <el-form-item label="酒店类型">
  69. <span>{{ props.row.hotelType }}</span>
  70. </el-form-item>
  71. <el-form-item label="酒店位置">
  72. <span>{{ props.row.hotelHposition }}</span>
  73. </el-form-item>
  74. <el-form-item label="酒店名称">
  75. <span>{{ props.row.hotelName }}</span>
  76. </el-form-item>
  77. <el-form-item label="酒店位置经纬度">
  78. <span>{{ props.row.hotelHpositionWens }}</span>
  79. </el-form-item>
  80. <el-form-item label="接单设置">
  81. <span>{{ props.row.hotelIsCanorder }}</span>
  82. </el-form-item>
  83. <el-form-item label="酒店状态(1 营业 2.休息)">
  84. <span>{{ props.row.hotelStatus }}</span>
  85. </el-form-item>
  86. <el-form-item label="开业时间">
  87. <span>{{ props.row.openTime }}</span>
  88. </el-form-item>
  89. <el-form-item label="装修时间">
  90. <span>{{ props.row.fitupTime }}</span>
  91. </el-form-item>
  92. <el-form-item label="订单创建时间">
  93. <span>{{ props.row.createTime }}</span>
  94. </el-form-item>
  95. <el-form-item label="入住时间">
  96. <span>{{ props.row.liveTime }}</span>
  97. </el-form-item>
  98. <el-form-item label="离店时间">
  99. <span>{{ props.row.checkOutTime }}</span>
  100. </el-form-item>
  101. </el-form>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="所属乡镇" align="center" width="180">
  105. <template slot-scope="scope">
  106. <span>{{ scope.row.hotelHposition }}</span>
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="民宿名称" align="center">
  110. <template slot-scope="scope">
  111. <span>{{ scope.row.hotelName }}</span>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="订单号" align="center">
  115. <template slot-scope="scope">
  116. <span>{{ scope.row.orderNum }}</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="订单金额(元)" align="center">
  120. <template slot-scope="scope">
  121. <span>{{ scope.row.houseTotalPrice }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="退房时间" align="center">
  125. <template slot-scope="scope">
  126. <span>{{ scope.row.checkOutTime }}</span>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. <div class="pagination-table">
  131. <div class="txt-notice">订单总额:<span>{{ sumAccount }}元</span></div>
  132. <el-pagination @current-change="currentPageChange" :current-page.sync="pagination.currentPage" :page-size="pagination.pageSize"
  133. layout="prev, pager, next, jumper" :total="pagination.total">
  134. </el-pagination>
  135. </div>
  136. </div>
  137. </div>
  138. </el-col>
  139. </el-row>
  140. </div>
  141. </template>
  142. <script>
  143. import {
  144. getTableData,
  145. getTowns,
  146. downloadExcel
  147. } from '@/api/stdbookMgr'
  148. export default {
  149. data() {
  150. return {
  151. dialogImageUrl: '',
  152. formLabelWidth: '120px',
  153. sumAccount: '', // 总金额
  154. // 表格单元格样式
  155. cell_style: {
  156. color: '#1A202B',
  157. 'font-size': '14px',
  158. 'font-family': 'Microsoft YaHei-3970(82674968)'
  159. },
  160. // 表格头部样式
  161. header_cell_style: {
  162. background: '#E6ECFE',
  163. color: '#1A202B',
  164. 'font-size': '16px',
  165. 'font-family': 'Microsoft YaHei-3970(82674968)'
  166. },
  167. // 查询数据
  168. formInline: {
  169. options: [],
  170. id: '',
  171. amount1: '',
  172. amount2: '',
  173. search_datatime: '',
  174. keyword: ''
  175. },
  176. tableData: [],
  177. cond_data: {},
  178. // 分页参数
  179. pagination: {
  180. currentPage: 1,
  181. pageSize: 9,
  182. total: 0
  183. },
  184. loading: true
  185. }
  186. },
  187. created() {
  188. // 获取消费记录,表格数据
  189. this.get_table_data('list')
  190. // 获取乡镇
  191. this.get_towns()
  192. },
  193. mounted() {
  194. document.getElementsByClassName("el-pagination__jump")[0].childNodes[0].nodeValue = "跳至";
  195. },
  196. methods: {
  197. // 获取乡镇列表
  198. get_towns() {
  199. getTowns().then((res) => {
  200. if (res.code === 200) {
  201. this.formInline.options = []
  202. for (var i = 0; i < res.data.length; i++) {
  203. let town = {
  204. id: res.data[i].id,
  205. hotelTownship: res.data[i].name
  206. }
  207. this.formInline.options.push(town)
  208. }
  209. } else {
  210. if (res.data.length === 0) {
  211. this.formInline.options = []
  212. this.$message.warning('没有符合条件的数据!')
  213. } else {
  214. this.$message.warning(res.message)
  215. }
  216. }
  217. }).catch((err) => {
  218. // console.log(err);
  219. this.$message.error(err.message)
  220. });
  221. },
  222. /**
  223. * 获取消费记录,表格数据
  224. */
  225. get_table_data(param) {
  226. this.loading = true
  227. this.get_condtion();
  228. let data = this.cond_data;
  229. if (param == 'search') {
  230. data.page = 1
  231. this.pagination.currentPage = 1
  232. }
  233. var that = this
  234. // console.log(data);
  235. getTableData(data).then((res) => {
  236. // console.log(res);
  237. if (res.code === 200) {
  238. var d = res.data
  239. that.pagination.total = d.bookIPage.total
  240. that.tableData = []
  241. for (var i = 0; i < d.bookIPage.pageList.length; i++) {
  242. that.tableData.push(d.bookIPage.pageList[i])
  243. }
  244. that.sumAccount = d.sumAccount.toFixed(2)
  245. } else {
  246. that.tableData = []
  247. that.$message.warning('没有符合条件的数据!')
  248. }
  249. }).catch((err) => {
  250. // console.log(err);
  251. that.$message.error(err.message)
  252. });
  253. that.loading = false;
  254. },
  255. /**
  256. * 查询条件
  257. */
  258. get_condtion() {
  259. let data = {
  260. page: this.pagination.currentPage,
  261. rows: this.pagination.pageSize
  262. }
  263. if (this.formInline.id !== '') {
  264. data.id = this.formInline.id
  265. }
  266. if (this.formInline.amount1 !== '') {
  267. data.amount1 = this.formInline.amount1
  268. }
  269. if (this.formInline.amount2 !== '') {
  270. data.amount2 = this.formInline.amount2
  271. }
  272. if (this.formInline.search_datatime !== '') {
  273. data.search_datatime = this.formInline.search_datatime
  274. }
  275. if (this.formInline.keyword !== '') {
  276. data.keyword = this.formInline.keyword
  277. }
  278. this.cond_data = data;
  279. },
  280. /**
  281. * 导出为Excel
  282. */
  283. exportExcel() {
  284. var that = this
  285. downloadExcel(this.cond_data).then((res) => {
  286. console.log(res);
  287. if (res.code === 200) {
  288. that.$message.success(res.message)
  289. } else {
  290. that.tableData = []
  291. that.$message.warning(res.message)
  292. }
  293. }).catch((err) => {
  294. // console.log(err);
  295. that.$message.error(err.message)
  296. });
  297. },
  298. /**
  299. * 搜索
  300. */
  301. btn_search() {
  302. this.get_table_data('search')
  303. },
  304. /**
  305. * currentPage 改变时会触发
  306. * @param {Object} val
  307. */
  308. currentPageChange(val) {
  309. this.pagination.currentPage = val
  310. this.get_table_data('pages')
  311. }
  312. }
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. .app-container {
  317. background-color: #EFF2F7;
  318. padding: 10px;
  319. .el-row {
  320. .el-col {
  321. padding: 10px;
  322. .cell {
  323. padding: 30px;
  324. border-radius: 10px;
  325. background-color: #FFFFFF;
  326. box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
  327. .cell-title {
  328. display: flex;
  329. justify-content: space-between;
  330. align-items: center;
  331. margin-bottom: 30px;
  332. padding-bottom: 30px;
  333. border-bottom: 1px solid #CCCCCC;
  334. .title-left {
  335. display: flex;
  336. align-items: center;
  337. .title {
  338. font-size: 22px;
  339. font-family: Microsoft YaHei-3970(82674968);
  340. font-weight: bold;
  341. color: #1A202B;
  342. }
  343. .title-detail {
  344. margin-left: 50px;
  345. font-size: 18px;
  346. font-family: Microsoft YaHei-3970(82674968);
  347. color: #1A202B;
  348. }
  349. }
  350. .title-right {
  351. display: flex;
  352. justify-content: space-between;
  353. align-items: center;
  354. .el-button {
  355. width: 110px;
  356. height: 46px;
  357. background: #2B4CFE;
  358. font-size: 18px;
  359. color: #FFFFFF;
  360. font-family: Microsoft YaHei-3970(82674968);
  361. border-radius: 5px;
  362. }
  363. .el-button--warning {
  364. background: #F88A64;
  365. }
  366. }
  367. }
  368. .cell-body {
  369. .controls {
  370. display: flex;
  371. justify-content: space-between;
  372. align-items: center;
  373. .demo-form-inline {
  374. display: inline-flex;
  375. flex-wrap: wrap;
  376. align-items: center;
  377. justify-content: flex-start;
  378. .btn-search {
  379. background: rgba(9, 101, 98, 1);
  380. font-size: 14px;
  381. color: #FFFFFF;
  382. font-family: Microsoft YaHei-3970(82674968);
  383. border-radius: 5px;
  384. border: none;
  385. }
  386. }
  387. .export {
  388. background: rgba(9, 101, 98, 1);
  389. font-size: 14px;
  390. color: #FFFFFF;
  391. font-family: Microsoft YaHei-3970(82674968);
  392. border-radius: 5px;
  393. margin-bottom: 22px;
  394. border: none;
  395. }
  396. }
  397. .pagination-table {
  398. display: flex;
  399. justify-content: space-between;
  400. align-items: center;
  401. height: 30px;
  402. margin-top: 20px;
  403. padding-right: 100px;
  404. .txt-notice {
  405. span {
  406. font-size: 28px;
  407. font-weight: 500;
  408. font-family: '微软雅黑';
  409. }
  410. }
  411. ::v-deep .el-pagination {
  412. display: flex;
  413. justify-content: flex-end;
  414. align-items: center;
  415. }
  416. ::v-deep .el-pagination ul {
  417. display: flex;
  418. }
  419. ::v-deep .el-pagination button,
  420. ::v-deep .el-pagination li {
  421. display: flex;
  422. justify-content: center;
  423. align-items: center;
  424. width: 50px;
  425. height: 36px;
  426. border: 1px solid #626262;
  427. border-radius: 3px;
  428. font-size: 14px;
  429. margin: 0 5px;
  430. }
  431. ::v-deep .el-pagination span {
  432. margin-left: 10px;
  433. }
  434. ::v-deep .el-pagination .el-pagination__jump {
  435. font-size: 16px;
  436. }
  437. ::v-deep .el-pagination .el-pagination__editor {
  438. width: 50px;
  439. height: 36px;
  440. margin: 0 5px;
  441. }
  442. ::v-deep .el-pagination .el-input__inner {
  443. width: 50px;
  444. height: 36px;
  445. border: 1px solid #626262;
  446. margin: -4px 0 0 0;
  447. }
  448. }
  449. }
  450. }
  451. }
  452. }
  453. }
  454. </style>
  455. <style>
  456. .el-date-editor--daterange.el-input__inner {
  457. width: 280px !important;
  458. }
  459. .demo-table-expand {
  460. font-size: 0;
  461. }
  462. .demo-table-expand label {
  463. width: 180px;
  464. color: #99a9bf;
  465. }
  466. .demo-table-expand .el-form-item {
  467. margin-right: 0;
  468. margin-bottom: 0;
  469. width: 33%;
  470. }
  471. </style>