From 6e961fafc0f921d575772a3c89f2c5cad28c270d Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期五, 14 三月 2025 17:15:14 +0800
Subject: [PATCH] -

---
 src/pages/delivergoods/clockInRecord.vue |  174 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 130 insertions(+), 44 deletions(-)

diff --git a/src/pages/delivergoods/clockInRecord.vue b/src/pages/delivergoods/clockInRecord.vue
index fae8017..c95a20e 100644
--- a/src/pages/delivergoods/clockInRecord.vue
+++ b/src/pages/delivergoods/clockInRecord.vue
@@ -9,24 +9,40 @@
 	</up-sticky>
 	<view class="c-p-b-100">
 		<view class="c-p-l-20 c-p-r-20" v-if="orderList&&orderList.length>0">
-			<view class="listrecord c-p-t-20" v-for="(item,index) in orderList" :key="item.keyid">
+			<view class="listrecord c-p-t-20" v-for="(item,index) in orderList" :key="item.keyid" @click='goDetail(item)'>
 				<view class="coreshop-ff chuany-bradius20">
 					<view class="chuany-font26">
 						<view class="chuany-flex chuany-justify-between">
 							<text class="chuany-width5">{{index+1}}</text>
-							<view class="chuany-width15">
-								{{$util.formatDate(item.deliverTime,'riqi')}}
+							<view class="chuany-width13">
+								{{$util.formatDate(item.creatTime,'riqi')}}
 							</view>
-							<view class="chuany-width67" @click='goDetail(item)'>
-								<u-text size='14' :text="item.remark||item.companyName" lines="1">
-								</u-text>
+							<view class="chuany-width13">
+								{{item.creater}}
 							</view>
-							<view class="chuany-width11 chuany-flex chuany-justify-between">
+							<view class="chuany-width52">
+								{{item.car.carNumber}}
+							</view>
+							<!-- <view class="chuany-width52" @click='goDetail(item)'>
+								
+							</view> -->
+							<!-- <view class="chuany-width11 chuany-flex chuany-justify-between">
 								<up-icon v-if="item.deliveredstatus=='Undeliver'" name="play-right" size='18'
 									@tap.stop='startOrder(item)'></up-icon>
 								<up-icon v-else-if="item.deliveredstatus=='Deliver'" name="checkbox-mark" size='18'
 									@tap.stop="editOrder(item)"></up-icon>
+							</view> -->
+							<view class="chuany-width17 chuany-flex chuany-justify-between">
+								<u-text size='14' :text="item.clockType=='ClockIn'?'鍑鸿溅鎵撳崱':'涓嬬彮鎵撳崱'" lines="1">
+								</u-text>
+
 							</view>
+
+						</view>
+						<view class="c-p-t-8 chuany-flex">
+							<text class="chuany-width5" style="color: white;">{{index+1}}</text>
+							<u-text size='14' :text="item.carCondition" lines="1">
+							</u-text>
 						</view>
 					</view>
 				</view>
@@ -56,8 +72,9 @@
 				</up-form-item>
 			</up-form>
 		</up-modal>
-		<up-modal title="鍑鸿溅鎵撳崱" :show="showClockIn" showCancelButton @confirm="confirmClockSave" @cancel='cancelModal'
-			:asyncClose="true" ref='clockInModal'>
+		<up-modal :title="clockInfo.clockType=='ClockIn'?'鍑鸿溅鎵撳崱':'涓嬬彮鎵撳崱'" :show="showClockIn" showCancelButton
+			:closeOnClickOverlay="true" @close="closeModal" @confirm="confirmClockSave" @cancel='cancelModal'
+			:asyncClose="true" ref='clockInModal' cancel-text="瀛樹负鑽夌" confirm-text="鎵撳崱">
 			<up-form labelPosition="left" :model="clockInfo" ref="formClockInRef" labelWidth='140rpx'>
 				<up-form-item label="杞﹁締妫�鏌�" prop="carConditionAttachments" v-if="clockInfo.clockType=='ClockIn'"
 					required>
@@ -68,14 +85,14 @@
 					</tem-upload-file>
 				</up-form-item>
 				<template v-else>
-					<up-form-item label="瑁呰揣鐓х墖" prop="attachments" required>
+					<up-form-item label="瑁呰揣鐓х墖" prop="attachments" required v-if='!clockInfo.emptyCause'>
 						<tem-upload-file immediate btnText="涓婁紶鐓х墖" :url="`https://appimchat.oss-cn-chengdu.aliyuncs.com`"
 							ref="zhuanghuo" :isSource='true' fileType="all" @success="successClock('zhuanghuo',$event)"
 							@error="errorInvoice" @complete="completeInvoice('zhuanghuo',$event)">
 						</tem-upload-file>
 					</up-form-item>
