paycode.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. title="推广码"
  5. :placeholder="true"
  6. :autoBack="true"
  7. :safeAreaInsetTop="true"
  8. >
  9. </u-navbar>
  10. <view class="content">
  11. <img class="qrCode" :src="details.qrCode" alt="">
  12. <view class="tip">仅限消费者注册使用</view>
  13. <text class="save" @click="save">保存本地</text>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import {downloadImage} from '@/utils/downloadImage.js';
  19. export default {
  20. components:{
  21. },
  22. data() {
  23. return {
  24. id:'',
  25. staticUrl:this.$commonConfig.staticUrl,
  26. details:{}
  27. }
  28. },
  29. onShow() {
  30. },
  31. onLoad(page) {
  32. console.log('page',page);
  33. this.id = page.id;
  34. this.getPageData()
  35. },
  36. onUnload() {
  37. },
  38. onReady() {
  39. },
  40. methods: {
  41. getPageData(){
  42. this.$u.api.shopById({id:this.id}).then(res=>{
  43. this.details = res.data;
  44. // console.log('getPageData',this.details);
  45. }).catch(err=>{
  46. console.log('getPageData',err);
  47. })
  48. },
  49. save(){
  50. downloadImage(this.details.qrCode, this.details.name);
  51. }
  52. }
  53. }
  54. </script>
  55. <style>
  56. page{
  57. background-color: #005223;
  58. }
  59. </style>
  60. <style lang="scss" scoped>
  61. .content{
  62. text-align: center;
  63. margin: 90rpx 45rpx 24rpx;
  64. background: #FFFFFF;
  65. border-radius: 8rpx;
  66. padding: 100rpx 20rpx;
  67. box-sizing: border-box;
  68. .qrCode{
  69. width: 250px;
  70. height: 250px;
  71. }
  72. .tip{
  73. font-size: 24rpx;
  74. font-weight: 400;
  75. color: #999999;
  76. margin-bottom: 40rpx;
  77. }
  78. .save{
  79. padding: 25rpx 98rpx;
  80. font-size: 26rpx;
  81. font-weight: 600;
  82. color: #FFFFFF;
  83. background-color: #00A447;
  84. border-radius: 4rpx;
  85. }
  86. }
  87. </style>