鸿宇研学生前端代码
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.

93 lines
1.7 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="我的优惠券" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <view class="list">
  5. <uv-radio-group
  6. v-model="selectedId"
  7. placement="column"
  8. shape="circle"
  9. size="36rpx"
  10. iconSize="36rpx"
  11. activeColor="#00A9FF"
  12. >
  13. <view class="list-item" v-for="item in list" :key="item.id">
  14. <couponCard
  15. :data="item"
  16. ></couponCard>
  17. </view>
  18. </uv-radio-group>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import { mapState } from 'vuex'
  24. import mixinsList from '@/mixins/list.js'
  25. import couponCard from './couponCard.vue'
  26. export default {
  27. mixins: [mixinsList],
  28. components: {
  29. couponCard,
  30. },
  31. data() {
  32. return {
  33. mixinsListApi: 'queryCouponList',
  34. queryParams: {
  35. pageNo: 1,
  36. pageSize: 10,
  37. status: 0,
  38. },
  39. selectedId: null,
  40. }
  41. },
  42. computed: {
  43. ...mapState(['couponInfo']),
  44. },
  45. onLoad(arg) {
  46. if (this.couponInfo?.id) {
  47. this.selectedId = this.couponInfo.id
  48. }
  49. this.getData()
  50. },
  51. onUnload() {
  52. if (!this.selectedId) {
  53. this.$store.commit('setCouponInfo', null)
  54. return
  55. }
  56. const target = this.list.find(item => item.id === this.selectedId)
  57. this.$store.commit('setCouponInfo', target)
  58. },
  59. methods: {
  60. },
  61. }
  62. </script>
  63. <style scoped lang="scss">
  64. .page__view {
  65. width: 100vw;
  66. min-height: 100vh;
  67. background: $uni-bg-color;
  68. position: relative;
  69. }
  70. .list {
  71. padding: 32rpx 40rpx;
  72. &-item {
  73. & + & {
  74. margin-top: 24rpx;
  75. }
  76. }
  77. }
  78. </style>