index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="container">
  3. <!-- #ifdef H5 -->
  4. <!--公众号-->
  5. <view class="payCount" v-if="isWeixin">
  6. <view class="count">
  7. <view class="main">
  8. <view>点击右上角
  9. <text class='iconfont icon-gengduo2'></text>
  10. <image class="image" src="../../static/images/guide.png"></image>
  11. </view>
  12. <view>选择在<text class="text">浏览器</text>中打开,去支付宝支付</view>
  13. </view>
  14. </view>
  15. <view class="pay_count">
  16. <navigator url="/pages/users/order_list/index?status=1" class="payBtn bg-color">完成支付</navigator>
  17. <navigator url="/pages/users/order_list/index?status=0" class="payBtn bg-none">返回查看订单</navigator>
  18. </view>
  19. </view>
  20. <!--H5-->
  21. <view v-else>
  22. <view class="alipay">
  23. <image class="alipay_wait" src="../../static/images/alipay_wait.png"></image>
  24. <view class="alipay_text">正在跳转支付... </view>
  25. </view>
  26. <view class="pay_count">
  27. <navigator url="/pages/users/order_list/index?status=1" class="payBtn bg-color">完成支付</navigator>
  28. <navigator url="/pages/users/order_list/index?status=0" class="payBtn bg-none">返回查看订单</navigator>
  29. </view>
  30. </view>
  31. <!-- #endif -->
  32. <!-- #ifdef MP -->
  33. <!--小程序-->
  34. <view class="payCount">
  35. <view class="count">
  36. <view class="main_text">
  37. <view>去支付,请长按网址复制后 使用浏览器访问</view>
  38. <text class='copy' @tap='copy'>{{url}}</text>
  39. </view>
  40. </view>
  41. <view class="pay_count">
  42. <navigator url="/pages/users/order_list/index?status=1" class="payBtn bg-color">完成支付</navigator>
  43. <navigator url="/pages/users/order_list/index?status=0" class="payBtn bg-none">返回查看订单</navigator>
  44. </view>
  45. </view>
  46. <!-- #endif -->
  47. </view>
  48. </template>
  49. <script>
  50. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  51. import {
  52. getCallBackUrlApi
  53. } from "@/api/order";
  54. export default {
  55. data() {
  56. return {
  57. isWeixin: false,
  58. url: '',
  59. keyCode: ''
  60. };
  61. },
  62. /**
  63. * 生命周期函数--监听页面显示
  64. */
  65. onShow: function() {
  66. },
  67. onReady: function() {
  68. // #ifdef H5
  69. this.$nextTick(function() {
  70. const clipboard = new ClipboardJS(".copy-data");
  71. clipboard.on("success", () => {
  72. this.$util.Tips({
  73. title: '复制成功'
  74. });
  75. });
  76. });
  77. // #endif
  78. },
  79. onLoad: function(options){
  80. let that = this;
  81. that.url = options.url;
  82. if(options.keyCode && options.url){
  83. // #ifdef H5
  84. that.keyCode = options.keyCode;
  85. that.getCallBackUrl(that.keyCode);
  86. // 公众号
  87. if(that.$wechat.isWeixin()){
  88. that.isWeixin = true;
  89. }else{
  90. setTimeout(function(){
  91. window.location.href = that.url;
  92. },2000)
  93. }
  94. // #endif
  95. }
  96. },
  97. methods: {
  98. /**
  99. *
  100. * 剪切订单号
  101. */
  102. // #ifndef H5
  103. copy: function() {
  104. let that = this;
  105. uni.setClipboardData({
  106. data: that.url,
  107. success: function(res){
  108. }
  109. });
  110. },
  111. // #endif
  112. getCallBackUrl: function(key){
  113. let that = this;
  114. getCallBackUrlApi(key)
  115. .then(res => {
  116. that.url = res.message;
  117. })
  118. .catch(res => {
  119. that.$util.Tips({
  120. title: res
  121. });
  122. });
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss">
  128. .container{
  129. height: 100vh;
  130. background: #F5F5F5;
  131. }
  132. .payCount{
  133. padding-bottom: 60rpx;
  134. .count{
  135. padding-top: 260rpx;
  136. }
  137. .main{
  138. position: relative;
  139. padding: 0 100rpx;
  140. color: #111111;
  141. font-size: 32rpx;
  142. line-height: 60rpx;
  143. .text{
  144. color: #000000;
  145. font-size: 36rpx;
  146. margin: 0 4px;
  147. font-weight: 700;
  148. }
  149. .image{
  150. width: 200rpx;
  151. height: 200rpx;
  152. position: absolute;
  153. right: 50rpx;
  154. top: -200rpx;
  155. }
  156. }
  157. .main_text{
  158. position: relative;
  159. color: #111111;
  160. font-size: 32rpx;
  161. line-height: 60rpx;
  162. text-align: center;
  163. width: 600rpx;
  164. margin: 0 auto;
  165. }
  166. .copy{
  167. display: block;
  168. margin-top: 100rpx;
  169. font-weight: bold;
  170. word-break:break-all;
  171. }
  172. }
  173. .pay_count{
  174. padding: 0 15px;
  175. box-sizing: border-box;
  176. margin-top: 180rpx;
  177. }
  178. .payBtn{
  179. width: 690rpx;
  180. margin: 0 auto;
  181. height: 86rpx;
  182. border-radius: 50rpx;
  183. text-align: center;
  184. line-height: 86rpx;
  185. font-size: 30rpx;
  186. color: #fff;
  187. &.bg-none{
  188. color: #e93323;
  189. border: 1px solid #e93323;
  190. margin-top: 30rpx;
  191. }
  192. }
  193. .alipay{
  194. text-align: center;
  195. .alipay_wait{
  196. width: 502rpx;
  197. height: 400rpx;
  198. margin-top: 200rpx;
  199. }
  200. .alipay_text{
  201. color: #111111;
  202. font-size: 32rpx;
  203. margin-top: 40rpx;
  204. }
  205. }
  206. </style>