tradeSuccess.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <!-- 交易成功页面 -->
  2. <template>
  3. <scroll-view class="container" scroll-y @scrolltolower='getData'>
  4. <view class="main_content" :style="{backgroundImage: 'url('+imgUrl+'order-detail/order_success_bg.png'+')'}">
  5. <!-- 订单状态 start -->
  6. <view class="order_state">
  7. <image :src="imgUrl+'order-detail/dagou.png'" mode="" class="order_state_img"></image>
  8. <view class="order_state_text">{{$L('交易成功')}}</view>
  9. <view class="order_btn">
  10. <text @click="backIndex">{{$L('返回首页')}}</text>
  11. <text @click="lookOrder" v-if="sourceType == 'tradeSuccess'">{{$L('查看订单')}}</text>
  12. <text @click="goEvaluate" v-else>{{$L('立即评价')}}</text>
  13. </view>
  14. </view>
  15. <!-- 订单状态 end -->
  16. <!-- 推荐商品 start-->
  17. <view class="recomment">
  18. <recommendGoods ref='recomment_goods' />
  19. </view>
  20. <!-- 推荐商品 end-->
  21. </view>
  22. </scroll-view>
  23. </template>
  24. <script>
  25. import {
  26. mapState
  27. } from 'vuex';
  28. import recommendGoods from "@/components/recommend-goods.vue";
  29. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  30. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue';
  31. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue';
  32. let startY = 0,
  33. moveY = 0,
  34. pageAtTop = true;
  35. export default {
  36. components: {
  37. recommendGoods,
  38. uniPopup,
  39. uniPopupMessage,
  40. uniPopupDialog
  41. },
  42. data() {
  43. return {
  44. imgUrl: getApp().globalData.imgUrl,
  45. coverTransform: 'translateY(0px)',
  46. coverTransition: '0s',
  47. moving: false,
  48. orderSn:'', //订单号
  49. sourceType:'', //页面来源 orderDetail:订单详情 orderList:订单列表 tradeSuccess:支付成功
  50. }
  51. },
  52. async onLoad(option) {
  53. //订单号
  54. this.orderSn = option.orderSn;
  55. this.sourceType = option.sourceType;
  56. },
  57. computed: {
  58. ...mapState(['hasLogin', 'userInfo', 'userCenterData'])
  59. },
  60. methods: {
  61. initData() {
  62. },
  63. /**
  64. * 统一跳转接口,拦截未登录路由
  65. * navigator标签现在默认没有转场动画,所以用view
  66. */
  67. navTo(url) {
  68. if (!this.hasLogin) {
  69. url = '/pages/public/login';
  70. }
  71. uni.navigateTo({
  72. url
  73. })
  74. },
  75. /**
  76. * 会员卡下拉和回弹
  77. * 1.关闭bounce避免ios端下拉冲突
  78. * 2.由于touchmove事件的缺陷(以前做小程序就遇到,比如20跳到40,h5反而好很多),下拉的时候会有掉帧的感觉
  79. * transition设置0.1秒延迟,让css来过渡这段空窗期
  80. * 3.回弹效果可修改曲线值来调整效果,推荐一个好用的bezier生成工具 http://cubic-bezier.com/
  81. */
  82. coverTouchstart(e) {
  83. if (pageAtTop === false) {
  84. return;
  85. }
  86. this.coverTransition = 'transform .1s linear';
  87. startY = e.touches[0].clientY;
  88. },
  89. coverTouchmove(e) {
  90. moveY = e.touches[0].clientY;
  91. let moveDistance = moveY - startY;
  92. if (moveDistance < 0) {
  93. this.moving = false;
  94. return;
  95. }
  96. this.moving = true;
  97. if (moveDistance >= 80 && moveDistance < 100) {
  98. moveDistance = 80;
  99. }
  100. if (moveDistance > 0 && moveDistance <= 80) {
  101. this.coverTransform = `translateY(${moveDistance}px)`;
  102. }
  103. },
  104. coverTouchend() {
  105. if (this.moving === false) {
  106. return;
  107. }
  108. this.moving = false;
  109. this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
  110. this.coverTransform = 'translateY(0px)';
  111. },
  112. //返回首页
  113. backIndex(){
  114. uni.switchTab({
  115. url:'/pages/index/index'
  116. })
  117. },
  118. //去评价页面
  119. goEvaluate(){
  120. uni.redirectTo({
  121. url:'/pages/order/publishEvaluation?orderSn='+this.orderSn + '&sourceType=' + this.sourceType
  122. })
  123. },
  124. //查看订单
  125. lookOrder(){
  126. uni.redirectTo({
  127. url:'/pages/order/list'
  128. })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang='scss'>
  134. page {
  135. background: $bg-color-split;
  136. }
  137. .container {
  138. display: flex;
  139. flex: 1;
  140. height: 100vh;
  141. position: relative;
  142. width: 750rpx;
  143. margin: 0 auto;
  144. .main_content{
  145. width: 100%;
  146. background-repeat: no-repeat;
  147. background-size:750rpx 452rpx;
  148. padding-top: 92rpx;
  149. box-sizing: border-box;
  150. .order_state{
  151. display: flex;
  152. flex-direction: column;
  153. align-items: center;
  154. padding-bottom: 31rpx;
  155. .order_state_img{
  156. width: 99rpx;
  157. height: 99rpx;
  158. }
  159. .order_state_text{
  160. font-size: 34rpx;
  161. font-family: PingFang SC;
  162. font-weight: bold;
  163. color: #FFFFFF;
  164. margin: 30rpx 0 50rpx;
  165. }
  166. .order_btn{
  167. display: flex;
  168. align-items: center;
  169. text:nth-child(1){
  170. width: 210rpx;
  171. height: 60rpx;
  172. border: 1rpx solid #FFFFFF;
  173. border-radius: 30rpx;
  174. font-size: 28rpx;
  175. font-family: PingFang SC;
  176. font-weight: 500;
  177. color: #FFFFFF;
  178. text-align: center;
  179. line-height: 60rpx;
  180. }
  181. text:nth-child(2){
  182. width: 210rpx;
  183. height: 60rpx;
  184. background: #FFFFFF;
  185. box-shadow: 0rpx 10rpx 20rpx 0rpx rgba(252, 32, 28, 0.1);
  186. border-radius: 30rpx;
  187. font-size: 28rpx;
  188. font-family: PingFang SC;
  189. font-weight: 500;
  190. color: #FC1C1C;
  191. text-align: center;
  192. line-height: 60rpx;
  193. margin-left: 90rpx;
  194. }
  195. }
  196. }
  197. .recomment{
  198. background:linear-gradient(top, #FFFFFF 0%, #F5F5F5 20%, #F5F5F5 100%) ;
  199. box-sizing: border-box;
  200. border-radius: 30rpx 30rpx 0 0;
  201. }
  202. }
  203. }
  204. </style>