推拿小程序前端代码仓库
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.

93 lines
1.7 KiB

  1. <template>
  2. <view class="voucher">
  3. <image class="voucher-bg" src="@/pages_order/static/voucher/voucher-bg.png" ></image>
  4. <view class="voucher-info">
  5. <view class="voucher-row voucher-title">{{ data.name }}</view>
  6. <view class="voucher-row voucher-time">{{ `${data.startTime}-${data.endTime}` }}</view>
  7. <view class="voucher-row voucher-desc">{{ data.desc }}</view>
  8. </view>
  9. <template v-if="!readonly">
  10. <button palin class="btn" @click="onClick">立即使用</button>
  11. </template>
  12. </view>
  13. </template>
  14. <script>
  15. const TEST_DATA = {
  16. id: '001',
  17. name: '【会员礼】50元代金券',
  18. startTime: '2025.03.12',
  19. endTime: '2025.09.12',
  20. desc: '只可在线下门店使用',
  21. }
  22. export default {
  23. props: {
  24. data: {
  25. type: Object,
  26. default() {
  27. return TEST_DATA
  28. }
  29. },
  30. readonly: {
  31. type: Boolean,
  32. default: false,
  33. }
  34. },
  35. methods: {
  36. onClick() {
  37. this.$utils.navigateTo(`/pages_order/mine/verifyVoucher?id=${this.data.id}`)
  38. }
  39. },
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .voucher {
  44. width: 100%;
  45. height: 202rpx;
  46. position: relative;
  47. &-bg {
  48. width: 100%;
  49. height: 100%;
  50. }
  51. &-info {
  52. position: absolute;
  53. top: 49rpx;
  54. left: 253rpx;
  55. color: $uni-color-light;
  56. font-size: 18rpx;
  57. }
  58. &-row {
  59. & + & {
  60. margin-top: 6rpx;
  61. }
  62. }
  63. &-title {
  64. font-size: 28rpx;
  65. font-weight: 900;
  66. }
  67. .btn {
  68. position: absolute;
  69. bottom: 39rpx;
  70. right: 39rpx;
  71. width: auto;
  72. padding: 12rpx 29rpx;
  73. color: $uni-text-color-inverse;
  74. font-size: 18rpx;
  75. line-height: 25rpx;
  76. border-radius: 25rpx;
  77. border: none;
  78. background-image: linear-gradient(to right, #84A73F, #D8FF8F);
  79. }
  80. }
  81. </style>