payCode.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view style="height: 100%;
  3. background: linear-gradient(to bottom right, #d7fdfc, #f2f9fe);">
  4. <view class="view2">
  5. <text class="payMode1" :size="26" bold block>支付方式:</text>
  6. <text class="payMode2" :size="18" bold>等值积分</text>
  7. </view>
  8. <view style="height: 110%">
  9. <view id="view1" style="height: 100%">
  10. <view class="payCodeView">
  11. <!-- <view style="padding: 0 5rpx;font-size: 32rpx; font-weight: bold;background-color: #41c8bf;color: #ffffff;
  12. position:absolute;top: 200px;">
  13. HS
  14. </view> -->
  15. <uqrcode style="z-index: 0;" ref="uqrcode"></uqrcode>
  16. <!-- <u--image :showLoading="true" radius="7" :src="payCode" width="200px" height="200px"></u--image> -->
  17. </view>
  18. </view>
  19. <view style="height: 100%;padding-bottom: 520rpx;">
  20. <u-button class="sxButton" icon="reload" size="normal" loadingMode="circle" color="rgb(55,186,189)"
  21. @click="refreshQRCode">刷新
  22. </u-button>
  23. <view style="height: 100"></view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. payCode: '../../static/uview/user/payCodeDemo.png',
  33. imgSrc: "../../static/uview/willalpImg/750x560-.png",
  34. payMode1: '',
  35. height:0,
  36. payMode2: '',
  37. codeText: {
  38. u: uni.getStorageSync('setUserName'),
  39. un: uni.getStorageSync('userInfo').nickName,
  40. o: uni.getStorageSync('orgInfo').organizationCode,
  41. d: this.$dateResult(new Date(), 'datetime')
  42. },
  43. // viewHeight: document.getElementById('view1')
  44. }
  45. },
  46. mounted() {
  47. uni.getSystemInfo({
  48. success: res => {
  49. that.height = res.windowHeight - uni.getStorageSync('mydomHeight')
  50. }
  51. })
  52. },
  53. onReady() {
  54. this.getQRCode()
  55. // console.log(this.viewHeight)
  56. },
  57. methods: {
  58. refreshQRCode() {
  59. uni.redirectTo({
  60. url: 'payCode'
  61. })
  62. // this.getQRCode()
  63. },
  64. getQRCode() {
  65. this.$refs.uqrcode.make({
  66. mode: 'canvas', // 默认为view
  67. size: 250,
  68. text: JSON.stringify(this.codeText)
  69. })
  70. .then(res => {
  71. // 返回的res与uni.canvasToTempFilePath返回一致
  72. console.log(res)
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style>
  79. page {
  80. background: linear-gradient(to bottom right, #d7fdfc, #f2f9fe);
  81. }
  82. .view1 {
  83. height: 100%;
  84. padding: 5%;
  85. }
  86. .view2 {
  87. padding: 50rpx 5px;
  88. border-radius: 10px;
  89. box-shadow: 0px 2px 2px #9e9e9e;
  90. }
  91. .payCodeView {
  92. padding: 100rpx 20rpx;
  93. height: 78%;
  94. display: flex;
  95. flex-direction: row;
  96. justify-content: center;
  97. }
  98. .sxButton {
  99. width: 100px;
  100. display: flex;
  101. flex-direction: column;
  102. align-items: center;
  103. }
  104. .payMode1 {
  105. color: #5a8e7d;
  106. font-size: 55rpx;
  107. font-weight: bold;
  108. padding: 10px 0 5px 10px;
  109. }
  110. .payMode2 {
  111. font-weight: bold;
  112. color: #767676;
  113. font-size: 45rpx;
  114. padding: 5px 0 15px 10px;
  115. }
  116. </style>