123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <view class="page" :style="{'height':h+'px','padding-top':mt+'px'}">
- <c-nav-bar title="房情表"></c-nav-bar>
- <view class="table">
- <view class="t_th">
- <!-- <view class="tt_year b_rb" @tap="show=true"> -->
- <view class="tt_year b_rb">
- <text>{{year}}年</text>
- <u-icon name="arrow-down" size="24" color="#999999"></u-icon>
- </view>
- <view class="tt_title b_rb">数量</view>
- <view class="tt_title b_rb">可售</view>
- <view class="tt_title b_rb">占用</view>
- <view class="tt_title b_rb">不可售</view>
- </view>
- <view class="t_item" v-for="(item,index) in list" :key="index">
- <view class="ti_date b_rb" @tap="toDetails(item)">
- <view :class="item.color">
- <text>{{item.yr}}</text>
- <text>{{item.week}}</text>
- </view>
- <u-icon name="arrow-right" size="24" color="#999999"></u-icon>
- </view>
- <view class="ti_num b_rb">{{item.totalNums}}</view>
- <view class="ti_num b_rb">{{item.saleNums}}</view>
- <view class="ti_num b_rb">{{item.occupyNums}}</view>
- <view class="ti_num b_rb">{{item.unSaleNums}}</view>
- </view>
- </view>
- <u-calendar :show="show" :monthNum="24" mode="single" @confirm="confirm"></u-calendar>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- year:new Date().getFullYear(),
- weekCfg:{0:'周日',1:'周一',2:'周二',3:'周三',4:'周四',5:'周五',6:'周六'},
- show:false,
- startDate:new Date().Format('yyyy-MM-dd'),
- list:[]
- }
- },
- onLoad() {
- this.getList();
- },
- methods: {
- getList(){
- this.$api.get('/merchant/hotel/home/getRoomConditionList',{
- homestayId:uni.getStorageSync('homestayId')
- }).then(res=>{
- if(res.data.code===0){
- this.list = res.data.data;
- let n = new Date().Format('yyyy-MM-dd');
- let y = new Date(new Date().setDate(new Date().getDate()-1)).Format('yyyy-MM-dd');
- this.list.forEach(l=>{
- let w = new Date(l.dateDay).getDay();
- l.yr = new Date(l.dateDay).Format('MM-dd');
- l.week = y==l.dateDay?'昨天':(n==l.dateDay?'今天':this.weekCfg[w]);
- l.color = n==l.dateDay?'c_today':([6,0].includes(w)?'c_week':'c_normal');
- })
- }else this.$showToast(res.data.msg)
- })
- },
- confirm(e){
- this.show = false;
- this.year = new Date(e[0]).Format('yyyy');
- this.startDate = e[0];
- this.getList();
- },
- toDetails(item){
- uni.navigateTo({
- url:'/pages/home/details?item='+encodeURIComponent(JSON.stringify(item))
- })
- }
- }
- }
- </script>
- <style scoped lang="less">
- .page{
- background: #F9FAFC;
- .table{
- width: 100%;
- border-top: 1rpx solid #D1D1D1;
- border-left: 1rpx solid #D1D1D1;
- margin-top: 20rpx;
- .t_th{
- display: flex;
- align-items: center;
- justify-content: space-around;
- &>view{
- width: 25%;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 20rpx 0;
- box-sizing: border-box;
- &.tt_year{
- text{
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- color: #1F2425;
- margin-right: 10rpx;
- }
- }
- &.tt_title{
- background: #FAFAFA;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- color: #1F2425;
- }
- }
- }
-
- .t_item{
- display: flex;
- align-items: center;
- justify-content: space-around;
- &>view{
- width: 25%;
- height: 106rpx;
- }
- .ti_date{
- display: flex;
- align-items: center;
- justify-content: center;
- background: #FAFAFA;
- box-sizing: border-box;
- &>view{
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-right: 20rpx;
- text{
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- color: #245BED;
- }
- }
- }
- .ti_num{
- box-sizing: border-box;
- background: #ffffff;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- color: #1F2425;
- }
- }
- }
-
- .b_rb{
- border-right: 1rpx solid #D1D1D1;
- border-bottom: 1rpx solid #D1D1D1;
- }
-
- .c_today{
- text{
- color: #245BED !important;
- }
- }
- .c_week{
- text{
- color: #FF0000 !important;
- }
- }
- .c_normal{
- text{
- color: #1F2425 !important;
- }
- }
- }
-
- ::v-deep .u-transition{
- .u-calendar-month__days__day{
- height: 104rpx !important;
- }
- .u-calendar__confirm .u-button{
- width: calc(100% - 24rpx) !important;
- height: 88rpx !important;
- background: #0DBFFD !important;
- border-radius: 44rpx !important;
- }
- .u-calendar__confirm .u-button text{
- font-size: 32rpx !important;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #FFFFFF !important;
- }
- .u-calendar scroll-view{
- height: 600rpx !important;
- }
- .u-icon__icon{
- font-size: 14px !important;
- line-height: 14px !important;
- }
- }
- </style>
|