From ec90cbd7680a6f927cb1cea43f33ab7df6d0864c Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 11 十一月 2025 09:23:22 +0800
Subject: [PATCH] -

---
 src/pages/delivergoods/arrange.vue |  187 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 145 insertions(+), 42 deletions(-)

diff --git a/src/pages/delivergoods/arrange.vue b/src/pages/delivergoods/arrange.vue
index 371503a..ee16396 100644
--- a/src/pages/delivergoods/arrange.vue
+++ b/src/pages/delivergoods/arrange.vue
@@ -17,22 +17,37 @@
 	</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"
-				@click='goDetail(item)'>
+			<view class="listrecord c-p-t-20" v-for="(item,index) in orderList" :key="item.keyid">
 				<view class="coreshop-ff chuany-bradius20">
 					<view class="chuany-font26">
 						<view class="chuany-flex chuany-justify-between">
-							<text class="chuany-width7">{{index+1}}</text>
+							<text class="chuany-width6">{{index+1}}</text>
 							<view class="chuany-width15">
 								{{$util.formatDate(item.deliverTime,'riqi')}}
 							</view>
-							<view class="chuany-width73">
-								<u-text size='14' :text="item.remark||item.companyName" lines="1">
+							<view class="chuany-width15">
+								<u-text size='14' :text="carNumber(item.car&&item.car.carNumber)" lines="1">
+									<!-- <u-text size='14' :text="item.remark||item.companyName" lines="1"> -->
 								</u-text>
 							</view>
-							<view class="chuany-width5" @tap.stop='editOrder(item)'>
-								<up-icon name="edit-pen"></up-icon>
+							<view :class="item.deliveredstatus !== 'Delivered'?'chuany-width67':'chuany-width79'"
+								@click='goDetail(item)'>
+								<u-text size='14' :text="item.companyName" lines="1">
+									<!-- <u-text size='14' :text="item.remark||item.companyName" lines="1"> -->
+								</u-text>
 							</view>
+							<template v-if="item.deliveredstatus !== 'Delivered'">
+								<view class="chuany-width6 chuany-paddingright-10" @tap.stop='editOrder(item)'>
+									<up-icon name="edit-pen" size='18'></up-icon>
+								</view>
+								<view class="chuany-width6" @tap.stop='UndoDeliverPlans(item)'>
+									<up-icon name="reload" size='19'></up-icon>
+								</view>
+							</template>
+							<!-- <view class="chuany-width6" v-else>
+								<u-text size='14' type="" text="" lines="1">
+								</u-text>
+							</view> -->
 						</view>
 					</view>
 				</view>
@@ -51,8 +66,8 @@
 					<!-- <up-input v-model="arrangeInfo.deliverTime" readonly border="none"
 						placeholder="鐐瑰嚮閫夋嫨宸ヤ綔鏃ユ湡"></up-input> -->
 					<up-datetime-picker hasInput @confirm='confirmDate' :show="shougHuoshow" v-model="deliverTime"
-						mode="date" placeholder="鐐瑰嚮閫夋嫨宸ヤ綔鏃ユ湡" :minDate='Number(new Date(minDate))'
-						@cancel='() => shougHuoshow = false'></up-datetime-picker>
+						disabled disabledColor='#FFF' mode="date" placeholder="鐐瑰嚮閫夋嫨宸ヤ綔鏃ユ湡"
+						:minDate='Number(new Date(minDate))' @cancel='() => shougHuoshow = false'></up-datetime-picker>
 				</up-form-item>
 				<up-form-item label="鎺掑簭" prop="sort" required :borderBottom='false' ref="item1">
 					<up-input v-model="arrangeInfo.sort" placeholder="璇疯緭鍏ユ帓搴�" border="none" type="number">
@@ -64,12 +79,21 @@
 						placeholder="璇烽�夋嫨鍙告満"></up-input>
 				</up-form-item>
 				<up-form-item label="鏀惰揣鍗曚綅" prop="companyName" labelPosition='top' required :borderBottom='false'
