Bläddra i källkod

fix:业绩统计添加总数

xuyunhui 2 månader sedan
förälder
incheckning
0745c7bbc3

+ 24 - 0
pages/performanceList/index.rpx.css

@@ -14,3 +14,27 @@
 	font-size: 24rpx;
 	margin-left: 10rpx;
 }
+
+.totalCount{
+	display: flex;
+	align-items: center;
+	margin-left: 20rpx;
+	padding: 8rpx 20rpx;
+	background: linear-gradient(135deg, #FFE05C 0%, #FFD02A 100%);
+	border-radius: 30rpx;
+	box-shadow: 0 4rpx 12rpx rgba(255, 224, 92, 0.3);
+}
+
+.totalCountLabel{
+	font-size: 24rpx;
+	color: #333333;
+	font-weight: 500;
+}
+
+.totalCountValue{
+	font-size: 32rpx;
+	color: #FF6B35;
+	font-weight: bold;
+	margin: 0 6rpx;
+	text-shadow: 0 2rpx 4rpx rgba(255, 107, 53, 0.1);
+}

+ 4 - 0
pages/performanceList/module/mescrollUni-item.vue

@@ -177,6 +177,10 @@
 						}
 					})
 					this.list = this.list.concat(res.data.data.records); //追加新数据
+					// 通知父组件更新统计总数
+					if (page.num === 1) {
+						this.$emit('updateTotal', res.data.data.total || 0)
+					}
 					console.log(this.list)
 				}).catch((err) => {
 					//联网失败, 结束加载

+ 29 - 2
pages/performanceList/performanceList.vue

@@ -32,6 +32,11 @@
         <view class="flex-col justify-center" style="margin-left: 10rpx;">
           <u-button text="清空" type="primary" size="mini" @click="cancelParam"></u-button>
         </view>
+        <view class="totalCount">
+          <text class="totalCountLabel">总计:</text>
+          <text class="totalCountValue">{{ totalCount }}</text>
+          <text class="totalCountLabel">单</text>
+        </view>
       </view>
 
     </view>
@@ -42,7 +47,7 @@
 			<swiper :style="{'height':windowHeight}" :current="tabIndex" @change="swiperChange">
 				<swiper-item class="swiperItem" v-for="(item,index) in tabList" :key="index">
 					<view>
-						<mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :tabs="tabList" :height="windowHeight" :selectStartDate="selectStartDate" :selectEndDate="selectEndDate"  :selectServiceId="selectServiceId"  >
+						<mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :tabs="tabList" :height="windowHeight" :selectStartDate="selectStartDate" :selectEndDate="selectEndDate"  :selectServiceId="selectServiceId"  @updateTotal="updateTotal" >
 						</mescroll-item>
 					</view>
 				</swiper-item>
@@ -79,6 +84,7 @@
         selectEndDate:null,
         selectServiceId:null,
         selectServiceName:null,
+        totalCount:0,
 
 				windowHeight:'',
         serviceList:[],
@@ -96,14 +102,25 @@
       }else {
         this.windowHeight = sysInfo.windowHeight - 74 - 90 + 'px' //除标题栏栏外的屏幕可用高度
       }
+      // 页面加载后延迟触发初始数据加载,确保组件已挂载
+      setTimeout(() => {
+        if (this.$refs.MescrollItem && this.$refs.MescrollItem[this.tabIndex]) {
+          this.$refs.MescrollItem[this.tabIndex].downCallback()
+        }
+      }, 300)
 		},
 		methods: {
+      // 更新统计总数
+      updateTotal(total){
+        this.totalCount = total
+      },
 
       cancelParam(){
         this.selectStartDate = null
         this.selectEndDate = null
         this.selectServiceId = null
         this.selectServiceName = null
+        this.totalCount = 0
         setTimeout(()=>{
           this.$refs.MescrollItem[this.tabIndex].downCallback()
         },100)
@@ -170,11 +187,21 @@
         this.selectEndDate = null
         this.selectServiceId = null
         this.selectServiceName = null
+        this.totalCount = 0
 				this.tabIndex = e.index
+				// 切换tab时触发数据加载以更新统计
+				setTimeout(() => {
+					this.$refs.MescrollItem[this.tabIndex].downCallback()
+				}, 100)
 			},
 			swiperChange(e) {
 				this.tabIndex = e.detail.current
-
+				// 滑动切换时触发数据加载以更新统计
+				setTimeout(() => {
+					if (this.$refs.MescrollItem && this.$refs.MescrollItem[this.tabIndex]) {
+						this.$refs.MescrollItem[this.tabIndex].downCallback()
+					}
+				}, 100)
 			},
 		}
 	}