UpdatePopup.vue 6.4 KB

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