-					ref="item1">
-					<up-input v-model="arrangeInfo.companyName" placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" border="none">
+					ref="item1" v-if='show7'>
+					<!-- <tem-selects-fan placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" :data="customerList" :clearable='true'
+						:value="arrangeInfo.companyName" :value-type="valueType" :filterable='true' :searchType='1'
+						@input='selectChange'></tem-selects-fan> -->
+					<!-- <form-select class="form_select" ref="formSelect1" :search="true" :icon="true"
+						:placeholder="optionPlaceholder" :selectedId="optionId" :localdata="optionModel"
+						@change="changeOption" @clear="clearOption"></form-select> -->
+					<tem-select ref="formSelect" placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" :selectedId="arrangeInfo.buyerId"
+						:value='arrangeInfo.companyName' :search='true' :localdata="customerList"
+						@change="selectChange"></tem-select>
+					<!-- <up-input v-model="arrangeInfo.companyName" placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" border="none">
 						<template #suffix>
 							<up-button @tap="clickAction" text="鐐瑰嚮閫夋嫨" type="primary" size="mini"></up-button>
 						</template>
-					</up-input>
+					</up-input> -->
 				</up-form-item>
 				<up-form-item label="鑱旂郴浜�" prop="lianxiren" :borderBottom='false' ref="item1">
 					<up-input v-model="arrangeInfo.lianxiren" border="none" placeholder="璇疯緭鍏ヨ仈绯讳汉"></up-input>
@@ -85,7 +109,7 @@
 				</up-form-item>
 			</up-form>
 		</up-modal>
-		<fui-date-picker range :show="datePickerShow" :value="getFirstDayOfMonth()" type="3" zIndex="10000"
+		<fui-date-picker :show="datePickerShow" :value="getFirstDayOfMonth()" type="3" zIndex="10000"
 			@change="changePicker" :minDate='minDate' :maxDate='maxDate' @cancel="clickTime"></fui-date-picker>
 		<up-action-sheet :show="showActions" :actions="actions" title="璇烽�夋嫨" @close="showActions = false"
 			wrapMaxHeight='500px' @select="selectItem">
