condition.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. let y = new Date(new Date().setDate(new Date().getDate()-1)).Format('yyyy-MM-dd');
  56. this.list.forEach(l=>{
  57. let w = new Date(l.dateDay).getDay();
  58. l.yr = new Date(l.dateDay).Format('MM-dd');
  59. l.week = y==l.dateDay?'昨天':(n==l.dateDay?'今天':this.weekCfg[w]);
  60. l.color = n==l.dateDay?'c_today':([6,0].includes(w)?'c_week':'c_normal');
  61. })
  62. }else this.$showToast(res.data.msg)
  63. })
  64. },
  65. confirm(e){
  66. this.show = false;
  67. this.year = new Date(e[0]).Format('yyyy');
  68. this.startDate = e[0];
  69. this.getList();
  70. },
  71. toDetails(item){
  72. uni.navigateTo({
  73. url:'/pages/home/details?item='+encodeURIComponent(JSON.stringify(item))
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style scoped lang="less">
  80. .page{
  81. background: #F9FAFC;
  82. .table{
  83. width: 100%;
  84. border-top: 1rpx solid #D1D1D1;
  85. border-left: 1rpx solid #D1D1D1;
  86. margin-top: 20rpx;
  87. .t_th{
  88. display: flex;
  89. align-items: center;
  90. justify-content: space-around;
  91. &>view{
  92. width: 25%;
  93. display: flex;
  94. align-items: center;
  95. justify-content: center;
  96. padding: 20rpx 0;
  97. box-sizing: border-box;
  98. &.tt_year{
  99. text{
  100. font-size: 24rpx;
  101. font-family: PingFang SC, PingFang SC;
  102. font-weight: 400;
  103. color: #1F2425;
  104. margin-right: 10rpx;
  105. }
  106. }
  107. &.tt_title{
  108. background: #FAFAFA;
  109. font-size: 24rpx;
  110. font-family: PingFang SC, PingFang SC;
  111. font-weight: 400;
  112. color: #1F2425;
  113. }
  114. }
  115. }
  116. .t_item{
  117. display: flex;
  118. align-items: center;
  119. justify-content: space-around;
  120. &>view{
  121. width: 25%;
  122. height: 106rpx;
  123. }
  124. .ti_date{
  125. display: flex;
  126. align-items: center;
  127. justify-content: center;
  128. background: #FAFAFA;
  129. box-sizing: border-box;
  130. &>view{
  131. display: flex;
  132. flex-direction: column;
  133. align-items: center;
  134. margin-right: 20rpx;
  135. text{
  136. font-size: 24rpx;
  137. font-family: PingFang SC, PingFang SC;
  138. font-weight: 400;
  139. color: #245BED;
  140. }
  141. }
  142. }
  143. .ti_num{
  144. box-sizing: border-box;
  145. background: #ffffff;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. font-size: 24rpx;
  150. font-family: PingFang SC, PingFang SC;
  151. font-weight: 400;
  152. color: #1F2425;
  153. }
  154. }
  155. }
  156. .b_rb{
  157. border-right: 1rpx solid #D1D1D1;
  158. border-bottom: 1rpx solid #D1D1D1;
  159. }
  160. .c_today{
  161. text{
  162. color: #245BED !important;
  163. }
  164. }
  165. .c_week{
  166. text{
  167. color: #FF0000 !important;
  168. }
  169. }
  170. .c_normal{
  171. text{
  172. color: #1F2425 !important;
  173. }
  174. }
  175. }
  176. ::v-deep .u-transition{
  177. .u-calendar-month__days__day{
  178. height: 104rpx !important;
  179. }
  180. .u-calendar__confirm .u-button{
  181. width: calc(100% - 24rpx) !important;
  182. height: 88rpx !important;
  183. background: #0DBFFD !important;
  184. border-radius: 44rpx !important;
  185. }
  186. .u-calendar__confirm .u-button text{
  187. font-size: 32rpx !important;
  188. font-family: PingFangSC-Regular, PingFang SC;
  189. font-weight: 400;
  190. color: #FFFFFF !important;
  191. }
  192. .u-calendar scroll-view{
  193. height: 600rpx !important;
  194. }
  195. .u-icon__icon{
  196. font-size: 14px !important;
  197. line-height: 14px !important;
  198. }
  199. }
  200. </style>