performanceList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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>
  33. </view>
  34. <!-- 订单列表 -->
  35. <view :style="{'height':windowHeight}">
  36. <swiper :style="{'height':windowHeight}" :current="tabIndex" @change="swiperChange">
  37. <swiper-item class="swiperItem" v-for="(item,index) in tabList" :key="index">
  38. <view>
  39. <mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :tabs="tabList" :height="windowHeight" :selectStartDate="selectStartDate" :selectEndDate="selectEndDate" :selectServiceId="selectServiceId" >
  40. </mescroll-item>
  41. </view>
  42. </swiper-item>
  43. </swiper>
  44. </view>
  45. <u-picker title="服务项目" :show="openServiceProShow" :closeOnClickOverlay="true" :columns="serviceList" :keyName="'serviceName'" @cancel="openServiceProCancel" @confirm="openServiceProConfirm"></u-picker>
  46. <u-datetime-picker title="服务时间" :show="openDateShow" :closeOnClickOverlay="true" mode="date" @cancel="openDateCancel" @confirm="openDateConfirm"></u-datetime-picker>
  47. </view>
  48. </template>
  49. <script>
  50. import MescrollItem from "./module/mescrollUni-item.vue";
  51. export default {
  52. components: {
  53. MescrollItem
  54. },
  55. data() {
  56. return {
  57. tabIndex: 0,
  58. tabList: [{
  59. name: '累计服务'
  60. }, {
  61. name: '今日业绩'
  62. }, {
  63. name: '本月业绩'
  64. }],
  65. dateType:1,
  66. selectStartDate:null,
  67. selectEndDate:null,
  68. selectServiceId:null,
  69. selectServiceName:null,
  70. windowHeight:'',
  71. serviceList:[],
  72. openServiceProShow:false,
  73. openDateShow:false
  74. }
  75. },
  76. onLoad(e) {
  77. this.tabIndex = e.index*1
  78. this.serviceProjectList()
  79. let sysInfo = uni.getSystemInfoSync()
  80. if (this.tabIndex == 0){
  81. this.windowHeight = sysInfo.windowHeight - 74 - 130 + 'px' //除标题栏栏外的屏幕可用高度
  82. }else {
  83. this.windowHeight = sysInfo.windowHeight - 74 - 90 + 'px' //除标题栏栏外的屏幕可用高度
  84. }
  85. },
  86. methods: {
  87. cancelParam(){
  88. this.selectStartDate = null
  89. this.selectEndDate = null
  90. this.selectServiceId = null
  91. this.selectServiceName = null
  92. setTimeout(()=>{
  93. this.$refs.MescrollItem[this.tabIndex].downCallback()
  94. },100)
  95. },
  96. openDate(dateType){
  97. this.dateType = dateType;
  98. this.openDateShow = true
  99. },
  100. openDateCancel(){
  101. this.openDateShow = false
  102. },
  103. openDateConfirm(e){
  104. console.log(e)
  105. const timeFormat = uni.$u.timeFormat;
  106. if (this.dateType == 1){
  107. this.selectStartDate = timeFormat(e.value, 'yyyy-mm-dd')
  108. }
  109. if (this.dateType == 2){
  110. this.selectEndDate = timeFormat(e.value, 'yyyy-mm-dd')
  111. }
  112. this.openDateShow = false
  113. setTimeout(()=>{
  114. this.$refs.MescrollItem[this.tabIndex].downCallback()
  115. },100)
  116. },
  117. openServicePro(){
  118. console.log('openServicePro')
  119. this.openServiceProShow = true
  120. },
  121. openServiceProCancel(){
  122. this.openServiceProShow = false
  123. },
  124. openServiceProConfirm(e){
  125. console.log(e)
  126. this.openServiceProShow = false
  127. this.selectServiceId = e.value[0].id
  128. this.selectServiceName = e.value[0].serviceName
  129. console.log('++++++++++++++this.$refs+++++++++++++',this.$refs);
  130. setTimeout(()=>{
  131. this.$refs.MescrollItem[this.tabIndex].downCallback()
  132. },100)
  133. },
  134. serviceProjectList(){
  135. this.serviceList = [];
  136. this.$api.service.serviceProjectList().then(res => {
  137. this.$set(this.serviceList,0, res.data.data)
  138. })
  139. },
  140. back() {
  141. uni.navigateBack({
  142. delta: 1
  143. })
  144. },
  145. clickTab(e) {
  146. this.selectStartDate = null
  147. this.selectEndDate = null
  148. this.selectServiceId = null
  149. this.selectServiceName = null
  150. this.tabIndex = e.index
  151. },
  152. swiperChange(e) {
  153. this.tabIndex = e.detail.current
  154. },
  155. }
  156. }
  157. </script>
  158. <style scoped lang="scss">
  159. @import './index.rpx.css';
  160. </style>