From 17efddc6a667670dca682bf36b51a43e99615e6d Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 16 十月 2024 15:59:38 +0800
Subject: [PATCH] 代码初始化

---
 h5/pages/staff/vehicle/shiwai.vue |  511 ++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 332 insertions(+), 179 deletions(-)

diff --git a/h5/pages/staff/vehicle/shiwai.vue b/h5/pages/staff/vehicle/shiwai.vue
index 82ac57d..ff51cda 100644
--- a/h5/pages/staff/vehicle/shiwai.vue
+++ b/h5/pages/staff/vehicle/shiwai.vue
@@ -1,191 +1,344 @@
 <template>
-	<view class="main_app">
-		<view class="main_wrap">
-			<!--  -->
-			<view class="line">
-				<view class="label">
-					<text>*</text>
-					<text>閫夋嫨杞﹁締</text>
-				</view>
-				<view class="value" @click="isShowCar = true">
-					<text class="mr6" :style="{ color: param.area ? '#000000' : '#999999' }">{{ param.area ? param.area : '璇烽�夋嫨' }}</text>
-					<u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
-				</view>
-			</view>
-			<view class="line">
-				<view class="label">
-					<text>*</text>
-					<text>棰勮鐢ㄨ溅鏃舵</text>
-				</view>
-				<view class="value" @click="isShowDate = true">
-					<text class="mr6" :style="{ color: param.area ? '#000000' : '#999999' }">{{ param.area ? param.area : '璇烽�夋嫨' }}</text>
-					<u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
-				</view>
-			</view>
-		</view>
-		<view class="have_info">
-			<view class="tit">鎮ㄧ敵璇风殑鐢ㄨ溅鏃舵宸叉湁杞﹁締棰勭害</view>
-			<view class="content">
-				<view class="card">鐨朅1212</view>
-				<view class="line"><text>鐢ㄨ溅鏃舵</text><text>111111</text></view>
-				<view class="line"><text>鐩殑鍦�</text><text>111111</text></view>
-				<view class="line"><text>涔樿溅浜烘暟</text><text>111111</text></view>
-				<view class="line"><text>鐢ㄨ溅浜嬬敱</text><text>111111</text></view>
-				<view class="line"><text>鐢宠浜�</text><text>111111</text></view>
-			</view>
-		</view>
-		<view class="main_footer">
-			<text>宸查�夋嫨锛�</text>
-			<text class="sel">132123</text>
-			<text class="btn" @click="$jump('/pages/staff/vehicle/apply')">纭棰勭害</text>
-		</view>
-		<!--  -->
-		<!-- 閫夋嫨杞﹁締 -->
-		<u-picker keyName="name" :show="isShowCar" @close="isShowCar = false" :closeOnClickOverlay="true" :columns="carList" @confirm="seletedCar" @cancel="isShowCar = false"></u-picker>
-		<u-picker keyName="name" :show="isShowDate" @close="isShowDate = false" :closeOnClickOverlay="true" :columns="datetimeOp" @confirm="seletedDate" @cancel="isShowDate = false"></u-picker>
-	</view>
+  <view class="main_app">
+    <view class="main_wrap">
+      <!--  -->
+      <view class="line">
+        <view class="label">
+          <text>*</text>
+          <text>閫夋嫨杞﹁締</text>
+        </view>
+        <view class="value" @click="isShowCar = true">
+          <text
+            class="mr6"
+            :style="{ color: param.carCode ? '#000000' : '#999999' }"
+            >{{ param.carCode ? param.carCode : "璇烽�夋嫨" }}</text
+          >
+          <u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
+        </view>
+      </view>
+      <view class="line">
+        <view class="label">
+          <text>*</text>
+          <text>棰勮鐢ㄨ溅鏃舵</text>
+        </view>
+        <view class="value" @click="isShowDate = true">
+          <text
+            class="mr6"
+            :style="{ color: param.startTime ? '#000000' : '#999999' }"
+          >
+            <template v-if="param.startTime">
+              {{ param.startHours }}鑷硔{ param.endHours }}
+            </template>
+            <template v-else> 璇烽�夋嫨 </template>
+          </text>
+          <u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
+        </view>
+      </view>
+    </view>
+    <view class="have_info" v-if="info && info.length > 0">
+      <view class="tit">鎮ㄧ敵璇风殑鐢ㄨ溅鏃舵瀛樺湪浠ヤ笅棰勭害淇℃伅锛屾棤娉曢绾�</view>
+      <view class="content" v-for="(item, i) in info" :key="i">
+        <view class="card">{{ item.carCode }}</view>
+        <view class="line">
+          <text>鐢ㄨ溅鏃舵</text>
+          <text>
+            {{ item.startTime.slice(5, 16) }}鑷硔{
+              item.endTime.slice(5, 16)
+            }}</text
+          >
+        </view>
+        <view class="line">
+          <text>鐩殑鍦�</text>
+          <text>{{ item.addr }}</text>
+        </view>
+        <view class="line">
+          <text>涔樿溅浜烘暟</text>
+          <text>{{ item.memberIds.split(",").length }}浜�</text>
+        </view>
+        <view class="line">
+          <text>鐢ㄨ溅浜嬬敱</text>
+          <text>{{ item.content }}</text>
+        </view>
+        <view class="line">
+          <text>鐢宠浜�</text>
+          <text>{{ item.memberName }} {{ item.memberMobile }}</text>
+        </view>
+      </view>
+    </view>
+    <view class="main_footer">
+      <text>宸查�夋嫨锛�</text>
+      <text class="sel" v-if="param.startTime"
+        >{{ param.startHours }}鑷硔{ param.endHours }}</text
+      >
+      <text class="btn" :class="{disable: info && info.length > 0}" @click="onSubmit">纭棰勭害</text>
+    </view>
+    <!--  -->
+    <!-- 閫夋嫨杞﹁締 -->
+    <u-picker
+      keyName="code"
+      :show="isShowCar"
+      @close="isShowCar = false"
+      :closeOnClickOverlay="true"
+      :columns="carsList"
+      @confirm="seletedCar"
+      @cancel="isShowCar = false"
+    ></u-picker>
+    <u-datetime-picker
+      mode="datetime"
+      :show="isShowDate"
+      :filter="timeFilter"
+      title="寮�濮嬫椂闂�"
+      :minDate="minDate"
+      @close="isShowDate = false"
+      :closeOnClickOverlay="true"
+      @confirm="seletedDate"
+      @cancel="isShowDate = false"
+    />
+    <u-datetime-picker
+      mode="datetime"
+      :show="isShowEndDate"
+      :filter="timeFilter"
+      title="缁撴潫鏃堕棿"
+      :minDate="new Date(param.startTime || null).getTime()"
+      @close="endtimeClose"
+      :closeOnClickOverlay="true"
+      @confirm="seletedEndDate"
+      @cancel="endtimeClose"
+    />
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				param: {},
-				isShowCar: false,
-				isShowDate: false,
-				carList: [],
-				datetimeOp: [],
-			};
-		},
-		methods: {
-			seletedCar() {},
-			seletedDate() {},
-		}
-	}
+import { getCarsList, carUseBookList } from '@/api'
+import dayjs from 'dayjs'
+export default {
+  data() {
+    return {
+      param: {},
+      isShowCar: false,
+      isShowDate: false,
+      isShowEndDate: false,
+      carsList: [],
+      info: [],
+
+      minDate: ''
+    }
+  },
+  onLoad() {
+    this.minDate = new Date(dayjs().format('YYYY-MM-DD HH:mm') + ':00').getTime()
+    console.log('minDate', this.minDate);
+    this.initData()
+  },
+  methods: {
+    onSubmit() {
+      const { param, info } = this
+      if (info.length > 0) return
+      if (!param.startTime) return uni.showToast({
+        title: '璇峰厛閫夋嫨鐢ㄨ溅鏃堕棿娈�',
+        icon: 'none'
+      })
+      if (!param.carId) return uni.showToast({
+        title: '璇烽�夋嫨杞﹁締',
+        icon: 'none'
+      })
+      const obj = {
+        carCode: param.carCode,
+        carId: param.carId,
+        startTime: param.startTime,
+        endTime: param.endTime,
+        type: '1'
+      }
+      uni.navigateTo({
+        url: `/pages/staff/vehicle/apply?carCode=${obj.carCode}&carId=${obj.carId}&startTime=${obj.startTime}&endTime=${obj.endTime}&type=${obj.type}`
+      })
+      // this.$jump('/pages/staff/vehicle/apply')
+    },
+    getInfo() {
+      const { param } = this
+      carUseBookList({
+        carId: param.carId,
+        startTime: param.startTime,
+        endTime: param.endTime,
+      }).then(res => {
+        if (res.code == 200) {
+          this.info = res.data
+        }
+      })
+    },
+    seletedCar(e) {
+      const item = e.value[0]
+      this.$set(this.param, 'carCode', item.code)
+      this.$set(this.param, 'carId', item.id)
+      this.isShowCar = false
+      if (this.param.carId && this.param.startTime) {
+        this.getInfo()
+      }
+    },
+    seletedDate(e) {
+      this.param.startTime = dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')
+      this.param.startHours = dayjs(e.value).format('MM-DD HH:mm')
+      console.log(this.param.startTime)
+      this.isShowDate = false
+      this.isShowEndDate = true
+    },
+    seletedEndDate(e) {
+      this.param.endTime = dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')
+      this.param.endHours = dayjs(e.value).format('MM-DD HH:mm')
+      console.log(this.param.endTime)
+      this.isShowEndDate = false
+      if (this.param.carId && this.param.startTime) {
+        this.getInfo()
+      }
+      this.$forceUpdate()
+    },
+    endtimeClose() {
+      this.param.endTime = ''
+      this.param.startTime = ''
+      this.isShowEndDate = false
+    },
+    timeFilter(mode, options) {
+      if (mode === 'minute') {
+        return options.filter(option => option === '00' || option === '30' || option === '60')
+      }
+      return options
+    },
+    initData() {
+      getCarsList({
+        type: 1
+      }).then(res => {
+        this.carsList = [res.data]
+      })
+    },
+  }
+};
 </script>
 
 <style lang="scss">