@@ -102,6 +126,10 @@
 	export default {
 		data() {
 			return {
+				valueType: {
+					label: 'companyName',
+					value: 'keyid'
+				},
 				datePickerShow: false,
 				shougHuoshow: false,
 				workTime: this.$util.formatDate(new Date()),
@@ -123,7 +151,7 @@
 				deliverTime: Number(new Date(this.$util.formatDate(new Date(), null, 1))),
 				arrangeInfo: {
 					deliverTime: this.$util.formatDate(new Date(), null, 1),
-					driverId: '',
+					// driverId: '',
 					buyerId: null,
 					dianhua: '',
 					remark: '',
@@ -131,7 +159,6 @@
 					dizhi: '',
 					companyName: '',
 					driverName: '',
-					deliverTixingId: '',
 					sort: '1'
 				},
 				rules: {
@@ -150,7 +177,7 @@
 					'companyName': {
 						type: 'string',
 						required: true,
-						message: '璇峰~鍐欏叕鍙�',
+						message: '璇烽�夋嫨鎴栧~鍐欓�佽揣鍗曚綅',
 						trigger: ['blur', 'change']
 					},
 					'dianhua': {
@@ -172,7 +199,7 @@
 						trigger: ['blur', 'change']
 					},
 					'sort': {
-						type: 'string',
+						type: 'number',
 						required: true,
 						message: '璇疯緭鍏ユ帓搴�',
 						trigger: ['blur', 'change']
@@ -189,6 +216,9 @@
 				deliverKeyName: ''
 			}
 		},
+		computed: {
+
+		},
 		onShow() {
 			this.init()
 		},
@@ -196,7 +226,7 @@
 			this.$refs.formRef.setRules(this.rules);
 		},
 		onLoad() {
-			this.Getdrivers()
+			this.GetCarList()
 			this.getCustomer()
 			this.GetDriversOfWithin7days()
 		},
@@ -209,14 +239,30 @@
 			}
 		},
 		onPullDownRefresh() {
-			this.timeStart = ''
-			this.timeEnd = ''
-			this.workTime = ''
+			this.timeStart = new Date()
+			this.timeEnd = new Date()
+			this.workTime = this.$util.formatDate(new Date())
 			this.deliverKeyName = ''
 			this.init()
 			uni.stopPullDownRefresh();
 		},
 		methods: {
+			carNumber(str) {
+				if (!str) {
+					return ''
+				}
+				// 妫�鏌ュ瓧绗︿覆鏄惁鍖呭惈鎷彿
+				const leftBracket = str.indexOf('(');
+				const rightBracket = str.lastIndexOf(')');
+
+				// 濡傛灉瀛樺湪宸﹀彸鎷彿涓斾綅缃纭紝鍒欒繑鍥炴嫭鍙峰唴鐨勫唴瀹�
+				if (leftBracket !== -1 && rightBracket !== -1 && leftBracket < rightBracket) {
+					return str.substring(leftBracket + 1, rightBracket);
+				}
+
+				// 鍚﹀垯杩斿洖鍘熷瓧绗︿覆
+				return str;
+			},
 			goDetail(item) {
 				uni.navigateTo({
 					url: `/pages/delivergoods/arrangedetail?KeyId=${item.keyid}`
@@ -230,15 +276,16 @@
 				})
 			},
 			changePicker(val) {
-				this.workTime = val.startDate.result + '鑷�' + val.endDate.result
-				this.timeStart = new Date(val.startDate.result) //宸ヤ綔寮�濮嬫椂闂�
-				this.timeEnd = new Date(val.endDate.result)
+				console.log(val, '-=-=鈥�');
+				this.workTime = val.result
+				this.timeStart = new Date(val.result) //宸ヤ綔寮�濮嬫椂闂�
+				this.timeEnd = new Date(val.result)
 				this.datePickerShow = !this.datePickerShow
 				this.init()
 			},
 			confirmDate(val) {
 				console.log(val);
-				this.arrangeInfo.deliverTime = val
+				this.arrangeInfo.deliverTime = this.$util.formatDate(val.value)
 				this.shougHuoshow = false
 			},
 			getCustomer() {
@@ -247,14 +294,18 @@
 						this.customerList = res.data
 						this.customerList.forEach(item => {
 							item.name = item.companyName
+							item.title = item.companyName
+							item.id = item.keyid
 						})
 					}
 				})
 			},
 			selectItem(item) {
 				if (this.selectAc == 'driver') {
-					this.driverName = item.name
-					this.arrangeInfo.driverId = item.keyid
+					// this.arrangeInfo.driverName = item.driverName
+					this.arrangeInfo.driverName = item.carNumber
+					// this.arrangeInfo.driverId = item.keyid
+					this.arrangeInfo.carId = item.keyid
 				} else if (this.selectAc == 'driver7') {
 					this.deliverKeyID = item.keyid
 					this.deliverKeyName = item.name
@@ -268,6 +319,19 @@
 					this.arrangeInfo.companyName = item.companyName
 				}
 				this.selectAc = ''
+			},
+			selectChange(item) {
+				console.log(item, 'hhhhh');
+				if (typeof item == 'object') {
+					this.buyerName = item.name
+					this.arrangeInfo.buyerId = item.keyid
+					this.arrangeInfo.dizhi = item.adder
+					this.arrangeInfo.dianhua = item.companyPhone
+					this.arrangeInfo.lianxiren = item.businessManagers
+					this.arrangeInfo.companyName = item.companyName
+				} else {
+					this.arrangeInfo.companyName = item
+				}
 			},
 			getFirstDayOfMonth() {
 				var currentDate = new Date();
@@ -299,8 +363,9 @@
 			editOrder(item) {
 				this.isEdit = true
 				this.arrangeInfo = {
-					deliverTime: this.$util.formatDate(new Date(), null, 1),
-					driverId: item.driverId,
+					deliverTime: this.$util.formatDate(item.deliverTime),
+					// driverId: item.driverId,
+					carId: item.car.keyid || "",
 					buyerId: item.buyerId,
 					dianhua: item.dianhua,
 					remark: item.remark,
@@ -308,14 +373,43 @@
 					dizhi: item.dizhi,
 					keyid: item.keyid,
 					companyName: item.companyName,
-					sort: item.sort
+					sort: item.sort,
+					driverName: item.car.carNumber || ''
 				}
 				this.show7 = true
-				this.driverName = item.driver && item.driver.name
+				this.driverName = item.car && item.car.carNumber
+				this.deliverTime = Number(new Date(this.$util.formatDate(item.deliverTime)))
 				// let obj = this.customerList.find(ite => {
 				// 	return ite.keyid == item.buyerId
 				// })
 				// this.buyerName = obj.companyName
+			},
+			UndoDeliverPlans(item) {
+				let that = this
+				uni.showModal({
+					title: '鎻愮ず',
+					content: '纭鎾ら攢璇ヨ鍗曞悧锛�',
+					success: function(res) {
+						if (res.confirm) {
+							// 鎵ц纭鍚庣殑鎿嶄綔
+							that.$api.UndoDeliverPlans(item.keyid).then(res => {
+								if (res.code == 1) {
+									that.$util.showToast({
+										title: '鎾ら攢鎴愬姛锛�'
+									})
+									that.init()
+								} else {
+									that.$util.showToast({
+										title: res.error
+									})
+								}
+							})
+						} else {
+							// 鎵ц鍙栨秷鍚庣殑鎿嶄綔
+						}
+					}
+				})
+
 			},
 			delOrder(item) {
 				let that = this
@@ -354,12 +448,12 @@
 				this.getList()
 			},
 			confirmSave() {
-				if (!this.arrangeInfo.driverId) {
-					this.$refs.modalArrange.loading = false
-					return this.$util.showToast({
-						title: '璇烽�夋嫨鍙告満锛�'
-					})
-				}
+				// if (!this.arrangeInfo.driverId) {
+				// 	this.$refs.modalArrange.loading = false
+				// 	return this.$util.showToast({
+				// 		title: '璇烽�夋嫨鍙告満锛�'
+				// 	})
+				// }
 				console.log();
 				this.$refs.formRef.validate().then(res => {
 					if (this.isEdit) {
@@ -368,12 +462,14 @@
 								this.isEdit = false
 								this.arrangeInfo = {
 									deliverTime: this.$util.formatDate(new Date(), null, 1),
-									driverId: '',
+									// driverId: '',
 									buyerId: null,
 									dianhua: '',
 									remark: '',
 									lianxiren: '',
 									dizhi: '',
+									companyName: '',
+									driverName: '',
 									sort: '1'
 								}
 								this.show7 = false
@@ -385,6 +481,7 @@
 									title: res.error
 								})
 							}
+							this.deliverTime = Number(new Date(this.$util.formatDate(new Date(), null, 1)))
 							this.isLoading = false
 						})
 						return
