submit-confirm.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <u-popup v-model="showPopup" @close="closePopup" mode="center" border-radius="30" :width="width">
  3. <view class="submit-confirm">
  4. <view class="container-form">
  5. <view class="icon-wrapper">
  6. <image src="/static/tabbar/home2.png" class="tip-icon"></image>
  7. <text class="tip-text">温馨提示</text>
  8. </view>
  9. <view class="content">
  10. <view> 目前付款后<span class="highlight">24小时</span>内发货,如有发货超时或者物流异常情况,您可联系在线客服处理。
  11. </view>
  12. <view class="mt-20"> 页面库存同步有延迟为预估数字,<span
  13. class="highlight">实际库存以发货为准。</span>下单后如有售后电话或短信通知无货,请留意查收短信通知及时申请退款。</view>
  14. </view>
  15. <view class="footer">
  16. <button class="cancel-btn" @click="handleCancel">取消</button>
  17. <button class="confirm-btn" :disabled="countdown > 0" @click="handleConfirm">
  18. 确定提交{{ countdown > 0 ? `(${countdown}s)` : "" }}
  19. </button>
  20. </view>
  21. </view>
  22. </view>
  23. </u-popup>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. width: {
  29. type: String,
  30. default: "92%",
  31. },
  32. },
  33. data() {
  34. return {
  35. showPopup: false,
  36. countdown: 3,
  37. timer: null
  38. };
  39. },
  40. methods: {
  41. openPopup() {
  42. this.showPopup = true;
  43. this.startCountdown();
  44. },
  45. closePopup() {
  46. this.showPopup = false;
  47. this.countdown = 3;
  48. if (this.timer) {
  49. clearInterval(this.timer);
  50. this.timer = null;
  51. }
  52. },
  53. handleConfirm() {
  54. this.$emit("confirm");
  55. this.closePopup();
  56. },
  57. handleCancel() {
  58. this.$emit("cancel");
  59. this.closePopup();
  60. },
  61. startCountdown() {
  62. if (this.timer) {
  63. clearInterval(this.timer);
  64. }
  65. this.countdown = 3;
  66. this.timer = setInterval(() => {
  67. if (this.countdown > 0) {
  68. this.countdown--;
  69. } else {
  70. clearInterval(this.timer);
  71. this.timer = null;
  72. }
  73. }, 1000);
  74. },
  75. },
  76. beforeDestroy() {
  77. if (this.timer) {
  78. clearInterval(this.timer);
  79. this.timer = null;
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. .submit-confirm {
  86. background: #ffffff;
  87. border-radius: 26rpx;
  88. overflow: hidden;
  89. padding: 16rpx;
  90. background: linear-gradient(-90deg, #98e05f, #0de3ac);
  91. .container-form {
  92. background: #effcf3;
  93. border-radius: 26rpx;
  94. padding: 30rpx;
  95. padding-bottom: 40rpx;
  96. }
  97. .icon-wrapper {
  98. display: flex;
  99. align-items: center;
  100. justify-content: center;
  101. margin-bottom: 20rpx;
  102. .tip-icon {
  103. width: 48rpx;
  104. height: 48rpx;
  105. margin-right: 10rpx;
  106. }
  107. .tip-text {
  108. font-family: Source Han Sans CN;
  109. font-weight: bold;
  110. font-size: 36rpx;
  111. color: #37c148;
  112. }
  113. }
  114. .content {
  115. padding: 0 10rpx;
  116. font-size: 32rpx;
  117. color: #333333;
  118. line-height: 48rpx;
  119. view {
  120. font-size: 32rpx;
  121. }
  122. .highlight {
  123. color: #ff0000;
  124. }
  125. }
  126. .mt-20 {
  127. margin-top: 20rpx;
  128. }
  129. .footer {
  130. display: flex;
  131. gap: 30rpx;
  132. margin-top: 30rpx;
  133. padding: 0 10rpx;
  134. button {
  135. height: 88rpx;
  136. line-height: 88rpx;
  137. font-size: 32rpx;
  138. border: none;
  139. border-radius: 10rpx;
  140. &::after {
  141. border: none;
  142. }
  143. &.cancel-btn {
  144. flex: 1;
  145. background-color: #E3E3E3;
  146. color: #ffffff;
  147. width: 135rpx;
  148. }
  149. &.confirm-btn {
  150. flex: 2.5;
  151. width: 335rpx;
  152. background-color: #38c148;
  153. color: #ffffff;
  154. &:disabled {
  155. opacity: 0.7;
  156. }
  157. }
  158. }
  159. }
  160. }
  161. </style>