敢为人鲜小程序前端代码仓库
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.

113 lines
2.1 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="coupon">
  3. <!-- 导航栏 -->
  4. <navbar title="优惠券" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" />
  5. <!-- 优惠券筛选 -->
  6. <view class="tabs">
  7. <uv-tabs :list="filtrationMenu" @click="hadleFiltrationMenuEvent" lineColor="#E3441A"
  8. :activeStyle="{ color : '#E3441A' }"></uv-tabs>
  9. </view>
  10. <couponList ref="couponList" :list="list" :state="state"></couponList>
  11. </view>
  12. </template>
  13. <script>
  14. import couponList from "@/components/couponList/couponList.vue"
  15. export default {
  16. name: "coupon",
  17. components: {
  18. couponList
  19. },
  20. props: {
  21. height: {
  22. default: 'auto'
  23. // default : 'calc(90vh - 180rpx)'
  24. },
  25. // 押金
  26. depositPrice: {},
  27. washPrice: { //水洗费
  28. },
  29. rentPrice: { //租金
  30. },
  31. },
  32. onShow() {
  33. this.getCouponList()
  34. },
  35. data() {
  36. return {
  37. filtrationMenu: [{
  38. name: "全部优惠券"
  39. }, {
  40. name: "已使用优惠券"
  41. }, {
  42. name: "已过期优惠券"
  43. }],
  44. state: 0
  45. };
  46. },
  47. methods: {
  48. //获取优惠券数据
  49. getCouponList() {
  50. this.$refs.couponList.getCouponList()
  51. },
  52. select(item) {
  53. if (this.isSelect(item)) {
  54. return
  55. }
  56. this.$emit('select', item)
  57. },
  58. isSelect(item) {
  59. if (!this.depositPrice && !this.rentPrice && !this.washPrice) {
  60. return false
  61. }
  62. // 押金
  63. if (this.depositPrice &&
  64. item.useType == 0 &&
  65. this.depositPrice >= item.conditionPrice) {
  66. return false
  67. }
  68. // 租金
  69. if (this.rentPrice &&
  70. item.useType == 1 &&
  71. this.rentPrice >= item.conditionPrice) {
  72. return false
  73. }
  74. // 水洗
  75. if (this.washPrice &&
  76. item.useType == 2 &&
  77. this.washPrice >= item.conditionPrice) {
  78. return false
  79. }
  80. return true
  81. },
  82. //点击过滤菜单
  83. hadleFiltrationMenuEvent(event) {
  84. this.state = event.index
  85. }
  86. }
  87. }
  88. </script>
  89. <style scoped lang="scss">
  90. // 优惠券筛选
  91. .tabs {
  92. &::v-deep .uv-tabs__wrapper__nav {
  93. background: white;
  94. .uv-tabs__wrapper__nav__item {
  95. width: 33.33%;
  96. text-align: center;
  97. box-sizing: border-box;
  98. }
  99. }
  100. }
  101. </style>