order-success.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. <!-- 公众号图片展示 -->
  25. <view class="gzh-img-box" @click="openOfficialAccount">
  26. <image class="gzh-img" src="../static/gzh.png" mode="widthFix" style="width: 100vw;margin-top: 100rpx;"></image>
  27. </view>
  28. <OrderSuccessPopup ref="orderPopupRef" />
  29. </view>
  30. </template>
  31. <script>
  32. import OrderSuccessPopup from "../components/OrderSuccessPopup.vue";
  33. export default {
  34. data() {
  35. return {
  36. startX: 0
  37. };
  38. },
  39. components: {
  40. OrderSuccessPopup,
  41. },
  42. onUnload() {
  43. uni.navigateTo({
  44. url: "/pages/home/index",
  45. });
  46. },
  47. methods: {
  48. touchStart(e) {
  49. this.startX = e.touches[0].clientX;
  50. },
  51. touchEnd(e) {
  52. const endX = e.changedTouches[0].clientX;
  53. if (this.startX - endX > 50) {
  54. // 左滑距离超过50px
  55. uni.navigateBack({ delta: 2 }); // 返回两级
  56. }
  57. },
  58. notifyStatusChange() {
  59. // 处理状态变更通知逻辑
  60. console.log("状态变更通知");
  61. },
  62. viewOrder() {
  63. uni.navigateTo({
  64. url: "/pages-mine/pages/order-page?status=-1",
  65. });
  66. },
  67. goHome() {
  68. uni.switchTab({
  69. url: "/pages/home/index",
  70. });
  71. },
  72. //获取弹窗信息
  73. getDialogInfo() {
  74. uni.$u.http.post("/token/submitPage/dialog").then((res) => {
  75. if (res.code == 200) {
  76. res.data?.id && this.$refs.orderPopupRef.openPopup(res.data);
  77. }
  78. });
  79. },
  80. // 打开公众号
  81. openOfficialAccount() {
  82. uni.navigateTo({
  83. url: '/pages-home/pages/official-account'
  84. });
  85. }
  86. },
  87. onLoad() {
  88. let frequency = uni.getStorageSync("frequency");
  89. if (!frequency) {
  90. this.getDialogInfo();
  91. }
  92. },
  93. };
  94. </script>
  95. <style lang="scss" scoped>
  96. .order-success {
  97. display: flex;
  98. flex-direction: column;
  99. align-items: center;
  100. background-color: #ffffff;
  101. padding: 34rpx 0 44rpx 0;
  102. height: 100vh;
  103. .success-icon {
  104. width: 200rpx;
  105. height: 200rpx;
  106. }
  107. .success-title {
  108. font-family: PingFang SC;
  109. font-weight: 400;
  110. font-size: 40rpx;
  111. color: #333333;
  112. line-height: 107rpx;
  113. }
  114. .success-message {
  115. font-family: PingFang SC;
  116. font-weight: 400;
  117. font-size: 28rpx;
  118. color: #999999;
  119. margin-bottom: 40rpx;
  120. }
  121. .button-group {
  122. display: flex;
  123. justify-content: center;
  124. gap: 70rpx;
  125. }
  126. }
  127. </style>