index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view class="carDemand-container" :style="{top: top + 'px'}">
  3. <view class="input-wrap" @tap="showUpdateInfoPopupHadle">
  4. <view class="content">
  5. <view class="address-txt">
  6. {{ getReactiveData()['myLocation'].address || getReactiveData()['desc_adress'] }}
  7. </view>
  8. <view class="takeCar">{{ getReactiveData()['takeCar'] }} 取车</view>
  9. <view>{{ getLeaseType(getReactiveData()['duration_unit']) }}</view>
  10. <img class="img" src="https://qiniu.bms16.com/FiUo5RmbIfH0upEt3LRST4I_uYhd">
  11. </view>
  12. </view>
  13. <u-popup
  14. v-model="showUpdateInfoPopup"
  15. mode="top"
  16. border-radius="32"
  17. :height="popupHeight"
  18. :custom-style="{ 'margin-top': top + 'px' }"
  19. :mask-custom-style="{ 'margin-top': top + 'px', 'top': top + 'px' }"
  20. >
  21. <view style="padding: 0 32rpx;">
  22. <UpdateReservationHireCar
  23. isUpdate
  24. ref="UpdateReservation"
  25. @changeType="showLeaseTypeHandle"
  26. @close="closeUpdateInfoPopup"
  27. @calendarChange="calendarChange"
  28. />
  29. </view>
  30. </u-popup>
  31. <u-popup v-model="showLeaseType" :closeable="false" mode="bottom" border-radius="32">
  32. <view class="bottom-popup">
  33. <view class="title">选择租车类型</view>
  34. <view class="item-wrap">
  35. <view
  36. v-for="(item, index) in LEASE_TYPE_ARR"
  37. :class="['item', leaseType === item.value && 'checked']"
  38. :key="index"
  39. @click="leaseType = item.value"
  40. >
  41. {{ item.label }}
  42. </view>
  43. <view class="item" style="opacity: 0;"></view>
  44. </view>
  45. <view class="options-wrap">
  46. <view class="btn cancle" @click="showLeaseType = false">取消</view>
  47. <view class="btn confirm" @click="chooseLeaseType">确定</view>
  48. </view>
  49. </view>
  50. </u-popup>
  51. </view>
  52. </template>
  53. <script>
  54. import { LEASE_TYPE_ARR } from '@/common/constant.js'
  55. import UpdateReservationHireCar from '../ReservationHireCar'
  56. export default {
  57. props: {
  58. top: {
  59. type: Number,
  60. default: 0
  61. }
  62. },
  63. components: { UpdateReservationHireCar },
  64. data () {
  65. return {
  66. LEASE_TYPE_ARR,
  67. popupHeight: 'auto',
  68. showLeaseType: false,
  69. showUpdateInfoPopup: false,
  70. leaseType: 4
  71. }
  72. },
  73. methods: {
  74. getReactiveData() {
  75. return {
  76. myLocation: this.getBortherValue('myLocation') ,
  77. desc_adress: this.getBortherValue('desc_adress') ,
  78. takeCar: this.getBortherValue('takeCar'),
  79. duration_unit: this.getBortherValue('duration_unit'),
  80. cityName: this.getBortherValue('cityName'),
  81. cityCode: this.getBortherValue('cityCode'),
  82. dateText: this.getBortherValue('dateText'),
  83. }
  84. },
  85. getBortherValue(val) {
  86. const { reservationHireCar } = this.$parent.$refs
  87. return reservationHireCar[val]
  88. },
  89. getLeaseType(val) {
  90. const obj = this.LEASE_TYPE_ARR.find(v => v.value === val)
  91. return obj.label
  92. },
  93. showLeaseTypeHandle() {
  94. this.showLeaseType = true
  95. this.leaseType = this.getBortherValue('duration_unit')
  96. },
  97. chooseLeaseType() {
  98. this.showLeaseType = false
  99. this.$refs.UpdateReservation.duration_unit = this.leaseType
  100. // this.$emit('changeLeaseType', this.leaseType)
  101. // this.showUpdateInfoPopupHadle()
  102. },
  103. showUpdateInfoPopupHadle() {
  104. this.showUpdateInfoPopup = true
  105. const data = this.$u.deepClone(this.getReactiveData())
  106. this.$nextTick(() => {
  107. this.$refs.UpdateReservation.setDataInfo(data)
  108. })
  109. },
  110. closeUpdateInfoPopup(obj) {
  111. this.showUpdateInfoPopup = false
  112. if (obj) {
  113. this.$emit('updateInfo', obj)
  114. }
  115. },
  116. calendarChange(val) {
  117. this.popupHeight = val
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. .carDemand-container {
  124. background: #fff;
  125. width: 100%;
  126. padding: 10rpx 32rpx;
  127. position: fixed;
  128. z-index: 999;
  129. left: 0;
  130. right: 0;
  131. .input-wrap {
  132. background: #F4F5F6;
  133. border-radius: 36rpx;
  134. .content {
  135. display: flex;
  136. justify-content: space-between;
  137. padding: 20rpx 30rpx;
  138. font-family: PingFangSC, PingFang SC;
  139. font-weight: 400;
  140. font-size: 28rpx;
  141. color: #5E6F90;
  142. line-height: 28rpx;
  143. text-align: left;
  144. font-style: normal;
  145. .img {
  146. width: 32rpx;
  147. height: 32rpx;
  148. margin-left: 20rpx;
  149. }
  150. .address-txt {
  151. width: 140rpx;
  152. overflow: hidden;
  153. white-space: nowrap;
  154. text-overflow: ellipsis;
  155. }
  156. }
  157. .takeCar {
  158. display: flex;
  159. &::before, &::after {
  160. content: "";
  161. width: 2px;
  162. height: 28rpx;
  163. background: #E9EBED;
  164. position: relative;
  165. }
  166. &::before {
  167. left: -16rpx;
  168. }
  169. &::after {
  170. right: -16rpx;
  171. }
  172. }
  173. }
  174. .bottom-popup {
  175. padding: 40rpx 32rpx 32rpx 32rpx;
  176. padding-bottom: env(safe-area-inset-bottom);
  177. .title {
  178. font-family: PingFangSC, PingFang SC;
  179. font-weight: 600;
  180. font-size: 40rpx;
  181. color: #2A3A5A;
  182. line-height: 40rpx;
  183. text-align: left;
  184. font-style: normal;
  185. margin-bottom: 48rpx;
  186. }
  187. .item-wrap {
  188. display: flex;
  189. flex-wrap: wrap;
  190. justify-content: space-between;
  191. .item {
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. margin-bottom: 20rpx;
  196. width: 220rpx;
  197. height: 64rpx;
  198. background: #FFFFFF;
  199. border-radius: 38rpx;
  200. border: 2px solid #E7EAEE;
  201. box-sizing: border-box;
  202. font-family: PingFangSC, PingFang SC;
  203. font-weight: 600;
  204. font-size: 30rpx;
  205. color: #8997B1;
  206. text-align: center;
  207. font-style: normal;
  208. }
  209. .checked {
  210. background: #EDF5FF;
  211. color: #0074FF;
  212. border: 2px solid #0074FF;
  213. }
  214. }
  215. .options-wrap {
  216. margin-top: 40rpx;
  217. display: flex;
  218. justify-content: space-between;
  219. .btn {
  220. display: flex;
  221. justify-content: center;
  222. align-items: center;
  223. width: 334rpx;
  224. height: 80rpx;
  225. font-family: PingFangSC, PingFang SC;
  226. font-weight: 500;
  227. font-size: 32rpx;
  228. line-height: 32rpx;
  229. text-align: center;
  230. font-style: normal;
  231. border-radius: 40rpx;
  232. }
  233. .cancle {
  234. background: #E5F1FF;
  235. color: #0074FF;
  236. }
  237. .confirm {
  238. background: #0074FF;
  239. color: #FFFFFF;
  240. }
  241. }
  242. }
  243. }
  244. </style>