detail.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view>
  3. <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="卡券详情"></u-navbar>
  4. <view class="detail">
  5. <view class="flex detail-item">
  6. <image :src="info.picUrl" mode="aspectFill"></image>
  7. <view class="flex info">
  8. <view class="flex desc">
  9. <view class="title">{{ info.title }}</view>
  10. <view class="txt">使用期限:{{ $parseTime(info.validStart, '{y}.{m}.{d}') }}-{{ $parseTime(info.validEnd, '{y}.{m}.{d}') }}</view>
  11. <view class="txt">适用范围:{{ info.useAreaDesc }}</view>
  12. </view>
  13. <view class="flex btn">
  14. <view class="amt"><text>¥</text>{{ info.discount / 100 }}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="flex detail-code">
  19. <canvas style="width: 426rpx;height: 426rpx;" canvas-id="couponQrcode"></canvas>
  20. </view>
  21. <view class="detail-explain">
  22. <view class="txt">使用说明:</view>
  23. <view class="txt">{{ info.description }}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. const qrCode = require('@/common/weapp-qrcode.js')
  30. export default {
  31. data() {
  32. return {
  33. info: {}
  34. };
  35. },
  36. onLoad(options) {
  37. uni.showLoading({
  38. title: '加载中'
  39. });
  40. this.info = JSON.parse(options.info)
  41. console.log(this.info);
  42. setTimeout(() => {
  43. uni.hideLoading();
  44. this.couponQrCode()
  45. }, 50)
  46. },
  47. methods: {
  48. // 二维码生成工具
  49. couponQrCode() {
  50. new qrCode('couponQrcode', {
  51. text: this.info.verifyCode,
  52. width: 213,
  53. height: 213,
  54. colorDark: "#333333",
  55. colorLight: "#FFFFFF",
  56. correctLevel: qrCode.CorrectLevel.H
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .detail {
  64. margin: 20rpx;
  65. padding: 26rpx 24rpx;
  66. background-color: #FFFFFF;
  67. border-radius: 10rpx;
  68. &-item {
  69. justify-content: space-between;
  70. padding-bottom: 26rpx;
  71. border-bottom: 1px dashed rgba(236, 236, 236, 100);
  72. image {
  73. width: 94rpx;
  74. height: 132rpx;
  75. }
  76. .info {
  77. position: relative;
  78. justify-content: space-between;
  79. flex: 1;
  80. }
  81. .desc {
  82. height: 132rpx;
  83. flex-direction: column;
  84. justify-content: space-between;
  85. align-items: flex-start;
  86. padding-left: 20rpx;
  87. }
  88. .txt {
  89. font-size: 24rpx;
  90. }
  91. .btn {
  92. flex-direction: column;
  93. }
  94. .amt {
  95. font-size: 48rpx;
  96. font-weight: bold;
  97. line-height: 72rpx;
  98. }
  99. text {
  100. font-size: 24rpx;
  101. }
  102. }
  103. &-code {
  104. padding: 60rpx 0;
  105. image {
  106. width: 426rpx;
  107. height: 426rpx;
  108. }
  109. }
  110. &-explain {
  111. font-size: 24rpx;
  112. .txt {
  113. line-height: 50rpx;
  114. }
  115. }
  116. }
  117. </style>