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

130 lines
2.6 KiB

  1. <template>
  2. <view class="input__view" :style="style">
  3. <view class="flex row" v-for="(item, index) in options" :key="item.id">
  4. <view class="flex row-label">
  5. <view class="title">{{ item.period_dictText }}</view>
  6. <!-- todo: check key -->
  7. <view class="desc" v-if="getTypeDesc(item.period_dictText)">{{ `(${getTypeDesc(item.period_dictText)})` }}</view>
  8. <view class="flex price">
  9. <text>¥</text>
  10. <text class="highlight">{{ item.price }}</text>
  11. </view>
  12. </view>
  13. <view class="row-content">
  14. <uv-number-box
  15. :value="value[index]"
  16. @input="onInput(index, $event)"
  17. :min="0"
  18. :integer="true"
  19. :inputWidth="68"
  20. bgColor="transparent"
  21. :iconStyle="{
  22. background: '#F7F8FA',
  23. fontSize: '13px',
  24. lineHeight: 1,
  25. padding: '12px',
  26. borderRadius: '50%',
  27. }"
  28. ></uv-number-box>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. const TYPE_DESC = {
  35. '成人': '(18周岁以上)',
  36. '青少年': '(14周岁以上)',
  37. '儿童': '(14周岁以下)',
  38. }
  39. export default {
  40. props: {
  41. value: {
  42. type: Array,
  43. default() {
  44. return []
  45. }
  46. },
  47. options: {
  48. type: Array,
  49. default() {
  50. return []
  51. }
  52. },
  53. style: {
  54. type: String,
  55. default: ''
  56. },
  57. },
  58. computed: {
  59. prices: {
  60. set(val) {
  61. this.$emit('input', val)
  62. },
  63. get() {
  64. return this.value
  65. }
  66. },
  67. },
  68. methods: {
  69. onInput(index, value) {
  70. let prices = [...this.prices]
  71. prices[index] = value
  72. this.prices = prices
  73. },
  74. getTypeDesc(type) {
  75. return TYPE_DESC[type]
  76. },
  77. },
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .input__view {
  82. width: 100%;
  83. }
  84. .row {
  85. justify-content: space-between;
  86. padding: 24rpx 0;
  87. font-family: PingFang SC;
  88. font-size: 24rpx;
  89. font-weight: 400;
  90. line-height: 1.4;
  91. border-bottom: 2rpx solid #EEEEEE;
  92. & + & {
  93. margin-top: 20rpx;
  94. }
  95. &-label {
  96. justify-content: flex-start;
  97. column-gap: 4rpx;
  98. }
  99. &-content {
  100. /deep/ .uv-number-box__minus--disabled {
  101. background: transparent !important;
  102. }
  103. }
  104. }
  105. .title {
  106. font-size: 28rpx;
  107. color: #000000;
  108. }
  109. .desc {
  110. color: #8B8B8B;
  111. }
  112. .price {
  113. font-weight: 500;
  114. color: #FF4800;
  115. .highlight {
  116. font-size: 32rpx;
  117. }
  118. }
  119. </style>