-					<up-form-item label="鏈璐у師鍥�" prop="emptyCause" :borderBottom='false' @click="clickAction"
-						labelWidth='160rpx' ref="item1">
+					<up-form-item label="鏈璐у師鍥�" required prop="emptyCause" :borderBottom='false' @click="clickAction"
+						v-if="clockInfo.attachments&&clockInfo.attachments.length==0" labelWidth='160rpx' ref="item1">
 						<up-input v-model="clockInfo.emptyCause" disabled border="none" disabledColor="#ffffff"
 							placeholder="璇烽�夋嫨鏈璐у師鍥�"></up-input>
 					</up-form-item>
@@ -104,14 +121,6 @@
 		<up-action-sheet :show="showActions" :actions="actions" title="璇烽�夋嫨" @close="showActions = false"
 			@select="selectItem">
 		</up-action-sheet>
-		<view class="tabbtns chuany-flex chuany-justify-between">
-			<view class="chuany-width45">
-				<up-button type="primary" text="鍑鸿溅鎵撳崱" @click="clockIn('ClockIn')"></up-button>
-			</view>
-			<view class="chuany-width45">
-				<up-button type="success" text="涓嬬彮鎵撳崱" @click="clockIn('Clockout')"></up-button>
-			</view>
-		</view>
 	</view>
 </template>
 
@@ -156,7 +165,7 @@
 				}],
 				// selectAc: '宸插畬鎴�',
 				minDate: this.$util.formatDate(new Date(), null, -7),
-				maxDate: this.$util.formatDate(new Date(), null, 7),
+				maxDate: this.$util.formatDate(new Date(), null),
 				deliverTime: Number(new Date(this.$util.formatDate(new Date(), null, 1))),
 				arrangeInfo: {
 					keyid: '',
@@ -167,7 +176,7 @@
 				},
 				rules: {
 					'mileage': {
-						type: 'string',
+						type: 'number',
 						required: true,
 						message: '璇疯緭鍏ラ噷绋�',
 						trigger: ['blur', 'change']
@@ -198,6 +207,12 @@
 						message: '璇蜂笂浼犻�佽揣鍗曠収鐗�',
 						trigger: ['blur', 'change']
 					},
+					'emptyCause': {
+						type: 'string',
+						required: true,
+						message: '璇烽�夋嫨鏈璐у師鍥�',
+						trigger: ['blur', 'change']
+					},
 				},
 				radio: '',
 				switchVal: false,
@@ -214,9 +229,11 @@
 					carConditionAttachments: [],
 					attachments: [],
 					mileageImg: '',
+					mileage: '',
 					clockType: '', //ClockIn ,Clockout
 					carCondition: ''
 				},
