bind.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="print-page">
  3. <image class="pic" :src="QRCode" mode="widthFix" :show-menu-by-longpress="true"></image>
  4. <view v-if="QRCode.length>0">
  5. <span style="display: flex; justify-content: center;">长按识别二维码</span>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import {mapState} from 'vuex';
  11. import {checkBox} from '../components/p-checkbox.vue'
  12. export default {
  13. components: {
  14. checkBox
  15. },
  16. data () {
  17. return {
  18. qrCodeUrl: '/storeUserLoginApi/getTempWeiXinQRCode',
  19. QRCode: ''
  20. }
  21. },
  22. computed: {
  23. ...mapState(['storeInfo'])
  24. },
  25. methods: {
  26. loadData () {
  27. uni.showLoading({
  28. title: '加载中'
  29. });
  30. var dateStr = (new Date()).getTime();
  31. var sign = this.getSign('' + this.storeInfo.storeUserId + dateStr);
  32. this.requst({
  33. url: this.qrCodeUrl,
  34. data: {
  35. timestamp: dateStr,
  36. sign: sign,
  37. storeUserId: this.storeInfo.storeUserId
  38. },
  39. success: res => {
  40. if (res.data.rtnBean.rtnCode == 0) {
  41. this.QRCode = res.data.obj
  42. } else {
  43. this.$api.msg(res.data.rtnBean.rtnMsg);
  44. }
  45. uni.hideLoading();
  46. },
  47. fail: (e) => {
  48. console.log("接口调用失败:" + JSON.stringify(e));
  49. uni.hideLoading();
  50. },
  51. })
  52. }
  53. },
  54. onLoad () {
  55. this.loadData()
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .print-page {
  61. width: 100vw;
  62. height: 100vh;
  63. background-color: #fff;
  64. }
  65. .pic {
  66. display: block;
  67. margin: 0 auto;
  68. }
  69. </style>