performanceList.vue 6.7 KB

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