PersonalExpressDialog.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. const url = encodeURIComponent(company == '京东' ? "https://www.jdl.com/" : "https://www.sf-express.com/chn/sc")
  53. uni.navigateTo({
  54. url:'/pages/webView/webView?url=' + url
  55. })
  56. selectedExpress.value = ''
  57. }, 300)
  58. }
  59. const handleClose = () => {
  60. selectedExpress.value = ''
  61. emit('update:visible', false)
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .popup-content {
  66. padding: 32rpx 16rpx 0rpx 16rpx;
  67. background-color: #fff;
  68. border-radius: 40rpx 40rpx 0rpx 0rpx;
  69. }
  70. .popup-header {
  71. display: flex;
  72. justify-content: center;
  73. align-items: center;
  74. margin-bottom: 46rpx;
  75. }
  76. .popup-title {
  77. height: 52rpx;
  78. line-height: 52rpx;
  79. font-size: 36rpx;
  80. font-weight: bold;
  81. color: #333;
  82. }
  83. .express-options {
  84. height: 204rpx;
  85. display: flex;
  86. justify-content: space-around;
  87. }
  88. .express-option {
  89. width: 200rpx;
  90. display: flex;
  91. flex-direction: column;
  92. align-items: center;
  93. justify-content: center;
  94. &.selected {
  95. width: 200rpx;
  96. height: 204rpx;
  97. background: #E9F0FF;
  98. border-radius: 32rpx;
  99. border: 2rpx solid #C1D5FF;
  100. }
  101. .option-icon {
  102. width: 88rpx;
  103. height: 88rpx;
  104. margin-bottom: 8rpx;
  105. }
  106. .option-text {
  107. font-size: 28rpx;
  108. font-weight: 500;
  109. color: #333;
  110. }
  111. }
  112. .popup-footer {
  113. margin-top: 44rpx;
  114. .cancel-btn {
  115. width: 100%;
  116. height: 88rpx;
  117. background: #E9F0FF;
  118. border-radius: 44rpx;
  119. font-weight: 400;
  120. font-size: 32rpx;
  121. color: #2361FF;
  122. line-height: 88rpx;
  123. text-align: center;
  124. font-style: normal;
  125. text-transform: none;
  126. }
  127. }
  128. @keyframes popIn {
  129. 0% {
  130. transform: scale(0);
  131. }
  132. 70% {
  133. transform: scale(1.2);
  134. }
  135. 100% {
  136. transform: scale(1);
  137. }
  138. }
  139. </style>