From fb4fa76b4c1a93c833cd97f97f41b6158ab1aef7 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 21 四月 2023 17:24:44 +0800
Subject: [PATCH] 修改bug

---
 pages/customer-page/customer-index/customer-index.vue |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/pages/customer-page/customer-index/customer-index.vue b/pages/customer-page/customer-index/customer-index.vue
index 6437192..fbceba9 100644
--- a/pages/customer-page/customer-index/customer-index.vue
+++ b/pages/customer-page/customer-index/customer-index.vue
@@ -9,8 +9,8 @@
 						寮�
 					</view>
 					<view class="card-left__utils">
-						<u-button @tap.stop="receiveClick(item)" text="棰嗗彇" type="primary" v-if="item.carNum != 0" shape="circle"></u-button>
-						<u-button text="杞彂" type="primary" @tap.stop="forwardClick(item)" shape="circle" v-if="item.cars2 != 0"></u-button>
+						<u-button @tap.stop="receiveClick(item)" text="棰嗗彇" type="primary" v-if="item.carNum - item.cars2 != 0" shape="circle"></u-button>
+						<u-button text="杞彂" type="primary" @tap.stop="forwardClick(item)" shape="circle"></u-button>
 					</view>
 				</template>
 				<template v-slot:right-top>
@@ -34,7 +34,7 @@
 								<text class="lingqu" @tap.stop="numInput(item.id)">{{ item.receiveNum || '_______' }}</text>
 								寮�
 							</view> -->
-							<view v-if="item.cars == item.cars2 ? false : true">鍓╀綑{{ item.carNum - item.cars2 }}寮�</view>
+							<view v-if="item.carNum == item.cars2 ? false : true">鍓╀綑{{ item.carNum - item.cars2 }}寮�</view>
 							<view v-else>宸查瀹�</view>
 						</view>
 					</view>
@@ -60,13 +60,13 @@
 						<uni-th align="center" width="80">鎻愮叅鍗曚釜鏁�</uni-th>
 					</uni-tr>
 					<uni-tr v-for="(item, index) in historyCoalData" :key="index">
-						<uni-td align="center" @row-click="faYundetail(item)">{{ item.sendDate }}</uni-td>
-						<uni-td align="left" @row-click="faYundetail(item)">{{ item.deptName }}</uni-td>
-						<uni-td align="center" @row-click="faYundetail(item)">{{ item.filedName }}</uni-td>
-						<uni-td align="center" @row-click="faYundetail(item)">{{ item.coalName }}</uni-td>
-						<uni-td align="center" @row-click="faYundetail(item)">{{ item.orderCode }}</uni-td>
-						<uni-td align="center" @row-click="faYundetail(item)">{{ item.carNumSurplus }}</uni-td>
-						<uni-td align="center" @row-click="faYundetail(item)">{{ item.tmCount }}</uni-td>
+						<uni-td align="center" @row-click="faYundetail(item)">{{ item.sendDate || '' }}</uni-td>
+						<uni-td align="left" @row-click="faYundetail(item)">{{ item.deptName || '' }}</uni-td>
+						<uni-td align="center" @row-click="faYundetail(item)">{{ item.filedName || '' }}</uni-td>
+						<uni-td align="center" @row-click="faYundetail(item)">{{ item.coalName || '' }}</uni-td>
+						<uni-td align="center" @row-click="faYundetail(item)">{{ item.orderCode || '' }}</uni-td>
+						<uni-td align="center" @row-click="faYundetail(item)">{{ item.carNumSurplus || '' }}</uni-td>
+						<uni-td align="center" @row-click="faYundetail(item)">{{ item.tmCount || '' }}</uni-td>
 					</uni-tr>
 				</uni-table>
 				<view class="more_text" v-if="showMoreData && historyCoalData.length !== 0">娌℃湁鏁版嵁浜�...</view>
@@ -154,16 +154,15 @@
 			this.loading = true;
 			this.$reqGet('getJhOrderPlanDataPage', { current: this.pageCurrent, size: this.pageSize }).then(res => {
 				if (res.data.records) {
+					this.total = res.data.total;
 					if (this.pageCurrent > 1) {
 						this.historyCoalData = this.historyCoalData.concat(res.data.records);
+						this.historyCoalData = this.ArrSet(this.historyCoalData, 'id');
 						this.loading = false;
 					} else {
 						this.historyCoalData = res.data.records;
 						this.loading = false;
 					}
-					// this.historyCoalData = [...this.historyCoalData, ...res.data.records];
-					// this.total = res.data.total;
-					// this.loading = false;
 				}
 			});
 		},
@@ -172,6 +171,15 @@
 			if (this.pageCurrent * this.pageSize >= this.total) return (this.showMoreData = true);
 			this.pageCurrent++;
 			this.getJhOrderPlanDataPage();
+		},
+		//fix 鐐瑰嚮鎻愮叅鍗曡繑鍥炰細澧炲姞閲嶅鏁版嵁
+		ArrSet(Arr, id) {
+			var obj = {};
+			const arrays = Arr.reduce((setArr, item) => {
+				obj[item[id]] ? '' : (obj[item[id]] = true && setArr.push(item));
+				return setArr;
+			}, []);
+			return arrays;
 		},
 		popupDetermineClick() {
 			if (this.receiveNum) {
@@ -188,7 +196,7 @@
 							duration: 1000
 						});
 					} else {
-						this.$u.toast(res.data ? res.data : '棰嗗彇澶辫触');
+						this.$u.toast(res.msg ? res.msg : '棰嗗彇澶辫触');
 					}
 				});
 			} else {

--
Gitblit v1.9.1