| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <template>
- <view class="book-month">
- <CalendarCard @nowDateList="nowDateList" ref="date" @click="(data)=>$emit('clickDate',data.date)">
- <template v-slot:default="slot">
- <view class="book-month-area_data">
- <template v-if="allDateInfo[slot.data.date]">
- <view class="iconfont iconxing2"
- v-if="allDateInfo[slot.data.date].importantDates&&allDateInfo[slot.data.date].importantDates.length>0"
- style="color: #e64340;font-size: 25rpx;transform: scale(0.8);width: 20rpx;">
- </view>
- <view class="flex-n fac" v-if="allDateInfo[slot.data.date].orderHouseTypeText01">
- <image class="icon" src="../../../static/c1.png"></image>
- <view class="num flex-1">{{allDateInfo[slot.data.date].orderHouseTypeText01}}</view>
- </view>
- <view class="flex-n fac" v-if="allDateInfo[slot.data.date].orderHouseTypeText03">
- <image class="icon" src="../../../static/c2.png"></image>
- <view class="num flex-1">{{allDateInfo[slot.data.date].orderHouseTypeText03}}</view>
- </view>
- <view class="flex-n fac" v-if="allDateInfo[slot.data.date].orderHouseTypeText02">
- <image class="icon" src="../../../static/c3.png"></image>
- <view class="num flex-1">{{allDateInfo[slot.data.date].orderHouseTypeText02}}</view>
- </view>
- <view class="flex-n fac" v-if="isDisplayPrein=='1'&&allDateInfo[slot.data.date].totalMoney">
- <image class="icon" src="../../../static/c4.png"></image>
- <view class="num flex-1 line-1">{{allDateInfo[slot.data.date].totalMoney}}</view>
- </view>
- </template>
- </view>
- </template>
- </CalendarCard>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- const app = getApp({
- allowDefault: true
- });
- export default {
- name: 'book-month',
- props: {
- refresh: Boolean
- },
- data() {
- return {
- current: 1,
- left: 0,
- right: 2,
- xqday: ['一', '二', '三', '四', '五', '六', '日'],
- monthList: [],
- ImpList: [], //重点日期
- orderTotalList: [], //订单总计数
- threeMonthList: ['', '', ''],
- // dataList: [],
- callPhone: '',
- column: -1,
- row: -1,
- disabletouch: false,
- monthday: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
- showDataAnimate: {},
- dx: 0,
- weekName: ['一', '二', '三', '四', '五', '六', '日'],
- showday: {}, //需要传入的值
- choose: 0,
- animateIn: '',
- timeout: '',
- date: '',
- total: 0,
- pageNum: 1,
- scrollTop: 0,
- showLoading: false,
- savedata: {},
- isDisplayPrein: '0',
- dateList: [],
- allDateInfo: {
- }
- }
- },
-
- methods: {
- nowDateList(dateList) {
- this.allDateInfo = {};
- this.dateList = dateList;
- this.$emit('changeDate', dateList[15].date)
- this.orderCalendarTotal(dateList);
- this.bookImportantDate(dateList);
- this.getAuthState();
- },
- getDate(date) {
- console.log(date)
- this.$nextTick(() => {
- this.$refs.date.setDate(date);
- })
- },
- //重点日期
- bookImportantDate(dataList) {
- this.$axios.post("app/order/orderImportantDate", {
- "startTime": dataList[0].date,
- "endTime": dataList[dataList.length - 1].date,
- "storeId": uni.getStorageSync('storeId')
- }).then(res => {
- this.getOrderDateInfo(res.data.list);
- }).catch(err => {
- this.$refs.uToast.error(err.msg)
- })
- },
- //日历订单汇总
- orderCalendarTotal(dataList) {
- var houseTypeIds = uni.getStorageSync('searchField') || [];
- this.$axios.post("app/order/orderCalendarTotalCalc", {
- "startTime": dataList[0].date,
- "endTime": dataList[dataList.length - 1].date,
- "storeId": uni.getStorageSync('storeId'),
- "houseTypeIds": houseTypeIds,
- }).then(res => {
- this.getOrderDateInfo(res.data.list);
- }).catch(err => {
- this.$refs.uToast.error(err.msg)
- })
- },
- getOrderDateInfo(list) {
- let info = this.allDateInfo;
- for (let i in list) {
- if (info[list[i].orderDate]) {
- this.$set(info, [list[i].orderDate], Object.assign(info[list[i].orderDate], list[i]))
- } else {
- this.$set(info, [list[i].orderDate], list[i])
- }
- }
- for (let key in info) {
- if (info[key].houseOrderCalc) {
- let orderHouseTypeText01 = 0,
- orderHouseTypeText02 = 0,
- orderHouseTypeText03 = 0;
- for (let i in info[key].houseOrderCalc) {
- if (info[key].houseOrderCalc[i].houseTypeCode == '01') {
- orderHouseTypeText01 += info[key].houseOrderCalc[i].orderCount
- }
- if (info[key].houseOrderCalc[i].houseTypeCode == '02') {
- orderHouseTypeText02 += info[key].houseOrderCalc[i].orderCount
- }
- if (info[key].houseOrderCalc[i].houseTypeCode == '03') {
- orderHouseTypeText03 += info[key].houseOrderCalc[i].orderCount
- }
- }
- if (orderHouseTypeText01) {
- this.$set(info[key], 'orderHouseTypeText01', orderHouseTypeText01)
- }
- if (orderHouseTypeText02) {
- this.$set(info[key], 'orderHouseTypeText02', orderHouseTypeText02)
- }
- if (orderHouseTypeText03) {
- this.$set(info[key], 'orderHouseTypeText03', orderHouseTypeText03)
- }
- }
- }
- this.allDateInfo = Object.assign(this.allDateInfo, info)
- },
- //权限
- getAuthState() {
- this.$axios.post("storeAuth/findByRoleIdStoreId", {
- "roleId": uni.getStorageSync('roleId'),
- "storeId": uni.getStorageSync('storeId')
- }).then(res => {
- console.log(res.data)
- //不可编辑
- this.isDisplayPrein = res.data.auth.isDisplayPrein;
- }).catch(err => {
- this.$refs.uToast.error(err.msg);
- })
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .book-month {
- .book-month-area_data {
- height: 100%;
- padding: 0 10rpx;
- position: relative;
- .iconxing2 {
- position: absolute;
- top: -32rpx;
- left: 34rpx;
- }
- .icon {
- width: 30rpx;
- min-width: 30rpx;
- height: 30rpx;
- margin-top: 4rpx;
- }
- .num {
- color: #666666;
- font-size: 20rpx;
- text-align: center;
- }
- }
- }
- </style>
|