From 2d43a1df3f5ba42710e6d21c27d1e13bdb8dfd56 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期一, 24 三月 2025 09:23:08 +0800
Subject: [PATCH] -

---
 src/pages/delivergoods/reservation.vue |  371 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 334 insertions(+), 37 deletions(-)

diff --git a/src/pages/delivergoods/reservation.vue b/src/pages/delivergoods/reservation.vue
index c18694e..b4aa18e 100644
--- a/src/pages/delivergoods/reservation.vue
+++ b/src/pages/delivergoods/reservation.vue
@@ -14,16 +14,20 @@
 				<view class="coreshop-ff chuany-bradius20">
 
 					<view class="chuany-font26">
-						<view class="chuany-flex chuany-justify-between">
+						<view class="chuany-flex chuany-justify-between chuany-align-center">
 							<text class="chuany-width5">{{index+1}}</text>
-							<view class="chuany-width15">
+							<view class="chuany-width12">
 								{{$util.formatDate(item.createTime,'riqi')}}
 							</view>
-							<view class="chuany-width65">
+							<view class="chuany-width16">
+								<u-text size='14' :text="item.sentStaff.name" lines="1">
+								</u-text>
+							</view>
+							<view class="chuany-width55">
 								<u-text size='14' :text="item.remark" lines="1">
 								</u-text>
 							</view>
-							<u-text align="right" size='14' type="error" text="鏈彈鐞�" @click='accept(item)'>
+							<u-text align="right" size='13' type="error" text="鏈彈鐞�" @click='accept(item)'>
 							</u-text>
 						</view>
 						<view class="c-p-t-8">
@@ -38,6 +42,57 @@
 			<up-empty text='鏆傛棤' icon="/static/order.png">
 			</up-empty>
 		</view>
+		<up-modal title="閫佽揣瀹夋帓" :show="show7" showCancelButton @confirm="confirmSave" @cancel='cancelModal'
+			ref='modalArrange' :asyncClose="true">
+			<up-form labelPosition="left" :model="arrangeInfo" ref="formRef" labelWidth='140rpx'>
+				<up-form-item label="閫佽揣鏃ユ湡" prop="deliverTime" required :borderBottom='false' ref="item1"
+					@click="clickShouTime">
+					<!-- <up-input v-model="arrangeInfo.deliverTime" readonly border="none"
+						placeholder="鐐瑰嚮閫夋嫨宸ヤ綔鏃ユ湡"></up-input> -->
+					<up-datetime-picker hasInput @confirm='confirmDate' :show="shougHuoshow" v-model="deliverTime"
+						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">
+					</up-input>
+				</up-form-item>
+				<up-form-item label="鍙告満" prop="driverName" required :borderBottom='false' @click="clickAction('driver')"
+					ref="item1">
+					<up-input v-model="arrangeInfo.driverName" disabled border="none" disabledColor="#ffffff"
+						placeholder="璇烽�夋嫨鍙告満"></up-input>
+				</up-form-item>
+				<up-form-item label="鏀惰揣鍗曚綅" prop="companyName" labelPosition='top' required :borderBottom='false'
+					ref="item1" v-if='show7'>
+					<tem-select ref="formSelect" placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" :selectedId="arrangeInfo.buyerId" :value='arrangeInfo.companyName' :search='true'
+						:localdata="customerList" @change="selectChange"></tem-select>
+						
+					<!-- <tem-selects-fan placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" :data="customerList" :clearable='true'
+						:value="arrangeInfo.companyName" :value-type="valueType" :filterable='true' :searchType='1'
+						@input='selectChange'></tem-selects-fan> -->
+					<!-- <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-form-item>
+				<up-form-item label="鑱旂郴浜�" prop="lianxiren" :borderBottom='false' ref="item1">
+					<up-input v-model="arrangeInfo.lianxiren" border="none" placeholder="璇疯緭鍏ヨ仈绯讳汉"></up-input>
+				</up-form-item>
+				<up-form-item label="鑱旂郴鐢佃瘽" prop="dianhua" required :borderBottom='false' ref="item1">
+					<up-input v-model="arrangeInfo.dianhua" border="none" placeholder="璇疯緭鍏ヨ仈绯荤數璇�"></up-input>
+				</up-form-item>
+				<up-form-item label="閫佽揣鍦板潃" prop="dizhi" labelPosition='top' required :borderBottom='false' ref="item1">
+					<up-input v-model="arrangeInfo.dizhi" border="none" placeholder="璇疯緭鍏ラ�佽揣鍦板潃"></up-input>
+				</up-form-item>
+				<up-form-item label="閫佽揣浜嬬敱" prop="remark" labelPosition='top' required :borderBottom='false' ref="item1">
+					<up-input v-model="arrangeInfo.remark" border="none" placeholder="璇疯緭鍏ラ�佽揣浜嬬敱"></up-input>
+				</up-form-item>
+			</up-form>
+		</up-modal>
+		<up-action-sheet :show="showActions" :actions="actions" title="璇烽�夋嫨" @close="showActions = false"
+			wrapMaxHeight='500px' @select="selectItem">
+		</up-action-sheet>
 	</view>
 </template>
 
