condition.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="page" :style="{'height':h+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="房情表"></c-nav-bar>
  4. <view class="table">
  5. <view class="t_th">
  6. <!-- <view class="tt_year b_rb" @tap="show=true"> -->
  7. <view class="tt_year b_rb">
  8. <text>{{year}}年</text>
  9. <u-icon name="arrow-down" size="24" color="#999999"></u-icon>
  10. </view>
  11. <view class="tt_title b_rb">数量</view>
  12. <view class="tt_title b_rb">可售</view>
  13. <view class="tt_title b_rb">占用</view>
  14. <view class="tt_title b_rb">不可售</view>
  15. </view>
  16. <view class="t_item" v-for="(item,index) in list" :key="index">
  17. <view class="ti_date b_rb" @tap="toDetails(item)">
  18. <view :class="item.color">
  19. <text>{{item.yr}}</text>
  20. <text>{{item.week}}</text>
  21. </view>
  22. <u-icon name="arrow-right" size="24" color="#999999"></u-icon>
  23. </view>
  24. <view class="ti_num b_rb">{{item.totalNums}}</view>
  25. <view class="ti_num b_rb">{{item.saleNums}}</view>
  26. <view class="ti_num b_rb">{{item.occupyNums}}</view>
  27. <view class="ti_num b_rb">{{item.unSaleNums}}</view>
  28. </view>
  29. </view>
  30. <u-calendar :show="show" :monthNum="24" mode="single" @confirm="confirm"></u-calendar>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. year:new Date().getFullYear(),
  38. weekCfg:{0:'周日',1:'周一',2:'周二',3:'周三',4:'周四',5:'周五',6:'周六'},
  39. show:false,
  40. startDate:new Date().Format('yyyy-MM-dd'),
  41. list:[]
  42. }
  43. },
  44. onLoad() {
  45. this.getList();
  46. },
  47. methods: {
  48. getList(){
  49. this.$api.get('/merchant/hotel/home/getRoomConditionList',{
  50. homestayId:uni.getStorageSync('homestayId')
  51. }).then(res=>{
  52. if(res.data.code===0){
  53. this.list = res.data.data;
  54. let n = new Date().Format('yyyy-MM-dd');
  55. this.list.forEach(l=>{
  56. let w = new Date(l.dateDay).getDay();
  57. l.yr = new Date(l.dateDay).Format('MM-dd');
  58. l.week = n==l.dateDay?'今天':this.weekCfg[w];
  59. l.color = n==l.dateDay?'c_today':([6,0].includes(w)?'c_week':'c_normal');
  60. })
  61. }else this.$showToast(res.data.msg)
  62. })
  63. },
  64. confirm(e){
  65. this.show = false;
  66. this.year = new Date(e[0]).Format('yyyy');
  67. this.startDate = e[0];
  68. this.getList();
  69. },
  70. toDetails(item){
  71. uni.navigateTo({
  72. url:'/pages/home/details?item='+encodeURIComponent(JSON.stringify(item))
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style scoped lang="less">
  79. .page{
  80. background: #F9FAFC;
  81. .table{
  82. width: 100%;
  83. border-top: 1rpx solid #D1D1D1;
  84. border-left: 1rpx solid #D1D1D1;
  85. margin-top: 20rpx;
  86. .t_th{
  87. display: flex;
  88. align-items: center;
  89. justify-content: space-around;
  90. &>view{
  91. width: 25%;
  92. display: flex;
  93. align-items: center;
  94. justify-content: center;
  95. padding: 20rpx 0;
  96. box-sizing: border-box;
  97. &.tt_year{
  98. text{
  99. font-size: 24rpx;
  100. font-family: PingFang SC, PingFang SC;
  101. font-weight: 400;
  102. color: #1F2425;
  103. margin-right: 10rpx;
  104. }
  105. }
  106. &.tt_title{
  107. background: #FAFAFA;
  108. font-size: 24rpx;
  109. font-family: PingFang SC, PingFang SC;
  110. font-weight: 400;
  111. color: #1F2425;
  112. }
  113. }
  114. }
  115. .t_item{
  116. display: flex;
  117. align-items: center;
  118. justify-content: space-around;
  119. &>view{
  120. width: 25%;
  121. height: 106rpx;
  122. }
  123. .ti_date{
  124. display: flex;
  125. align-items: center;
  126. justify-content: center;
  127. background: #FAFAFA;
  128. box-sizing: border-box;
  129. &>view{
  130. display: flex;
  131. flex-direction: column;
  132. align-items: center;
  133. margin-right: 20rpx;
  134. text{
  135. font-size: 24rpx;
  136. font-family: PingFang SC, PingFang SC;
  137. font-weight: 400;
  138. color: #245BED;
  139. }
  140. }
  141. }
  142. .ti_num{
  143. box-sizing: border-box;
  144. background: #ffffff;
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. font-size: 24rpx;
  149. font-family: PingFang SC, PingFang SC;
  150. font-weight: 400;
  151. color: #1F2425;
  152. }
  153. }
  154. }
  155. .b_rb{
  156. border-right: 1rpx solid #D1D1D1;
  157. border-bottom: 1rpx solid #D1D1D1;
  158. }
  159. .c_today{
  160. text{
  161. color: #245BED !important;
  162. }
  163. }
  164. .c_week{
  165. text{
  166. color: #FF0000 !important;
  167. }
  168. }
  169. .c_normal{
  170. text{
  171. color: #1F2425 !important;
  172. }
  173. }
  174. }
  175. ::v-deep .u-transition{
  176. .u-calendar-month__days__day{
  177. height: 104rpx !important;
  178. }
  179. .u-calendar__confirm .u-button{
  180. width: calc(100% - 24rpx) !important;
  181. height: 88rpx !important;
  182. background: #0DBFFD !important;
  183. border-radius: 44rpx !important;
  184. }
  185. .u-calendar__confirm .u-button text{
  186. font-size: 32rpx !important;
  187. font-family: PingFangSC-Regular, PingFang SC;
  188. font-weight: 400;
  189. color: #FFFFFF !important;
  190. }
  191. .u-calendar scroll-view{
  192. height: 600rpx !important;
  193. }
  194. .u-icon__icon{
  195. font-size: 14px !important;
  196. line-height: 14px !important;
  197. }
  198. }
  199. </style>