performanceList.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="page">
  3. <uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" left-icon="left"
  4. title="我的业绩" @clickLeft="back"/>
  5. <view class=" tabs ">
  6. <u-tabs :list="tabList" :scrollable="false" lineWidth="30" lineColor="#FFE05C"
  7. :activeStyle="{color: '#333333',fontWeight: 'bold',transform: 'scale(1.05)'}" :current="tabIndex"
  8. @click="clickTab"></u-tabs>
  9. </view>
  10. <view class="flex-col justify-between" style="margin-top: 20rpx">
  11. <view v-if="tabIndex == 0" class="flex-row justify-start">
  12. <view class="flex-col justify-center">
  13. <text class="selectParam">时间:</text>
  14. </view>
  15. <view @click="openDate(1)">
  16. <u-input v-model="selectStartDate" class="selectParamInput" disabled-color="#ffffff"
  17. placeholder="开始时间"></u-input>
  18. </view>
  19. <view class="flex-col justify-center">
  20. <text class="selectParam" style="margin-left: 10rpx">-</text>
  21. </view>
  22. <view @click="openDate(2)">
  23. <u-input v-model="selectEndDate" class="selectParamInput" disabled-color="#ffffff"
  24. placeholder="结束时间"></u-input>
  25. </view>
  26. </view>
  27. <view class="flex-row justify-start" style="margin-top: 10rpx;">
  28. <view class="flex-col justify-center">
  29. <text class="selectParam">项目:</text>
  30. </view>
  31. <view @click="openServicePro">
  32. <u-input v-model="selectServiceName" class="selectParamInput" disabled-color="#ffffff"
  33. placeholder="选择服务项目"></u-input>
  34. </view>
  35. <view class="flex-col justify-center" style="margin-left: 10rpx;">
  36. <u-button text="清空" type="primary" size="mini" @click="cancelParam"></u-button>
  37. </view>
  38. <view class="totalCount">
  39. <text class="totalCountLabel">总计:</text>
  40. <text class="totalCountValue">{{ totalCount }}</text>
  41. <text class="totalCountLabel">单</text>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 订单列表 -->
  46. <view :style="{'height':windowHeight}">
  47. <swiper :style="{'height':windowHeight}" :current="tabIndex" @change="swiperChange">
  48. <swiper-item class="swiperItem" v-for="(item,index) in tabList" :key="index">
  49. <view>
  50. <mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :tabs="tabList" :height="windowHeight"
  51. :selectStartDate="selectStartDate" :selectEndDate="selectEndDate"
  52. :selectServiceId="selectServiceId" @updateTotal="updateTotal">
  53. </mescroll-item>
  54. </view>
  55. </swiper-item>
  56. </swiper>
  57. </view>
  58. <u-picker title="服务项目" :show="openServiceProShow" :closeOnClickOverlay="true" :columns="serviceList"
  59. :keyName="'serviceName'" @cancel="openServiceProCancel" @confirm="openServiceProConfirm"></u-picker>
  60. <u-datetime-picker title="服务时间" :show="openDateShow" :closeOnClickOverlay="true" mode="date"
  61. @cancel="openDateCancel" @confirm="openDateConfirm"></u-datetime-picker>
  62. </view>
  63. </template>
  64. <script>
  65. import MescrollItem from "./module/mescrollUni-item.vue";
  66. export default {
  67. components: {
  68. MescrollItem
  69. },
  70. data() {
  71. return {
  72. tabIndex: 0,
  73. tabList: [{
  74. name: '累计服务'
  75. }, {
  76. name: '今日业绩'
  77. }, {
  78. name: '本月业绩'
  79. }],
  80. dateType: 1,
  81. selectStartDate: null,
  82. selectEndDate: null,
  83. selectServiceId: null,
  84. selectServiceName: null,
  85. totalCount: 0,
  86. windowHeight: '',
  87. serviceList: [],
  88. openServiceProShow: false,
  89. openDateShow: false
  90. }
  91. },
  92. onLoad(e) {
  93. this.tabIndex = e.index * 1
  94. this.serviceProjectList()
  95. let sysInfo = uni.getSystemInfoSync()
  96. if (this.tabIndex == 0) {
  97. this.windowHeight = sysInfo.windowHeight - 74 - 130 + 'px' //除标题栏栏外的屏幕可用高度
  98. } else {
  99. this.windowHeight = sysInfo.windowHeight - 74 - 90 + 'px' //除标题栏栏外的屏幕可用高度
  100. }
  101. // 页面加载后延迟触发初始数据加载,确保组件已挂载
  102. setTimeout(() => {
  103. if (this.$refs.MescrollItem && this.$refs.MescrollItem[this.tabIndex]) {
  104. this.$refs.MescrollItem[this.tabIndex].downCallback()
  105. }
  106. }, 300)
  107. },
  108. methods: {
  109. // 更新统计总数
  110. updateTotal(total) {
  111. this.totalCount = total
  112. },
  113. cancelParam() {
  114. this.selectStartDate = null
  115. this.selectEndDate = null
  116. this.selectServiceId = null
  117. this.selectServiceName = null
  118. this.totalCount = 0
  119. setTimeout(() => {
  120. this.$refs.MescrollItem[this.tabIndex].downCallback()
  121. }, 100)
  122. },
  123. openDate(dateType) {
  124. this.dateType = dateType;
  125. this.openDateShow = true
  126. },
  127. openDateCancel() {
  128. this.openDateShow = false
  129. },
  130. openDateConfirm(e) {
  131. console.log(e)
  132. const timeFormat = uni.$u.timeFormat;
  133. if (this.dateType == 1) {
  134. this.selectStartDate = timeFormat(e.value, 'yyyy-mm-dd')
  135. }
  136. if (this.dateType == 2) {
  137. this.selectEndDate = timeFormat(e.value, 'yyyy-mm-dd')
  138. }
  139. this.openDateShow = false
  140. setTimeout(() => {
  141. this.$refs.MescrollItem[this.tabIndex].downCallback()
  142. }, 100)
  143. },
  144. openServicePro() {
  145. console.log('openServicePro')
  146. this.openServiceProShow = true
  147. },
  148. openServiceProCancel() {
  149. this.openServiceProShow = false
  150. },
  151. openServiceProConfirm(e) {
  152. console.log(e)
  153. this.openServiceProShow = false
  154. this.selectServiceId = e.value[0].id
  155. this.selectServiceName = e.value[0].serviceName
  156. console.log('++++++++++++++this.$refs+++++++++++++', this.$refs);
  157. setTimeout(() => {
  158. this.$refs.MescrollItem[this.tabIndex].downCallback()
  159. }, 100)
  160. },
  161. serviceProjectList() {
  162. this.serviceList = [];
  163. this.$api.service.serviceProjectList().then(res => {
  164. this.$set(this.serviceList, 0, res.data.data)
  165. })
  166. },
  167. back() {
  168. uni.navigateBack({
  169. delta: 1
  170. })
  171. },
  172. clickTab(e) {
  173. this.selectStartDate = null
  174. this.selectEndDate = null
  175. this.selectServiceId = null
  176. this.selectServiceName = null
  177. this.totalCount = 0
  178. this.tabIndex = e.index
  179. // 切换tab时触发数据加载以更新统计
  180. setTimeout(() => {
  181. this.$refs.MescrollItem[this.tabIndex].downCallback()
  182. }, 100)
  183. },
  184. swiperChange(e) {
  185. this.tabIndex = e.detail.current
  186. // 滑动切换时触发数据加载以更新统计
  187. setTimeout(() => {
  188. if (this.$refs.MescrollItem && this.$refs.MescrollItem[this.tabIndex]) {
  189. this.$refs.MescrollItem[this.tabIndex].downCallback()
  190. }
  191. }, 100)
  192. },
  193. }
  194. }
  195. </script>
  196. <style scoped lang="scss">
  197. @import './index.rpx.css';
  198. </style>