<style> /* 日期样式开始 */ .scenicSpotSalesBoard .month ul { border-radius: 4px 4px 0 0; width: 100%; height: 50px; line-height: 50px; background: #e95252; margin: 0; padding: 0; text-align: center; } .scenicSpotSalesBoard .year-month { flex-direction: column; align-items: center; justify-content: space-around; } .scenicSpotSalesBoard .year-month>input { width: 100px; float: left; } .scenicSpotSalesBoard .arrow { padding: 10px; font-style: normal; cursor: pointer; } .scenicSpotSalesBoard .monthminus { position: absolute; left: 0px; top: 15px; } .scenicSpotSalesBoard .monthadd { position: absolute; right: 21px; top: 15px; } .scenicSpotSalesBoard .month ul li { font-size: 18px; color: #fff; position: relative; display: inline-block; letter-spacing: 3px; } .scenicSpotSalesBoard .month ul li i { font-size: 22px; color: #ff7e7e; cursor: pointer; } .scenicSpotSalesBoard .month ul li>input { text-align: center; } .scenicSpotSalesBoard .weekdays { margin: 0; padding: 3px 0; background-color: #3fa783; display: flex; width: 100%; flex-wrap: wrap; color: #fff; justify-content: space-around; } .scenicSpotSalesBoard .weekdays li { display: inline-block; width: 14.2857%; text-align: center; } .scenicSpotSalesBoard .days { width: 100%; padding: 0; margin: 0; border-left: 1px solid #dddddd; flex-wrap: wrap; box-sizing: border-box; justify-content: space-around; } .scenicSpotSalesBoard .days>li { list-style-type: none; width: 14.2857%; height: 140px; text-align: center; position: relative; font-size: 12px; float: left; color: #000; box-sizing: border-box; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; } .scenicSpotSalesBoard .days li>div { height: 112px; width: 100%; overflow-y: auto; text-align: left; } .scenicSpotSalesBoard .days li>div>p { border-bottom: 1px dashed #ccc; height: 28px; line-height: 28px; width: 100%; text-indent: 10px; } .scenicSpotSalesBoard .currentInput { width: 120px; height: 30px; border-radius: 17px; outline: none; border: none; color: #fff; background: transparent; font-size: 18px; } .scenicSpotSalesBoard .days li .other-month { display: inline-block; position: absolute; right: 0; bottom: 0; width: 24px; height: 17px; font-size: 12px; line-height: 17px; background-color: #cccccc; color: #fff; } .scenicSpotSalesBoard .ckStyle { width: 100%; height: 28px; line-height: 28px; text-align: center; font-size: 14px; font-weight: bold; background: #ccc; color: #000; } .scenicSpotSalesBoard .ckStyleOther { background: #dddddd !important; font-weight: normal !important; color: #999; } .scenicSpotSalesBoard .Owe_Room { color: #e95252; } .scenicSpotSalesBoard .Used_room { color: #13b0ae; } .scenicSpotSalesBoard .otherMoth { background: #f2f2f2; } .scenicSpotSalesBoard .title { height: 14px; line-height: 14px; border-left: 3px solid #e95252; font-size: 16px; color: #333; text-indent: 10px; margin: 20px 0; } .scenicSpotSalesBoard .hasStock_1 { color: #FFFFFF; background-color: #ff3737; } .scenicSpotSalesBoard .hasStock_2 { background-color: #ff99cc; } .scenicSpotSalesBoard .hasStock_3 { background-color: #bcd6ee; } .scenicSpotSalesBoard .hasStock_4 { background-color: #ffffff; } /* 日期样式结束*/ </style> <template> <div class="flexOne scenicSpotSalesBoard"> <div class="query-box Plan_Query"> <ul> <li> <span> <em>{{$t('commonPickUp.Pick_attractions')}}</em> <el-select v-model="msg.CouponsIdList" :placeholder="$t('pub.pleaseSel')" multiple collapse-tags filterable @change="getMultipleChoice"> <el-option :label="$t('pub.unlimitedSel')" :value="defaultSelectValue"></el-option> <el-option v-for="item in ScenicList" :key="item.ID" :label="item.Name" :value="item.ID"></el-option> </el-select> </span> </li> <li> <span> <em>{{$t('advmanager.v_type')}}</em> <el-select v-model="msg.QStatus" :placeholder="$t('pub.pleaseSel')" filterable> <el-option :key="0" :label="$t('ground.djmpdd')" :value="0"></el-option> <el-option :key="1" :label="$t('ground.xcmp')" :value="1"></el-option> </el-select> </span> </li> <li style="margin-right:50px;"> <button class="normalBtn" type="button" @click="GetHoltelInventory()">{{$t('pub.searchBtn')}}</button> <button class="normalBtn" type="button" @click="DownLoadDinnerSalesBoard()">{{$t('adm.adm_download')}}</button> </li> </ul> </div> <div class="title" style="display:none;"> {{$t('ground.mptj')}} {{$t('hotel.hotel_totalRoom')}} <span class="Owe_Room"></span> </div> <div class="month"> <ul> <li> <i class="el-icon-caret-left monthminus" @click="currentYear-=1,getDateString(),initCalendar(dateString)"></i> <input type="text" disabled="disabled" v-model="currentYear" class="currentInput" @input="getDateString(),initCalendar(dateString)">{{$t('pub.year')}} <i class="el-icon-caret-right monthadd" @click="currentYear+=1,getDateString(),initCalendar(dateString)"></i> </li> <li> <i class="el-icon-caret-left monthminus" @click="pickPre(currentYear,currentMonth)"></i> <input type="text" disabled="disabled" v-model="currentMonth" class="currentInput" @input="getDateString(),initCalendar(dateString)">{{$t('pub.month')}} <i class="el-icon-caret-right monthadd" @click="pickNext(currentYear,currentMonth)"></i> </li> </ul> </div> <ul class="weekdays"> <li>{{$t('hotel.hotel_Monday')}}</li> <li>{{$t('hotel.hotel_Tuesday')}}</li> <li>{{$t('hotel.hotel_Wednesday')}}</li> <li>{{$t('hotel.hotel_Thursday')}}</li> <li>{{$t('hotel.hotel_Friday')}}</li> <li>{{$t('hotel.hotel_Saturday')}}</li> <li>{{$t('hotel.hotel_Sunday')}}</li> </ul> <ul class="days clearfix" v-loading="msg.loading"> <li v-for="(dayItem,index) in days" :key="dayItem.index"> <p class="ckStyle" :class="{ckStyleOther:dayItem.day.getMonth()+1 != currentMonth}">{{dayItem.day.getDate()}} </p> <div> <p v-for="item in dayItem.dayValue"> <span class="text_underLine">{{item.TicketName}}({{item.TicketNum}})</span> </p> </div> </li> </ul> </div> </template> <script> export default { data() { return { userInfo: {}, //当前用户登录信息 msg: { Year: 0, Month: 0, CouponsId: 0, CouponsIdList: [], CouponsIds: '', QStatus: 0, loading: false, uid: 0, }, //餐厅列表 ScenicList: [], defaultSelectValue: 0, currentDay: 1, currentMonth: 1, currentYear: 1970, currentWeek: 1, days: [], //每天的门票库存 DayData: [], }; }, methods: { // 多选 getMultipleChoice() { if (this.msg.CouponsIdList.length > 1) { if (this.msg.CouponsIdList.at(-1) == 0) { this.msg.CouponsIdList = [0] } else if (this.msg.CouponsIdList.at(-1) != 0) { this.msg.CouponsIdList.forEach((x, index) => { if (x == 0) { this.msg.CouponsIdList.splice(index, 1) } }) } this.msg.CouponsId = 0 this.msg.CouponsIds = this.msg.CouponsIdList.join(',') } if (this.msg.CouponsIdList.length == 1) { this.msg.CouponsId = this.msg.CouponsIdList[0] this.msg.CouponsIds = '' } }, stockColor: function (type) { if (type === 1) { return 'hasStock_1' } else if (type === 2) { return 'hasStock_2' } else if (type === 3) { return 'hasStock_3' } else if (type === 4) { return 'hasStock_4' } }, //格式化日期 getDateString: function () { this.dateString = this.$calendarUtils.formatDate( this.currentYear, this.currentMonth, 1 ); this.GetHoltelInventory(); }, initCalendar: function (cur) { var newDays = this.$calendarUtils.createCalendar(cur); this.currentDay = newDays.CurrentDay; this.currentYear = newDays.CurrentYear; this.currentMonth = newDays.CurrentMonth; this.currentWeek = newDays.CurrentWeek; this.days.length = 0; var dateArray = newDays.DayArray; for (var i = 0; i < dateArray.length; i++) { var d = dateArray[i].day; var dayobject = {}; dayobject.day = d; this.days.push(dayobject); } }, //点击左箭头切换年月 pickPre: function (year, month) { var d = new Date(this.$calendarUtils.formatDate(year, month, 1)); d.setDate(0); this.nowDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-1"; this.initCalendar( this.$calendarUtils.formatDate(d.getFullYear(), d.getMonth() + 1, 1) ); this.GetHoltelInventory(); }, //点击右箭头切换年月 pickNext: function (year, month) { var d = new Date(this.$calendarUtils.formatDate(year, month, 1)); d.setDate(35); this.nowDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-1"; this.initCalendar( this.$calendarUtils.formatDate(d.getFullYear(), d.getMonth() + 1, 1) ); this.GetHoltelInventory(); }, //点击获取酒店库存数据 GetHoltelInventory() { this.msg.loading = true; var that = this; this.msg.Year = this.currentYear; this.msg.Month = this.currentMonth; this.DayData = []; this.apipost( "ticketcouponsorder_post_GetScenicMonthStatistics", this.msg, res => { this.msg.loading = false; this.DayData = res.data.data; this.days.forEach(dayItem => { let d = dayItem.day; let myDate = this.$calendarUtils.formatDate( d.getFullYear(), d.getMonth() + 1, d.getDate() ); dayItem.dayValue = []; for (var j = 0; j < this.DayData.length; j++) { if (this.DayData[j].Day == myDate) { dayItem.dayValue = this.DayData[j].SubList; } } }); this.$forceUpdate(); }, err => {} ); }, //获取酒店列表 GetScenicList() { var postMsg = { QCountrys: "" }; if (this.userInfo.RB_Group_id == 2) { postMsg.QCountrys = "651"; } this.apipost( "ticketcoupons_post_GetList", postMsg, res => { if (res.data.resultCode == 1) { this.ScenicList = res.data.data; } }, err => {} ); }, //下载餐厅统计 DownLoadDinnerSalesBoard() { if (this.msg.CouponsId <= 0 && !this.msg.CouponsIds) { this.Info(this.$t('sm.qxzjingdian')); return; } let url if (this.msg.CouponsId > 0) { url = 'ticketcouponsorder_post_DownLoadScenicMonthStatistics' } else { url = 'ticketcouponsorder_post_DownLoadScenicMonthStatisticsNew' } this.msg.loading = true; this.msg.uid = this.userInfo.EmployeeId; let fileName = this.$t('objFill.v101.qxzjingdian')+ this.$commonUtils.getCurrentDate() + ".xls"; this.GetLocalFile(url, this.msg, fileName, res => { this.msg.loading = false; }); } }, mounted() { this.userInfo = this.getLocalStorage(); //初始化日历 let myDate = new Date(); this.currentYear = myDate.getFullYear(); this.currentMonth = myDate.getMonth() + 1; this.msg.Year = this.currentYear; this.msg.Month = this.currentDay; this.GetScenicList(); this.initCalendar(); this.GetHoltelInventory(); } }; </script>