湘妃到家前端代码仓库
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
1.9 KiB

1 month ago
  1. <template>
  2. <van-popup
  3. v-model:show="showBottom"
  4. round
  5. position="bottom"
  6. @close="close"
  7. :style="{ height: '75%' }"
  8. >
  9. <view class="box">
  10. <view class="title">
  11. {{ title || '选择优惠劵' }}
  12. </view>
  13. <view class="technician-list">
  14. <van-list
  15. v-model:loading="loading"
  16. :finished="finished"
  17. @load="onLoad"
  18. >
  19. <couponList :list="list" @select="select"/>
  20. </van-list>
  21. </view>
  22. </view>
  23. </van-popup>
  24. </template>
  25. <script>
  26. import couponList from "../couponList.vue"
  27. export default {
  28. components: {
  29. couponList
  30. },
  31. name:"selectCouponPopup",
  32. props : ['show', 'title'],
  33. data() {
  34. return {
  35. showBottom : false,
  36. i : 0,
  37. queryParams : {
  38. pageNo : 1,
  39. pageSize : 10,
  40. title : ''
  41. },
  42. list : [],
  43. loading : false,
  44. finished : false,
  45. }
  46. },
  47. created(){
  48. this.getCouponList();
  49. },
  50. methods : {
  51. onLoad(){
  52. this.queryParams.pageSize += 10
  53. this.getCouponList()
  54. },
  55. getCouponList(){
  56. this.$api('getCouponList' , {
  57. ...this.queryParams,
  58. state : 0
  59. } , res => {
  60. if(res.code == 200){
  61. this.list = res.result.records;
  62. this.$emit('countCouponNum',this.list.length)
  63. if(this.queryParams.pageSize > res.result.total){
  64. this.finished = true
  65. }
  66. }
  67. this.loading = false
  68. })
  69. },
  70. select(e){
  71. this.$emit('selectCoupon', e)
  72. },
  73. close(){
  74. this.$emit('close')
  75. },
  76. },
  77. watch: {
  78. show: {
  79. handler (newValue, oldValue) {
  80. this.showBottom = newValue
  81. this.getCouponList()
  82. },
  83. immediate: true
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .box{
  90. width: 100%;
  91. height: 100%;
  92. background: linear-gradient(#57CAA0, #55B16E);
  93. box-sizing: border-box;
  94. padding: 40rpx;
  95. .title{
  96. font-size: 32rpx;
  97. text-align: center;
  98. color: #fff;
  99. margin-bottom: 40rpx;
  100. }
  101. .technician-list{
  102. overflow: auto;
  103. width: 100%;
  104. height: calc(100% - 45rpx);
  105. }
  106. }
  107. </style>