select-mod.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="">
  3. <uni-popup ref="popSelect" type="bottom">
  4. <view class="pop-box bgc-f ptb-24">
  5. <view class="text-align-center fs-36 fw-600 box-title mb-32">
  6. {{popTitleName}}
  7. <uni-icons @click="closeCoupon" class="box-close" type="closeempty" size="20"></uni-icons>
  8. </view>
  9. <scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  10. <view class="align-items-center flex-justify-space p-24 box-border-box b-b-EAEAEC"
  11. v-for="(item,index) in list" :key="index" @click="selectClick(item)">
  12. <view class="align-items-center">
  13. <view class="fs-28 mr-24">
  14. {{item.name}}
  15. </view>
  16. <view class="fs-26 fc-FB3D03">
  17. ¥{{item.price}}
  18. </view>
  19. </view>
  20. <uni-icons v-if="item.item_id === select_id" type="checkbox-filled" size="22"
  21. color="#4495FD"></uni-icons>
  22. </view>
  23. </scroll-view>
  24. </view>
  25. </uni-popup>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. popTitleName: {}
  32. },
  33. components: {},
  34. data() {
  35. return {
  36. list: [],
  37. select_id: 0
  38. };
  39. },
  40. onLoad(data) {},
  41. mounted() {},
  42. methods: {
  43. getList(id, data) {
  44. if (id && id != 0) {
  45. this.select_id = id
  46. }
  47. if (data) {
  48. this.list = data
  49. this.openPop()
  50. }
  51. },
  52. selectClick(item) {
  53. console.log(item, this.select_id);
  54. if (item.item_id === this.select_id) {
  55. return
  56. }
  57. this.select_id = item.item_id
  58. this.$emit('selectData', item)
  59. this.closeCoupon()
  60. },
  61. openPop() {
  62. this.$refs.popSelect.open();
  63. },
  64. closeCoupon() {
  65. this.$refs.popSelect.close();
  66. },
  67. },
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .pop-box {
  72. max-height: 60vh;
  73. }
  74. .box-close {
  75. position: absolute;
  76. right: 22rpx;
  77. }
  78. </style>