@@ -50,10 +105,57 @@
 	export default {
 		data() {
 			return {
+				valueType: {
+					label: 'companyName',
+					value: 'keyid'
+				},
+				rules: {
+					'deliverTime': {
+						type: 'string',
+						required: true,
+						message: '璇烽�夋嫨鏃ユ湡',
+						trigger: ['blur', 'change']
+					},
+					'driverName': {
+						type: 'string',
+						required: true,
+						message: '璇烽�夋嫨鍙告満',
+						trigger: ['blur', 'change']
+					},
+					'companyName': {
+						type: 'string',
+						required: true,
+						message: '璇烽�夋嫨鎴栧~鍐欓�佽揣鍗曚綅',
+						trigger: ['blur', 'change']
+					},
+					'dianhua': {
+						type: 'string',
+						required: true,
+						message: '璇疯緭鍏ヨ仈绯荤數璇�',
+						trigger: ['blur', 'change']
+					},
+					'dizhi': {
+						type: 'string',
+						required: true,
+						message: '璇疯緭鍏ラ�佽揣鍦板潃',
+						trigger: ['blur', 'change']
+					},
+					'remark': {
+						type: 'string',
+						required: true,
+						message: '璇疯緭鍏ラ�佽揣浜嬬敱',
+						trigger: ['blur', 'change']
+					},
+					'sort': {
+						required: true,
+						message: '璇疯緭鍏ユ帓搴�',
+						trigger: ['blur', 'change']
+					},
+				},
 				orderList: [],
 				loadStatus: 'loadmore',
 				pageIndex: 1,
-				pageSize: 20,
+				pageSize: 30,
 				contentVal: '',
 				options2: [{
 					text: '缂栬緫',
@@ -66,10 +168,40 @@
 						backgroundColor: '#f56c6c'
 					}
 				}],
+				show7: false,
+				arrangeInfo: {
+					deliverTime: this.$util.formatDate(new Date(), null, 1),
+					driverId: '',
+					buyerId: null,
+					dianhua: '',
+					remark: '',
+					lianxiren: '',
+					dizhi: '',
+					companyName: '',
+					driverName: '',
+					deliverTixingId: '',
+					sort: '1'
+				},
+				shougHuoshow: false,
+				minDate: this.$util.formatDate(new Date(), null, -7),
+				maxDate: this.$util.formatDate(new Date(), null, 7),
+				deliverTime: Number(new Date(this.$util.formatDate(new Date(), null, 1))),
+				driverList: [],
+				customerList: [],
+				showActions: false,
+				driverName: '',
+				actions: []
 			}
 		},
 		onShow() {
 			this.init()
+		},
+		onLoad() {
+			this.Getdrivers()
+			this.getCustomer()
+		},
+		onReady() {
+			this.$refs.formRef.setRules(this.rules);
 		},
 		onPullDownRefresh() {
 			this.init()
@@ -88,23 +220,185 @@
 
 		},
 		methods: {
+			selectChange(item) {
+				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
+				}
+			},
+			Getdrivers() {
+				this.$api.Getdrivers().then(res => {
+					if (res.code == 1) {
+						this.driverList = res.data
+					}
+				})
+			},
+			clickShouTime() {
+				this.shougHuoshow = !this.shougHuoshow
+			},
+			confirmDate(val) {
+				console.log(val);
+				this.arrangeInfo.deliverTime = this.$util.formatDate(val.value)
+				this.shougHuoshow = false
+			},
+			cancelModal() {
+				this.arrangeInfo = {
+					deliverTime: this.$util.formatDate(new Date(), null, 1),
+					driverId: '',
+					buyerId: null,
+					dianhua: '',
+					remark: '',
+					lianxiren: '',
+					dizhi: '',
+					deliverTixingId: '',
+					sort: 1,
+					driverName:'',
+					companyName: '',
+				}
+				this.show7 = false
+				this.driverName = ''
+				this.buyerName = ''
+			},
+			clickAction(val) {
+				switch (val) {
+					case 'driver':
+						this.actions = this.driverList
+						break
+					case 'driver7':
+						this.actions = this.sevenDaysDriver
+						break
+					default:
+						this.actions = this.customerList
+						break
+				}
+				this.selectAc = val
+				this.showActions = true
+				uni.hideKeyboard()
+			},
+			getCustomer() {
+				this.$api.GeCorporateClients().then(res => {
+					if (res.code == 1) {
+						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.arrangeInfo.driverName = item.name
+					this.arrangeInfo.driverId = item.keyid
+				} else if (this.selectAc == 'driver7') {
+					this.deliverKeyID = item.keyid
+					this.deliverKeyName = item.name
+					this.init()
+				} else {
+					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
+				}
+				this.selectAc = ''
+			},
 			init() {
 				this.pageIndex = 1
-				this.pageSize = 20
+				this.pageSize = 30
 				this.loadStatus = 'loadmore'
 				this.orderList = []
 				this.contentVal = ''
 				this.getList()
 			},
-			reservation() {
-				this.$api.CreatAppointmentDeliver({
-					remark: this.contentVal
-				}).then(res => {
-					if (res.code == 1) {
-						this.contentVal = ''
-						this.init()
+			confirmSave() {
+				// 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) {
+						this.$api.UpDataDeliverPlans(this.arrangeInfo).then(res => {
+							if (res.code == 1) {
+								this.isEdit = false
+								this.arrangeInfo = {
+									deliverTime: this.$util.formatDate(new Date(), null, 1),
+									driverId: '',
+									buyerId: null,
+									dianhua: '',
+									remark: '',
+									lianxiren: '',
+									dizhi: '',
+									deliverTixingId: '',
+									sort: 1,
+									driverName:'',
+									companyName: '',
+								}
+								this.show7 = false
+								this.driverName = ''
+								this.buyerName = ''
+								this.init()
+							} else {
+								this.$util.showToast({
+									title: res.error
+								})
+							}
+							this.isLoading = false
+						})
+						return
 					}
+					this.$api.CreatDeliverPlan(this.arrangeInfo).then(res => {
+						if (res.code == 1) {
+							this.arrangeInfo = {
+								deliverTime: this.$util.formatDate(new Date(), null, 1),
+								driverId: '',
+								buyerId: null,
+								dianhua: '',
+								remark: '',
+								lianxiren: '',
+								dizhi: '',
+								deliverTixingId: '',
+								sort: 1,
+								driverName:'',
+								companyName: '',
+							}
+							this.show7 = false
+							this.driverName = ''
+							this.buyerName = ''
+							this.init()
+						} else {
+							this.$util.showToast({
+								title: res.error
+							})
+						}
+						this.isLoading = false
+					})
+				}).catch(errors => {
+					this.$refs.modalArrange.loading = false
 				})
+
+			},
+			reservation() {
+				this.show7 = true
+				// this.$api.CreatAppointmentDeliver({
+				// 	remark: this.contentVal
+				// }).then(res => {
+				// 	if (res.code == 1) {
+				// 		this.contentVal = ''
+				// 		this.init()
+				// 	}
+				// })
 			},
 			getList() {
 				let data = {
@@ -138,30 +432,33 @@
 				})
 			},
 			accept(item) {
-				let that = this
-				uni.showModal({
-					title: '鎻愮ず',
-					content: '纭鍙楃悊璇ラ�佽揣鍚楋紵',
-					success: function(res) {
-						if (res.confirm) {
-							// 鎵ц纭鍚庣殑鎿嶄綔
-							that.$api.AcceptAppointmentDeliver(item.keyid).then(req => {
-								if (req.code == 1) {
-									that.$util.showToast({
-										title: '鍙楃悊鎴愬姛锛�'
-									})
-									that.init()
-								} else {
-									that.$util.showToast({
-										title: req.error
-									})
-								}
-							})
-						} else {
-							// 鎵ц鍙栨秷鍚庣殑鎿嶄綔
-						}
-					}
-				})
+				this.show7 = true
+				this.arrangeInfo.remark = item.remark
+				this.arrangeInfo.deliverTixingId = item.keyid
+				// let that = this
+				// uni.showModal({
+				// 	title: '鎻愮ず',
+				// 	content: '纭鍙楃悊璇ラ�佽揣鍚楋紵',
+				// 	success: function(res) {
+				// 		if (res.confirm) {
+				// 			// 鎵ц纭鍚庣殑鎿嶄綔
+				// 			that.$api.AcceptAppointmentDeliver(item.keyid).then(req => {
+				// 				if (req.code == 1) {
+				// 					that.$util.showToast({
+				// 						title: '鍙楃悊鎴愬姛锛�'
+				// 					})
+				// 					that.init()
+				// 				} else {
+				// 					that.$util.showToast({
+				// 						title: req.error
+				// 					})
+				// 				}
+				// 			})
+				// 		} else {
+				// 			// 鎵ц鍙栨秷鍚庣殑鎿嶄綔
+				// 		}
+				// 	}
+				// })
 			}
 		}
 	}

--
Gitblit v1.9.1