推拿小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
2.4 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="代金券" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  4. <view class="page-content">
  5. <!-- 代金券详情 -->
  6. <view class="coupon">
  7. <voucherCard :data="voucherDetail" :readonly="true"></voucherCard>
  8. </view>
  9. <view class="card info">
  10. <view class="info-header">代金券核销</view>
  11. <view class="flex flex-column info-content">
  12. <view class="info-qr">
  13. <uv-qrcode ref="qrcode" size="279rpx" :value="`${voucherDetail.id},1`"></uv-qrcode>
  14. </view>
  15. <view class="info-desc">{{ `有效时间:${validRange}` }}</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import voucherCard from '../components/voucher/voucherCard.vue'
  23. export default {
  24. components: {
  25. voucherCard,
  26. },
  27. data() {
  28. return {
  29. id: null,
  30. voucherDetail: {},
  31. }
  32. },
  33. computed: {
  34. validRange() {
  35. const { createTime, validDate } = this.voucherDetail || {}
  36. let startTime = createTime ? this.$dayjs(createTime).format('YYYY.MM.DD') : '-'
  37. let endTime = validDate ? this.$dayjs(validDate).format('YYYY.MM.DD') : '-'
  38. return `${startTime}${endTime}`
  39. },
  40. },
  41. onLoad(option) {
  42. const { id } = option
  43. this.id = id
  44. this.fetchVoucherInfo()
  45. },
  46. methods: {
  47. async fetchVoucherInfo() {
  48. try {
  49. const res = await this.$fetch('queryVouchersById', { userVouchersId: this.id })
  50. res.vouchersId_dictText = res.title
  51. this.voucherDetail =res
  52. } catch (err) {
  53. }
  54. },
  55. },
  56. }
  57. </script>
  58. <style scoped lang="scss">
  59. $bar-height: 132rpx;
  60. .page {
  61. background-color: #F5F5F5;
  62. /deep/ .nav-bar__view {
  63. background-image: linear-gradient(#84A73F, #D8FF8F);
  64. }
  65. &-header {
  66. color: #000000;
  67. font-size: 28rpx;
  68. margin-top: 24rpx;
  69. }
  70. &-content {
  71. padding: 33rpx 13rpx;
  72. }
  73. }
  74. .coupon {
  75. padding: 0 13rpx;
  76. }
  77. .info {
  78. margin-top: 26rpx;
  79. padding: 25rpx 41rpx 108rpx 41rpx;
  80. &-header {
  81. color: #000000;
  82. padding: 0 0 16rpx 7rpx;
  83. border-bottom: 1rpx dashed #C7C7C7;
  84. }
  85. &-qr {
  86. width: 279rpx;
  87. height: auto;
  88. margin-top: 57rpx;
  89. }
  90. &-desc {
  91. color: #999999;
  92. font-size: 22rpx;
  93. margin-top: 45rpx;
  94. }
  95. }
  96. </style>