paycode.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. title="兑换码"
  5. :placeholder="true"
  6. :autoBack="true"
  7. @leftClick="leftClick"
  8. :safeAreaInsetTop="true"
  9. >
  10. </u-navbar>
  11. <view class="avatar-wrap u-flex">
  12. <u-avatar :src="vuex_member_info.avatar||'/static/img/defaultavatar.png'" size="138rpx"></u-avatar>
  13. </view>
  14. <view class="name">{{vuex_member_info.name}}</view>
  15. <view class="ayQrcode">
  16. <view class="code">
  17. 数字码:{{code}}
  18. </view>
  19. <ayQrcode ref="qrcode" :modal="modal_qr" :url="qrContent" @hideQrcode="hideQrcode" :height="200" :width="200" />
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import ayQrcode from "@/components/ay-qrcode/ay-qrcode.vue"
  25. export default {
  26. components:{
  27. ayQrcode
  28. },
  29. data() {
  30. return {
  31. code:'',
  32. staticUrl:this.$commonConfig.staticUrl,
  33. modal_qr: false,
  34. qrContent: {}, // 要生成的二维码值
  35. params:{
  36. },
  37. timer: null,
  38. }
  39. },
  40. onShow() {
  41. },
  42. onLoad(page) {
  43. this.code = page.qrContent;
  44. this.qrContent.qrcode = page.qrContent;
  45. this.qrContent = JSON.stringify(this.qrContent);
  46. let that = this;
  47. that.showQrcode();//一加载生成二维码
  48. // this.timer = setInterval(() => {
  49. // this.refreshCode()
  50. // }, 30000);
  51. },
  52. onUnload() {
  53. // 页面离开时停止计时器
  54. // clearInterval(this.timer)
  55. },
  56. methods: {
  57. leftClick(){
  58. // uni.reLaunch({url: `/pages/index/index`});
  59. },
  60. // 展示二维码
  61. showQrcode() {
  62. let _this = this;
  63. this.modal_qr = true;
  64. // uni.showLoading()
  65. setTimeout(function() {
  66. // uni.hideLoading()
  67. _this.$refs.qrcode.crtQrCode()
  68. }, 50)
  69. },
  70. //传入组件的方法
  71. hideQrcode() {
  72. this.modal_qr = false;
  73. },
  74. refreshCode(){
  75. this.qrContent = {};
  76. this.qrContent.qrcode = this.code;
  77. this.qrContent = JSON.stringify(this.qrContent);
  78. this.showQrcode()
  79. }
  80. }
  81. }
  82. </script>
  83. <style>
  84. page{
  85. background-color: #009AEF;
  86. }
  87. </style>
  88. <style lang="scss" scoped>
  89. .avatar-wrap{
  90. margin-top: 42rpx;
  91. margin-bottom: 8rpx;
  92. justify-content: center;
  93. }
  94. .name{
  95. font-size: 34rpx;
  96. font-family: PingFangSC-Semibold, PingFang SC;
  97. font-weight: 600;
  98. color: #FFFFFF;
  99. line-height: 48rpx;
  100. text-align: center;
  101. margin-bottom: 60rpx;
  102. }
  103. .ayQrcode{
  104. position: relative;
  105. background-color: #fff;
  106. margin: 40rpx 60rpx 20rpx;
  107. padding: 40rpx 40rpx 100rpx;
  108. border-radius: 20rpx;
  109. text-align: center;
  110. .code{
  111. padding-bottom: 38rpx;
  112. border-bottom: 1px dashed #ddd;
  113. margin-bottom: 90rpx;
  114. font-size: 30rpx;
  115. font-family: PingFangSC-Regular, PingFang SC;
  116. font-weight: 400;
  117. color: #666666;
  118. line-height: 42rpx;
  119. }
  120. .show-qrcode{
  121. overflow: hidden;
  122. display: flex;
  123. justify-content: center;
  124. /deep/ .box-qrcode{
  125. margin-left: 25px!important;
  126. }
  127. }
  128. &:before,&:after{
  129. content: '';
  130. width: 40rpx;
  131. height: 40rpx;
  132. background-color: #009AEF;
  133. position: absolute;
  134. top: 100rpx;
  135. border-radius: 50%;
  136. }
  137. &:before{
  138. left: -20rpx;
  139. }
  140. &:after{
  141. right: -20rpx;
  142. }
  143. }
  144. .tip{
  145. margin-top: 40rpx;
  146. font-size: 24rpx;
  147. font-weight: 400;
  148. color: #999999;
  149. line-height: 33rpx;
  150. .refresh-ico{
  151. width: 27rpx;
  152. height: 27rpx;
  153. margin-right: 10rpx;
  154. }
  155. }
  156. </style>