宜轩到家/服务到家第三版,换个颜色
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.

111 lines
2.0 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. <template>
  2. <view>
  3. <mNavbar title="我的优惠劵"
  4. :leftClick="toLeft"
  5. />
  6. <view style="position: sticky;top: 45px;z-index: 99;">
  7. <van-tabs v-model:active="active"
  8. title-active-color="#6e3009"
  9. @change="clickTabs"
  10. >
  11. <van-tab :title="item.name"
  12. v-for="(item, index) in tabs"
  13. :key="index"></van-tab>
  14. </van-tabs>
  15. </view>
  16. <van-list
  17. v-model:loading="loading"
  18. :finished="finished"
  19. @load="onLoad"
  20. >
  21. <couponList :list="couponList" @select="toHome"/>
  22. </van-list>
  23. </view>
  24. </template>
  25. <script>
  26. import couponList from '/components/couponList.vue'
  27. import mNavbar from '@/components/base/m-navbar.vue'
  28. export default {
  29. components : {
  30. couponList,
  31. mNavbar
  32. },
  33. data() {
  34. return {
  35. value : '',
  36. tabs : [
  37. {
  38. name: '待使用优惠劵',
  39. }, {
  40. name: '已使用优惠劵',
  41. }, {
  42. name: '已过期优惠劵'
  43. }
  44. ],
  45. active : 0,
  46. queryParams : {
  47. pageNo : 1,
  48. pageSize : 10,
  49. },
  50. couponList : [],
  51. loading : false,
  52. finished : false,
  53. }
  54. },
  55. onShow(){
  56. this.getCouponList()
  57. },
  58. methods: {
  59. onLoad(){
  60. this.queryParams.pageSize += 10
  61. this.getCouponList()
  62. },
  63. //获取优惠券列表
  64. getCouponList(){
  65. this.$api('getCouponList' , {
  66. ...this.queryParams,
  67. state : this.active
  68. } , res => {
  69. if(res.code == 200){
  70. this.couponList = res.result.records;
  71. if(this.queryParams.pageSize > res.result.total){
  72. this.finished = true
  73. }
  74. }
  75. this.loading = false
  76. })
  77. },
  78. toLeft(){
  79. uni.switchTab({
  80. url: '/pages/index/center'
  81. })
  82. },
  83. clickTabs(e){
  84. this.getCouponList()
  85. },
  86. onClickButton(){
  87. },
  88. toHome(){ //跳转首页
  89. uni.switchTab({
  90. url: '/pages/index/index'
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style scoped lang="scss">
  97. .btn{
  98. padding: 0px 30rpx;
  99. background: linear-gradient(178deg, #ffe6ed, #ecb978);
  100. color: #6e3009;
  101. font-size: 22rpx;
  102. margin-left: 20rpx;
  103. font-size: 20rpx;
  104. border-radius: 30rpx;
  105. }
  106. </style>