orderPaySuccess.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view class="top">
  5. <text class="title">{{order.status==2?"支付成功":"支付失败"}}</text>
  6. <image class="icon" :src="order.status==2?'/static/images/success.png':'/static/images/error.png'" ></image>
  7. <view class="btn-box">
  8. <view class="btn cancel" @click="showOrderDetails(order.orderId)"> 查看订单</view>
  9. </view>
  10. </view>
  11. <!-- 订单详情查看 -->
  12. <view class="order-info">
  13. <view class="title">订单信息</view>
  14. <view class="item">
  15. <text class="label">订单编号</text>
  16. <view class="sn-box">
  17. <text class="text">{{order.orderSn}}</text>
  18. <view class="copy-btn" @click="copyTest(order.orderSn)">复制</view>
  19. </view>
  20. </view>
  21. <view class="item">
  22. <text class="label">支付金额</text>
  23. <text class="text">{{order.payMoney.toFixed(2)}}</text>
  24. </view>
  25. <view class="item">
  26. <text class="label">下单时间</text>
  27. <text class="text">{{order.createTime}}</text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import {orderDetail} from '@/api/courseAnswer.js'
  35. export default {
  36. data() {
  37. return {
  38. order:null,
  39. orderId:''
  40. }
  41. },
  42. onLoad(option) {
  43. uni.setNavigationBarTitle({
  44.   title:'支付结果'
  45. })
  46. this.orderId=option.orderId;
  47. this.getOrderDetail();
  48. },
  49. methods: {
  50. getOrderDetail(type){
  51. var data={orderId:this.orderId};
  52. orderDetail(data).then(res => {
  53. if(res.code==200){
  54. this.order=res.data;
  55. }else{
  56. uni.showToast({
  57. icon:'none',
  58. title: "请求失败",
  59. });
  60. }
  61. });
  62. },
  63. copyTest(text) {
  64. // 复制方法
  65. uni.setClipboardData({
  66. data:text,
  67. success:()=>{
  68. uni.showToast({
  69. title:'内容已成功复制到剪切板',
  70. icon:'none'
  71. })
  72. }
  73. });
  74. },
  75. showOrderDetails(orderId){
  76. console.log(orderId)
  77. uni.redirectTo({
  78. url: "/pages/courseAnswer/orderDetail?orderId="+orderId
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. page{
  86. height: 100%;
  87. }
  88. .content{
  89. height: 100%;
  90. display: flex;
  91. flex-direction: column;
  92. justify-content: space-between;
  93. .inner{
  94. padding: 20upx;
  95. .top{
  96. box-sizing: border-box;
  97. background: #FFFFFF;
  98. border-radius: 16upx;
  99. display: flex;
  100. flex-direction: column;
  101. align-items: center;
  102. padding: 50upx 0upx;
  103. .title{
  104. font-size: 40upx;
  105. font-family: PingFang SC;
  106. font-weight: 500;
  107. color: #222222;
  108. line-height: 1;
  109. text-align: center;
  110. }
  111. .icon{
  112. margin: 60upx 0upx;
  113. width: 100upx;
  114. height: 100upx;
  115. }
  116. }
  117. .order-info{
  118. margin-top: 20upx;
  119. background: #FFFFFF;
  120. border-radius: 16upx;
  121. padding: 40upx 30upx;
  122. .title{
  123. font-size: 30upx;
  124. font-family: PingFang SC;
  125. font-weight: bold;
  126. color: #222222;
  127. line-height: 1;
  128. }
  129. .item{
  130. margin-top: 40upx;
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. .label{
  135. font-size: 26upx;
  136. font-family: PingFang SC;
  137. font-weight: 500;
  138. color: #666666;
  139. line-height: 1;
  140. }
  141. .text{
  142. font-size: 26upx;
  143. font-family: PingFang SC;
  144. font-weight: 500;
  145. color: #222222;
  146. line-height: 32upx;
  147. }
  148. .cont-text{
  149. font-size: 26upx;
  150. font-family: PingFang SC;
  151. font-weight: 500;
  152. color: #666666;
  153. .bold{
  154. color: #111111;
  155. }
  156. }
  157. .sn-box{
  158. display: flex;
  159. align-items: center;
  160. .copy-btn{
  161. width: 58upx;
  162. height: 32upx;
  163. line-height: 32upx;
  164. text-align: center;
  165. font-size: 22upx;
  166. font-family: PingFang SC;
  167. font-weight: 500;
  168. color: #222222;
  169. background: #F5F5F5;
  170. border-radius: 4upx;
  171. margin-left: 24upx;
  172. }
  173. }
  174. }
  175. .line{
  176. width: 100%;
  177. height: 1px;
  178. background: #F0F0F0;
  179. margin-top: 30upx;
  180. }
  181. }
  182. }
  183. .btn-box{
  184. margin-top: 20upx;
  185. box-sizing: border-box;
  186. display: flex;
  187. align-items: center;
  188. .btn{
  189. width: 155upx;
  190. height: 64upx;
  191. line-height: 64upx;
  192. font-size: 26upx;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. text-align: center;
  196. border-radius: 32upx;
  197. &.cancel{
  198. border: 1px solid #DDDDDD;
  199. color: #666666;
  200. }
  201. }
  202. }
  203. }
  204. </style>