detail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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="../../static/icon/coupon.png" mode=""></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: 220px;height: 220px;" 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. setTimeout(() => {
  42. uni.hideLoading();
  43. this.couponQrCode()
  44. }, 50)
  45. },
  46. methods: {
  47. // 二维码生成工具
  48. couponQrCode() {
  49. new qrCode('couponQrcode', {
  50. text: this.info.verifyCode,
  51. width: 213,
  52. height: 213,
  53. colorDark: "#333333",
  54. colorLight: "#FFFFFF",
  55. correctLevel: qrCode.CorrectLevel.H
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .detail {
  63. margin: 20rpx;
  64. padding: 26rpx 24rpx;
  65. background-color: #FFFFFF;
  66. border-radius: 10rpx;
  67. &-item {
  68. justify-content: space-between;
  69. padding-bottom: 26rpx;
  70. border-bottom: 1px dashed rgba(236, 236, 236, 100);
  71. image {
  72. width: 120rpx;
  73. height: 106rpx;
  74. }
  75. .info {
  76. position: relative;
  77. justify-content: space-between;
  78. flex: 1;
  79. }
  80. .desc {
  81. height: 106rpx;
  82. flex-direction: column;
  83. justify-content: space-between;
  84. align-items: flex-start;
  85. padding-left: 20rpx;
  86. }
  87. .title{
  88. font-weight: bold;
  89. }
  90. .txt {
  91. font-size: 24rpx;
  92. }
  93. .btn {
  94. flex-direction: column;
  95. }
  96. .amt {
  97. font-size: 48rpx;
  98. font-weight: bold;
  99. line-height: 72rpx;
  100. }
  101. text {
  102. font-size: 24rpx;
  103. }
  104. }
  105. &-code {
  106. width: 100%;
  107. height: 550rpx;
  108. }
  109. &-explain {
  110. font-size: 24rpx;
  111. .txt {
  112. line-height: 50rpx;
  113. }
  114. }
  115. }
  116. </style>