Quellcode durchsuchen

出入记录,客户管理

lzm vor 3 Jahren
Ursprung
Commit
184d0da9d6

+ 9 - 0
app/apis/api.js

@@ -11,4 +11,13 @@ export default {
 	register(data) {
 		return ajax.postForm('/api/register', data)
 	},
+	getInOutRecord(data) {
+		return ajax.get('/api/getInOutRecord', data)
+	},
+	getCustomerList(data) {
+		return ajax.get('/api/getCustomerList', data)
+	},
+	confirmCustomer(data) {
+		return ajax.postForm('/api/confirmCustomer', data)
+	}
 }

+ 90 - 60
app/pages/customer-management/customer-management.vue

@@ -5,7 +5,7 @@
 				<text class="title">客户管理</text>
 			</view>
 		</view>
-		<view class="t-btn">+添加客户</view>
+		<view class="t-btn" @click="addCustomer()">+添加客户</view>
 		<u-sticky offset-top="-90">
 			<u-tabs :list="tabs" @change="change" :current="current" :is-scroll="false"></u-tabs>
 		</u-sticky>
@@ -13,12 +13,12 @@
 			<view class="card" v-for="(customerItem,index) in customerItemList" :key="index">
 				<view class="t">
 					<image class="icon" src="../../static/home-icon-01.png"></image>
-					<text class="title">{{customerItem.companyName}}</text>
+					<text class="title">{{customerItem.name}}</text>
 				</view>
 				<view class="c">
 					<view class="item">
 						<text class="p1">联系人:</text>
-						<text class="p2">{{customerItem.user}}</text>
+						<text class="p2">{{customerItem.dutyPeople}}</text>
 					</view>
 					<view class="item">
 						<text class="p1">联系电话:</text>
@@ -26,22 +26,29 @@
 					</view>
 					<view class="item">
 						<text class="p1">营业执照:</text>
-						<text class="p2">{{customerItem.license}}</text>
+						<text class="p2">
+							<image class="licence" :src="customerItem.businessLicence"></image>
+						</text>
 					</view>
 					<view class="item">
 						<text class="p1">状态:</text>
-						<text class="p2">{{customerItem.state}}</text>
+						<text class="p2">
+							<text v-if="customerItem.judgeStatus==1">未审核</text>
+							<text v-if="customerItem.judgeStatus==2">审核通过</text>
+							<text v-if="customerItem.judgeStatus==3">审核不通过</text>
+						</text>
 					</view>
 				</view>
 				<view class="b">
-					<view class="btn b1" v-if="customerItem.btnShow==1" @click="sh(index)">审核</view>
+					<view class="btn b1" v-if="customerItem.btnShow==1 " @click="sh(customerItem.id)">审核</view>
 				</view>
 			</view>
 		</view>
 		<u-loadmore style="margin: 30rpx;" :status="status"/>
-		<uni-popup ref="shpopup" type="dialog">
+		<uni-popup ref="shpopup" type="center">
 		    <uni-popup-dialog type="success" title="确定审核吗?" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
 		</uni-popup>
+	
 	</view>
 </template>
 
@@ -68,80 +75,92 @@
 				],
 				customerItemList:[
 					{
-						companyName:'广西医科大一附院',
-						user:'张三',
-						phone:'18888888888',
-						license:'有',
-						state:'未审核',
-						btnShow:1
-					},
-					{
-						companyName:'广西医科大一附院',
-						user:'张三',
-						phone:'18888888888',
-						license:'有',
-						state:'审核通过',
-						btnShow:0
-					},
-					{
-						companyName:'广西医科大一附院',
-						user:'张三',
-						phone:'18888888888',
-						license:'有',
-						state:'禁用',
+						name:'',
+						dutyPeople:'',
+						phone:'',
+						businessLicence:'',
+						judgeStatus:'',
 						btnShow:0
 					},
-					{
-						companyName:'广西医科大一附院',
-						user:'张三',
-						phone:'18888888888',
-						license:'有',
-						state:'禁用',
-						btnShow:0
-					}
-				]
+				],
+				confirmCustomerId: '',
+				judgeContent: '',
 			}
 		},
 		methods: {
+			getCustomerList(){
+				this.$api.getCustomerList({
+					current: this.current,
+				}).then(resp => {
+					let customerList = resp.data;
+					//todo 还要判断当前用户是否为admin
+					for (let i in customerList) {
+						if(customerList[i].judgeStatus == 1){
+							customerList[i].btnShow = 1;
+						}
+					}
+					this.customerItemList = customerList;
+					console.log(customerList);
+				})
+			},
+			confirmCustomer(){
+				this.$api.confirmCustomer({
+					customerId: this.confirmCustomerId
+				}).then(resp =>{
+					if(resp.code == 200){
+						this.getCustomerList();
+					}
+				})
+			},
 			//点击上方切换栏,根据点击项重新加载数据
 			change(index) {
 				this.current = index;
-				if(index==0){
-					//加载全部
-				}
-				if(index==1){
-					//加载未审核
-				}
-				if(index==2){
-					//只加载审核通过
-				}
-				if(index==3){
-					//只加载禁用
-				}
+				this.getCustomerList();
+				// if(index==0){
+				// 	//加载全部
+				// }
+				// if(index==1){
+				// 	//加载未审核
+				// }
+				// if(index==2){
+				// 	//只加载审核通过
+				// }
+				// if(index==3){
+				// 	//只加载禁用
+				// }
 			},
 			//点击按钮
 			//------------------------------------------
-			sh(){
+			sh(id){
+				this.confirmCustomerId = id;
 				this.$refs.shpopup.open('center')
 			},
 			shconfirm(index) {
-				console.log('审核')
+				this.confirmCustomer();
 				this.$refs.shpopup.close()
 			},
 			
+			addCustomer() {
+				this.$common.to("/pages/enterprise-reg/enterprise-reg");
+			},
+			
 			//------------------------------------------
 			//上拉加载更多,分页模拟数据
 			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)
+				// 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)
 			}
