From e3f6581c48b1dfb65c55e8a1a6ce1761a7dc26b4 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期四, 16 一月 2025 15:29:43 +0800
Subject: [PATCH] 费用报销

---
 src/pages/checkin/checkin.vue |  271 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 213 insertions(+), 58 deletions(-)

diff --git a/src/pages/checkin/checkin.vue b/src/pages/checkin/checkin.vue
index d7c1d98..cd28503 100644
--- a/src/pages/checkin/checkin.vue
+++ b/src/pages/checkin/checkin.vue
@@ -1,33 +1,66 @@
 <template>
 	<view>
 		<view class='chuany-flex camera-fill chuany-justify-center chuany-align-center'>
-			<fui-upload immediate :url="`${apiBaseUrl}api/UpFile/UpdateFile`" ref="uploadB" max='1' @success="success"
-				@error="error" @complete="complete" width="300" height="300">
-				<image v-if="src" :src="src" mode="widthFix" style="width: 300rpx;height: 300rpx;"></image>
-				<fui-icon v-else name="camera-fill"></fui-icon>
-			</fui-upload>
+			<tem-upload-fui immediate :url="`${apiBaseUrl}/api/UpFile/UpdateFile`" ref="uploadE" max='1'
+				@success="success" cameraType='back' :sizeType='sizeType' :sourceType='sourceType' @error="error"
+				@complete="complete" width="280" :mediaType='mediaType' height="280">
+				<view class="" v-if="checkPhoto">
+					<image :src="checkPhoto" mode="aspectFill" style="width: 280rpx;height: 280rpx;">
+					</image>
+				</view>
+				<view class=" chuany-flex chuany-flex-direction chuany-align-center" v-else>
+					<fui-icon name="camera-fill"></fui-icon>
+					<view class="chuany-font20">鎷嶆憚鐜鐓х墖</view>
+				</view>
+			</tem-upload-fui>
+			<tem-upload-fui ref="uploadP" max='1' @error="error" @complete="completePerson" width="280" height="280"
+				:sizeType='sizeType' :sourceType='sourceType' :mediaType='mediaType' :isFace='true'>
+				<view class="" v-if="faceImg">
+					<image :src="faceImg" mode="aspectFill" style="width: 280rpx;height: 280rpx;"></image>
+				</view>
+				<view class=" chuany-flex chuany-flex-direction chuany-align-center" v-else>
+					<fui-icon name="addfriends-fill"></fui-icon>
+					<view class="chuany-font20">鎷嶆憚浜鸿劯鐓х墖</view>
+				</view>
+			</tem-upload-fui>
+			
+			<!-- <view class="fui-upload__item fui-upload__noborder"
+				style="width:280rpx;height:280rpx;background:#eee;" @tap.stop="openCamera">
+				<view class="" v-if="faceImg">
+					<image :src="faceImg" mode="aspectFill" style="width: 280rpx;height: 280rpx;"></image>
+				</view>
+				<view class=" chuany-flex chuany-flex-direction chuany-align-center" v-else>
+					<fui-icon name="addfriends-fill"></fui-icon>
+					<view class="chuany-font20">鎷嶆憚浜鸿劯鐓х墖</view>
+				</view>
+			</view> -->
 		</view>
-		<view class="c-m-30 c-p-t-20 c-p-b-20">
+		<view class="c-m-20 chuany-font24">
 			涓轰簡淇濊瘉鎵撳崱鐨勬纭�э紝鈥屽缓璁湪鍏徃闂ㄥ彛鎴栬繘鍏ュ姙鍏鐨勯棬鍙e啀鎵撳崱銆傗�屽悓鏃讹紝鈥岀‘淇濈収鐗囩殑娓呮櫚銆佲�屾槑浜紝鈥岄潰閮ㄥ彲瑙併��
 		</view>
-		<view class="c-p-20">
-			<view class="chuany-flex chuany-justify-between c-p-t-20">
-				<view class="chuany-flex chuany-flex-direction chuany-align-center textclo chuany-font24 step_item"
-					v-for="(item,index) in 4">
-					<up-avatar shape="square" size="38" src="https://uview-plus.jiangruyi.com/album/1.jpg"
-						@click="previewImage"></up-avatar>
-					<view class="line line-active" v-if="index!==3">
-
+		<view v-if='dakaList&&dakaList.length>0'>
+			<view class="chuany-flex chuany-justify-evenly chuany-flex-wrap c-p-t-20">
+				<view
+					class="chuany-flex chuany-flex-direction chuany-align-center chuany-justify-around textclo chuany-font24 c-p-b-30 daka"
+					:key="index" v-for="(item,index) in dakaList">
+					<up-avatar shape="square" size="56" :src="item.checkPhoto"
+						@click="previewImage(item.checkPhoto)"></up-avatar>
+					<view class="step_item">
+						<up-icon name="checkmark-circle-fill" :color="item.checktime?'#2979ff':'#e9e8e8'"
+							size="22"></up-icon>
+						<view class="line" :class="item.checkPhoto?'line-active':''"
+							v-if="index!==dakaList.length-1&&index%2==0">
+						</view>
 					</view>
