From c5a0ff2661fe362dddbe88c6a28d19c48c24c39b Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期一, 21 十月 2024 20:39:32 +0800 Subject: [PATCH] 最新版本541200007 --- admin/src/components/operation/OperCarUseBookParamWindow.vue | 211 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 162 insertions(+), 49 deletions(-) diff --git a/admin/src/components/operation/OperCarUseBookParamWindow.vue b/admin/src/components/operation/OperCarUseBookParamWindow.vue index d8bc84d..980be80 100644 --- a/admin/src/components/operation/OperCarUseBookParamWindow.vue +++ b/admin/src/components/operation/OperCarUseBookParamWindow.vue @@ -17,7 +17,7 @@ > </el-form-item> <el-form-item label="閫夋嫨杞﹁締" prop="carId"> - <el-select v-model="form.carId" placeholder="閫夋嫨杞﹁締"> + <el-select v-model="form.carId" @change="clearTime" placeholder="閫夋嫨杞﹁締"> <el-option v-for="item in carsList" :key="item.id" @@ -107,7 +107,7 @@ title="閫夋嫨鐢ㄨ溅鏃堕棿" :visible.sync="isShowTime" append-to-body - width="600px" + width="640px" > <el-form :model="form" ref="modalRef" class="el_form" :rules="rules"> <el-form-item label="鐢ㄨ溅鏃ユ湡" prop="dateDay"> @@ -133,12 +133,13 @@ :class="{ disable: item.isUse == 1, active: item.checked == '1', + hasSub: item.carUseBookId, }" @click="datetimeClick(item, i)" v-for="(item, i) in timeList" :key="i" > - {{ item.startHours }}-{{ item.endHours }} + {{ item.startHours }} - {{ item.endHours }} </div> </div> </div> @@ -161,25 +162,28 @@ :visible.sync="isShowShiwai" append-to-body width="600px" + :before-close="clearTime" > <el-form :model="form" ref="modalRef" class="el_form" :rules="rules"> <el-form-item label="鐢ㄨ溅寮�濮嬫椂闂�" prop="startTime"> <el-date-picker v-model="form.startTime" - format="yyyy-MM-dd HH:mm" + format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" - :picker-options="pickerOptions" - @change="seletedShiwaiDate" + :default-time="defaultTime" + :picker-options="pickerOptionsNow" + @change="seletedShiwaiDate(1)" > </el-date-picker> </el-form-item> <el-form-item label="鐢ㄨ溅缁撴潫鏃堕棿" prop="endTime"> <el-date-picker v-model="form.endTime" - format="yyyy-MM-dd HH:mm" + format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" + :default-time="defaultTime" :picker-options="pickerOptions" @change="seletedShiwaiDate" > @@ -189,7 +193,10 @@ <div class="have_info" v-if="info && info.length > 0"> <div class="tit">鎮ㄧ敵璇风殑鐢ㄨ溅鏃舵宸叉湁杞﹁締棰勭害</div> <div class="content" v-for="(item, i) in info" :key="i"> - <div class="card">{{ item.carCode }}</div> + <div class="df_sb"> + <span class="card" v-if="item.carCode">{{ item.carCode }}</span> + <span>{{ i + 1 }}/{{ info.length }}</span> + </div> <div class="line"> <span>鐢ㄨ溅鏃舵</span> <span> @@ -212,16 +219,48 @@ </div> <div class="line"> <span>鐢宠浜�</span> - <span>{{ item.memberName }} {{ item.memberMobile }}</span> + <span>{{ item.memberName }} <span class="primaryColor">{{ item.memberMobile }}</span></span> </div> </div> </div> <span slot="footer" class="dialog-footer"> <div>宸查�夋嫨锛歿{ selDatetime }}</div> - <div class="btn" @click="subTime">纭鏃堕棿</div> + <div class="btn" :class="{disable: info && info.length > 0}" @click="subTime">纭鏃堕棿</div> </span> </el-dialog> + <!-- 璇︽儏 --> + <el-dialog + title="閫夋嫨鐢ㄨ溅鏃堕棿" + :visible.sync="isShowDetail" + append-to-body + width="600px" + > + <div class="detail_modal"> + <div class="title">杞﹁締棰勭害鎯呭喌</div> + <div class="h1" v-if="activeInfo.carCode">{{ activeInfo.carCode }}</div> + <div class="line"> + <div class="label">棰勮鐢ㄨ溅鏃舵</div> + <div class="value" v-if="activeInfo.startTime">{{ activeInfo.startTime.slice(5, 16) }} - {{ activeInfo.endTime.slice(5, 16) }}</div> + </div> + <div class="line"> + <div class="label">鐩殑鍦�</div> + <div class="value">{{ activeInfo.addr }}</div> + </div> + <div class="line"> + <div class="label">涔樿溅浜烘暟</div> + <div class="value" v-if="activeInfo.memberIds">{{ activeInfo.memberIds.split(',').length }}浜�</div> + </div> + <div class="line"> + <div class="label">鐢ㄨ溅浜嬬敱</div> + <div class="value">{{ activeInfo.content || '' }}</div> + </div> + <div class="line"> + <div class="label">鐢宠浜�</div> + <div class="value">{{ activeInfo.memberName }} <span class="primaryColor ml12">{{ activeInfo.memberPhone }}</span></div> + </div> + </div> + </el-dialog> </GlobalWindow> </template> @@ -230,14 +269,15 @@ import GlobalWindow from '@/components/common/GlobalWindow' import { allList } from '@/api/business/member' import { allList as getCarList } from '@/api/business/cars' -import { carCanReservationDate, carUseBookCraete, carUseBookList } from '@/api/business/carUseBook' +import { carCanReservationDate, carUseBookCraete, carUseBookList, detail } from '@/api/business/carUseBook' import { findTypeMemberInfo } from '@/api/business/memberCard' import dayjs from 'dayjs' + export default { name: 'OperCarUseBookParamWindow', extends: BaseOpera, components: { GlobalWindow }, - data() { + data () { return { // 琛ㄥ崟鏁版嵁 isShowTime: false, @@ -245,6 +285,7 @@ memberList: [], timeList: [], + defaultTime: dayjs().format('HH:mm:ss'), selDatetime: '', colorOptions: [ { color: this.$store.state.primaryColor, name: '宸查�夋嫨' }, @@ -260,6 +301,9 @@ endTime: '', memberIds: [] }, + activeInfo: {}, + isShowDetail: false, + carBookInfo: {}, pickerOptions: { disabledDate: (time) => { if (this.form.startTime) { @@ -288,6 +332,11 @@ }, selectableRange: '00:00:00 - 23:59:59' }, + pickerOptionsNow: { + disabledDate: (time) => { + return time.getTime() < Date.now() - 8.64e7; + } + }, // 楠岃瘉瑙勫垯 rules: { type: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }], @@ -306,7 +355,7 @@ }, watch: { 'form.planUseDate': { - handler(newValue, oldValue) { + handler (newValue, oldValue) { if (newValue) { this.$set(this.pickerOptions, 'selectableRange', this.form.startTime.slice(11, 19) + ' - ' + this.form.endTime.slice(11, 19)) // this.startPickerOptions = this.startPickerOptions @@ -314,23 +363,13 @@ }, deep: true, immediate: true - }, - 'form.startTime': { - handler(newValue, oldValue) { - if (newValue) { - this.$set(this.pickerOptions, 'selectableRange', this.form.startTime.slice(11, 19) + ' - ' + '23:59:59') - // this.startPickerOptions = this.startPickerOptions - } - }, - deep: true, - immediate: true } }, - created() { + created () { this.initData() }, methods: { - open() { + open () { this.title = '鏂板缓鍏姟杞︾敤杞︾敵璇�' this.form = { type: 0, @@ -341,7 +380,7 @@ }) this.visible = true }, - confirm() { + confirm () { const form = JSON.parse(JSON.stringify(this.form)) this.$refs.formRef.validate((valid) => { const memberList = [] @@ -365,18 +404,33 @@ } }) }, - openTime() { + openTime () { const { form } = this if (!form.carId) { return this.$tip.error('璇峰厛閫夋嫨杞﹁締') } if (this.form.type === 0) { + this.$set(this.form, 'dateDay', '') + this.timeList = [] this.isShowTime = true } else { + this.clearTime() + this.selDatetime = '' this.isShowShiwai = true } }, - subTime() { + clearTime () { + this.isShowShiwai = false + this.$set(this.form, 'startTime', '') + this.$set(this.form, 'endTime', '') + this.$nextTick(() => { + if (this.$refs.modalRef) { + this.$refs.modalRef.clearValidate() + } + }) + }, + subTime () { + if (this.info && this.info.length > 0) return if (this.form.type === 0) { const selTimeList = this.timeList.filter(i => i.checked == '1') if (selTimeList.length === 0) { @@ -389,11 +443,24 @@ this.$forceUpdate() } else { this.$refs.modalRef.validate((valid) => { + const { form } = this + if (new Date(form.startTime).getTime() > new Date(form.endTime).getTime()) { + return this.$tip.error('缁撴潫鏃堕棿搴斿ぇ浜庡紑濮嬫椂闂�') + } this.isShowShiwai = false }) } }, - datetimeClick(item, index) { + datetimeClick (item, index) { + if (item.carUseBookId) { + detail( + item.carUseBookId + ).then(res => { + this.activeInfo = res + this.isShowDetail = true + }) + return + } if (item.isUse == '1') return const { timeList } = this const selTimeList = timeList.filter(i => i.checked == '1') @@ -434,13 +501,16 @@ this.selDatetime = this.form.dateDay.slice(5) + ' ' + selTimeLists[0].startHours + '-' + selTimeLists[selTimeLists.length - 1].endHours } }, - seletedDate(e) { + seletedDate (e) { this.gettimes() }, - seletedShiwaiDate() { + seletedShiwaiDate (str) { const { form } = this + if(str && str == 1){ + this.$set(this.form, 'endTime', '') + } if (form.startTime && form.endTime) { - this.selDatetime = form.startTime + '-' + form.endTime + this.selDatetime = form.startTime + ' - ' + form.endTime carUseBookList({ carId: form.carId, startTime: form.startTime, @@ -450,7 +520,7 @@ }) } }, - gettimes() { + gettimes () { const { form } = this carCanReservationDate({ dateDay: form.dateDay, @@ -459,18 +529,19 @@ this.timeList = res || [] this.timeList.forEach((i, j) => { i.checked = '0', - i.index = j + i.index = j }) }) }, - initData() { + initData () { getCarList({ - type: 1 + type: 0 }).then(res => { this.carsList = res }) findTypeMemberInfo({ - type: '2' + type: '2', + companyType: 1 }).then(res => { this.memberList = res || [] }) @@ -516,29 +587,42 @@ div { line-height: 28px; } - } + } } .time_list { display: flex; - justify-content: space-between; flex-wrap: wrap; .item { - width: 154px; - height: 32px; - line-height: 32px; - text-align: center; - background: #f7f7f7; - border-radius: 4px; - margin-bottom: 10px; + margin-right: 8px; + margin-bottom: 8px; + font-size: 14px; + font-weight: 400; + line-height: 14px; + width: 124px; + height: 36px; + display: flex; + justify-content: center; + align-items: center; + border-radius: 5px; + color: #111; + border: #cccccc solid 1px; + cursor: pointer; } .active { - background-color: $primary-color; - color: #fff; + border-color: $primary-color; + background-color: #f6f9fe; + color: $primary-color; } .disable { + color: #fff; + border-color: #cccccc; background-color: #cccccc; - color: #999999; } + .hasSub { + border-color: #bed6f9; + background-color: #bed6f9; + color: #fff; + } } .color_op { display: flex; @@ -564,6 +648,10 @@ color: #fff; width: 120px; text-align: center; + cursor: pointer; + } + .disable{ + background: #cccccc; } } .have_info { @@ -600,4 +688,29 @@ } } } +.detail_modal { + padding: 20px 15px; + .title { + text-align: center; + font-weight: 600; + font-size: 16px; + margin-bottom: 20px; + } + .h1 { + font-weight: 600; + font-size: 16px; + margin-bottom: 16px; + } + .line { + display: flex; + margin-bottom: 10px; + .label { + width: 120px; + color: #888888; + } + .value { + color: #333333; + } + } +} </style> -- Gitblit v1.9.3