pay-qrcode.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="code-container">
  3. <view class="title center">扫一扫,向我付款</view>
  4. <view class="main-content">
  5. <!-- 收款码 -->
  6. <view class="charge-code center">
  7. <tki-qrcode
  8. cid="1"
  9. ref="qrcode-charge"
  10. :val="id"
  11. size="420"
  12. :onval="true"
  13. :loadMake="true"
  14. :usingComponents="true"
  15. />
  16. </view>
  17. </view>
  18. <view class="footer center">
  19. <text class="text-xl text-bold">{{shopDetail.name}}</text>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import tkiQrcode from "tki-qrcode"
  25. export default {
  26. components: {tkiQrcode},
  27. computed:{
  28. content(){
  29. let transformStr = (this.id*this.$global.TRANSFORM_PARAMS)*2
  30. return transformStr+this.secret
  31. }
  32. },
  33. data() {
  34. return {
  35. id: "",
  36. shopDetail:{},//商户详情
  37. avatar: "",
  38. secret: '000000',
  39. timer: '',
  40. }
  41. },
  42. methods: {
  43. async initAvatat(url){
  44. return new Promise((reslove,reject)=>{
  45. uni.downloadFile({
  46. url,
  47. success: (res)=> {
  48. reslove(res);
  49. },
  50. fail: (err) => {
  51. reject(err)
  52. }
  53. })
  54. })
  55. }
  56. },
  57. async mounted(option){
  58. let res=await this.$api.shop.detail({id:this.vuex_shopId})
  59. this.shopDetail=res.data
  60. let avatar=res.data.cover
  61. // this.avatar =(await this.initAvatat(avatar)).tempFilePath;
  62. //获取用户ID
  63. this.id = this.$global.QR_PATH+this.vuex_shopId
  64. //生成动态密码
  65. },
  66. beforeDestroy() {
  67. clearInterval(this.timer);
  68. }
  69. }
  70. </script>
  71. <style>
  72. page {
  73. background-color: #EF9944;
  74. }
  75. </style>
  76. <style lang="scss" scoped>
  77. .code-container{
  78. background-color: #FFFFFF;
  79. border-radius: 16rpx;
  80. // min-height: 900rpx;
  81. min-height: 800rpx;
  82. margin: 60rpx 20rpx;
  83. .title{
  84. border-radius: 25rpx 25rpx 0 0;
  85. height: 100rpx;
  86. width: 100%;
  87. font-size: 35rpx;
  88. color: #FE9644;
  89. background-color: #F7F7F7;
  90. font-weight: 600;
  91. letter-spacing: 3rpx;
  92. }
  93. .footer{
  94. width: 90%;
  95. height: 120rpx;
  96. margin-left: 5%;
  97. border-top: 1rpx dashed #dddddd;
  98. }
  99. .main-content{
  100. width: 100%;
  101. height: 600rpx;
  102. scroll-margin-top: 600rpx;
  103. // overflow: hidden;
  104. .bar-code{
  105. margin-left: 5%;
  106. width: 90%;
  107. height: 150rpx;
  108. }
  109. .qr-code{
  110. width: 100%;
  111. height: 450rpx;
  112. }
  113. .charge-code{
  114. width: 100%;
  115. height: 600rpx;
  116. transition: transform 1s ease-in-out;
  117. }
  118. }
  119. }
  120. </style>