book-month.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. nowChooseDate:'',//现在选中的日期
  77. }
  78. },
  79. methods: {
  80. nowDateList(dateList) {
  81. this.allDateInfo = {};
  82. this.dateList = dateList;
  83. console.error(2131234938985492843)
  84. this.$emit('changeDate', dateList[15].date)
  85. let k=-1;
  86. for(let i in dateList){
  87. //选择的日子在列表中的
  88. if(dateList[i].date==this.nowChooseDate&&dateList[15].mm==Number(this.nowChooseDate.substring(5,7))){
  89. k=i;
  90. break;
  91. }
  92. }
  93. if(k==-1){
  94. console.error(this.nowChooseDate,324213123)
  95. for(let i in dateList){
  96. if(dateList[i].dd==1){
  97. this.$emit('changeDate', dateList[i].date)
  98. break;
  99. }
  100. }
  101. }
  102. this.orderCalendarTotal(dateList);
  103. this.bookImportantDate(dateList);
  104. this.getAuthState();
  105. },
  106. getDate(date) {
  107. console.log(date)
  108. this.nowChooseDate=date;
  109. this.$nextTick(() => {
  110. this.$refs.date.setDate(date);
  111. })
  112. },
  113. //重点日期
  114. bookImportantDate(dataList) {
  115. this.$axios.post("app/order/orderImportantDate", {
  116. "startTime": dataList[0].date,
  117. "endTime": dataList[dataList.length - 1].date,
  118. "storeId": uni.getStorageSync('storeId')
  119. }).then(res => {
  120. this.getOrderDateInfo(res.data.list);
  121. }).catch(err => {
  122. this.$refs.uToast.error(err.msg)
  123. })
  124. },
  125. //日历订单汇总
  126. orderCalendarTotal(dataList) {
  127. var houseTypeIds = uni.getStorageSync('searchField') || [];
  128. this.$axios.post("app/order/orderCalendarTotalCalc", {
  129. "startTime": dataList[0].date,
  130. "endTime": dataList[dataList.length - 1].date,
  131. "storeId": uni.getStorageSync('storeId'),
  132. "houseTypeIds": houseTypeIds,
  133. }).then(res => {
  134. this.getOrderDateInfo(res.data.list);
  135. }).catch(err => {
  136. this.$refs.uToast.error(err.msg)
  137. })
  138. },
  139. getOrderDateInfo(list) {
  140. let info = this.allDateInfo;
  141. for (let i in list) {
  142. if (info[list[i].orderDate]) {
  143. this.$set(info, [list[i].orderDate], Object.assign(info[list[i].orderDate], list[i]))
  144. } else {
  145. this.$set(info, [list[i].orderDate], list[i])
  146. }
  147. }
  148. for (let key in info) {
  149. if (info[key].houseOrderCalc) {
  150. let orderHouseTypeText01 = 0,
  151. orderHouseTypeText02 = 0,
  152. orderHouseTypeText03 = 0;
  153. for (let i in info[key].houseOrderCalc) {
  154. if (info[key].houseOrderCalc[i].houseTypeCode == '01') {
  155. orderHouseTypeText01 += info[key].houseOrderCalc[i].orderCount
  156. }
  157. if (info[key].houseOrderCalc[i].houseTypeCode == '02') {
  158. orderHouseTypeText02 += info[key].houseOrderCalc[i].orderCount
  159. }
  160. if (info[key].houseOrderCalc[i].houseTypeCode == '03') {
  161. orderHouseTypeText03 += info[key].houseOrderCalc[i].orderCount
  162. }
  163. }
  164. if (orderHouseTypeText01) {
  165. this.$set(info[key], 'orderHouseTypeText01', orderHouseTypeText01)
  166. }
  167. if (orderHouseTypeText02) {
  168. this.$set(info[key], 'orderHouseTypeText02', orderHouseTypeText02)
  169. }
  170. if (orderHouseTypeText03) {
  171. this.$set(info[key], 'orderHouseTypeText03', orderHouseTypeText03)
  172. }
  173. }
  174. }
  175. this.allDateInfo = Object.assign(this.allDateInfo, info)
  176. },
  177. //权限
  178. getAuthState() {
  179. this.$axios.post("storeAuth/findByRoleIdStoreId", {
  180. "roleId": uni.getStorageSync('roleId'),
  181. "storeId": uni.getStorageSync('storeId')
  182. }).then(res => {
  183. console.log(res.data)
  184. //不可编辑
  185. this.isDisplayPrein = res.data.auth.isDisplayPrein;
  186. }).catch(err => {
  187. this.$refs.uToast.error(err.msg);
  188. })
  189. },
  190. }
  191. }
  192. </script>
  193. <style scoped lang="scss">
  194. .book-month {
  195. .book-month-area_data {
  196. height: 100%;
  197. padding: 0 10rpx;
  198. position: relative;
  199. .iconxing2 {
  200. position: absolute;
  201. top: -32rpx;
  202. left: 34rpx;
  203. }
  204. .icon {
  205. width: 30rpx;
  206. min-width: 30rpx;
  207. height: 30rpx;
  208. margin-top: 4rpx;
  209. }
  210. .num {
  211. color: #666666;
  212. font-size: 20rpx;
  213. text-align: center;
  214. }
  215. }
  216. }
  217. </style>