details.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.title}}</view>
  14. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.num}}</view>
  15. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.ksNum}}</view>
  16. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.zyNum}}</view>
  17. <view class="b_rb" :class="(index==list.length-1||index==list.length-2)?'b_grey':''">{{item.bksNum}}</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.yr+'房情表';
  35. this.getList();
  36. }
  37. },
  38. methods: {
  39. getList(){
  40. let resData = [
  41. {
  42. title:'大床房',
  43. num:10,
  44. ksNum:10,
  45. zyNum:10,
  46. bksNum:0,
  47. },
  48. {
  49. title:'海景房',
  50. num:10,
  51. ksNum:10,
  52. zyNum:10,
  53. bksNum:0,
  54. },
  55. {
  56. title:'标准间',
  57. num:10,
  58. ksNum:10,
  59. zyNum:10,
  60. bksNum:0,
  61. },
  62. {
  63. title:'家庭房',
  64. num:10,
  65. ksNum:10,
  66. zyNum:10,
  67. bksNum:0,
  68. }
  69. ];
  70. let allNums = resData.reduce((cur,pre)=>cur+pre.num,0);
  71. let ksNums = resData.reduce((cur,pre)=>cur+pre.ksNum,0);
  72. let zyNums = resData.reduce((cur,pre)=>cur+pre.zyNum,0);
  73. let bksNums = resData.reduce((cur,pre)=>cur+pre.bksNum,0);
  74. resData.push({
  75. title:'占房屋总数的比例',
  76. num:'-',
  77. ksNum:(ksNums/allNums*100).toFixed(2)+'%',
  78. zyNum:(zyNums/allNums*100).toFixed(2)+'%',
  79. bksNum:(bksNums/allNums*100).toFixed(2)+'%'
  80. })
  81. resData.push({
  82. title:'总计',
  83. num:allNums,
  84. ksNum:ksNums,
  85. zyNum:zyNums,
  86. bksNum:bksNums
  87. })
  88. this.list = resData;
  89. }
  90. }
  91. }
  92. </script>
  93. <style scoped lang="less">
  94. .page{
  95. background: #F9FAFC;
  96. .table{
  97. width: 100%;
  98. border-top: 1rpx solid #D1D1D1;
  99. border-left: 1rpx solid #D1D1D1;
  100. margin-top: 20rpx;
  101. .t_th{
  102. display: flex;
  103. align-items: center;
  104. justify-content: space-around;
  105. &>view{
  106. width: 25%;
  107. display: flex;
  108. align-items: center;
  109. justify-content: center;
  110. padding: 20rpx 0;
  111. box-sizing: border-box;
  112. font-size: 24rpx;
  113. font-family: PingFang SC, PingFang SC;
  114. font-weight: 400;
  115. color: #1F2425;
  116. }
  117. }
  118. .t_item{
  119. display: flex;
  120. align-items: center;
  121. justify-content: space-around;
  122. &>view{
  123. width: 25%;
  124. height: 106rpx;
  125. display: flex;
  126. align-items: center;
  127. justify-content: center;
  128. box-sizing: border-box;
  129. background: #ffffff;
  130. font-size: 24rpx;
  131. font-family: PingFang SC, PingFang SC;
  132. font-weight: 400;
  133. color: #1F2425;
  134. text-align: center;
  135. }
  136. }
  137. }
  138. .b_grey{
  139. background: #FAFAFA !important;
  140. }
  141. .b_rb{
  142. border-right: 1rpx solid #D1D1D1;
  143. border-bottom: 1rpx solid #D1D1D1;
  144. }
  145. }
  146. </style>