index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="page" :style="{'height':countsList.length>0?'':'100vh'}">
  3. <view class="flex-col" v-if="countsList.length === 0">
  4. <view class="flex-row justify-center">
  5. <image class="empty" src="/static/imageIcon/empty.png" mode="widthFix"></image>
  6. </view>
  7. <view class="emptyText flex-row justify-center">
  8. <text>暂无内容</text>
  9. </view>
  10. </view>
  11. <view v-else>
  12. <view class="flex-col" v-for="(item,index) in countsList" :key="index">
  13. <view class="row-list flex-row justify-start">
  14. <view class="h-text flex-col justify-center ">
  15. <view class="money">
  16. <text>{{ item.discountsPrice }}</text>
  17. </view>
  18. <view class="desc">
  19. <text>满{{ item.reachPrice }}可用</text>
  20. </view>
  21. </view>
  22. <view class="h-center-content flex-col justify-around">
  23. <view class="h-value">
  24. <text>{{ item.name }}</text>
  25. </view>
  26. <!-- <view class="title">-->
  27. <!-- 使用平台:<text v-if="item.strategyType == '0'">全平台</text>-->
  28. <!-- <text v-else-if="item.strategyType == '1'">个人优惠卷</text>-->
  29. <!-- </view>-->
  30. <view class="title">
  31. 使用次数:{{ item.degree }}
  32. </view>
  33. <view class="title">
  34. 领取后{{ item.effectiveDays }}天内有效
  35. </view>
  36. <view class="title flex-row">
  37. <text @click.stop="showRemark(item)">使用规则</text>
  38. <u-icon v-if="item.id == showRemarkId" name="arrow-down-fill" color="" size="12"></u-icon>
  39. <u-icon v-else name="play-right-fill" color="" size="12"></u-icon>
  40. </view>
  41. </view>
  42. <view class="h-right-content flex-col justify-center ">
  43. <view class="btn" @click="gotoReceiveCoupon(item)">
  44. <text>立即领取</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view v-if="showRemarkId == item.id" class="remark" style="text-indent:unset">
  49. <view>
  50. 可用门店:
  51. <text>{{ item.useStoreDesc }}</text>
  52. </view>
  53. <view v-if="item.remark !=null">
  54. 使用说明:
  55. <text>{{ item.remark }}</text>
  56. </view>
  57. <text v-else class="remarkText">该优惠券暂无使用说明</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. countsList: [],
  68. showRemarkId: '',
  69. };
  70. },
  71. onLoad(option) {
  72. this.getUserDiscountsList()
  73. },
  74. methods: {
  75. showRemark(item) {
  76. if (this.showRemarkId == item.id) {
  77. this.showRemarkId = ''
  78. } else {
  79. this.showRemarkId = item.id
  80. }
  81. },
  82. // 领取优惠劵
  83. gotoReceiveCoupon(item) {
  84. this.$api.claimCoupon({id: item.id}).then((res) => {
  85. uni.showToast({
  86. title: "领取成功"
  87. })
  88. // 查询可领取的优惠劵
  89. this.getUserDiscountsList();
  90. })
  91. },
  92. // 查询可领取的优惠劵
  93. getUserDiscountsList() {
  94. let that = this;
  95. // 用户绑定门店
  96. this.$api.getUserDiscountsList().then((res) => {
  97. console.log(res.data.data)
  98. this.countsList = res.data.data;
  99. }).catch(() => {
  100. uni.showToast({
  101. title: "操作失败"
  102. })
  103. })
  104. },
  105. },
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. @import '/common/css/common.css';
  110. @import './index.rpx.scss';
  111. </style>