-		}
+		},
+		onShow() {
+			this.getCustomerList();
+		
+		},
 	}
 </script>
 
@@ -205,6 +224,10 @@
 						font-weight: bold;
 						margin-left: 20rpx;
 						flex: 7;
+						.licence{
+							width: 80%;
+							height: 100rpx;
+						}
 					}
 				}
 				.car-num-item{
@@ -261,5 +284,12 @@
 		background-color: #fff;
 		border: 1px solid #eee;
 	}
+	.popup-box {
+	    text-align: center;
+	    background-color: #fff;
+	    height: 280rpx;
+		width: 560rpx;
+	    border-radius: 10rpx;
+	  }
 	@import '@/common/common.scss'
 </style>

+ 51 - 48
app/pages/inout-record/inout-record.vue

@@ -12,39 +12,43 @@
 			<view class="card" v-for="(recordItem,index) in recordItemList" :key="index">
 				<view class="t">
 					<image class="icon" src="../../static/home-icon-01.png"></image>
-					<text class="title">{{recordItem.companyName}}</text>
+					<text class="title">{{recordItem.customerName}}</text>
 				</view>
 				<view class="c">
 					<view class="item car-num-item">
-						<text class="car-num">{{recordItem.carNum}}</text>
+						<text class="car-num">{{recordItem.cardNo}}</text>
 					</view>
 					<view class="item">
 						<text class="p1">联系人:</text>
-						<text class="p2">{{recordItem.user}}</text>
+						<text class="p2">{{recordItem.dutyPeople}}</text>
 					</view>
 					<view class="item">
 						<text class="p1">联系电话:</text>
-						<text class="p2">{{recordItem.phone}}</text>
+						<text class="p2">{{recordItem.customerContact}}</text>
 					</view>
-					<view class="item">
+					<view class="item" v-if="recordItem.realInTime != null">
 						<text class="p1">入场时间:</text>
-						<text class="p2">{{recordItem.intime}}</text>
+						<text class="p2">{{recordItem.realInTime}}</text>
 					</view>
-					<view class="item">
+					<view class="item" v-if="recordItem.outDayTime != null">
 						<text class="p1">出场时间:</text>
-						<text class="p2">{{recordItem.outtime}}</text>
+						<text class="p2">{{recordItem.outDayTime}}</text>
 					</view>
 					<view class="item">
 						<text class="p1">状态:</text>
-						<text class="p2">{{recordItem.state}}</text>
+						<text class="p2">
+							<text v-if="recordItem.status==1">未进场</text>
+							<text v-if="recordItem.status==2">已进场</text>
+							<text v-if="recordItem.status==3">已出场</text>
+						</text>
 					</view>
 				</view>
 			</view>
 		</view>
 		<u-loadmore style="margin: 30rpx;" :status="status"/>
-		<uni-popup ref="shpopup" type="dialog">
+		<!-- <uni-popup ref="shpopup" type="dialog">
 		    <uni-popup-dialog type="success" title="确定审核吗?" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
-		</uni-popup>
+		</uni-popup> -->
 	</view>
 </template>
 
@@ -71,65 +75,64 @@
 				],
 				recordItemList:[
 					{
-						companyName:'广西医科大一附院',
-						carNum:'桂A.B5W61',
-						user:'张三',
-						phone:'18888888888',
-						intime:'2022-01-17 19:02.01',
-						outtime:'022-01-17 23:22.41',
-						state:'未入场'
-					},
-					{
-						companyName:'广西医科大一附院',
-						carNum:'桂A.B5W61',
-						user:'张三',
-						phone:'18888888888',
-						intime:'2022-01-17 19:02.01',
-						outtime:'022-01-17 23:22.41',
-						state:'已入场'
+						customerName:'',
+						cardNo:'',
+						dutyPeople:'',
+						customerContact:'',
+						realInTime:'',
+						outDayTime:'',
+						status:''
 					},
-					{
-						companyName:'广西医科大一附院',
-						carNum:'桂A.B5W61',
-						user:'张三',
-						phone:'18888888888',
-						intime:'2022-01-17 19:02.01',
-						outtime:'022-01-17 23:22.41',
-						state:'已出场'
-					}
-				]
+				],
+				//recordList: [],
 			}
 		},
 		methods: {
+			getRecordList() {
+				this.$api.getInOutRecord({
+					current: this.current,
+				}).then(resp => {
+					let recordList = resp.data;
+					this.recordItemList = recordList;
+				})
+			},
 			//点击上方切换栏,根据点击项重新加载数据
 			change(index) {
 				this.current = index;
 				if(index==0){
 					//加载全部
+					this.getRecordList();
 				}
 				if(index==1){
 					//加载未入场
+					this.getRecordList();
 				}
 				if(index==2){
 					//只加载已入场
+					this.getRecordList();
 				}
 				if(index==3){
 					//只加载已出场
+					this.getRecordList();
 				}
 			},
 			//------------------------------------------
 			//上拉加载更多,分页模拟数据
-			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() {
+			// 	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)
+			// }
+		},
+		onShow() {
+			this.getRecordList();
+		
+		},
 	}
 </script>