+				nextClockType: ''
 			}
 		},
 		onShow() {
@@ -227,9 +244,9 @@
 			this.$refs.formFinishRef.setRules(this.rules1);
 		},
 		onLoad() {
-			this.Getdrivers()
-			this.getCustomer()
-			this.GetDriversOfWithin7days()
+			// this.Getdrivers()
+			// this.getCustomer()
+			// this.GetDriversOfWithin7days()
 		},
 		onReachBottom() {
 			if (this.loadStatus != 'nomore') {
@@ -246,8 +263,48 @@
 		},
 		methods: {
 			clockIn(text) {
-				this.clockInfo.clockType = text
-				this.showClockIn = true
+				this.$api.GetClockRoughDraft().then(res => {
+					if (res.code == 1 && res.data) {
+						this.clockInfo.emptyCause = res.data.emptyCause || ''
+						this.clockInfo.carConditionAttachments = res.data.carConditionAttachments || []
+						this.clockInfo.attachments = res.data.attachments || []
+						this.clockInfo.mileageImg = res.data.mileageImg || ''
+						this.clockInfo.mileage = res.data.mileage || ''
+						this.clockInfo.carCondition = res.data.carCondition || ''
+						this.clockInfo.id = res.data.id
+					}
+					this.clockInfo.clockType = text
+					this.showClockIn = true
+					this.$refs.licheng.urls = this.clockInfo.mileageImg ? [this.clockInfo.mileageImg] : []
+					this.$refs.licheng.status = this.clockInfo.mileageImg ? ['success'] : []
+					this.$nextTick(() => {
+						if (text == 'ClockIn') {
+							this.$refs.carCondition.urls = []
+							this.clockInfo.carConditionAttachments.forEach(item => {
+								this.$refs.carCondition.urls.push(item.planAttachment)
+							})
+							let length = this.$refs.carCondition.urls.length
+							this.$refs.carCondition.status = Array.from({
+								length
+							}, () => 'success')
+							console.log(this.$refs.carCondition.urls, this.$refs.carCondition.status);
+						} else {
+							this.$refs.zhuanghuo.urls = []
+							this.clockInfo.attachments.forEach(item => {
+								console.log(item, '9jh');
+								this.$refs.zhuanghuo.urls.push(item.planAttachment)
+							})
+							console.log(res.data, this.clockInfo.attachments, res.data.attachments);
+							let length = this.$refs.zhuanghuo.urls.length
+							this.$refs.zhuanghuo.status = Array.from({
+								length
+							}, () => 'success')
+						}
+					})
+
+
+				})
+
 			},
 			success(text, e) {
 				//e.res 涓烘湇鍔″櫒杩斿洖鏁版嵁
@@ -303,6 +360,7 @@
 						this.$refs.zhuanghuo.status.push('success')
 						this.$refs.zhuanghuo.status.length = this.$refs.zhuanghuo.urls.length
 						this.clockInfo.attachments.push(obj)
+						console.log(this.clockInfo.attachments, '------------------------------');
 					}
 				} else {
 					uni.$u.toast(res.error)
@@ -324,7 +382,7 @@
 			},
 			changePicker(val) {
 				console.log(val);
-				this.workTime = val.result 
+				this.workTime = val.result
 				this.timeStart = new Date(val.result) //宸ヤ綔寮�濮嬫椂闂�
 				this.timeEnd = new Date(val.result)
 				this.datePickerShow = !this.datePickerShow
@@ -491,6 +549,9 @@
 				// 		title: '璇蜂笂浼犻噷绋嬬収鐗囷紒'
 				// 	})
 				// }
+				// if(this.clockInfo.emptyCause){
+				// 	this.clockInfo.attachments = []
+				// }
 				this.clockInfo = this.$util.removeEmptyValuesRecursive(this.clockInfo)
 				this.$refs.formClockInRef.validate().then(res => {
 					this.$api.Clock(this.clockInfo).then(res => {
@@ -504,7 +565,7 @@
 								carCondition: ''
 							}
 							this.showClockIn = false
-							// this.init()
+							this.init()
 						} else {
 							this.$util.showToast({
 								title: res.error
@@ -519,27 +580,50 @@
 
 			},
 			cancelModal() {
+				console.log(this.clockInfo);
+				// if (!this.clockInfo.mileageImg) {
+				// 	this.$refs.clockInModal.loading = false
+				// 	return this.$util.showToast({
+				// 		title: '璇蜂笂浼犻噷绋嬬収鐗囷紒'
+				// 	})
+				// }
+				// if(this.clockInfo.emptyCause){
+				// 	this.clockInfo.attachments = []
+				// }
+				this.clockInfo = this.$util.removeEmptyValuesRecursive(this.clockInfo)
+				this.clockInfo.clockType = 'RoughDraft '
+				this.$api.Clock(this.clockInfo).then(res => {
+					if (res.code == 1) {
+						this.clockInfo = {
+							emptyCause: '',
+							carConditionAttachments: [],
+							mileage: '',
+							mileageImg: '',
+							attachments: [],
+							clockType: '', //ClockIn ,Clockout
+							carCondition: ''
+						}
+						this.showClockIn = false
+						this.init()
+					} else {
+						this.$util.showToast({
+							title: res.error
+						})
+						this.$refs.clockInModal.loading = false
+					}
+				})
+			},
+			closeModal() {
 				this.showClockIn = false
-				this.show7 = false
-				this.arrangeInfo = {
-					deliverTime: this.$util.formatDate(new Date(), null, 1),
-					driverId: '',
-					buyerId: '',
-					dianhua: '',
-					wentifankui: '',
-					lianxiren: '',
-					dizhi: '',
-				}
 				this.clockInfo = {
 					emptyCause: '',
 					carConditionAttachments: [],
+					mileage: '',
 					mileageImg: '',
 					attachments: [],
-					clockType: '', //ClockIn ,Clockout
+					clockType: this.nextClockType, //ClockIn ,Clockout
 					carCondition: ''
 				}
-				this.driverName = ''
-				this.buyerName = ''
 			},
 			Getdrivers() {
 				this.$api.Getdrivers().then(res => {
@@ -565,8 +649,9 @@
 				if (this.deliverKeyID) {
 					data.deliverKeyID = this.deliverKeyID
 				}
-				this.$api.driverGetDeliverPlans(data).then(res => {
+				this.$api.GetDriverRecords(data).then(res => {
 					if (res.code == 1) {
+						this.nextClockType = res.data.nextClockType
 						if (this.pageIndex == 1) {
 							this.orderList = res.data.data
 						} else {
@@ -582,6 +667,7 @@
 							// 鏁版嵁宸插姞杞藉畬姣�
 							this.loadStatus = 'nomore'
 						}
+
 					} else {
 						// _that.$refs.uToast.show({ message: res.msg, type: 'error' });
 					}
@@ -621,7 +707,7 @@
 			},
 			goDetail(item) {
 				uni.navigateTo({
-					url: `/pages/delivergoods/feedbackdetail?KeyId=${item.keyid}`
+					url: `/pages/delivergoods/clockInDetail?KeyId=${item.id}&isAdmin=true`
 				});
 			}
 		}

--
Gitblit v1.9.1