index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="page">
  3. <view class="row-list flex-row justify-start" v-for="(item,index) in countsList" :key="index">
  4. <view class="h-text flex-col justify-center ">
  5. <view class="money">
  6. <text>¥{{item.discountsPrice}}</text>
  7. </view>
  8. <view class="desc">
  9. <text>{{item.name}}</text>
  10. </view>
  11. </view>
  12. <view class="h-center-content flex-col ">
  13. <view class="h-value">
  14. <text>门店通用</text>
  15. </view>
  16. <view class="title">
  17. 使用平台:<text v-if="item.strategyType == '0'">全平台</text>
  18. <text v-else-if="item.strategyType == '1'">个人优惠卷</text>
  19. </view>
  20. <view class="title">
  21. 使用次数:{{item.degree}}
  22. </view>
  23. <view class="title">
  24. 到期时间:{{item.endTime.substring(0,10)}}
  25. </view>
  26. </view>
  27. <view class="h-right-content flex-col justify-center ">
  28. <view class="btn" @click="gotoReceiveCoupon(item)">
  29. <text>立即领取</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. countsList:[]
  40. };
  41. },
  42. onLoad(option) {
  43. this.getUserDiscountsList()
  44. },
  45. methods: {
  46. // 领取优惠劵
  47. gotoReceiveCoupon(item) {
  48. this.$api.claimCoupon({id:item.id}).then((res) => {
  49. uni.showToast({
  50. title: "领取成功"
  51. })
  52. // 查询可领取的优惠劵
  53. this.getUserDiscountsList();
  54. })
  55. },
  56. // 查询可领取的优惠劵
  57. getUserDiscountsList() {
  58. let that = this;
  59. // 用户绑定门店
  60. this.$api.getUserDiscountsList().then((res) => {
  61. console.log(res.data.data)
  62. this.countsList = res.data.data;
  63. }).catch(() => {
  64. uni.showToast({
  65. title: "操作失败"
  66. })
  67. })
  68. },
  69. },
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. @import '/common/css/common.css';
  74. @import './index.rpx.scss';
  75. </style>