-.have_info{
-	.tit{
-		color: #ED4545;
-		margin: 40rpx 0 24rpx;
-	}
-	.content{
-		background: #F7F7F7;
-		border-radius: 16rpx;
-		padding: 30rpx 30rpx 10rpx;
-		.card{
-			margin-bottom: 30rpx;
-			font-weight: 500;
-			font-size: 32rpx;
-			color: #222222;
-			background: #F7F7F7;
-			padding: 0;
-		}
-		.line{
-			display: flex;
-			margin-bottom: 20rpx;
-			text{
-				&:nth-of-type(1){
-					width: 150rpx;
-					color: #888888;
-				}
-				&:nth-of-type(2){
-					flex: 1;
-				}
-			}
-		}
-	}
+.have_info {
+  padding: 0 0 200rpx;
+  .tit {
+    color: #ed4545;
+    margin: 40rpx 0 24rpx;
+  }
+  .content {
+    background: #f7f7f7;
+    border-radius: 16rpx;
+    padding: 30rpx 30rpx 10rpx;
+    margin-bottom: 20rpx;
+    .card {
+      margin-bottom: 30rpx;
+      font-weight: 600;
+      font-size: 32rpx;
+      color: #222222;
+      background: #f7f7f7;
+      padding: 0;
+    }
+    .line {
+      display: flex;
+      margin-bottom: 20rpx;
+      text {
+        &:nth-of-type(1) {
+          width: 150rpx;
+          color: #888888;
+        }
+        &:nth-of-type(2) {
+          flex: 1;
+        }
+      }
+    }
+  }
 }
 .main_wrap {
-	.line {
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		border-bottom: 1rpx solid #e5e5e5;
-		padding: 30rpx 0;
-		.label {
-			font-size: 30rpx;
-			font-weight: 400;
-			text {
-				&:nth-child(1) {
-					color: #e42d2d;
-					margin-right: 4rpx;
-				}
-			}
-		}
-		.value {
-			flex: 1;
-			height: 100%;
-			margin-left: 30rpx;
-			display: flex;
-			align-items: center;
-			justify-content: flex-end;
-			input {
-				width: 100%;
-				height: 100%;
-				text-align: right;
-				font-size: 28rpx;
-				font-weight: 400;
-				color: #222222;
-			}
-		}
-	}
-	.upload_line {
-		padding: 30rpx 0;
-		textarea {
-			margin-top: 12rpx;
-			width: 100%;
-			height: 180rpx;
-			font-size: 28rpx;
-			font-weight: 400;
-			color: #222222;
-		}
-		.adduser_list_item_ipt1_upload {
-			margin-top: 24rpx;
-			width: 120rpx;
-			height: 120rpx;
-			border: 2rpx solid #E5E5E5;
-			background: #f7f7f7;
-			color: #666666;
-			font-size: 22rpx;
-			display: flex;
-			align-items: center;
-			justify-content: center;
-			overflow: hidden;
-			image {
-				width: 100%;
-				height: 100%;
-			}
-		}
+  .line {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    border-bottom: 1rpx solid #e5e5e5;
+    padding: 30rpx 0;
+    .label {
+      font-size: 30rpx;
+      font-weight: 400;
+      text {
+        &:nth-child(1) {
+          color: #e42d2d;
+          margin-right: 4rpx;
+        }
+      }
+    }
+    .value {
+      flex: 1;
+      height: 100%;
+      margin-left: 30rpx;
+      display: flex;
+      align-items: center;
+      justify-content: flex-end;
+      input {
+        width: 100%;
+        height: 100%;
+        text-align: right;
+        font-size: 28rpx;
+        font-weight: 400;
+        color: #222222;
+      }
+    }
+  }
+  .upload_line {
+    padding: 30rpx 0;
+    textarea {
+      margin-top: 12rpx;
+      width: 100%;
+      height: 180rpx;
+      font-size: 28rpx;
+      font-weight: 400;
+      color: #222222;
+    }
+    .adduser_list_item_ipt1_upload {
+      margin-top: 24rpx;
+      width: 120rpx;
+      height: 120rpx;
+      border: 2rpx solid #e5e5e5;
+      background: #f7f7f7;
+      color: #666666;
+      font-size: 22rpx;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      overflow: hidden;
+      image {
+        width: 100%;
+        height: 100%;
+      }
+    }
+  }
+}
+.main_footer {
+  position: fixed;
+  width: 100%;
+  left: 0;
+  background-color: #fff;
+  bottom: 0;
+  padding: 20rpx 30rpx 84rpx;
+  box-shadow: 0rpx -3rpx 6rpx 0rpx #eeeeee;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  .btn {
+    width: 184rpx;
+    height: 72rpx;
+    line-height: 72rpx;
+    text-align: center;
+    background: $uni-color-primary;
+    box-shadow: 0rpx -1rpx 0rpx 0rpx #eeeeee;
+    border-radius: 36rpx;
+    font-size: 30rpx;
+    color: #ffffff;
+  }
+  .sel {
+    color: $uni-color-primary;
+    flex: 1;
+  }
+	.disable{
+		background: #CCCCCC;
 	}
 }
-.main_footer{
-		position: absolute;
-		width: 100%;
-		left: 0;
-		bottom: 0;
-		padding: 20rpx 30rpx 84rpx;
-		box-shadow: 0rpx -3rpx 6rpx 0rpx #EEEEEE;
-		display: flex;
-		align-items: center;
-		justify-content: space-between;
-		.btn{
-			width: 184rpx;
-			height: 72rpx;
-			line-height: 72rpx;
-			text-align: center;
-			background: #279BAA;
-			box-shadow: 0rpx -1rpx 0rpx 0rpx #EEEEEE;
-			border-radius: 36rpx;
-			font-size: 30rpx;
-			color: #FFFFFF;
-		}
-		.sel{
-			color: #279BAA;
-			flex: 1;
-		}
-		
-
-	}
 </style>

--
Gitblit v1.9.3