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

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