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

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