lzm 3 жил өмнө
parent
commit
bf780251dd

+ 17 - 10
app/pages/customer-management/customer-management.vue

@@ -57,6 +57,9 @@
 		data() {
 			return {
 				current:0,
+				pageNo: 1,
+				pageSize: 3,
+				dataCount: 0,
 				status: 'loadmore',
 				page: 0,
 				tabs: [
@@ -91,6 +94,9 @@
 			getCustomerList(){
 				this.$api.getCustomerList({
 					current: this.current,
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					dataCount: this.dataCount,
 				}).then(resp => {
 					let customerList = resp.data;
 					//todo 还要判断当前用户是否为admin
@@ -99,8 +105,10 @@
 							customerList[i].btnShow = 1;
 						}
 					}
+					this.dataCount = resp.dataCount;
+					this.pageNo = resp.pageNo;
 					this.customerItemList = customerList;
-					console.log(customerList);
+					if(this.dataCount < this.pageSize * this.pageNo) this.status = 'nomore';
 				})
 			},
 			confirmCustomer(){
@@ -147,15 +155,14 @@
 			//------------------------------------------
 			//上拉加载更多,分页模拟数据
 			onReachBottom() {
-				// if(this.page >= 3) return ;
-				// this.status = 'loading';
-				// this.page = ++ this.page;
-				// setTimeout(() => {
-				// 	this.customerItemList += 5;//接接口后把数据加上,懒得写假数据了
-				// 	if(this.page >= 3) this.status = 'nomore';
-				// 	else this.status = 'loading';
-				// }, 2000) 
-			}
+				this.status = 'loading';
+				if(this.dataCount > this.pageSize * this.pageNo){
+					this.pageSize = parseInt(this.pageSize) + 3;
+					this.getCustomerList();
+				}else{
+					this.status = 'nomore';
+				}
+			} 
 		},
 		onShow() {
 			this.getCustomerList();

+ 19 - 10
app/pages/inout-record/inout-record.vue

@@ -57,6 +57,9 @@
 		data() {
 			return {
 				current:0,
+				pageNo: 1,
+				pageSize: 3,
+				dataCount: 0,
 				status: 'loadmore',
 				page: 0,
 				tabs: [
@@ -91,9 +94,16 @@
 			getRecordList() {
 				this.$api.getInOutRecord({
 					current: this.current,
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					dataCount: this.dataCount,
 				}).then(resp => {
+					this.status = 'loadmore';
 					let recordList = resp.data;
+					this.dataCount = resp.dataCount;
+					this.pageNo = resp.pageNo;
 					this.recordItemList = recordList;
+					if(this.dataCount < this.pageSize * this.pageNo) this.status = 'nomore';
 				})
 			},
 			//点击上方切换栏,根据点击项重新加载数据
@@ -118,16 +128,15 @@
 			},
 			//------------------------------------------
 			//上拉加载更多,分页模拟数据
-			// onReachBottom() {
-			// 	if(this.page >= 3) return ;
-			// 	this.status = 'loading';
-			// 	this.page = ++ this.page;
-			// 	setTimeout(() => {
-			// 		this.recordItemList += 5;//接接口后把数据加上,懒得写假数据了
-			// 		if(this.page >= 3) this.status = 'nomore';
-			// 		else this.status = 'loading';
-			// 	}, 2000)
-			// } 
+			onReachBottom() {
+				this.status = 'loading';
+				if(this.dataCount > this.pageSize * this.pageNo){
+					this.pageSize = parseInt(this.pageSize) + 3;
+					this.getRecordList();
+				}else{
+					this.status = 'nomore';
+				}
+			} 
 		},
 		onShow() {
 			this.getRecordList();

+ 6 - 6
sp-server/src/main/java/com/pj/api/h5/ApiController.java

@@ -53,26 +53,24 @@ public class ApiController {
 
     @RequestMapping(value = "getInOutRecord")
     public AjaxJson getInOutRecord(){
-        //
         SoMap so = SoMap.getRequestSoMap();
         String currentCustomerId = StpUserUtil.getCustomerId();
         if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
             so.put("customerId",currentCustomerId);
         }
-        List<InOutRecordBO> recordList = apiService.getInOutRecord(so);
-        return AjaxJson.getSuccessData(recordList);
+        List<InOutRecordBO> recordList = apiService.getInOutRecord(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), recordList);
     }
 
     @RequestMapping(value = "getCustomerList")
-    //
     public AjaxJson getCustomerList(){
         SoMap so = SoMap.getRequestSoMap();
         String currentCustomerId = StpUserUtil.getCustomerId();
         if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
             so.put("id",currentCustomerId);
         }
-        List<TbCostomer> list = apiService.getCustomerList(so);
-        return AjaxJson.getSuccessData(list);
+        List<TbCostomer> list = apiService.getCustomerList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
     }
 
     @PostMapping(value = "confirmCustomer")
@@ -81,4 +79,6 @@ public class ApiController {
         return AjaxJson.getSuccess();
     }
 
+
+
 }

+ 2 - 18
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -29,8 +29,6 @@ public class ApiService {
     TbBusinessService tbBusinessService;
 
     public List<InOutRecordBO> getInOutRecord(SoMap so){
-        //
-        int current = so.getInt("current");
         List<TbBusiness> businessList = tbBusinessService.getList(so);
         List<InOutRecordBO> recordList = new ArrayList<>();
         for (TbBusiness business : businessList) {
@@ -45,28 +43,14 @@ public class ApiService {
             }else{
                 record.setStatus(1);//未入场
             }
-            if(current == 0){
-                recordList.add(record);
-            }else if(current == record.getStatus()) {
-                recordList.add(record);
-            }
+            recordList.add(record);
         }
         return recordList;
     }
 
     public List<TbCostomer> getCustomerList(SoMap so) {
-        //
-        int current = so.getInt("current");
-        List<TbCostomer> costomerList = new ArrayList<>();
         List<TbCostomer> list = tbCostomerService.getList(so);
-        for (TbCostomer costomer : list) {
-            if(current == 0){
-                costomerList.add(costomer);
-            }else if(current == costomer.getJudgeStatus()){
-                costomerList.add(costomer);
-            }
-        }
-        return costomerList;
+        return list;
     }
 
     public void confirmCustomer(Long customerId) {

+ 5 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml

@@ -28,6 +28,11 @@
 			<if test=' this.has("outDayTime") '> and out_day_time = #{outDayTime} </if>
 			<if test=' this.has("partMoney") '> and part_money = #{partMoney} </if>
 			<if test=' this.has("partTime") '> and part_time = #{partTime} </if>
+            <if test=' this.has("current") '>
+                <if test=' current == 3 '>and real_in_time is not null and out_day_time is not null</if>
+                <if test=' current == 2 '>and real_in_time is not null and out_day_time is null</if>
+                <if test=' current == 1 '>and real_in_time is null and out_day_time is null</if>
+            </if>
 		</where>
 		order by
 		<choose>

+ 3 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.xml

@@ -80,6 +80,9 @@
 			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>
 			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>
 			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>
+            <if test=' this.has("current") '>
+                <if test=' current != 0 '>and judge_status = #{current}</if>
+            </if>
 		</where>
 		order by
 		<choose>