@@ -393,7 +490,7 @@
 						if (res.code == 1) {
 							this.arrangeInfo = {
 								deliverTime: this.$util.formatDate(new Date(), null, 1),
-								driverId: '',
+								// driverId: '',
 								buyerId: null,
 								dianhua: '',
 								remark: '',
@@ -412,6 +509,7 @@
 								title: res.error
 							})
 						}
+						this.deliverTime = Number(new Date(this.$util.formatDate(new Date(), null, 1)))
 						this.isLoading = false
 					})
 				}).catch(errors => {
@@ -422,7 +520,7 @@
 			cancelModal() {
 				this.arrangeInfo = {
 					deliverTime: this.$util.formatDate(new Date(), null, 1),
-					driverId: '',
+					// driverId: '',
 					buyerId: null,
 					dianhua: '',
 					remark: '',
@@ -432,14 +530,19 @@
 					driverName: '',
 					sort: '1'
 				}
+				this.deliverTime = Number(new Date(this.$util.formatDate(new Date(), null, 1)))
 				this.show7 = false
 				this.driverName = ''
 				this.buyerName = ''
 			},
-			Getdrivers() {
-				this.$api.Getdrivers().then(res => {
+			GetCarList() {
+				this.$api.GetCarList().then(res => {
 					if (res.code == 1) {
 						this.driverList = res.data
+						this.driverList.forEach(item => {
+							item.driverName = item.name
+							item.name = item.carNumber
+						})
 					}
 				})
 			},

--
Gitblit v1.9.1