payCodePopup.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view>
  3. <uni-popup ref="payPopup" type="center">
  4. <view class="pay-popup">
  5. <image class="delete-icon" src="../static/images/icon-delete.png" @click="closePayDetail"></image>
  6. <view class="item">
  7. <view class="label">支付宝</view>
  8. <view class="qrcode">
  9. <image :src="aliCodeImg"></image>
  10. <!-- <mosowe-canvas-image ref="aliCanvas" @canvasImage="aliCanvasImage" :lists="aliLists" height="40vw" width="40vw" /> -->
  11. </view>
  12. </view>
  13. <view class="item">
  14. <view class="label">微信</view>
  15. <view class="qrcode">
  16. <image :src="wxCodeImg"></image>
  17. <!-- <mosowe-canvas-image ref="wxCanvas" @canvasImage="wxCanvasImage" :lists="wxLists" height="40vw" width="40vw" /> -->
  18. </view>
  19. </view>
  20. </view>
  21. </uni-popup>
  22. </view>
  23. </template>
  24. <script>
  25. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  26. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
  27. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  28. export default {
  29. props: {
  30. orderSn: {
  31. type: String
  32. },
  33. type: {
  34. type: String
  35. }
  36. },
  37. data() {
  38. return {
  39. timer: '',
  40. aliLists: [{
  41. type: 'qr',
  42. content: '',
  43. x: 0,
  44. y: 0,
  45. }],
  46. aliCodeImg: '',
  47. wxLists: [{
  48. type: 'qr',
  49. content: '',
  50. x: 0,
  51. y: 0,
  52. }],
  53. wxCodeImg: ''
  54. };
  55. },
  56. created() {
  57. },
  58. methods: {
  59. init(res) {
  60. const $this = this;
  61. let info = uni.getSystemInfoSync()
  62. this.aliCodeImg = res.aliCode;
  63. this.wxCodeImg = res.wxCode;
  64. // this.aliLists[0].content = res.aliCode;
  65. // this.aliLists[0].width = info.screenWidth * 0.4
  66. // this.aliLists[0].height = info.screenWidth * 0.4
  67. // this.wxLists[0].content = res.wxCode;
  68. // this.wxLists[0].width = info.screenWidth * 0.4
  69. // this.wxLists[0].height = info.screenWidth * 0.4
  70. this.$nextTick(function() {
  71. console.log("SSS2-1");
  72. $this.$refs.payPopup.open();
  73. console.log("SSS2");
  74. $this.$refs.payPopup.open();
  75. // setTimeout(function() {
  76. // console.log("SSS3");
  77. // $this.$refs.aliCanvas.createCanvas();
  78. // console.log("SSS4");
  79. // $this.$refs.wxCanvas.createCanvas();
  80. // }, 500)
  81. clearInterval($this.timer)
  82. $this.timer = setInterval(function() {
  83. $this.getPayStatus();
  84. }, 3000)
  85. })
  86. },
  87. aliCanvasImage(e) {
  88. this.aliCodeImg = e;
  89. },
  90. wxCanvasImage(e) {
  91. this.wxCodeImg = e;
  92. },
  93. getPayStatus() {
  94. this.$api.offorderGetStatus({
  95. orderSn: this.orderSn
  96. }).then(res => {
  97. if (res.status == 1) {
  98. clearInterval(this.timer);
  99. console.log("SSS5");
  100. this.$refs.payPopup.close();
  101. this.$emit('success', this.type)
  102. }
  103. })
  104. },
  105. clearTimer() {
  106. clearInterval(this.timer);
  107. },
  108. closePayDetail() {
  109. clearInterval(this.timer)
  110. this.$nextTick(function() {
  111. this.$refs.payPopup.close();
  112. })
  113. },
  114. }
  115. }
  116. </script>
  117. <style lang="scss">
  118. .pay-popup {
  119. position: relative;
  120. display: flex;
  121. align-items: center;
  122. justify-content: space-around;
  123. width: 90vw;
  124. min-height: 70vw;
  125. margin: 0 5.8vw 1.9vw;
  126. border-radius: .8vw;
  127. background-color: #F8F8F8;
  128. .delete-icon {
  129. position: absolute;
  130. top: 4vw;
  131. right: 4vw;
  132. width: 3.3vw;
  133. height: 3.3vw;
  134. }
  135. .item {
  136. display: flex;
  137. align-items: center;
  138. flex-direction: column;
  139. .qrcode {
  140. width: 40vw;
  141. height: 40vw;
  142. image {
  143. width: 40vw;
  144. height: 40vw;
  145. }
  146. }
  147. .label {
  148. margin-bottom: 2.9vw;
  149. font-size: 2.9vw;
  150. font-weight: 500;
  151. }
  152. }
  153. }
  154. </style>