PersonalExpressDialog.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <!-- 使用 u-popup 组件 -->
  3. <u-popup :show="visible" mode="bottom" :round="30" :closeable="false" :closeOnClickOverlay="true"
  4. @close="handleClose">
  5. <view class="popup-content">
  6. <!-- 标题 -->
  7. <view class="popup-header">
  8. <text class="popup-title">个人寄件</text>
  9. </view>
  10. <!-- 物流选项 -->
  11. <view class="express-options">
  12. <!-- 顺丰选项 -->
  13. <view class="express-option sf-option" :class="{ 'selected': selectedExpress === '顺丰' }"
  14. @click="selectExpress('顺丰')">
  15. <image class="option-icon" src="/static/img/icon-logo-sf.png"
  16. mode="aspectFit" />
  17. <text class="option-text">顺丰物流</text>
  18. </view>
  19. <!-- 京东选项 -->
  20. <view class="express-option jd-option" :class="{ 'selected': selectedExpress === '京东' }"
  21. @click="selectExpress('京东')">
  22. <image class="option-icon" src="/static/img/icon-logo-jd.png"
  23. mode="aspectFit" />
  24. <text class="option-text">京东物流</text>
  25. </view>
  26. </view>
  27. <!-- 取消按钮 -->
  28. <view class="popup-footer">
  29. <button class="cancel-btn" @click="handleClose">取消</button>
  30. </view>
  31. </view>
  32. </u-popup>
  33. </template>
  34. <script setup>
  35. import {
  36. ref
  37. } from 'vue'
  38. const props = defineProps({
  39. visible: {
  40. type: Boolean,
  41. default: false
  42. }
  43. })
  44. const emit = defineEmits(['update:visible', 'select'])
  45. const selectedExpress = ref('')
  46. const selectExpress = (company) => {
  47. selectedExpress.value = company
  48. // 延时关闭并传递选择结果
  49. setTimeout(() => {
  50. emit('select', company)
  51. emit('update:visible', false)
  52. selectedExpress.value = ''
  53. }, 300)
  54. }
  55. const handleClose = () => {
  56. selectedExpress.value = ''
  57. emit('update:visible', false)
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .popup-content {
  62. padding: 32rpx 16rpx 0rpx 16rpx;
  63. background-color: #fff;
  64. border-radius: 40rpx 40rpx 0rpx 0rpx;
  65. }
  66. .popup-header {
  67. display: flex;
  68. justify-content: center;
  69. align-items: center;
  70. margin-bottom: 46rpx;
  71. }
  72. .popup-title {
  73. height: 52rpx;
  74. line-height: 52rpx;
  75. font-size: 36rpx;
  76. font-weight: bold;
  77. color: #333;
  78. }
  79. .express-options {
  80. height: 204rpx;
  81. display: flex;
  82. justify-content: space-around;
  83. }
  84. .express-option {
  85. width: 200rpx;
  86. display: flex;
  87. flex-direction: column;
  88. align-items: center;
  89. justify-content: center;
  90. &.selected {
  91. width: 200rpx;
  92. height: 204rpx;
  93. background: #E9F0FF;
  94. border-radius: 32rpx;
  95. border: 2rpx solid #C1D5FF;
  96. }
  97. .option-icon {
  98. width: 88rpx;
  99. height: 88rpx;
  100. margin-bottom: 8rpx;
  101. }
  102. .option-text {
  103. font-size: 28rpx;
  104. font-weight: 500;
  105. color: #333;
  106. }
  107. }
  108. .popup-footer {
  109. margin-top: 44rpx;
  110. .cancel-btn {
  111. width: 100%;
  112. height: 88rpx;
  113. background: #E9F0FF;
  114. border-radius: 44rpx;
  115. font-weight: 400;
  116. font-size: 32rpx;
  117. color: #2361FF;
  118. line-height: 88rpx;
  119. text-align: center;
  120. font-style: normal;
  121. text-transform: none;
  122. }
  123. }
  124. @keyframes popIn {
  125. 0% {
  126. transform: scale(0);
  127. }
  128. 70% {
  129. transform: scale(1.2);
  130. }
  131. 100% {
  132. transform: scale(1);
  133. }
  134. }
  135. </style>