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

98 lines
1.9 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">{{ validRange }}</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. export default {
  18. props: {
  19. data: {
  20. type: Object,
  21. default() {
  22. return {}
  23. }
  24. },
  25. readonly: {
  26. type: Boolean,
  27. default: false,
  28. }
  29. },
  30. computed: {
  31. validRange() {
  32. const { createTime, validDate } = this.data || {}
  33. let startTime = createTime ? this.$dayjs(createTime).format('YYYY.MM.DD') : '-'
  34. let endTime = validDate ? this.$dayjs(validDate).format('YYYY.MM.DD') : '-'
  35. return `${startTime}-${endTime}`
  36. },
  37. },
  38. methods: {
  39. onClick() {
  40. this.$utils.navigateTo(`/pages_order/mine/verifyVoucher?id=${this.data.id}`)
  41. }
  42. },
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .voucher {
  47. width: 100%;
  48. height: 202rpx;
  49. position: relative;
  50. &-bg {
  51. width: 100%;
  52. height: 100%;
  53. }
  54. &-info {
  55. position: absolute;
  56. top: 49rpx;
  57. left: 253rpx;
  58. color: $uni-color-light;
  59. font-size: 18rpx;
  60. }
  61. &-row {
  62. & + & {
  63. margin-top: 6rpx;
  64. }
  65. }
  66. &-title {
  67. font-size: 28rpx;
  68. font-weight: 900;
  69. }
  70. .btn {
  71. position: absolute;
  72. bottom: 39rpx;
  73. right: 39rpx;
  74. width: auto;
  75. padding: 12rpx 29rpx;
  76. color: $uni-text-color-inverse;
  77. font-size: 18rpx;
  78. line-height: 25rpx;
  79. border-radius: 25rpx;
  80. border: none;
  81. background-image: linear-gradient(to right, #84A73F, #D8FF8F);
  82. }
  83. }
  84. </style>