coupon.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="container">
  3. <view class="card" v-for="(item, index) in list">
  4. <view class="leftIcon" ></view>
  5. <view class="left" >
  6. ¥<span style="font-size: 18px;">{{item.discount}}</span>
  7. </view>
  8. <view class="right">
  9. <view class="row title">
  10. {{item.name}}
  11. </view>
  12. <view class="row endTime">
  13. {{item.endTime}}到期
  14. </view>
  15. <view class="row desc">
  16. {{item.desc}}
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. couponListApi
  25. } from "@/api/coupon.js"
  26. export default {
  27. onLoad() {
  28. this.getList()
  29. },
  30. data() {
  31. return {
  32. list: [],
  33. params: {
  34. limit: 999,
  35. page: 1,
  36. status: 0
  37. }
  38. }
  39. },
  40. methods: {
  41. getList() {
  42. couponListApi(this.params).then(res => {
  43. console.log(res, '我的优惠券')
  44. this.list = res.data.list
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. .container {
  52. background: #eaeaea;
  53. padding: 10px;
  54. .card {
  55. background: #fff;
  56. border-radius: 8px;
  57. overflow: hidden;
  58. display: flex;
  59. .leftIcon {
  60. height: auto;
  61. width: 8px;
  62. background: #FF2C43;
  63. }
  64. .left {
  65. width: 80px;
  66. display: inline-flex;
  67. justify-content: center;
  68. align-items: center;
  69. color: #FF2C43;
  70. font-weight: 600;
  71. }
  72. .right {
  73. padding: 10px;
  74. .row {
  75. margin-bottom: 4px;
  76. font-size: 12px;
  77. }
  78. .title {
  79. font-size: 14px;
  80. font-weight: 600;
  81. }
  82. .endTime {
  83. color: #FF2C43;
  84. }
  85. .desc {
  86. margin-top: 5px;
  87. color: #8c8c8c;
  88. }
  89. }
  90. }
  91. }
  92. </style>