-					<up-icon name="checkmark-circle-fill" color="#2979ff" size="22"></up-icon>
-					<text>宸叉墦鍗�</text>
-					<text>10:00</text>
+					<text>{{item.checktime?'宸叉墦鍗�':'鏈墦鍗�'}}</text>
+					<text
+						:class="$util.formatDate(item.checktime,true)=='-'?'core-opa':''">{{$util.formatDate(item.checktime,true)}}</text>
 				</view>
-
 			</view>
 		</view>
 		<view class="tabbtns">
-			<up-button color='#fece01' class="text-69" text="纭鎵撳崱" @click="enroll"></up-button>
+			<up-button color='#fece01' class="text-69" text="纭鎵撳崱" :loading='isLoading' loadingText="鎵撳崱涓�"
+				@click="enroll"></up-button>
 		</view>
 	</view>
 </template>
@@ -39,48 +72,90 @@
 	export default {
 		data() {
 			return {
-				src: ''
+				src: '',
+				apiBaseUrl,
+				orderBiddingId: '', //鎷涘伐鏄庣粏OrderBiddingId
+				checkPhoto: '', //鎵撳崱鐓х墖
+				faceImg: '', //浜鸿劯鍥剧墖
+				dakaList: [],
+				sourceType: ["camera"],
+				sizeType: ['compressed'],
+				mediaType: ['image'],
+				isLoading: false
 			}
 		},
 		onLoad(option) {
-			let {
-				orderid
-			} = option
-			this.$api.getDaka({
-				orderId: orederid
-			}).then(res => {
-				console.log(res, '鎵撳崱');
-			})
+			this.apiBaseUrl = apiBaseUrl
+			let id = option.orderid
+			this.orderBiddingId = id
+			this.getDaka(id)
+		},
+		onShow(){
+			if(this.$db.get('faceImg')){
+				let faceImgPath = this.$db.get('faceImg')
+				this.$refs.uploadP.urls = [faceImgPath] 
+				this.$refs.uploadP.status = ['success']
+				this.$util.pathToBase64(faceImgPath).then(res => {
+					this.faceImg = res
+				})
+			}
+		},
+		onUnload(){
+			this.$db.del('faceImg')
 		},
 		methods: {
-			openCamera() {
-				console.log('-----------------')
-				// 鎷嶇収鍜岀浉鍐�
-				uni.chooseImage({
-					count: 1,
-					sizeType: ["original", "compressed"],
-					sourceType: ["camera"],
-					success: (res) => {
-						const {
-							tempFilePaths
-						} = res;
-						console.log(tempFilePaths);
-					},
-				});
-
+			getDaka(id) {
+				this.$api.getDaka({
+					orderId: id
+				}).then(res => {
+					if (res.code == 1) {
+						this.dakaList = res.data ? res.data.orderBiddingDetailCheck : []
+						if (this.dakaList.length > 6) {
+							this.dakaList.length = 6
+						}
+						if (this.dakaList.length % 2 !== 0) {
+							this.dakaList.push({})
+						}
+					} else {
+						this.$util.showToast({
+							title: res.error
+						})
+					}
+				})
 			},
+			openCamera() {
+				// 鎷嶇収鍜岀浉鍐�
+				// uni.chooseMedia({
+				// 	count: 1,
+				// 	mediaType: ['image'],
+				// 	sizeType: ["compressed"],
+				// 	sourceType: ["camera"],
+				// 	camera: 'front',
+				// 	success: (res) => {
+				// 		const {
+				// 			tempFiles
+				// 		} = res;
+				// 		this.$util.pathToBase64(tempFiles[0].tempFilePath).then(res => {
+				// 			this.faceImg = res
+				// 		})
+				// 	},
+				// });
+				
+			},
+
 			success(e) {
 				//e.res 涓烘湇鍔″櫒杩斿洖鏁版嵁
 				//涓婁紶鎴愬姛鍥炶皟锛屽鐞嗘湇鍔″櫒杩斿洖鏁版嵁銆愭澶勬牴鎹疄闄呰繑鍥炴暟鎹繘琛屽鐞嗐��
 				let res = JSON.parse(e.res.data.replace(/\ufeff/g, "") || "{}")
-				console.log(res.data);
-				if (res.data.url) {
-					enterpriseInfo.businessLicense = res.data.url
-					enterpriseInfo.suppliername = res.data.info.name //浼佷笟鍚嶇О
-					enterpriseInfo.regtime = res.data.info.setDate //娉ㄥ唽鏃堕棿
-					enterpriseInfo.address = res.data.info.address //鑱旂郴鍦板潃
-					enterpriseInfo.suppliercode = res.data.info.regNum //浼佷笟娉ㄥ唽鍙�
-					enterpriseInfo.contact = res.data.info.person //鑱旂郴浜�
+				if (res.data) {
+					this.checkPhoto = res.data //鎵撳崱鐓х墖
+					//浜鸿劯鍥剧墖
+					// enterpriseInfo.businessLicense = res.data.url
+					// enterpriseInfo.suppliername = res.data.info.name //浼佷笟鍚嶇О
+					// enterpriseInfo.regtime = res.data.info.setDate //娉ㄥ唽鏃堕棿
+					// enterpriseInfo.address = res.data.info.address //鑱旂郴鍦板潃
+					// enterpriseInfo.suppliercode = res.data.info.regNum //浼佷笟娉ㄥ唽鍙�
+					// enterpriseInfo.contact = res.data.info.person //鑱旂郴浜�
 				}
 			},
 			error() {
@@ -92,9 +167,61 @@
 				}
 				console.log(e, '鍒犻櫎')
 			},
-			previewImage() {
+			completePerson(e) {
+				if (e.action == 'delete') {
+					this.faceImg = ''
+					this.$db.del('faceImg')
+					// 鍒犻櫎澶勭悊
+					return
+				}
+				this.$util.pathToBase64(e.urls[0]).then(res => {
+					this.faceImg = res
+				})
+			},
+			previewImage(url) {
 				uni.previewImage({
-					urls: ['https://uview-plus.jiangruyi.com/album/1.jpg']
+					urls: [url]
+				})
+			},
+			enroll() {
+				if (!this.checkPhoto) {
+					this.$util.showToast({
+						title: "璇锋媿鎽勭幆澧冪収鐗囷紒",
+						icon: "error"
+					})
+					return
+				}
+				if (!this.faceImg) {
+					this.$util.showToast({
+						title: "璇锋媿鎽勪汉鑴哥収鐗囷紒",
+						icon: "error"
+					})
+					return
+				}
+				this.isLoading = true
+				let obj = {
+					OrderId: this.orderBiddingId, //鎷涘伐鏄庣粏OrderBiddingId
+					checkPhoto: this.checkPhoto, //鎵撳崱鐓х墖
+					faceImg: this.faceImg,
+				}
+				this.$api.saveDaka(obj).then(res => {
+					if (res.code == 1) {
+						this.$util.showToast({
+							title: "鎵撳崱鎴愬姛锛�",
+							icon: "success"
+						})
+						this.checkPhoto = '' //鎵撳崱鐓х墖
+						this.faceImg = ''
+						this.$db.del('faceImg')
+						this.$refs.uploadP.deleteImage()
+						this.$refs.uploadE.deleteImage()
+						this.getDaka(this.orderBiddingId)
+					} else {
+						this.$util.showToast({
+							title: res.error,
+						})
+					}
+					this.isLoading = false
 				})
 			}
 		}
@@ -102,11 +229,38 @@
 </script>
 
 <style lang="scss">
+	.fui-upload__item {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		align-items: center;
+		justify-content: center;
+		margin-right: 20rpx;
+		margin-bottom: 20rpx;
+		/* #ifdef H5 */
+		cursor: pointer;
+		/* #endif */
+		position: relative;
+
+		/* #ifndef APP-NVUE */
+		box-sizing: border-box;
+		/* #endif */
+	}
+
+	.fui-upload__noborder {
+		border-width: 0;
+	}
+
 	.camera-fill {
-		width: 400rpx;
-		height: 400rpx;
+		// width: 400rpx;
+		// height: 400rpx;
 		margin: 20rpx auto;
 		border-radius: 20rpx;
+	}
+
+	.daka {
+		width: 260rpx;
+		height: 230rpx;
 	}
 
 	.step_item {
@@ -116,12 +270,13 @@
 
 		.line {
 			position: absolute;
-			top: 92rpx;
-			left: 52rpx;
+			top: 17rpx;
+			left: 35rpx;
 			content: "";
 			height: 4rpx;
-			width: 192rpx;
+			width: 310rpx;
 			background-color: #e9e8e8;
+			z-index: -1;
 		}
 
 		.line-active {

--
Gitblit v1.9.1