order-success.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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
  27. class="gzh-img"
  28. src="../static/gzh.png"
  29. mode="widthFix"
  30. style="width: 100vw; margin-top: 100rpx"
  31. ></image>
  32. </view>
  33. <OrderSuccessPopup ref="orderPopupRef" />
  34. </view>
  35. </template>
  36. <script>
  37. import OrderSuccessPopup from "../components/OrderSuccessPopup.vue";
  38. export default {
  39. data() {
  40. return {
  41. startX: 0,
  42. };
  43. },
  44. components: {
  45. OrderSuccessPopup,
  46. },
  47. onUnload() {
  48. uni.navigateTo({
  49. url: "/pages/home/index",
  50. });
  51. },
  52. methods: {
  53. touchStart(e) {
  54. this.startX = e.touches[0].clientX;
  55. },
  56. touchEnd(e) {
  57. const endX = e.changedTouches[0].clientX;
  58. if (this.startX - endX > 50) {
  59. // 左滑距离超过50px
  60. uni.navigateBack({ delta: 2 }); // 返回两级
  61. }
  62. },
  63. notifyStatusChange() {
  64. // 处理状态变更通知逻辑
  65. console.log("状态变更通知");
  66. },
  67. viewOrder() {
  68. uni.navigateTo({
  69. url: "/pages-mine/pages/order-page?status=-1",
  70. });
  71. },
  72. goHome() {
  73. uni.switchTab({
  74. url: "/pages/home/index",
  75. });
  76. },
  77. //获取弹窗信息
  78. getDialogInfo() {
  79. uni.$u.http.post("/token/submitPage/dialog").then((res) => {
  80. if (res.code == 200) {
  81. res.data?.id && this.$refs.orderPopupRef.openPopup(res.data);
  82. }
  83. });
  84. },
  85. // 打开公众号
  86. openOfficialAccount() {
  87. uni.getProvider({
  88. service: "oauth",
  89. success: function (res) {
  90. console.log(res,'xxxx');
  91. if (res.provider.includes("weixin")) {
  92. // 调用微信小程序的 wx.openOfficialAccountProfile
  93. wx.openOfficialAccountProfile({
  94. username: "bookersea",
  95. success: function (res) {
  96. console.log("打开公众号资料页成功", res);
  97. },
  98. fail: function (err) {
  99. console.log("打开公众号资料页失败", err);
  100. },
  101. complete: function () {
  102. console.log("接口调用结束");
  103. },
  104. });
  105. }
  106. },
  107. });
  108. return;
  109. uni.navigateTo({
  110. url: "/pages-home/pages/official-account",
  111. });
  112. },
  113. },
  114. onLoad() {
  115. let frequency = uni.getStorageSync("frequency");
  116. if (!frequency) {
  117. this.getDialogInfo();
  118. }
  119. },
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. .order-success {
  124. display: flex;
  125. flex-direction: column;
  126. align-items: center;
  127. background-color: #ffffff;
  128. padding: 34rpx 0 44rpx 0;
  129. height: 100vh;
  130. .success-icon {
  131. width: 200rpx;
  132. height: 200rpx;
  133. }
  134. .success-title {
  135. font-family: PingFang SC;
  136. font-weight: 400;
  137. font-size: 40rpx;
  138. color: #333333;
  139. line-height: 107rpx;
  140. }
  141. .success-message {
  142. font-family: PingFang SC;
  143. font-weight: 400;
  144. font-size: 28rpx;
  145. color: #999999;
  146. margin-bottom: 40rpx;
  147. }
  148. .button-group {
  149. display: flex;
  150. justify-content: center;
  151. gap: 70rpx;
  152. }
  153. }
  154. </style>