小程序端工程代码
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.

72 lines
1.9 KiB

  1. <template>
  2. <view ref="container">
  3. <div class="coupon-list" v-if="couponsList.length > 0">
  4. <div class="item acea-row row-center-wrapper" v-cloak v-for="(item, index) in couponsList" :key="index">
  5. <div class="money" :class="item._type === 0 ? 'moneyGray' : ''">
  6. <div>
  7. <span class="num">{{ item.couponPrice }}</span>
  8. </div>
  9. <div class="pic-num">{{ item.useMinPrice }}元可用</div>
  10. </div>
  11. <div class="text">
  12. <div class="condition line1">
  13. {{ item.couponTitle }}
  14. </div>
  15. <div class="data acea-row row-between-wrapper">
  16. <div v-if="item.endTime === 0">不限时</div>
  17. <div v-else>{{ item.createTime }}-{{ item.endTime }}</div>
  18. <div class="bnt gray" v-if="item._type === 0">{{ item._msg }}</div>
  19. <div class="bnt bg-color-red" v-else>{{ item._msg }}</div>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. <!--暂无优惠券-->
  25. <view class="noCommodity" v-if="couponsList.length === 0 && loading === true">
  26. <view class="noPictrue">
  27. <image :src="`${$VUE_APP_RESOURCES_URL}/images/noCoupon.png`" class="image" />
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { getCouponsUser } from '@/api/user'
  34. import DataFormatT from '@/components/DataFormatT'
  35. const NAME = 'UserCoupon'
  36. export default {
  37. name: 'UserCoupon',
  38. components: {
  39. DataFormatT,
  40. },
  41. props: {},
  42. data: function() {
  43. return {
  44. couponsList: [],
  45. loading: false,
  46. }
  47. },
  48. watch: {
  49. $yroute: function(n) {
  50. var that = this
  51. if (n.name === NAME) {
  52. that.getUseCoupons()
  53. }
  54. },
  55. },
  56. mounted: function() {
  57. this.getUseCoupons()
  58. },
  59. methods: {
  60. getUseCoupons: function() {
  61. let that = this,
  62. type = 0
  63. getCouponsUser(type).then(res => {
  64. that.couponsList = res.data
  65. that.loading = true
  66. })
  67. },
  68. },
  69. }
  70. </script>