index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view>
  3. <scroll-view scroll-x class="bg-white nav">
  4. <view class="flex text-center">
  5. <view class="cu-item flex-sub" :class="index == TabCur ? 'text-orange cur' : ''" v-for="(item, index) in tabs" :key="index" @tap="tabSelect" :data-id="index">
  6. {{ item.name }}
  7. </view>
  8. </view>
  9. </scroll-view>
  10. <!-- <uni-section :title="'日期范围用法:' + '[' + range + ']'" type="line"></uni-section> -->
  11. <view class="example-body">
  12. <uni-datetime-picker v-model="range" type="daterange" @maskClick="maskClick" />
  13. </view>
  14. <scroll-view :scroll-y="true" class="page">
  15. <view class="cu-list menu card-menu margin-top">
  16. <view class="cu-item" style="margin-top: 10rpx;" v-for="(item, index) in reportData" v-if="TabCur == 0">
  17. <view class="content" @click="showReport(item)">
  18. <!-- <view class="cu-form-group">
  19. <view class="title" style="min-width: calc(6em + 15px);">制衣生产车间</view>
  20. <text class="text-grey" style="flex: 1;">{{ item.workshopName }}</text>
  21. </view>
  22. <view class="cu-form-group">
  23. <view class="title" style="min-width: calc(6em + 15px);">制衣班组</view>
  24. <text class="text-grey" style="flex: 1;">{{ item.teamName }}</text>
  25. </view>
  26. <view class="cu-form-group">
  27. <view class="title" style="min-width: calc(6em + 15px);">订单号</view>
  28. <text class="text-grey" style="flex: 1;">{{ item.orderNo }}</text>
  29. </view> -->
  30. <view class="cu-form-group">
  31. <view class="title" style="min-width: calc(6em + 15px);" v-if="TabCur == 0">时间</view>
  32. <!-- <view class="title" style="min-width: calc(6em + 15px);" v-if="TabCur == 1">送活日期</view> -->
  33. <text class="text-grey" style="flex: 1;" v-if="TabCur == 0">{{ item.rcvDate }}</text>
  34. <!-- <text class="text-grey" style="flex: 1;" v-if="TabCur == 1">{{ item.backDate }}</text> -->
  35. </view>
  36. <view class="cu-form-group">
  37. <view class="title" style="min-width: calc(6em + 15px);" v-if="TabCur == 0">总计</view>
  38. <!-- <view class="title" style="min-width: calc(6em + 15px);" v-if="TabCur == 1">送活总计</view> -->
  39. <!-- <text class="text-grey" style="flex: 1;" v-if="TabCur==0">{{item.rcvQty}}</text> -->
  40. <text class="text-grey" style="flex: 1;" v-if="TabCur == 0">{{ item.rcvCount }}</text>
  41. <!-- <text class="text-grey" style="flex: 1;" v-if="TabCur == 1">{{ item.backCount }}</text> -->
  42. </view>
  43. </view>
  44. </view>
  45. <view class="cu-item" style="margin-top: 10rpx;" v-for="(item, index) in reportData" v-if="TabCur == 1">
  46. <view class="content" @click="showBackReport(item)">
  47. <!-- <view class="cu-form-group">
  48. <view class="title" style="min-width: calc(6em + 15px);">制衣生产车间</view>
  49. <text class="text-grey" style="flex: 1;">{{ item.workshopName }}</text>
  50. </view>
  51. <view class="cu-form-group">
  52. <view class="title" style="min-width: calc(6em + 15px);">制衣班组</view>
  53. <text class="text-grey" style="flex: 1;">{{ item.teamName }}</text>
  54. </view>
  55. <view class="cu-form-group">
  56. <view class="title" style="min-width: calc(6em + 15px);">订单号</view>
  57. <text class="text-grey" style="flex: 1;">{{ item.orderNo }}</text>
  58. </view> -->
  59. <view class="cu-form-group">
  60. <view class="title" style="min-width: calc(6em + 15px);">时间</view>
  61. <text class="text-grey" style="flex: 1;">{{ item.backDate }}</text>
  62. </view>
  63. <view class="cu-form-group">
  64. <view class="title" style="min-width: calc(6em + 15px);">总计</view>
  65. <!-- <text class="text-grey" style="flex: 1;" v-if="TabCur==0">{{item.rcvQty}}</text> -->
  66. <text class="text-grey" style="flex: 1;">{{ item.backCount }}</text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </scroll-view>
  72. </view>
  73. </template>
  74. <script>
  75. import { getRcvReport, getBackReport } from '@/api/biz/report.js';
  76. export default {
  77. data() {
  78. return {
  79. tabs: [
  80. {
  81. key: 0,
  82. name: '领活'
  83. },
  84. {
  85. key: 1,
  86. name: '送活'
  87. }
  88. ],
  89. TabCur: 0,
  90. reportData: [],
  91. range: [],
  92. };
  93. },
  94. watch: {
  95. range(newval) {
  96. console.log('范围选:', this.range);
  97. console.log('长度:', this.range.length);
  98. if (this.TabCur == 0) {
  99. getRcvReport(this.range.length==0?null:this.range).then(res => {
  100. if (res.success) {
  101. this.reportData = res.data;
  102. // this.reportData.rcvDate = this.dateFormat(res.data.rcvDate);
  103. }
  104. });
  105. } else if (this.TabCur == 1) {
  106. getBackReport(this.range.length==0?null:this.range).then(res => {
  107. this.reportData = res.data;
  108. });
  109. }
  110. },
  111. },
  112. methods: {
  113. // dateFormat(time) {
  114. // let date = new Date(time);
  115. // let year = date.getFullYear();
  116. // // 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  117. // let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  118. // let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  119. // let hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
  120. // let minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
  121. // let seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
  122. // // 拼接
  123. // // return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  124. // return year + '-' + month + '-' + day;
  125. // },
  126. tabSelect(e) {
  127. this.TabCur = e.currentTarget.dataset.id;
  128. this.loadData(this.TabCur);
  129. },
  130. loadData(tabIndex) {
  131. if (tabIndex == 0) {
  132. getRcvReport(this.range.length==0?null:this.range).then(res => {
  133. if (res.success) {
  134. this.reportData = res.data;
  135. // this.reportData.rcvDate = this.dateFormat(res.data.rcvDate);
  136. }
  137. });
  138. } else if (tabIndex == 1) {
  139. getBackReport(this.range.length==0?null:this.range).then(res => {
  140. this.reportData = res.data;
  141. });
  142. } else {
  143. }
  144. },
  145. showReport(item) {
  146. uni.navigateTo({
  147. url: '/pages/report/show?reportInfo=' + encodeURIComponent(JSON.stringify(item))
  148. });
  149. },
  150. showBackReport(item) {
  151. uni.navigateTo({
  152. url: '/pages/report/backshow?reportInfo=' + encodeURIComponent(JSON.stringify(item))
  153. });
  154. },
  155. maskClick(e){
  156. console.log('maskClick事件:', e);
  157. }
  158. },
  159. onLoad() {
  160. this.loadData(this.TabCur);
  161. }
  162. };
  163. </script>
  164. <style>
  165. /* .cu-form-group {
  166. min-height: 0;
  167. border: none;
  168. } */
  169. </style>