book-month.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="book-month">
  3. <CalendarCard @nowDateList="nowDateList" ref="date" @click="(data)=>$emit('clickDate',data.date)">
  4. <template v-slot:default="slot">
  5. <view class="book-month-area_data">
  6. <template v-if="allDateInfo[slot.data.date]">
  7. <view class="iconfont iconxing2"
  8. v-if="allDateInfo[slot.data.date].importantDates&&allDateInfo[slot.data.date].importantDates.length>0"
  9. style="color: #e64340;font-size: 25rpx;transform: scale(0.8);width: 20rpx;">
  10. </view>
  11. <view class="flex-n fac" v-if="allDateInfo[slot.data.date].orderHouseTypeText01">
  12. <image class="icon" src="../../../static/c1.png"></image>
  13. <view class="num flex-1">{{allDateInfo[slot.data.date].orderHouseTypeText01}}</view>
  14. </view>
  15. <view class="flex-n fac" v-if="allDateInfo[slot.data.date].orderHouseTypeText03">
  16. <image class="icon" src="../../../static/c2.png"></image>
  17. <view class="num flex-1">{{allDateInfo[slot.data.date].orderHouseTypeText03}}</view>
  18. </view>
  19. <view class="flex-n fac" v-if="allDateInfo[slot.data.date].orderHouseTypeText02">
  20. <image class="icon" src="../../../static/c3.png"></image>
  21. <view class="num flex-1">{{allDateInfo[slot.data.date].orderHouseTypeText02}}</view>
  22. </view>
  23. <view class="flex-n fac" v-if="isDisplayPrein=='1'&&allDateInfo[slot.data.date].totalMoney">
  24. <image class="icon" src="../../../static/c4.png"></image>
  25. <view class="num flex-1 line-1">{{allDateInfo[slot.data.date].totalMoney}}</view>
  26. </view>
  27. </template>
  28. </view>
  29. </template>
  30. </CalendarCard>
  31. <u-toast ref="uToast"></u-toast>
  32. </view>
  33. </template>
  34. <script>
  35. const app = getApp({
  36. allowDefault: true
  37. });
  38. export default {
  39. name: 'book-month',
  40. props: {
  41. refresh: Boolean
  42. },
  43. data() {
  44. return {
  45. current: 1,
  46. left: 0,
  47. right: 2,
  48. xqday: ['一', '二', '三', '四', '五', '六', '日'],
  49. monthList: [],
  50. ImpList: [], //重点日期
  51. orderTotalList: [], //订单总计数
  52. threeMonthList: ['', '', ''],
  53. // dataList: [],
  54. callPhone: '',
  55. column: -1,
  56. row: -1,
  57. disabletouch: false,
  58. monthday: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
  59. showDataAnimate: {},
  60. dx: 0,
  61. weekName: ['一', '二', '三', '四', '五', '六', '日'],
  62. showday: {}, //需要传入的值
  63. choose: 0,
  64. animateIn: '',
  65. timeout: '',
  66. date: '',
  67. total: 0,
  68. pageNum: 1,
  69. scrollTop: 0,
  70. showLoading: false,
  71. savedata: {},
  72. isDisplayPrein: '0',
  73. dateList: [],
  74. allDateInfo: {
  75. }
  76. }
  77. },
  78. methods: {
  79. nowDateList(dateList) {
  80. this.allDateInfo = {};
  81. this.dateList = dateList;
  82. this.$emit('changeDate', dateList[15].date)
  83. this.orderCalendarTotal(dateList);
  84. this.bookImportantDate(dateList);
  85. this.getAuthState();
  86. },
  87. getDate(date) {
  88. console.log(date)
  89. this.$nextTick(() => {
  90. this.$refs.date.setDate(date);
  91. })
  92. },
  93. //重点日期
  94. bookImportantDate(dataList) {
  95. this.$axios.post("app/order/orderImportantDate", {
  96. "startTime": dataList[0].date,
  97. "endTime": dataList[dataList.length - 1].date,
  98. "storeId": uni.getStorageSync('storeId')
  99. }).then(res => {
  100. this.getOrderDateInfo(res.data.list);
  101. }).catch(err => {
  102. this.$refs.uToast.error(err.msg)
  103. })
  104. },
  105. //日历订单汇总
  106. orderCalendarTotal(dataList) {
  107. var houseTypeIds = uni.getStorageSync('searchField') || [];
  108. this.$axios.post("app/order/orderCalendarTotalCalc", {
  109. "startTime": dataList[0].date,
  110. "endTime": dataList[dataList.length - 1].date,
  111. "storeId": uni.getStorageSync('storeId'),
  112. "houseTypeIds": houseTypeIds,
  113. }).then(res => {
  114. this.getOrderDateInfo(res.data.list);
  115. }).catch(err => {
  116. this.$refs.uToast.error(err.msg)
  117. })
  118. },
  119. getOrderDateInfo(list) {
  120. let info = this.allDateInfo;
  121. for (let i in list) {
  122. if (info[list[i].orderDate]) {
  123. this.$set(info, [list[i].orderDate], Object.assign(info[list[i].orderDate], list[i]))
  124. } else {
  125. this.$set(info, [list[i].orderDate], list[i])
  126. }
  127. }
  128. for (let key in info) {
  129. if (info[key].houseOrderCalc) {
  130. let orderHouseTypeText01 = 0,
  131. orderHouseTypeText02 = 0,
  132. orderHouseTypeText03 = 0;
  133. for (let i in info[key].houseOrderCalc) {
  134. if (info[key].houseOrderCalc[i].houseTypeCode == '01') {
  135. orderHouseTypeText01 += info[key].houseOrderCalc[i].orderCount
  136. }
  137. if (info[key].houseOrderCalc[i].houseTypeCode == '02') {
  138. orderHouseTypeText02 += info[key].houseOrderCalc[i].orderCount
  139. }
  140. if (info[key].houseOrderCalc[i].houseTypeCode == '03') {
  141. orderHouseTypeText03 += info[key].houseOrderCalc[i].orderCount
  142. }
  143. }
  144. if (orderHouseTypeText01) {
  145. this.$set(info[key], 'orderHouseTypeText01', orderHouseTypeText01)
  146. }
  147. if (orderHouseTypeText02) {
  148. this.$set(info[key], 'orderHouseTypeText02', orderHouseTypeText02)
  149. }
  150. if (orderHouseTypeText03) {
  151. this.$set(info[key], 'orderHouseTypeText03', orderHouseTypeText03)
  152. }
  153. }
  154. }
  155. this.allDateInfo = Object.assign(this.allDateInfo, info)
  156. },
  157. //权限
  158. getAuthState() {
  159. this.$axios.post("storeAuth/findByRoleIdStoreId", {
  160. "roleId": uni.getStorageSync('roleId'),
  161. "storeId": uni.getStorageSync('storeId')
  162. }).then(res => {
  163. console.log(res.data)
  164. //不可编辑
  165. this.isDisplayPrein = res.data.auth.isDisplayPrein;
  166. }).catch(err => {
  167. this.$refs.uToast.error(err.msg);
  168. })
  169. },
  170. }
  171. }
  172. </script>
  173. <style scoped lang="scss">
  174. .book-month {
  175. .book-month-area_data {
  176. height: 100%;
  177. padding: 0 10rpx;
  178. position: relative;
  179. .iconxing2 {
  180. position: absolute;
  181. top: -32rpx;
  182. left: 34rpx;
  183. }
  184. .icon {
  185. width: 30rpx;
  186. min-width: 30rpx;
  187. height: 30rpx;
  188. margin-top: 4rpx;
  189. }
  190. .num {
  191. color: #666666;
  192. font-size: 20rpx;
  193. text-align: center;
  194. }
  195. }
  196. }
  197. </style>