code.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="container">
  3. <view class="info-list">
  4. <view class="info-item">
  5. <view class="contacts">
  6. <text class="name"><text class="iconfont icon-bangzhu"></text> 向商家展示会员码</text>
  7. </view>
  8. </view>
  9. </view>
  10. <view class="info-code">
  11. <view class="code-text">会员号:{{ userInfo.userNo ? userInfo.userNo : '--'}}</view>
  12. <image class="qrcode" :src="qrCode"></image>
  13. </view>
  14. <!-- 底部操作按钮 -->
  15. <view class="footer-fixed">
  16. <view class="btn-wrapper">
  17. <view class="btn-item btn-item-main" @click="goBack()">返回主页</view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import * as UserApi from '@/api/user'
  24. import store from '@/store'
  25. export default {
  26. data() {
  27. return {
  28. //当前页面参数
  29. options: {},
  30. // 正在加载
  31. isLoading: true,
  32. userInfo: {},
  33. qrCode: ""
  34. }
  35. },
  36. /**
  37. * 生命周期函数--监听页面加载
  38. */
  39. onLoad(options) {
  40. // 当前页面参数
  41. this.options = options
  42. this.getUserInfo()
  43. },
  44. methods: {
  45. /**
  46. * 用户信息
  47. * */
  48. getUserInfo() {
  49. const app = this
  50. app.isLoading = true
  51. UserApi.qrCode()
  52. .then(result => {
  53. app.userInfo = result.data.userInfo;
  54. app.qrCode = result.data.qrCode;
  55. app.isLoading = false;
  56. })
  57. },
  58. goBack() {
  59. this.$navTo('pages/user/index');
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .info-list {
  66. padding-bottom: 30rpx;
  67. margin-top: 30rpx;
  68. }
  69. // 项目内容
  70. .info-item {
  71. margin: 20rpx auto 20rpx auto;
  72. padding: 30rpx;
  73. width: 94%;
  74. box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
  75. border-radius: 10rpx;
  76. background: #fff;
  77. }
  78. .contacts {
  79. font-size: 35rpx;
  80. text-align: center;
  81. .name {
  82. margin-left:0px;
  83. text-align: center;
  84. }
  85. }
  86. .info-code {
  87. text-align: center;
  88. padding: 30rpx;
  89. margin-bottom: 30rpx;
  90. .code-text{
  91. margin-bottom: 50rpx;
  92. }
  93. .qrcode {
  94. width: 360rpx;
  95. height: 360rpx;
  96. margin: 0 auto;
  97. border: solid 1px #ccc;
  98. }
  99. }
  100. // 底部操作栏
  101. .footer-fixed {
  102. z-index: 11;
  103. box-shadow: 0 -4rpx 40rpx 0 rgba(144, 52, 52, 0.1);
  104. .btn-wrapper {
  105. height: 100%;
  106. display: flex;
  107. text-align: center;
  108. align-items: center;
  109. padding: 0 30rpx;
  110. }
  111. .btn-item {
  112. flex: 1;
  113. font-size: 28rpx;
  114. height: 80rpx;
  115. line-height: 80rpx;
  116. text-align: center;
  117. color: #fff;
  118. border-radius: 40rpx;
  119. }
  120. .btn-item-main {
  121. background: linear-gradient(to right, #f9211c, #ff6335);
  122. }
  123. }
  124. </style>