123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <template>
- <view class="carDemand-container" :style="{top: top + 'px'}">
- <view class="input-wrap" @tap="showUpdateInfoPopupHadle">
- <view class="content">
- <view class="address-txt">
- {{ getReactiveData()['myLocation'].address || getReactiveData()['desc_adress'] }}
- </view>
- <view class="takeCar">{{ getReactiveData()['takeCar'] }} 取车</view>
- <view>{{ getLeaseType(getReactiveData()['duration_unit']) }}</view>
- <img class="img" src="https://qiniu.bms16.com/FiUo5RmbIfH0upEt3LRST4I_uYhd">
- </view>
- </view>
- <u-popup
- v-model="showUpdateInfoPopup"
- mode="top"
- border-radius="32"
- :height="popupHeight"
- :custom-style="{ 'margin-top': top + 'px' }"
- :mask-custom-style="{ 'margin-top': top + 'px', 'top': top + 'px' }"
- >
- <view style="padding: 0 32rpx;">
- <UpdateReservationHireCar
- isUpdate
- ref="UpdateReservation"
- @changeType="showLeaseTypeHandle"
- @close="closeUpdateInfoPopup"
- @calendarChange="calendarChange"
- />
- </view>
- </u-popup>
- <u-popup v-model="showLeaseType" :closeable="false" mode="bottom" border-radius="32">
- <view class="bottom-popup">
- <view class="title">选择租车类型</view>
- <view class="item-wrap">
- <view
- v-for="(item, index) in LEASE_TYPE_ARR"
- :class="['item', leaseType === item.value && 'checked']"
- :key="index"
- @click="leaseType = item.value"
- >
- {{ item.label }}
- </view>
- <view class="item" style="opacity: 0;"></view>
- </view>
- <view class="options-wrap">
- <view class="btn cancle" @click="showLeaseType = false">取消</view>
- <view class="btn confirm" @click="chooseLeaseType">确定</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { LEASE_TYPE_ARR } from '@/common/constant.js'
- import UpdateReservationHireCar from '../ReservationHireCar'
- export default {
- props: {
- top: {
- type: Number,
- default: 0
- }
- },
- components: { UpdateReservationHireCar },
- data () {
- return {
- LEASE_TYPE_ARR,
- popupHeight: 'auto',
- showLeaseType: false,
- showUpdateInfoPopup: false,
- leaseType: 4
- }
- },
- methods: {
- getReactiveData() {
- return {
- myLocation: this.getBortherValue('myLocation') ,
- desc_adress: this.getBortherValue('desc_adress') ,
- takeCar: this.getBortherValue('takeCar'),
- duration_unit: this.getBortherValue('duration_unit'),
- cityName: this.getBortherValue('cityName'),
- cityCode: this.getBortherValue('cityCode'),
- dateText: this.getBortherValue('dateText'),
- }
- },
- getBortherValue(val) {
- const { reservationHireCar } = this.$parent.$refs
- return reservationHireCar[val]
- },
- getLeaseType(val) {
- const obj = this.LEASE_TYPE_ARR.find(v => v.value === val)
- return obj.label
- },
- showLeaseTypeHandle() {
- this.showLeaseType = true
- this.leaseType = this.getBortherValue('duration_unit')
- },
- chooseLeaseType() {
- this.showLeaseType = false
- this.$refs.UpdateReservation.duration_unit = this.leaseType
- // this.$emit('changeLeaseType', this.leaseType)
- // this.showUpdateInfoPopupHadle()
- },
- showUpdateInfoPopupHadle() {
- this.showUpdateInfoPopup = true
- const data = this.$u.deepClone(this.getReactiveData())
- this.$nextTick(() => {
- this.$refs.UpdateReservation.setDataInfo(data)
- })
- },
- closeUpdateInfoPopup(obj) {
- this.showUpdateInfoPopup = false
- if (obj) {
- this.$emit('updateInfo', obj)
- }
- },
- calendarChange(val) {
- this.popupHeight = val
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .carDemand-container {
- background: #fff;
- width: 100%;
- padding: 10rpx 32rpx;
- position: fixed;
- z-index: 999;
- left: 0;
- right: 0;
- .input-wrap {
- background: #F4F5F6;
- border-radius: 36rpx;
- .content {
- display: flex;
- justify-content: space-between;
- padding: 20rpx 30rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #5E6F90;
- line-height: 28rpx;
- text-align: left;
- font-style: normal;
- .img {
- width: 32rpx;
- height: 32rpx;
- margin-left: 20rpx;
- }
- .address-txt {
- width: 140rpx;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- }
- .takeCar {
- display: flex;
- &::before, &::after {
- content: "";
- width: 2px;
- height: 28rpx;
- background: #E9EBED;
- position: relative;
- }
- &::before {
- left: -16rpx;
- }
- &::after {
- right: -16rpx;
- }
- }
- }
- .bottom-popup {
- padding: 40rpx 32rpx 32rpx 32rpx;
- padding-bottom: env(safe-area-inset-bottom);
- .title {
- font-family: PingFangSC, PingFang SC;
- font-weight: 600;
- font-size: 40rpx;
- color: #2A3A5A;
- line-height: 40rpx;
- text-align: left;
- font-style: normal;
- margin-bottom: 48rpx;
- }
- .item-wrap {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .item {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-bottom: 20rpx;
- width: 220rpx;
- height: 64rpx;
- background: #FFFFFF;
- border-radius: 38rpx;
- border: 2px solid #E7EAEE;
- box-sizing: border-box;
- font-family: PingFangSC, PingFang SC;
- font-weight: 600;
- font-size: 30rpx;
- color: #8997B1;
- text-align: center;
- font-style: normal;
- }
- .checked {
- background: #EDF5FF;
- color: #0074FF;
- border: 2px solid #0074FF;
- }
- }
- .options-wrap {
- margin-top: 40rpx;
- display: flex;
- justify-content: space-between;
- .btn {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 334rpx;
- height: 80rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 500;
- font-size: 32rpx;
- line-height: 32rpx;
- text-align: center;
- font-style: normal;
- border-radius: 40rpx;
-
- }
- .cancle {
- background: #E5F1FF;
- color: #0074FF;
- }
- .confirm {
- background: #0074FF;
- color: #FFFFFF;
- }
- }
- }
- }
- </style>
|