historicalIncome.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <div>
  3. <div style="display:flex;justify-content:flex-end;">
  4. <div @click="show = true" class="calendar">{{`${startTime} ~ ${endTime}`}}</div>
  5. </div>
  6. <u-calendar closeOnClickOverlay :minDate="minData" :show="show" mode="range" @close="close" @confirm="confirm"></u-calendar>
  7. <div class="content-detail">
  8. <div class="content-detail-top">
  9. <div>
  10. <div>
  11. 总营业额/元
  12. </div>
  13. <div>
  14. 65535元
  15. </div>
  16. </div>
  17. <div>
  18. <div>
  19. 实收
  20. </div>
  21. <div>
  22. 60000元
  23. </div>
  24. </div>
  25. <div>
  26. <div>
  27. 欠款(预付)/元
  28. </div>
  29. <div>
  30. 500
  31. </div>
  32. </div>
  33. </div>
  34. <div class="content-detail-bottom">
  35. <div>
  36. <div>间夜数</div>
  37. <div>1234</div>
  38. </div>
  39. <div>
  40. <div>入住率</div>
  41. <div>58%</div>
  42. </div>
  43. <div>
  44. <div>平均房价/元</div>
  45. <div>325</div>
  46. </div>
  47. <div>
  48. <div>RevPAR</div>
  49. <div>216</div>
  50. </div>
  51. </div>
  52. </div>
  53. <u-subsection style="margin-top:20px;" :list="listWay" mode="subsection" :current="currentWay" @change="WayChange"></u-subsection>
  54. <u-collapse @change="change" @close="closeColl" @open="open" v-if="currentWay==0 && dataListTime.length>0">
  55. <u-collapse-item title="" name="Docs guide" v-for="(item, index) in dataListTime" :key="index">
  56. <b slot="title" class="u-page__item__title__slot-title">{{index+1}} {{item.roomName}} 收款合计{{item.detailList.reduce((pre, cur)=> pre+cur.money,0 )}}元</b>
  57. <div class="collapse-content" v-for="(sItem, index) in item.detailList" :key="index">
  58. <div>
  59. {{sItem.create_time}}
  60. </div>
  61. <div>
  62. {{sItem.money}}元/ {{sItem.subject_type_name}} / {{sItem.pay_name}}
  63. </div>
  64. <div>
  65. 收款人:
  66. </div>
  67. </div>
  68. </u-collapse-item>
  69. </u-collapse>
  70. <!-- <u-empty v-else mode="data" /> -->
  71. <u-collapse v-if="currentWay==1 && dataListIncome.length>0">
  72. <u-collapse-item title="" name="Docs guide" v-for="(item, index) in dataListIncome" :key="index">
  73. <b slot="title" class="u-page__item__title__slot-title">{{index+1}} {{item.create_time}} 收款合计{{dataListIncome.reduce((pre, cur)=> pre+cur.money,0 )}}元</b>
  74. <div class="collapse-content" :key="index">
  75. <!-- <div>
  76. {{item.create_time}}
  77. </div>
  78. <div>
  79. {{item.money}}元/ {{item.room_name}} / {{item.subject_type_name}}
  80. </div>
  81. <div>
  82. 收款人:
  83. </div> -->
  84. </div>
  85. </u-collapse-item>
  86. </u-collapse>
  87. <!-- <u-empty v-else mode="data" /> -->
  88. <!-- <uni-table style="margin-top:20px;" ref="table" :loading="false" border stripe type="" emptyText="暂无更多数据" @selection-change="selectionChange" v-if="currentWay==1">
  89. <uni-tr>
  90. <uni-th width="60" align="center">序号</uni-th>
  91. <uni-th width="60" align="center">时间</uni-th>
  92. <uni-th width="60" align="center">金额</uni-th>
  93. <uni-th width="60" align="center">房号</uni-th>
  94. <uni-th width="60" align="center">费项</uni-th>
  95. <uni-th width="60" align="center">收款方式</uni-th>
  96. </uni-tr>
  97. <uni-tr v-for="(item, index) in tableListIncome" :key="index">
  98. <uni-td align="center">{{ index+1 }}</uni-td>
  99. <uni-td>
  100. <view class="name">{{ item.create_time }}</view>
  101. </uni-td>
  102. <uni-td align="center">{{ item.money }}</uni-td>
  103. <uni-td align="center">{{ item.room_name }}</uni-td>
  104. <uni-td align="center">{{ item.subject_type_name }}</uni-td>
  105. <uni-td align="center">{{ item.pay_name }}</uni-td>
  106. </uni-tr>
  107. </uni-table> -->
  108. </div>
  109. </template>
  110. <script>
  111. import {
  112. getRoomIncomeList,
  113. getTimeIncomeList,
  114. getPayMethodIncomeList,
  115. getMatterExpenditureList,
  116. getTimeExpenditureList,
  117. getPayMethodExpenditureList,
  118. } from '../../utils/incomeDetail'
  119. import { mapState } from 'vuex'
  120. export default {
  121. data() {
  122. return {
  123. listWay: ['按房间', '按时间', '按收款方式'],
  124. currentWay: 0,
  125. dataListTime: [],
  126. dataListIncome: [],
  127. tableListIncome: [],
  128. show: false,
  129. startTime: (new Date().toLocaleDateString()).replace(/\//g, '-'),
  130. endTime: (new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()).replace(/\//g, '-'),
  131. minData: (new Date(new Date().getTime() - 24 * 60 * 60 * 1000 * 30).toLocaleDateString()).replace(/\//g, '-'),
  132. }
  133. },
  134. computed:{
  135. ...mapState(['hotelId'])
  136. },
  137. watch:{
  138. hotelId(newVal, oldVal){
  139. if (newVal!=oldVal) {
  140. this.getData()
  141. }
  142. }
  143. },
  144. mounted() {
  145. this.getData()
  146. },
  147. methods: {
  148. getData() {
  149. if (this.currentWay == 0) {
  150. getRoomIncomeList({
  151. startTime: this.startTime,
  152. endTime: this.endTime,
  153. }).then(res => {
  154. console.log(res);
  155. if (res.code == 200) {
  156. this.dataListTime = res.result
  157. }
  158. })
  159. }
  160. if (this.currentWay == 1) {
  161. getTimeIncomeList({
  162. startTime: this.startTime,
  163. endTime: this.endTime,
  164. }).then(res => {
  165. console.log(res);
  166. if (res.code == 200) {
  167. this.dataListIncome = res.result
  168. }
  169. })
  170. }
  171. },
  172. WayChange(e) {
  173. this.currentWay = e
  174. this.getData()
  175. },
  176. /**
  177. * 日期选择确认
  178. */
  179. confirm(e) {
  180. this.show = false
  181. this.timeList = e
  182. this.startTime = e[0].replace(/\//g, '-')
  183. this.endTime = e[e.length - 1].replace(/\//g, '-')
  184. this.getData()
  185. },
  186. /**
  187. * 日期选择取消
  188. */
  189. close() {
  190. this.show = false
  191. },
  192. change(){
  193. },
  194. closeColl(){
  195. },
  196. open(){
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .calendar {
  203. border: 1px solid;
  204. padding: 5px 10px;
  205. border-radius: 5px;
  206. color: #409EFF;
  207. font-size: 12px;
  208. // min-width: 30%;
  209. margin-left: 10px;
  210. display: flex;
  211. align-items: center;
  212. margin-bottom: 10px;
  213. }
  214. .content-detail {
  215. background: #409EFF;
  216. padding: 10px;
  217. display: flex;
  218. flex-direction: column;
  219. box-shadow: 0 0 10px #000;
  220. color: #fff;
  221. height: 130px;
  222. justify-content: space-between;
  223. .content-detail-top {
  224. display: flex;
  225. justify-content: space-between;
  226. margin-bottom: 10px;
  227. div {
  228. display: flex;
  229. flex-direction: column;
  230. justify-content: center;
  231. align-items: center;
  232. flex: 1;
  233. }
  234. }
  235. .content-detail-bottom {
  236. display: flex;
  237. justify-content: space-between;
  238. div {
  239. display: flex;
  240. flex-direction: column;
  241. justify-content: center;
  242. align-items: center;
  243. flex: 1;
  244. font-size: 16px;
  245. }
  246. }
  247. }
  248. .collapse-content {
  249. display: flex;
  250. justify-content: space-between;
  251. align-items: center;
  252. font-size: 12px;
  253. }
  254. </style>