order-success.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="order-success" @touchstart="touchStart" @touchend="touchEnd">
  3. <image class="success-icon" src="../static/success.png" mode="widthFix"></image>
  4. <text class="success-title">订单提交成功</text>
  5. <text class="success-message">您的订单已提交,书嗨稍后将安排快递上门取书!</text>
  6. <view class="button-group">
  7. <u-button
  8. class="notify-button"
  9. :custom-style="{ borderColor: '#07c160', width: '235rpx', color: '#07c160' }"
  10. type="default"
  11. @click="goHome"
  12. >返回首页</u-button
  13. >
  14. <!-- <u-button class="notify-button" :custom-style="{borderColor: '#07c160',width:'235rpx',
  15. color: '#07c160'}" type="default" @click="notifyStatusChange">状态变更通知</u-button> -->
  16. <u-button
  17. :custom-style="{ background: '#07c160', width: '235rpx', color: '#ffffff' }"
  18. class="view-order-button"
  19. type="primary"
  20. @click="viewOrder"
  21. >查看订单</u-button
  22. >
  23. </view>
  24. <OrderSuccessPopup ref="orderPopupRef" />
  25. </view>
  26. </template>
  27. <script>
  28. import OrderSuccessPopup from "../components/OrderSuccessPopup.vue";
  29. export default {
  30. data() {
  31. return {
  32. startX: 0,
  33. };
  34. },
  35. components: {
  36. OrderSuccessPopup,
  37. },
  38. onUnload() {
  39. uni.navigateTo({
  40. url: "/pages/home/index",
  41. });
  42. },
  43. methods: {
  44. touchStart(e) {
  45. this.startX = e.touches[0].clientX;
  46. },
  47. touchEnd(e) {
  48. const endX = e.changedTouches[0].clientX;
  49. if (this.startX - endX > 50) {
  50. // 左滑距离超过50px
  51. uni.navigateBack({ delta: 2 }); // 返回两级
  52. }
  53. },
  54. notifyStatusChange() {
  55. // 处理状态变更通知逻辑
  56. console.log("状态变更通知");
  57. },
  58. viewOrder() {
  59. uni.navigateTo({
  60. url: "/pages-mine/pages/order-page?status=-1",
  61. });
  62. },
  63. goHome() {
  64. uni.switchTab({
  65. url: "/pages/home/index",
  66. });
  67. },
  68. //获取弹窗信息
  69. getDialogInfo() {
  70. uni.$u.http.post("/token/submitPage/dialog").then((res) => {
  71. if (res.code == 200) {
  72. res.data?.id && this.$refs.orderPopupRef.openPopup(res.data);
  73. }
  74. });
  75. },
  76. },
  77. onLoad() {
  78. let frequency = uni.getStorageSync("frequency");
  79. if (!frequency) {
  80. this.getDialogInfo();
  81. }
  82. },
  83. };
  84. </script>
  85. <style lang="scss" scoped>
  86. .order-success {
  87. display: flex;
  88. flex-direction: column;
  89. align-items: center;
  90. background-color: #ffffff;
  91. padding: 34rpx 0 44rpx 0;
  92. height: 100vh;
  93. .success-icon {
  94. width: 200rpx;
  95. height: 200rpx;
  96. }
  97. .success-title {
  98. font-family: PingFang SC;
  99. font-weight: 400;
  100. font-size: 40rpx;
  101. color: #333333;
  102. line-height: 107rpx;
  103. }
  104. .success-message {
  105. font-family: PingFang SC;
  106. font-weight: 400;
  107. font-size: 28rpx;
  108. color: #999999;
  109. margin-bottom: 40rpx;
  110. }
  111. .button-group {
  112. display: flex;
  113. justify-content: center;
  114. gap: 70rpx;
  115. }
  116. }
  117. </style>