details.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="page" :style="{'height':h+'px','padding-top':mt+'px'}">
  3. <c-nav-bar :title="title"></c-nav-bar>
  4. <view class="table">
  5. <view class="t_th">
  6. <view class="b_grey b_rb">房型</view>
  7. <view class="b_grey b_rb">数量</view>
  8. <view class="b_grey b_rb">可售</view>
  9. <view class="b_grey b_rb">占用</view>
  10. <view class="b_grey b_rb">不可售</view>
  11. </view>
  12. <view v-if="list.length>0" class="t_item" v-for="(item,index) in list" :key="index">
  13. <view class="b_grey b_rb">{{item.houseBaseName}}</view>
  14. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.totalNums}}</view>
  15. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.saleNums}}</view>
  16. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.occupyNums}}</view>
  17. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.unSaleNums}}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. title:'',
  27. item:null,
  28. list:[]
  29. }
  30. },
  31. onLoad(option) {
  32. if(option.item){
  33. this.item = JSON.parse(decodeURIComponent(option.item));
  34. this.title = this.item.dateDay+'房情表';
  35. this.getList();
  36. }
  37. },
  38. methods: {
  39. getList(){
  40. this.$api.get('/merchant/hotel/home/getRoomConditionList',{
  41. homestayId:uni.getStorageSync('homestayId'),
  42. dateDay:this.item.dateDay
  43. }).then(res=>{
  44. if(res.data.code===0){
  45. this.list = res.data.data.splice(0,res.data.data.length-3);
  46. let totalNums = this.list.reduce((cur,pre)=>cur+pre.totalNums,0);
  47. let saleNums = this.list.reduce((cur,pre)=>cur+pre.saleNums,0);
  48. let occupyNums = this.list.reduce((cur,pre)=>cur+pre.occupyNums,0);
  49. let unSaleNums = this.list.reduce((cur,pre)=>cur+pre.unSaleNums,0);
  50. this.list.push({
  51. houseBaseName:'占房屋总数的比例',
  52. totalNums:'-',
  53. saleNums:(saleNums/totalNums*100).toFixed(2)+'%',
  54. occupyNums:(occupyNums/totalNums*100).toFixed(2)+'%',
  55. unSaleNums:(unSaleNums/totalNums*100).toFixed(2)+'%'
  56. })
  57. this.list.push({
  58. houseBaseName:'总计',
  59. totalNums:totalNums,
  60. saleNums:saleNums,
  61. occupyNums:occupyNums,
  62. unSaleNums:unSaleNums
  63. })
  64. }else this.$showToast(res.data.msg)
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. <style scoped lang="less">
  71. .page{
  72. background: #F9FAFC;
  73. .table{
  74. width: 100%;
  75. border-top: 1rpx solid #D1D1D1;
  76. border-left: 1rpx solid #D1D1D1;
  77. margin-top: 20rpx;
  78. .t_th{
  79. display: flex;
  80. align-items: center;
  81. justify-content: space-around;
  82. &>view{
  83. width: 25%;
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. padding: 20rpx 0;
  88. box-sizing: border-box;
  89. font-size: 24rpx;
  90. font-family: PingFang SC, PingFang SC;
  91. font-weight: 400;
  92. color: #1F2425;
  93. }
  94. }
  95. .t_item{
  96. display: flex;
  97. align-items: center;
  98. justify-content: space-around;
  99. &>view{
  100. width: 25%;
  101. height: 106rpx;
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. box-sizing: border-box;
  106. background: #ffffff;
  107. font-size: 24rpx;
  108. font-family: PingFang SC, PingFang SC;
  109. font-weight: 400;
  110. color: #1F2425;
  111. text-align: center;
  112. }
  113. }
  114. }
  115. .b_grey{
  116. background: #FAFAFA !important;
  117. }
  118. .b_rb{
  119. border-right: 1rpx solid #D1D1D1;
  120. border-bottom: 1rpx solid #D1D1D1;
  121. }
  122. }
  123. </style>