OrderSuccessPopup.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <u-popup
  3. v-model="showPopup"
  4. @close="closePopup"
  5. @open="openPopup"
  6. mode="center"
  7. border-radius="20"
  8. width="85%"
  9. class="first-order-free-popup"
  10. >
  11. <view class="popup-content">
  12. <image class="gift-image" :src="dialogInfo.img" mode="widthFix" @click="handleClick" />
  13. </view>
  14. </u-popup>
  15. </template>
  16. <script>
  17. export default {
  18. name: "OrderSuccessPopup",
  19. data() {
  20. return {
  21. showPopup: false,
  22. dialogInfo: {
  23. autoClose: "",
  24. autoCloseTime: "",
  25. img: "",
  26. jumpPage: "",
  27. },
  28. };
  29. },
  30. methods: {
  31. openPopup(data) {
  32. if (data.id) {
  33. this.dialogInfo = data;
  34. this.showPopup = true;
  35. this.autoClose();
  36. }
  37. },
  38. closePopup() {
  39. this.showPopup = false;
  40. this.$emit("close");
  41. if (this.dialogInfo.frequency == 1) {
  42. uni.setStorageSync("frequency", 1);
  43. } else {
  44. uni.removeStorageSync("frequency");
  45. }
  46. },
  47. //点击图片跳转
  48. handleClick() {
  49. if (this.dialogInfo.jumpPage) {
  50. uni.navigateTo({
  51. url: this.dialogInfo.jumpPage,
  52. });
  53. this.closePopup();
  54. }
  55. },
  56. //自动关闭弹窗
  57. autoClose() {
  58. if (this.dialogInfo?.autoClose == 1) {
  59. let time = this.dialogInfo.autoCloseTime ? this.dialogInfo.autoCloseTime * 1000 : 5000;
  60. setTimeout(() => {
  61. this.closePopup();
  62. }, time);
  63. }
  64. },
  65. },
  66. };
  67. </script>
  68. <style lang="scss">
  69. .popup-content {
  70. position: relative;
  71. display: flex;
  72. flex-direction: column;
  73. align-items: center;
  74. .gift-image {
  75. width: 100%;
  76. height: auto;
  77. }
  78. .action-buttons {
  79. position: absolute;
  80. bottom: 100rpx;
  81. width: 100%;
  82. display: flex;
  83. flex-direction: column;
  84. align-items: center;
  85. }
  86. .check-rules {
  87. font-size: 40rpx;
  88. color: #ffffff;
  89. text-align: center;
  90. padding: 10rpx;
  91. padding-left: 80rpx;
  92. }
  93. }
  94. </style>